Skip to content

Commit 1aa502f

Browse files
committed
feat(sdk-core): add webauthnInfo param to AddKeychainOptions for atomic passkey attachment
The backend POST /api/v2/:coin/key handler reads `req.body.webauthnInfo` (single object) to atomically attach a passkey during key creation, but the SDK only sent `webauthnDevices` (array) which the backend ignores. This caused passkey attachment to require a separate best-effort PUT call that could fail, leaving wallets in an inconsistent state. Add `webauthnInfo` field to `AddKeychainOptions` and pass it through in `keychains.add()` so callers can atomically link a passkey to a keychain during creation. Deprecate `webauthnDevices` on `AddKeychainOptions` since the backend never reads it on the POST path. WCN-127
1 parent 232ea03 commit 1aa502f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

modules/sdk-core/src/bitgo/keychain/iKeychains.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,13 @@ export interface AddKeychainOptions {
141141
// indicates if the key is MPCv2 or not
142142
isMPCv2?: boolean;
143143
coinSpecific?: { [coinName: string]: unknown };
144-
/** WebAuthn devices that have an additional encrypted copy of the private key, keyed by PRF-derived passphrases. */
144+
/** WebAuthn devices that have an additional encrypted copy of the private key, keyed by PRF-derived passphrases.
145+
* @deprecated Use {@link webauthnInfo} instead — the backend reads `webauthnInfo` (single object), not `webauthnDevices`. */
145146
webauthnDevices?: WebauthnInfo[];
147+
/** Single webauthn device to atomically attach during key creation.
148+
* Sent as `webauthnInfo` in the POST /key body so the backend can link
149+
* the passkey to the keychain in the same request. */
150+
webauthnInfo?: WebauthnInfo;
146151
}
147152

148153
export interface ApiKeyShare {

modules/sdk-core/src/bitgo/keychain/keychains.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ export class Keychains implements IKeychains {
307307
isMPCv2: params.isMPCv2,
308308
coinSpecific: params.coinSpecific,
309309
webauthnDevices: params.webauthnDevices,
310+
webauthnInfo: params.webauthnInfo,
310311
})
311312
.result();
312313
}

0 commit comments

Comments
 (0)