Skip to content

feat(sdk-core): add getEddsaMpcV2RecoveryKeyShares helper#8913

Closed
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
WCI-396/add-eddsa-mpcv2-recovery-key-shares
Closed

feat(sdk-core): add getEddsaMpcV2RecoveryKeyShares helper#8913
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
WCI-396/add-eddsa-mpcv2-recovery-key-shares

Conversation

@bitgo-ai-agent-dev
Copy link
Copy Markdown

Summary

  • Adds getEddsaMpcV2RecoveryKeyShares exported from @bitgo/sdk-core — decrypts and CBOR-decodes user and backup EdDSA MPCv2 reduced key shares in parallel, validates that pub and rootChainCode match, and returns usable Buffer key shares plus the derived commonKeyChain
  • Adds a new encrypt.ts utility module to sdk-core with a standalone decryptAsync that auto-detects v1 (SJCL) and v2 (Argon2id + AES-256-GCM) envelopes, and encryptV2 for test use
  • Adds @bitgo/argon2 as a direct dependency of sdk-core to support v2 envelope decryption

Test plan

  • v1 SJCL-encrypted matching pair returns correct userKeyShare, backupKeyShare, commonKeyChain
  • v2 Argon2id-encrypted matching pair returns same
  • Empty keyShare field throws descriptive error
  • Empty pub field throws descriptive error
  • Empty rootChainCode field throws descriptive error
  • Mismatched pub between user and backup throws
  • Mismatched rootChainCode between user and backup throws
  • All 39 existing EdDSA MPCv2 tests continue to pass

Ticket: WCI-396

Decrypt and CBOR-decode user and backup reduced key shares in
parallel, validate that pub and rootChainCode match between the
two, then return usable Buffer key shares and the derived
commonKeyChain.

Also adds a standalone decryptAsync utility to sdk-core
(encrypt.ts) that auto-detects v1 SJCL and v2 Argon2id envelopes,
requiring @bitgo/argon2 as a new dependency.

Ticket: WCI-396
Session-Id: 991c62f4-1a36-4e5b-8507-9e778d77b2e1
Task-Id: 9401c605-944c-4e5b-9659-2ed1470a7f21
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 2, 2026

WCI-396

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the WCI-396/add-eddsa-mpcv2-recovery-key-shares branch from 94170c3 to ba5aecf Compare June 2, 2026 07:07
@vibhavgo vibhavgo closed this Jun 2, 2026
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