Repository navigation
feat(sdk-core): add krs mode to safe recovery key params - #10257
yashaanand wants to merge 1 commit into
Conversation
|
@claude review |
This comment was marked as resolved.
This comment was marked as resolved.
|
|
580af92 to
c98470a
Compare
Review:
|
c98470a to
3eabd48
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Add a `krs` mode to buildSafeRecoverKeyParams for Wallet Safes whose backup root is held by CoinCover. It re-encrypts only the user child, returns the backup child public key and krsProvider 'coincover', so coin.recover() builds a half-signed PSBT (UTXO) or XDR (XLM) for the provider to countersign. MPC slots, non-UTXO secp256k1 coins, ALGO and HBAR reject krs mode because their recover() has no KRS path. SecpSafeRecoverKeyParams is now a union discriminated on `mode`: the existing signed/unsigned member is unchanged at runtime and types `mode?: undefined`, and a `mode: 'krs'` member has walletPassphrase as a string. Ed25519SafeRecoverKeyParams gains a `mode: 'krs'` member, and SafeRecoverMode is exported. Ticket: WCN-4948
3eabd48 to
d7c5f2c
Compare
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
@claude ready to merge? |
|
Claude finished @yashaanand's task in 20s —— View job Merge readinessI found nothing that blocks merging. I can't approve PRs, so a human reviewer still needs to do that.
Before merging, you may want to do the following:
|
Summary
Adds a
krsmode tobuildSafeRecoverKeyParamsfor Wallet Safes whose backup root is held by CoinCover. The params makecoin.recover()build a half-signed transaction for CoinCover to countersign.secp256k1Multisig, UTXO coins only: returns
{ slot, mode: 'krs', userKey, backupKey, bitgoKey, walletPassphrase, krsProvider: 'coincover', walletAddress? }.userKeyis the user child xprv, re-encrypted under a fresh ephemeral passphrase.backupKeyis the backup child xpub. Any backup private key passed in is ignored.ed25519Multisig, XLM/TXLM only: the same shape, with Stellar
S…/G…encodings and never anexternalBackupSigner.Rejected in
krsmode, before any key handling:Their
recover()has no KRS path, or no transaction format has been agreed with CoinCover yet.No
abstract-utxoorsdk-coin-xlmsource change: bothrecover()implementations already sign with the user key only whenkrsProvideris set and the backup key is public.Public types
SafeRecoverMode('signed' | 'unsigned' | 'krs') is exported.SecpSafeRecoverKeyParamsis now a union discriminated onmode. The existing signed/unsigned member is unchanged at runtime and is typedmode?: undefined. The newmode: 'krs'member haswalletPassphrase: string.result.mode === 'krs'narrows without aninguard. All existing callers type-check unchanged.Ed25519SafeRecoverKeyParamsgains amode: 'krs'member.Caller responsibility
The derived child keys don't carry the backup root's
provider. The caller must confirm from the safe keycard that the backup root was issued by CoinCover before usingkrsmode. This is stated in the JSDoc.Tests
sdk-coresafe/recovery.ts:krsparams for secp and for xlm/txlm, checked against golden vectors.externalBackupSigner, each without anyencryptcall.abstract-utxosafeRecovery.ts, for btc, bch and zec: a half-signed PSBT where only the user child signature verifies.sdk-coin-xlmxlmSafeRecovery.ts: the fullkrsparams spread intorecover()give an XDR with exactly one signature, the user child's.Ticket: WCN-4948