chore(crypto): use node v24 supported encryption format - #103
Conversation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This comment was marked as outdated.
This comment was marked as outdated.
|
Notes on Claude recs above: ❗ Add backward compatibility to symmetricDecrypt for preview URLs (Critical) ❗ Add error handling to migration (High) |
This comment was marked as outdated.
This comment was marked as outdated.
| @@ -0,0 +1,96 @@ | |||
| const crypto = require("crypto"); | |||
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
|
@ajohn25 thanks for the detailed response and explanations, and also for sharing the graphile migration opinions. I had somewhat surmised the importance of keeping migration code constant, so I was trying to minimize the chances of code change by using helper functions with a V2 suffix in the name (and maybe comments to not edit) to reduce the chance of change. The only con that I can see with code reuse is the potential for some accidental minor difference. I think tests (once we have a more developed test suite) would be a great way to minimize this to not rely solely on manual testing. Having said all that, I am leaning towards your version, just sharing my thoughts! |
@sukhada agreed 😅 I'll go ahead and tweak to work in your #2 suggestion about calling this method V2 for now then! |
Description
This PR moves Spoke to the cryptography methods that are supported in node v24
Motivation and Context
Prep for merging #88 - node v24 deprecates the previous "easier" crypto methods
This PR focuses on
messaging_service.encrypted_auth_tokenas the only stored value which is encrypted via the changed functions.Note that
campaign.previewUrlis also generated via the same encryption function. However, since that value isn't stored, we don't need to really worry about a migration for it. Clients who use preview URLs often will notice that the format for the URL (ex. always including a colon), as well as old links, have changed.How Has This Been Tested?
This has been tested locally by:
.env+ adding their messaging service record to the local databasedev-tools/symmetric-decrypt.jswith theencrypted_auth_tokenstring and storing this (to verify against in step 4)dev-tools/symmetric-decrypt.jswith the newly encrypted value to verify that the decrypted string matches the one from step 2Release Notes
messaging_servicerecords, prior to rolling this out, just in caseScreenshots (if appropriate):
Documentation Changes
Checklist: