Skip to content

feat(sdk-core): add dedicated EdDSA MPCv2 BitGo GPG public key support#8588

Merged
Marzooqa merged 1 commit into
masterfrom
WCI-223
Apr 21, 2026
Merged

feat(sdk-core): add dedicated EdDSA MPCv2 BitGo GPG public key support#8588
Marzooqa merged 1 commit into
masterfrom
WCI-223

Conversation

@Marzooqa
Copy link
Copy Markdown
Contributor

@Marzooqa Marzooqa commented Apr 21, 2026

Problem

1. Wrong BitGo GPG key type

eddsaMPCv2.ts was using mpcv2PublicKey from the feature flags endpoint,
which is a secp256k1 key used for ECDSA MPCv2. The EddsaMPSDkg WASM
requires an ed25519 GPG key with an X25519 encryption subkey. Passing the
wrong key type caused an immediate "Invalid Input" error from the WASM.

2. Missing GPG signing subkey

generateGPGKeyPair('ed25519') produced:
- Primary: ed25519 (sign + certify)
- Subkey: curve25519 (encrypt)

The HSM's MPS keygen verifies each party's GPG key by calling
getSigningKey() and reading key.bindingSignatures — a property that
only exists on subkeys, not the primary key. With no dedicated signing
subkey, getSigningKey() returns the primary key and bindingSignatures
is undefined, causing:

TypeError: Cannot read properties of undefined (reading 'find')
    at /home/bitgo/hsm-api/src/api/mps.js:214

Changes

New dedicated EdDSA MPCv2 key pipeline:

  • bitgoPubKeys.ts — Added eddsaMpcv2 hardcoded key map (on-prem test/staging) and isBitgoEddsaMpcv2PubKey() validator
  • baseTypes.ts — Added eddsaMpcv2PublicKey?: string to BitgoGPGPublicKey
  • opengpgUtils.tsgetBitgoGpgPubKey() now reads bitgoEddsaMpcv2PublicKey from constants and returns it as eddsaMpcV2
  • baseTSSUtils.ts — Added bitgoEddsaMpcv2PublicGpgKey field, getBitgoEddsaMpcv2PublicGpgKey() getter, wired through
    setBitgoGpgPubKey(); getBitgoGpgPubkeyBasedOnFeatureFlags() now returns { mpcv2PublicKey: Key, eddsaMpcv2PublicKey: Key | undefined }
  • eddsaMPCv2.ts — Uses eddsaMpcv2PublicKey (ed25519) with fallback to bitgoEddsaMpcv2PublicGpgKey; validates against isBitgoEddsaMpcv2PubKey()

GPG key generation fix:

  • opengpgUtils.tsgenerateGPGKeyPair('ed25519') now passes subkeys: [{sign: true}, {sign: false}], producing a dedicated ed25519
    signing subkey. This matches the key structure used in the HSM's own test suite (hsm-api/test/mps.js)

Unrelated callers updated:

  • ecdsa.ts, ecdsaMPCv2.ts — Destructure new return shape of getBitgoGpgPubkeyBasedOnFeatureFlags()

Test plan

  • yarn run unit-test --scope @bitgo/sdk-core
  • yarn run unit-test --scope bitgo
  • EdDSA MPCv2 wallet creation completes DKG round 1 and round 2 on staging (pending WCI-220 bgms fix)
  • ECDSA MPCv2 wallet creation is unaffected

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

TICKET: WCI-223

@linear
Copy link
Copy Markdown

linear Bot commented Apr 21, 2026

@Marzooqa Marzooqa force-pushed the WCI-223 branch 2 times, most recently from d7e3741 to 5c8ea10 Compare April 21, 2026 13:31
EdDSA MPCv2 (MPS) DKG requires an ed25519 GPG key with an X25519
encryption subkey. Using the existing secp256k1 mpcv2PublicKey caused
a WASM "Invalid Input" error. This adds a dedicated eddsaMpcv2PublicKey
field throughout the key-fetching pipeline so EdDSA and ECDSA MPCv2
wallets each use the correct BitGo GPG key.

Also fixes ed25519 GPG key generation to include a dedicated signing
subkey, which is required by the HSM's mps.js validator.

WCI-223

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

TICKET: WCI-223
@Marzooqa Marzooqa marked this pull request as ready for review April 21, 2026 14:31
@Marzooqa Marzooqa requested review from a team as code owners April 21, 2026 14:31
@Marzooqa Marzooqa merged commit affc67f into master Apr 21, 2026
22 checks passed
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.

2 participants