test(sdk-api): pin v1-leg password rotation behavior - #9743
Open
pranavjain97 wants to merge 1 commit into
Open
pranavjain97 wants to merge 1 commit into
pranavjain97 wants to merge 1 commit into
Conversation
Contributor
Contributor
|
|
kisslove-dewangan
approved these changes
Sep 16, 2026
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.
What
Follow-up to #9715 (WCN-2640). The merged unit test "shares one encryption session across keychain password updates" asserted
encryptionSessionreached the deprecated v1-leg via a stubbedupdatePassword, implying the v1-leg consumes the session. It does not:src/v1/keychains.tsvalidates onlyoldPassword/newPassword, ignoresencryptionSession/encryptionVersion, and preserves each envelope's version (isV2Envelope ? 2 : 1). The assertion passed only because the stub swallowed all args.Changes
test/unit/bitgoAPI.ts: renamed the test to "creates one encryption session, passes it to both keychain update calls, and destroys it" and documented that the session is consumed by the coin-leg only; call-site assertions retained.test/unit/v1/keychains.ts(new): exercises the real v1-legKeychains.prototype.updatePasswordwith nockedPOST /user/encrypted, pinning the wire contract:encrypt/destroyare never called (v1-leg does not use sessions);encryptionVersion: 1, v2 ->2) even when the caller passesencryptionVersion: 2+ a session (v1 stays v1 during a v2 rotation);Verification
npx tsc --noEmit -p modules/sdk-api/tsconfig.json— cleannpx mocha test/unit/v1/keychains.ts test/unit/bitgoAPI.ts— 67 passingnpx eslint --quieton both files — cleannpx prettier --check— clean