Skip to content

feat(passkey-crypto): add attachPasskeyToWallet function#8678

Merged
derranW26 merged 1 commit intomasterfrom
passkey/ticket-4-attach-passkey-to-wallet
May 6, 2026
Merged

feat(passkey-crypto): add attachPasskeyToWallet function#8678
derranW26 merged 1 commit intomasterfrom
passkey/ticket-4-attach-passkey-to-wallet

Conversation

@derranW26
Copy link
Copy Markdown
Contributor

@derranW26 derranW26 commented May 4, 2026

https://linear.app/bitgo/issue/WCN-189/implement-attachpasskeytowallet

Summary

  • Adds attachPasskeyToWallet() to modules/sdk-core/src/bitgo/passkey/
  • Fetches wallet to infer coin, keychainId, and enterpriseId from walletId alone
  • Derives enterprise-scoped PRF salt, decrypts private key with existing passphrase, re-encrypts with PRF-derived password
  • PUTs webauthnInfo ({ prfSalt, otpDeviceId, encryptedPrv }) to the keychain endpoint
  • Returns the updated Keychain from the server response

Test plan

  • Happy path: attaches passkey and returns updated keychain
  • Throws exact retail error message when device.prfSalt is undefined
  • Throws descriptively when keychain has no encryptedPrv
  • Verifies evalByCredential map uses device.credentialId as key
  • Throws when wallet has no coin / no keys / no enterprise
  • Throws when PRF assertion returns no result
  • Propagates decrypt errors

Ticket: WCN-189

@derranW26 derranW26 force-pushed the passkey/ticket-4-attach-passkey-to-wallet branch 4 times, most recently from 639e41a to 2c4d846 Compare May 4, 2026 15:29
@derranW26 derranW26 marked this pull request as ready for review May 4, 2026 16:01
@derranW26 derranW26 requested review from a team as code owners May 4, 2026 16:01
@derranW26 derranW26 requested a review from Marzooqa May 4, 2026 16:01
@derranW26 derranW26 force-pushed the passkey/ticket-4-attach-passkey-to-wallet branch from 2c4d846 to cc08d65 Compare May 4, 2026 16:50
@derranW26
Copy link
Copy Markdown
Contributor Author

@claude review this PR

@derranW26 derranW26 force-pushed the passkey/ticket-4-attach-passkey-to-wallet branch 2 times, most recently from 8cc811c to 9ef8250 Compare May 4, 2026 18:49
Comment thread modules/passkey-crypto/src/attachPasskeyToWallet.ts Outdated
Comment thread modules/passkey-crypto/src/attachPasskeyToWallet.ts Outdated
Comment thread modules/passkey-crypto/src/attachPasskeyToWallet.ts Outdated
Comment thread modules/passkey-crypto/src/attachPasskeyToWallet.ts Outdated
@derranW26 derranW26 force-pushed the passkey/ticket-4-attach-passkey-to-wallet branch 6 times, most recently from 772edd2 to 10fc6d1 Compare May 5, 2026 15:38
@derranW26 derranW26 force-pushed the passkey/ticket-4-attach-passkey-to-wallet branch from 10fc6d1 to 528ac7e Compare May 5, 2026 16:11
@derranW26 derranW26 changed the title feat(sdk-core): add attachPasskeyToWallet function feat(passkey-crypto): add attachPasskeyToWallet function May 5, 2026
@derranW26 derranW26 force-pushed the passkey/ticket-4-attach-passkey-to-wallet branch 2 times, most recently from 258f704 to 1b84f65 Compare May 6, 2026 15:07
- use sdk-core wallet and keychain methods for retrieval
- validate hot wallet before attaching passkey
- derive enterprise-scoped PRF salt via HMAC-SHA256
- re-encrypt private key with PRF-derived password
- PUT webauthnInfo to keychain endpoint with base64url prfSalt

Ticket: WCN-189
@derranW26 derranW26 force-pushed the passkey/ticket-4-attach-passkey-to-wallet branch from 1b84f65 to 5276fd9 Compare May 6, 2026 15:20
@derranW26 derranW26 merged commit f273031 into master May 6, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants