Skip to content

feat(sdk-core): add webauthnInfo support to createMpc#8607

Open
mohammadalfaiyazbitgo wants to merge 1 commit intomasterfrom
wal-761-webauthn-info-create-mpc
Open

feat(sdk-core): add webauthnInfo support to createMpc#8607
mohammadalfaiyazbitgo wants to merge 1 commit intomasterfrom
wal-761-webauthn-info-create-mpc

Conversation

@mohammadalfaiyazbitgo
Copy link
Copy Markdown
Contributor

** Summary

  • Introduces MpcWebauthnInfo interface ({ otpDeviceId, prfSalt, passphrase }) in iKeychains.ts for passing a PRF-derived passphrase into MPC key creation
  • Adds optional webauthnInfo?: MpcWebauthnInfo to CreateMpcOptions and threads it through all four createKeychains implementations (EDDSA, EdDSA MPCv2, ECDSA, ECDSA MPCv2)
  • When provided, each implementation stores an additional webauthnDevices entry on the user keychain encrypted with the PRF-derived passphrase
  • Wires webauthnInfo from GenerateWalletOptions through generateMpcWalletcreateMpc for the TSS wallet creation path
  • Adds tests verifying webauthnInfo is correctly forwarded to the underlying createKeychains for both EDDSA and ECDSA TSS

Test plan

  • Run yarn run unit-test --scope bitgo and verify new "should pass webauthnInfo to createKeychains" tests pass
  • Verify existing "Create TSS Keychains" tests still pass
  • Verify createParticipantKeychain tests in ecdsaMPCv2 and ecdsa still pass

Closes WAL-761

🤖 Generated with Claude Code

@linear
Copy link
Copy Markdown

linear Bot commented Apr 22, 2026

@mohammadalfaiyazbitgo mohammadalfaiyazbitgo force-pushed the wal-761-webauthn-info-create-mpc branch from e9c8790 to 0636e4f Compare April 23, 2026 19:16
{
otpDeviceId: webauthnInfo.otpDeviceId,
prfSalt: webauthnInfo.prfSalt,
encryptedPrv: this.bitgo.encrypt({
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.

can use await this.bitgo.encryptAsync() instead of this.bitgo.encrypt() for the webauthn entry. it handles both v1/v2 based on encryptionVersion

{
otpDeviceId: webauthnInfo.otpDeviceId,
prfSalt: webauthnInfo.prfSalt,
encryptedPrv: this.bitgo.encrypt({
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.

same, can use this.bitgo.encryptAsync()

{
otpDeviceId: webauthnInfo.otpDeviceId,
prfSalt: webauthnInfo.prfSalt,
encryptedPrv: this.bitgo.encrypt({
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.

same

{
otpDeviceId: webauthnInfo.otpDeviceId,
prfSalt: webauthnInfo.prfSalt,
encryptedPrv: this.bitgo.encrypt({
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.

here too

passphrase,
enterprise,
originalPasscodeEncryptionCode,
webauthnInfo: webauthnInfo ?? undefined,
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.

webauthnInfo ?? undefined is a noop, just use webauthnInf

}),
originalPasscodeEncryptionCode,
webauthnDevices:
webauthnInfo && recipientIndex === 1
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.

nit: use MPCv2PartiesEnum.USER instead of 1

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.

Good catch on using a named constant. wouldn't work here though — this is the non-MPCv2 ECDSA path which uses 1-based indexing (1 = user, 2 = backup, 3 = bitgo). Used ShareKeyPosition.USER (= 1) from ../../../tss/types instead, which is the correct named constant for this code path.

@mohammadalfaiyazbitgo mohammadalfaiyazbitgo force-pushed the wal-761-webauthn-info-create-mpc branch 2 times, most recently from dd33d5b to 14aeaae Compare May 6, 2026 20:40
pranavjain97
pranavjain97 previously approved these changes May 7, 2026
Copy link
Copy Markdown
Contributor

@pranavjain97 pranavjain97 left a comment

Choose a reason for hiding this comment

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

lgtm

What changed:
- Thread webauthnInfo through createMpc/createKeychains so hardware
  authenticator (PRF-derived) encryption can be stored alongside the
  standard encryptedPrv on user keychains
- Use encryptAsync instead of encrypt for webauthnDevices entries so
  v2 encryption is applied consistently
- Replace ad-hoc literal 1 with ShareKeyPosition.USER in ecdsa.ts
  webauthn guard
- Remove AddKeychainOptions annotation that was inadvertently excluding
  prv from the type
- Rename WebAuthn passphrase param type to WebauthnKeyEncryptionInfo,
  move canonical definition to iWallets.ts, consolidate duplicate
  AcceptShareWebauthnInfo, and re-export from iKeychains.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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