feat(passkey-crypto): add @bitgo/passkey-crypto package#8596
Open
feat(passkey-crypto): add @bitgo/passkey-crypto package#8596
Conversation
e57cafc to
8708c6e
Compare
mohammadalfaiyazbitgo
requested changes
Apr 22, 2026
| @@ -0,0 +1,39 @@ | |||
| { | |||
| "name": "@bitgo/passkey-crypto", | |||
| "version": "1.0.0", | |||
Contributor
There was a problem hiding this comment.
Suggested change
| "version": "1.0.0", | |
| "version": "0.1.0", |
still in development
e993fc3 to
6a6ee30
Compare
Comment on lines
+11
to
+16
| export function derivePassword(prfResult: ArrayBuffer | undefined): string { | ||
| if (!prfResult) { | ||
| throw new Error('Failed to derive password'); | ||
| } | ||
| return Buffer.from(prfResult).toString('hex'); | ||
| } |
Contributor
There was a problem hiding this comment.
seems redundant to allow undefined prfResult but throw an error if it's passed in. We should just update the signature to only allow passing ArrayBuffer
| * @returns Base64-encoded HMAC-SHA256 digest | ||
| * @throws If baseSalt is missing | ||
| */ | ||
| export function deriveEnterpriseSalt(baseSalt: string | undefined, enterpriseId: string): string { |
Pure cryptographic primitives for WebAuthn PRF-based key derivation: - derivePassword: converts ArrayBuffer PRF result to hex walletPassphrase - deriveEnterpriseSalt: HMAC-SHA256 via SJCL matching retail implementation exactly TICKET: WCN-186
6a6ee30 to
9ca1f7d
Compare
mohammadalfaiyazbitgo
approved these changes
Apr 23, 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.
Summary
modules/passkey-crypto/package (@bitgo/passkey-crypto) as the cryptographic foundation for the passkey feature (Ticket 1 of 9)derivePassword(prfResult: ArrayBuffer): string— converts WebAuthn PRF output to a hexwalletPassphrasefor SJCL encryptionderiveEnterpriseSalt(baseSalt: string, enterpriseId: string): string— HMAC-SHA256 enterprise-scoped salt to prevent cross-enterprise key reuseTest plan
yarn unit-testinmodules/passkey-crypto/— 11 tests passing (known vectors for both functions)anytypesyarn buildin the module