Skip to content

feat(sdk-core): extract isMpcV2Keycard and signEddsaMpcV2RecoveryTx into shared utils - #9449

Draft
vibhavgo wants to merge 3 commits into
feat/abstract-substrate/WCI-1239from
feat/sdk-core/extract-mpcv2-recovery-helper
Draft

feat(sdk-core): extract isMpcV2Keycard and signEddsaMpcV2RecoveryTx into shared utils#9449
vibhavgo wants to merge 3 commits into
feat/abstract-substrate/WCI-1239from
feat/sdk-core/extract-mpcv2-recovery-helper

Conversation

@vibhavgo

@vibhavgo vibhavgo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds EddsaSigningMaterial discriminated union (v1 | v2) to eddsaMPCv2.ts
  • Adds isMpcV2Keycard(userKey, walletPassphrase, bitgo?) — detects v1 (JSON/SJCL) vs v2 (CBOR) keycard, returns typed signing material; sjcl fallback retained for optional bitgo
  • Adds signEddsaMpcV2RecoveryTx(params) — full MPCv2 recovery signing: decrypt key shares → validate commonKeyChain → MPS DSG
  • Exports all new symbols from sdk-core package root
  • Replaces inline implementations in abstract-substrate and sdk-coin-sol with the shared helpers — drop-in, no behaviour change, no test modifications
  • 18 tests including end-to-end signature verification

Context

WCI-1276isMpcV2Keycard and signEddsaMpcV2RecoveryTx were duplicated inline across coin modules (Substrate/DOT/POLYX, SOL). This PR extracts them into sdk-core and replaces all call sites.

This branch is based on feat/abstract-substrate/WCI-1239 and should be merged after that branch lands.

Modules changed

Module Change
@bitgo/sdk-core New shared helpers + types + exports
@bitgo/abstract-substrate Delegates isMpcV2Keycard to shared helper; removes local SubstrateSigningMaterial type
@bitgo/sdk-coin-sol Delegates isMpcv2SigningMaterial and MPCv2 signing block to shared helpers

Test plan

  • yarn test in modules/sdk-core — 18 passing
  • yarn build in modules/abstract-substrate — clean
  • yarn test in modules/sdk-coin-sol — 482 passing (3 pre-existing env-var failures unrelated to this PR)

🤖 Generated with Claude Code

…nto shared utils

Ticket: WCI-1276

Add EddsaSigningMaterial discriminated union, isMpcV2Keycard (detects v1 vs v2
keycard format), and signEddsaMpcV2RecoveryTx (full MPCv2 recovery signing) to
eddsaMPCv2.ts. These functions were duplicated inline across TON and Substrate
coin recovery implementations.

- Remove sjcl.decrypt fallback: all decryption routes through bitgo.decrypt,
  which handles both v1 (SJCL) and v2 (Argon2id) envelopes.
- Export all new symbols from sdk-core package root.
- 17 tests covering both functions including end-to-end signature verification.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vibhavgo
vibhavgo requested review from a team as code owners August 7, 2026 09:08
…nd getEddsaMpcV2RecoveryKeySharesFromReducedKey

Ticket: WCI-1276

Reverts the bitgo-required change: both functions keep bitgo? optional with
sjcl.decrypt fallback for v1-only callers. isMpcV2Keycard and
signEddsaMpcV2RecoveryTx also remain with optional bitgo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vibhavgo
vibhavgo marked this pull request as draft August 7, 2026 10:18
Ticket: WCI-1276

Replace inline MPCv2 keycard detection and signing in abstract-substrate
and sdk-coin-sol with shared helpers isMpcV2Keycard and
signEddsaMpcV2RecoveryTx from sdk-core. Drop-in replacement — no
behaviour change, no test modifications required.

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.

1 participant