Skip to content

feature: Ecrypted Submission Responses #40

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

Merged
merged 43 commits into from
Sep 9, 2024

Conversation

bryan-robitaille
Copy link
Contributor

@bryan-robitaille bryan-robitaille commented Sep 3, 2024

Summary | Résumé

Main Features:

  • Encrypts a response with aes-256-gcm by getting the Public key from the Web App database and returns the encrypted values. The public key is cached for a 5 minute period to reduce the calls required to the database.
  • Utility script under /utils that demonstrates how to request an access token by using the private key and the resulting access token to retrieve a particular response. Once we have the /new endpoint finalized we can modify the script to not ask for the response Name to retrieve.
  • Extends Express Request type so that the Authentication middleware can add the serviceAccountId on the request for downstream controllers to use.
  • Adds a singleton database connector that creates a connection to the web app database that can be reused.

Medium sized Additions to project:

  • Swapped from compiling to CommonJs to ES Modules. This means that we can use all the latest ECMA goodies with the only big trade off being we need to add the .js extention of all of our relative module imports.

Small Additions to project:

  • logMessage() is now available like the web app from @lib/logger.js
  • Default debugger profile that connects to running task in a terminal
  • Removed Nodemon and using the built in watch functionality of tsx.

Test instructions | Instructions pour tester la modification

Create some responses in the vault and retrieve them using pnpm retrieve from the utils folder.

@bryan-robitaille bryan-robitaille marked this pull request as ready for review September 5, 2024 17:58
@bryan-robitaille bryan-robitaille marked this pull request as draft September 5, 2024 18:08
@bryan-robitaille bryan-robitaille marked this pull request as ready for review September 5, 2024 20:58
Copy link
Member

@patheard patheard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment but what would you think of moving the utilTokenGeneration.mjs script into the utils folder.

@bryan-robitaille
Copy link
Contributor Author

Minor comment but what would you think of moving the utilTokenGeneration.mjs script into the utils folder.

I was going to remove it completely later on since the same functionality can now be achieved through the responseRetriever function.

@bryan-robitaille
Copy link
Contributor Author

@patheard the code base is also going to go through a refactor where the utils folder will probably become examples with multiple coding languages.

Copy link
Contributor

@craigzour craigzour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work :)

There are probably a lot of comments that you may want to ignore either because I missed the point or because you just want to tackle those during our first refactoring session.

patheard
patheard previously approved these changes Sep 6, 2024
Copy link
Member

@patheard patheard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my end - nicely done on this!

Copy link
Contributor

@craigzour craigzour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Good job :)

@bryan-robitaille bryan-robitaille merged commit 5b3434a into main Sep 9, 2024
4 checks passed
@bryan-robitaille bryan-robitaille deleted the feature/encrypt_responses branch September 9, 2024 13:00
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.

3 participants