-
Notifications
You must be signed in to change notification settings - Fork 76
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: migrate encrypt spcp verified content flow to own verified-content module #934
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can tell that the implementation is covering for the general case, but it would be much easier on other developers if the flexibility of the implementation were more constrained. Could we merely pick out the properties necessary to convert between the data types, so that another developer can immediately tell which fields were renamed, or do we really need the power and expressivity of functions such as renameKeys
?
I'd recommend checking out the Rule of Least Power. Some programming resources see it as an extension of the KISS principle.
instead of using a generalized method of creating the verified content object for encrypted submissions, inline creation so it is more obvious to the developer how the shape is created.
tests/unit/backend/controllers/encrypt-submissions.server.controller.spec.js
Show resolved
Hide resolved
Ready for re-review |
Closing until merge conflicts can be resolved |
# Conflicts: # src/app/modules/form/form.utils.ts # src/app/modules/submission/encrypt-submission/__tests__/encrypt-submission.routes.spec.ts # src/app/routes/admin-forms.server.routes.js # src/app/routes/public-forms.server.routes.js
@liangyuanruo added tests for VerifiedContentService, so at least we have some modicum of safety. Feel free to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Problem
This PR adds validation for the contents of storage mode submissions'
verifiedContent
key with a type guard at runtime before encrypting for SPCP forms.Instead of using a generalized method of creating the verified content object for encrypted submissions, inline creation so it is more obvious to the developer how the shape is created.
Whilst doing so, migrate the verified content flow to its own
modules/verified-content
directory.Closes https://github.com/datagovsg/formsg-private/issues/103
Solution
Features:
VerifiedContentService#getVerifiedContent
functionVerifiedContentService#encryptVerifiedContent
functionVerifiedContentFactory
to gate access to service functions depending on whether feature is enabledVerifiedContentMiddlewares#encryptVerifiedSpcpFields
Improvements: