From 248bbfd59c56a5d5ae90d4915ddaa8c87ddad4ec Mon Sep 17 00:00:00 2001 From: Marzooqa Kather Date: Tue, 7 Jul 2026 12:11:00 +0000 Subject: [PATCH] feat(sdk-core): define EdDSA MPCv2 key gen callback types Add EddsaMPCv2KeyGenCallbacks interface and per-round callback type definitions to iWallets.ts, following the ECDSA MPCv2 pattern. Also define EddsaMPCv2SignedMessage (the PGP-signed DKG message type) and export all new types from index.ts. These types are the contract between the SDK orchestrator (createKeychainsWithExternalSigner, WCI-916) and external signer implementations (ME callback factory, WCI-895). Defining them first allows downstream tickets to reference a stable interface. Ticket: WCI-894 Session-Id: 5618dd06-6b18-4b4d-a0f3-4e8efd3271ca Task-Id: 51b30ada-7aea-4ec7-a83e-96900abaaeeb --- modules/sdk-core/src/bitgo/wallet/iWallets.ts | 52 ++++++++++++++++++- modules/sdk-core/src/index.ts | 5 ++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/modules/sdk-core/src/bitgo/wallet/iWallets.ts b/modules/sdk-core/src/bitgo/wallet/iWallets.ts index 26f07658d6..55aa835c6a 100644 --- a/modules/sdk-core/src/bitgo/wallet/iWallets.ts +++ b/modules/sdk-core/src/bitgo/wallet/iWallets.ts @@ -1,5 +1,5 @@ import * as t from 'io-ts'; -import { DklsTypes } from '@bitgo/sdk-lib-mpc'; +import { DklsTypes, MPSTypes } from '@bitgo/sdk-lib-mpc'; import { MPCv2BroadcastMessage, MPCv2P2PMessage } from '@bitgo/public-types'; import { EncryptionVersion, IRequestTracer } from '../../api'; @@ -178,6 +178,56 @@ export interface EddsaKeyGenCallbacks { finalizeCallback: EddsaKeyGenFinalizeCallback; } +export type EddsaMPCv2KeyGenInitializeCallback = (params: { + enterprise: string; + bitgoPublicGpgKey: string; +}) => Promise<{ + userGpgPublicKey: string; + backupGpgPublicKey: string; + userState: ExternalSignerMpcState; + backupState: ExternalSignerMpcState; +}>; + +export type EddsaMPCv2KeyGenRound1Callback = (params: { + bitgoPublicGpgKey: string; + userGpgPublicKey: string; + backupGpgPublicKey: string; + userState: ExternalSignerMpcState; + backupState: ExternalSignerMpcState; +}) => Promise<{ + userSignedMsg1: MPSTypes.MPSSignedMessage; + backupSignedMsg1: MPSTypes.MPSSignedMessage; + userState: ExternalSignerMpcState; + backupState: ExternalSignerMpcState; +}>; + +export type EddsaMPCv2KeyGenRound2Callback = (params: { + bitgoMsg1: MPSTypes.MPSSignedMessage; + userSignedMsg1: MPSTypes.MPSSignedMessage; + backupSignedMsg1: MPSTypes.MPSSignedMessage; + userState: ExternalSignerMpcState; + backupState: ExternalSignerMpcState; +}) => Promise<{ + userSignedMsg2: MPSTypes.MPSSignedMessage; + backupSignedMsg2: MPSTypes.MPSSignedMessage; + userState: ExternalSignerMpcState; + backupState: ExternalSignerMpcState; +}>; + +export type EddsaMPCv2KeyGenFinalizeCallback = (params: { + bitgoMsg2: MPSTypes.MPSSignedMessage; + bitgoCommonKeychain: string; + userState: ExternalSignerMpcState; + backupState: ExternalSignerMpcState; +}) => Promise<{ commonKeychain: string }>; + +export interface EddsaMPCv2KeyGenCallbacks { + initializeCallback: EddsaMPCv2KeyGenInitializeCallback; + round1Callback: EddsaMPCv2KeyGenRound1Callback; + round2Callback: EddsaMPCv2KeyGenRound2Callback; + finalizeCallback: EddsaMPCv2KeyGenFinalizeCallback; +} + export interface GenerateWalletOptions { label?: string; passphrase?: string; diff --git a/modules/sdk-core/src/index.ts b/modules/sdk-core/src/index.ts index 9326a21c7a..94783ed2ed 100644 --- a/modules/sdk-core/src/index.ts +++ b/modules/sdk-core/src/index.ts @@ -19,6 +19,11 @@ export type { EddsaKeyGenFinalizeResult, ExternalSignerKeyShare, ExternalSignerMpcState, + EddsaMPCv2KeyGenCallbacks, + EddsaMPCv2KeyGenInitializeCallback, + EddsaMPCv2KeyGenRound1Callback, + EddsaMPCv2KeyGenRound2Callback, + EddsaMPCv2KeyGenFinalizeCallback, } from './bitgo/wallet/iWallets'; import { EcdsaUtils } from './bitgo/utils/tss/ecdsa/ecdsa'; export { EcdsaUtils };