fix: unintented encryptions/decryptions with a lock context#58
Merged
calvinbrewer merged 4 commits intomainfrom Jan 23, 2025
Merged
fix: unintented encryptions/decryptions with a lock context#58calvinbrewer merged 4 commits intomainfrom
calvinbrewer merged 4 commits intomainfrom
Conversation
coderdan
reviewed
Jan 23, 2025
coderdan
reviewed
Jan 23, 2025
coderdan
reviewed
Jan 23, 2025
coderdan
reviewed
Jan 23, 2025
coderdan
reviewed
Jan 23, 2025
coderdan
reviewed
Jan 23, 2025
Contributor
|
I'd prefer if we could use a stronger type guarantee of the use of LockContext. I've created an example of what I mean here. The idea is that when you call |
coderdan
requested changes
Jan 23, 2025
Contributor
coderdan
left a comment
There was a problem hiding this comment.
I'd prefer to see this use the type state pattern like here: https://gist.github.com/coderdan/d6e620609b46b760471f5c9b65c2f47a
coderdan
approved these changes
Jan 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enforced lock context to be called as a proto function rather than an optional argument for crypto functions.
There was a bug that caused the lock context to be interpreted as undefined when the users intention was to use it causing the encryption/decryption to fail.
This is a breaking change for users who were using the lock context as an optional argument, hence the major version bump.
To use the lock context, call the
withLockContextmethod on the encrypt, decrypt, and bulk encrypt/decrypt functions, passing the lock context as a parameter rather than as an optional argument.Old:
New: