Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: convert req.hashedFields to Set #617

Merged
merged 4 commits into from
Nov 11, 2020
Merged

Conversation

mantariksh
Copy link
Contributor

Problem

myinfo.server.controller assigns a hashedFields key to the Express request object in order for subsequent middlewares to keep track of which MyInfo attributes have been verified through their hashes. hashedFields is an object which maps the MyInfo attribute to the corresponding client response, but subsequent middlewares have no need for the values of this object, since they only check that the value corresponding to each key is truthy, i.e. that the object contains the key.

Solution

Convert hashedFields into a Set, which is the more correct data structure for this case. This ensures that subsequent refactors (#560) don't have to bend over backwards just to get hashedFields into the right format.

Also, assign hashedFields to res.locals instead of req.

@mantariksh mantariksh requested a review from tshuli November 11, 2020 02:51
@liangyuanruo liangyuanruo merged commit c0fd688 into develop Nov 11, 2020
@liangyuanruo liangyuanruo deleted the ref/hashed-fields branch November 11, 2020 08:10
@karrui karrui mentioned this pull request Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants