Skip to content

feat(passkey-crypto): add derivePasskeyPrfKey function#8679

Open
derranW26 wants to merge 1 commit intomasterfrom
passkey/ticket-7-derive-passkey-prf-key
Open

feat(passkey-crypto): add derivePasskeyPrfKey function#8679
derranW26 wants to merge 1 commit intomasterfrom
passkey/ticket-7-derive-passkey-prf-key

Conversation

@derranW26
Copy link
Copy Markdown
Contributor

@derranW26 derranW26 commented May 4, 2026

https://linear.app/bitgo/issue/WCN-192/implement-derivepasskeyprfkey

Summary

  • Adds derivePasskeyPrfKey() to modules/sdk-core/src/bitgo/passkey/
  • Fetches wallet user keychain, builds PRF eval map, triggers WebAuthn assertion via WebAuthnProvider, and returns hex-encoded wallet passphrase
  • Imports buildEvalByCredential, matchDeviceByCredentialId, derivePassword from @bitgo/passkey-crypto
  • Adds @bitgo/passkey-crypto as a dependency in sdk-core/package.json and tsconfig.json project reference

Test plan

  • 5 unit tests pass: happy path, no devices, empty devices, no valid PRF salt, unknown credential ID
  • Error messages match retail exactly
  • No any types in implementation

Ticket: WCN-192

@derranW26 derranW26 force-pushed the passkey/ticket-7-derive-passkey-prf-key branch 2 times, most recently from 043577b to adc92b6 Compare May 4, 2026 15:16
@derranW26 derranW26 marked this pull request as ready for review May 4, 2026 15:51
@derranW26 derranW26 requested review from a team as code owners May 4, 2026 15:52
@derranW26 derranW26 force-pushed the passkey/ticket-7-derive-passkey-prf-key branch from adc92b6 to 2db8709 Compare May 4, 2026 16:48
@derranW26
Copy link
Copy Markdown
Contributor Author

@claude review this PR

@derranW26 derranW26 force-pushed the passkey/ticket-7-derive-passkey-prf-key branch from 2db8709 to 2d56dae Compare May 4, 2026 18:03
@derranW26 derranW26 requested a review from a team as a code owner May 4, 2026 18:03
@derranW26 derranW26 force-pushed the passkey/ticket-7-derive-passkey-prf-key branch 4 times, most recently from e247cb7 to d1e85f3 Compare May 5, 2026 15:29
Comment on lines +43 to +49
const result = await provider.get({
publicKey: {
challenge: new Uint8Array(),
allowCredentials,
} as PublicKeyCredentialRequestOptions,
evalByCredential,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use the navigator object here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep things enviroment agnostic I dont think we can

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated — bitgo is now used to fetch a server-issued assertion challenge from /user/otp/webauthn/assertion, and the manual allowCredentials construction has been removed. The provider receives { publicKey: { challenge }, evalByCredential } and handles the navigator-level credential selection.

Buffer.from(challenge, 'base64') is consistent with the existing registerPasskey.ts pattern — Buffer extends Uint8Array and satisfies BufferSource, so no DOM compatibility issue there.

@derranW26 derranW26 changed the title feat(sdk-core): add derivePasskeyPrfKey function feat(passkey-crypto): add derivePasskeyPrfKey function May 5, 2026
@derranW26 derranW26 force-pushed the passkey/ticket-7-derive-passkey-prf-key branch from d1e85f3 to 2df086f Compare May 5, 2026 17:30
@derranW26 derranW26 force-pushed the passkey/ticket-7-derive-passkey-prf-key branch from c21caeb to 5e04bd2 Compare May 6, 2026 14:54
- fetch keychain webauthn devices and build PRF eval map
- fetch server-issued assertion challenge via bitgo
- trigger WebAuthn assertion via provider (navigator layer)
- derive hex wallet passphrase from PRF output

Ticket: WCN-192
@derranW26 derranW26 force-pushed the passkey/ticket-7-derive-passkey-prf-key branch from 5e04bd2 to 5617c60 Compare May 6, 2026 15:08
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