feat(sdk-core): send webauthnInfo with enterpriseId for MPC (v1+v2) user keychain#8974
feat(sdk-core): send webauthnInfo with enterpriseId for MPC (v1+v2) user keychain#8974rajangarg047 wants to merge 1 commit into
Conversation
c05a54a to
19fc785
Compare
…hain MPC/TSS wallet creation attached the user keychain's passkey by sending a bare webauthnDevices array (no enterpriseId) on POST /api/v2/:coin/key. The wallet-platform atomic key-creation endpoint only consumes webauthnInfo (a single object including enterpriseId, used to validate the PRF salt) and ignores webauthnDevices on input, so passkeys were never persisted for TSS/MPC user keychains. Switch MPC user-keychain creation to send webauthnInfo with enterpriseId, mirroring the onchain key-creation contract. Applied across all four MPC keychain implementations (ECDSA + EdDSA, MPCv1 + MPCv2), threading the existing createKeychains enterprise param down to the USER participant, and widen WebauthnInfo with optional enterpriseId. Add unit tests asserting webauthnInfo (with enterpriseId) is sent on the user keychain across all four MPC paths, that the deprecated webauthnDevices array is not sent, and that the PRF-encrypted prv decrypts with the webauthn passphrase. WCN-848 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
19fc785 to
185c039
Compare
|
Claude finished @rajangarg047's task —— View job Code Review for PR #8974 ✅I've completed a comprehensive review of the changes for adding webauthnInfo with enterpriseId to MPC user keychain creation. Todo List:
SummaryThis PR successfully addresses the issue where passkeys were not persisted for TSS/MPC user keychains. The changes correctly switch from the deprecated Detailed Review✅ Interface Changes (
|
Summary
For MPC/TSS wallet creation,
createMpcattached the user keychain's passkey by sending a barewebauthnDevicesarray (noenterpriseId) onPOST /api/v2/:coin/key. The wallet-platform atomic key-creation endpoint only consumeswebauthnInfo(a single object that includesenterpriseId, used to validate the PRF salt) and ignoreswebauthnDeviceson input — so passkeys were never persisted for TSS/MPC user keychains (the keychain came back with nowebauthnDevicesand Wallet Settings showed no passkey).This switches MPC user-keychain creation to send
webauthnInfo { otpDeviceId, prfSalt, encryptedPrv, enterpriseId }, mirroring the onchain key-creation contract that already works. Applied across all four MPC keychain implementations (ECDSA + EdDSA, both MPCv1 and MPCv2), sincecreateMpcdispatches by curve (getMPCAlgorithm()) and version.Changes
ecdsaMPCv2.ts/eddsaMPCv2.tsandecdsa.ts/eddsa.ts(MPCv1): thread the existingenterprise(acreateKeychainsparam) down to the USER participant keychain; buildwebauthnInfo(withenterpriseId) instead of the deprecatedwebauthnDevicesarray.encryptionVersioncontinues to flow into the PRF-encryptedencryptedPrv.iKeychains.ts: widenWebauthnInfowith optionalenterpriseId(required by the atomic create endpoint; not needed on the PUT update path, which resolves enterprise from the wallet). This also lets the onchain client path drop its type-widening workaround.POST /keybody carrieswebauthnInfow/enterpriseId, the PRF-encrypted prv decrypts with the webauthn passphrase,webauthnDevicesis not sent, and the backup keychain carries no passkey material.Context
webauthnInfotoAddKeychainOptions/keychains.add), now merged to master.webauthnInfofor MPC keys (WCN-849); together they make passkey-on-MPC-creation work end to end.Testing
sdk-corebuilds/type-checks clean.modules/bitgoECDSA MPCv2createKeychainssuite passes (8 passing) including the newwebauthnInfotest.🤖 Generated with Claude Code