Skip to content

Commit 248bbfd

Browse files
Marzooqabitgobot
authored andcommitted
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
1 parent f328521 commit 248bbfd

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

modules/sdk-core/src/bitgo/wallet/iWallets.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as t from 'io-ts';
2-
import { DklsTypes } from '@bitgo/sdk-lib-mpc';
2+
import { DklsTypes, MPSTypes } from '@bitgo/sdk-lib-mpc';
33
import { MPCv2BroadcastMessage, MPCv2P2PMessage } from '@bitgo/public-types';
44

55
import { EncryptionVersion, IRequestTracer } from '../../api';
@@ -178,6 +178,56 @@ export interface EddsaKeyGenCallbacks {
178178
finalizeCallback: EddsaKeyGenFinalizeCallback;
179179
}
180180

181+
export type EddsaMPCv2KeyGenInitializeCallback = (params: {
182+
enterprise: string;
183+
bitgoPublicGpgKey: string;
184+
}) => Promise<{
185+
userGpgPublicKey: string;
186+
backupGpgPublicKey: string;
187+
userState: ExternalSignerMpcState;
188+
backupState: ExternalSignerMpcState;
189+
}>;
190+
191+
export type EddsaMPCv2KeyGenRound1Callback = (params: {
192+
bitgoPublicGpgKey: string;
193+
userGpgPublicKey: string;
194+
backupGpgPublicKey: string;
195+
userState: ExternalSignerMpcState;
196+
backupState: ExternalSignerMpcState;
197+
}) => Promise<{
198+
userSignedMsg1: MPSTypes.MPSSignedMessage;
199+
backupSignedMsg1: MPSTypes.MPSSignedMessage;
200+
userState: ExternalSignerMpcState;
201+
backupState: ExternalSignerMpcState;
202+
}>;
203+
204+
export type EddsaMPCv2KeyGenRound2Callback = (params: {
205+
bitgoMsg1: MPSTypes.MPSSignedMessage;
206+
userSignedMsg1: MPSTypes.MPSSignedMessage;
207+
backupSignedMsg1: MPSTypes.MPSSignedMessage;
208+
userState: ExternalSignerMpcState;
209+
backupState: ExternalSignerMpcState;
210+
}) => Promise<{
211+
userSignedMsg2: MPSTypes.MPSSignedMessage;
212+
backupSignedMsg2: MPSTypes.MPSSignedMessage;
213+
userState: ExternalSignerMpcState;
214+
backupState: ExternalSignerMpcState;
215+
}>;
216+
217+
export type EddsaMPCv2KeyGenFinalizeCallback = (params: {
218+
bitgoMsg2: MPSTypes.MPSSignedMessage;
219+
bitgoCommonKeychain: string;
220+
userState: ExternalSignerMpcState;
221+
backupState: ExternalSignerMpcState;
222+
}) => Promise<{ commonKeychain: string }>;
223+
224+
export interface EddsaMPCv2KeyGenCallbacks {
225+
initializeCallback: EddsaMPCv2KeyGenInitializeCallback;
226+
round1Callback: EddsaMPCv2KeyGenRound1Callback;
227+
round2Callback: EddsaMPCv2KeyGenRound2Callback;
228+
finalizeCallback: EddsaMPCv2KeyGenFinalizeCallback;
229+
}
230+
181231
export interface GenerateWalletOptions {
182232
label?: string;
183233
passphrase?: string;

modules/sdk-core/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export type {
1919
EddsaKeyGenFinalizeResult,
2020
ExternalSignerKeyShare,
2121
ExternalSignerMpcState,
22+
EddsaMPCv2KeyGenCallbacks,
23+
EddsaMPCv2KeyGenInitializeCallback,
24+
EddsaMPCv2KeyGenRound1Callback,
25+
EddsaMPCv2KeyGenRound2Callback,
26+
EddsaMPCv2KeyGenFinalizeCallback,
2227
} from './bitgo/wallet/iWallets';
2328
import { EcdsaUtils } from './bitgo/utils/tss/ecdsa/ecdsa';
2429
export { EcdsaUtils };

0 commit comments

Comments
 (0)