Skip to content

feat(sdk-coin-near): MPCv2 signed hot recovery - #9485

Draft
bitgo-ai-agent-dev[bot] wants to merge 2 commits into
masterfrom
WCI-1223-near-mpcv2-signed-hot-recovery
Draft

feat(sdk-coin-near): MPCv2 signed hot recovery#9485
bitgo-ai-agent-dev[bot] wants to merge 2 commits into
masterfrom
WCI-1223-near-mpcv2-signed-hot-recovery

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown
Contributor

What

  • Import getEddsaSigningMaterial and signEddsaMpcV2RecoveryTx from @bitgo/sdk-core in near.ts
  • Add isMpcv2SigningMaterial() private method: decrypts the user keycard once and returns true when the plaintext is CBOR-encoded (MPCv2 Silence Labs format) vs JSON (MPCv1 Zengo format)
  • Refactor signRecoveryTransaction() to accept an isMpcV2 boolean: when true, routes to signEddsaMpcV2RecoveryTx (MPS DSG local signing) instead of the legacy EDDSAMethods.getTSSSignature path
  • Detect isMpcV2 once at the top of recover() and thread the flag through both the native NEAR transfer path and the NEP141 FT token recovery path (recoverNearToken)
  • Add three unit tests: native NEAR MPCv2 signed recovery, NEP141 FT token MPCv2 signed recovery, and bitgoKey/commonKeyChain mismatch error

Why

NEAR wallets provisioned with the new Silence Labs (MPCv2) key material cannot be recovered using the legacy getTSSSignature path because the keycard format is different (CBOR base64 reduced share vs JSON uShare/yShare). This adds the same MPCv2 detection + signing path introduced for SOL in WCI-398, enabling hot signed recovery for MPCv2 NEAR wallets without requiring any new caller-visible parameters. Detection is automatic based on keycard format.

Test plan

  • should route to MPCv2 path for native NEAR recovery when keycard is MPCv2 — verifies signed tx returned, getTSSSignature not called
  • should throw when MPCv2 commonKeyChain does not match bitgoKey — verifies mismatch error
  • should route to MPCv2 path for NEP141 FT token recovery when keycard is MPCv2 — verifies token recovery routes to MPCv2
  • All existing MPCv1 and unsigned sweep tests pass unchanged (165 total unit tests)

Ticket: WCI-1223

Add MPCv2 detection and signing to Near.recover() alongside the
existing MPCv1 path.

What changed:
- Import getEddsaSigningMaterial and signEddsaMpcV2RecoveryTx from
  @bitgo/sdk-core in near.ts
- Add isMpcv2SigningMaterial() private method that decrypts the user
  keycard once and returns true when the plaintext is CBOR (MPCv2)
- Refactor signRecoveryTransaction() to accept an isMpcV2 boolean; when
  true it calls signEddsaMpcV2RecoveryTx (MPS DSG) instead of the
  legacy EDDSAMethods.getTSSSignature path
- Call isMpcv2SigningMaterial() once at the top of recover() and thread
  the isMpcV2 flag into both the native NEAR and NEP141 FT token paths
- Add three new unit tests: native MPCv2 signed recovery, NEP141 FT
  token MPCv2 signed recovery, and bitgoKey/commonKeyChain mismatch

Why:
NEAR wallets provisioned with the new Silence Labs (MPCv2) key material
cannot be recovered with the Zengo-era getTSSSignature path because the
keycard format is different (CBOR base64 vs JSON uShare/yShare). This
adds the same MPCv2 detection+signing path that was introduced for SOL
in WCI-398, enabling hot recovery for MPCv2 NEAR wallets without any
new caller-visible parameters.

Ticket: WCI-1223
Session-Id: 8de2a998-4754-4499-82b5-49167b8d9fd6
Task-Id: 7e0eb924-0c33-4cc6-9402-c71587bb14a5
@linear-code

linear-code Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

WCI-1223

@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1223-near-mpcv2-signed-hot-recovery branch from 5fc6899 to f43e93f Compare August 12, 2026 11:49
…ion call

Wrap long function call arguments to satisfy the project's line-length
constraint enforced by prettier/eslint.

Ticket: WCI-1223
Session-Id: 8de2a998-4754-4499-82b5-49167b8d9fd6
Task-Id: 7e0eb924-0c33-4cc6-9402-c71587bb14a5
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1223-near-mpcv2-signed-hot-recovery branch from ed8bc24 to d062b1f Compare August 12, 2026 12:29
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