fix: move Argon2id KDF off the main thread in payments send() [AMB-3036] - #43
Merged
Merged
Conversation
bufo24
force-pushed
the
jesseva/amb-3036-async-argon2-off-main-thread
branch
from
August 20, 2026 13:50
de0d27b to
6ae9532
Compare
bufo24
marked this pull request as ready for review
August 20, 2026 13:52
wthrajat
approved these changes
Aug 20, 2026
Merged
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.
Context
This is the upstream fix for the temporary
@ambosstech/payments@1.1.0pnpm patch in amboss-internal-api#551. Once this SDK release is available, internal-api can remove that patch.Problem
Live-wallet sends derive credentials with two memory-hard Argon2id passes. The previous synchronous implementation ran both passes on Node’s main thread, blocking timers, socket I/O, and health probes for several seconds. This caused the internal API to lose its RabbitMQ connection while processing payments.
Fix
node:worker_threadsworker.The worker is deliberately single-threaded: the second KDF depends on the first output, and a pool would add lifecycle complexity without helping that dependency.
Validation
pnpm testpnpm typecheckpnpm --filter @ambosstech/payments run test:examplespnpm --filter @ambosstech/payments run typecheck:examplesThe new Argon2 tests lock the known derivation outputs and assert that a timer remains responsive while hashing.