Add async support for argon2id#7
Open
rodrigo-speller wants to merge 4 commits into
Open
Conversation
Author
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.
This pull request introduces asynchronous, non-blocking support to the Argon2id hashing implementation, allowing hash computations to yield to the event loop and avoid blocking the main thread. It adds a new
asyncoption (with configurableyieldResolution) to both the library API and WASM loader, updates documentation, and provides comprehensive tests to verify async behavior.Key changes include:
Async Argon2id support:
asyncoption to theargon2idfunction, enabling Promise-based, non-blocking hashing with control over yielding frequency viayieldResolution. The async logic is implemented by splitting the core algorithm into a generator and providing both sync and async runners. (lib/argon2id.js,README.md) [1] [2] [3] [4]setupWasm) and its consumers to accept and propagate async options, ensuring async configuration is available throughout the stack. (lib/setup.js,index.js,test/helpers/node-loader.ts) [1] [2] [3] [4]Documentation and testing:
README.mdwith usage instructions and examples for the async API, including details on theasyncandyieldResolutionoptions.test/argon2id.spec.ts) [1] [2] [3] [4]Other improvements:
These changes make the Argon2id implementation suitable for browser and Node.js environments where blocking the main thread is undesirable, and provide a robust, configurable async interface.