Skip to content

Commit ac353ad

Browse files
committed
add sign method to ICoreKit interface
1 parent 57ac0ce commit ac353ad

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/interfaces.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ export interface IMPCContext {
354354
setCustomSessionSigGenerator: (sessionSigGenerator: ISessionSigGenerator) => void;
355355
}
356356

357+
export interface Secp256k1PrecomputedClient {
358+
client: Client;
359+
serverCoeffs: Record<string, string>;
360+
signatures: string[];
361+
}
362+
357363
export interface ICoreKit {
358364
/**
359365
* The tKey instance, if initialized.
@@ -460,6 +466,23 @@ export interface ICoreKit {
460466
*/
461467
commitChanges(): Promise<void>;
462468

469+
/**
470+
* Create a signature for the given data.
471+
*
472+
* Options:
473+
* - hashed: The data is already hashed. Do not hash again. Only works for ecdsa-secp256k1.
474+
* - secp256k1Precompute: Provide a precomputed client for faster signing. Only works for ecdsa-secp256k1.
475+
* - keyTweak: Provide a bip340 key tweak. Only works for bip340.
476+
*/
477+
sign(
478+
data: Buffer,
479+
opts?: {
480+
hashed?: boolean;
481+
secp256k1Precompute?: Secp256k1PrecomputedClient;
482+
keyTweak?: BN;
483+
}
484+
): Promise<Buffer>;
485+
463486
/**
464487
* WARNING: Use with caution. This will export the private signing key.
465488
*
@@ -516,12 +539,6 @@ export interface EthereumSigner {
516539
getPublic: () => Promise<Buffer>;
517540
}
518541

519-
export interface Secp256k1PrecomputedClient {
520-
client: Client;
521-
serverCoeffs: Record<string, string>;
522-
signatures: string[];
523-
}
524-
525542
export type StateEmitterEvents = {
526543
LOGOUT: () => void;
527544
};

0 commit comments

Comments
 (0)