Skip to content

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

Open
derranW26 wants to merge 1 commit intomasterfrom
passkey/ticket-4-attach-passkey-to-wallet
Open

feat(passkey-crypto): add attachPasskeyToWallet function#8678
derranW26 wants to merge 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
- fetch wallet to infer coin, keychainId, enterpriseId
- verify encryptedPrv exists before PRF assertion
- derive enterprise salt and re-encrypt prv with PRF-derived password
- PUT webauthnInfo to keychain endpoint

Ticket: WCN-189
@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
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