Skip to content

Commit de2936a

Browse files
signer interface matched with other plugins
1 parent 874bb7c commit de2936a

File tree

10 files changed

+2679
-3615
lines changed

10 files changed

+2679
-3615
lines changed

package-lock.json

Lines changed: 2327 additions & 3309 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"@toruslabs/torus-scripts": "^6.1.2",
8181
"@toruslabs/tss-dkls-lib": "^5.0.0-alpha.0",
8282
"@toruslabs/tss-frost-lib": "^2.0.0-alpha.0",
83+
"@toruslabs/tss-frost-lib-bip340": "^0.1.0-alpha.0",
8384
"@types/chai": "^4.3.16",
8485
"@types/elliptic": "^6.4.18",
8586
"@types/jsonwebtoken": "^9.0.7",

src/interfaces.ts

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { SafeEventEmitter } from "@web3auth/auth";
2222
import BN from "bn.js";
2323

2424
import { FactorKeyTypeShareDescription, TssShareType, USER_PATH, WEB3AUTH_NETWORK } from "./constants";
25-
import { IRemoteClientState, IRemoteSignerContext } from "./plugins/ICustomSigner";
26-
import { ISessionSigGenerator } from "./plugins/ISessionSigGenerator";
25+
import { ISessionSigGenerator } from "./plugins/SessionSigGenerator/ISessionSigGenerator";
26+
import { IRemoteClientState } from "./plugins/Signer/ISigner";
2727

2828
export type CoreKitMode = UX_MODE_TYPE | "nodejs" | "react-native";
2929

@@ -336,13 +336,45 @@ export interface Web3AuthOptions {
336336
useClientGeneratedTSSKey?: boolean;
337337
}
338338
export type Web3AuthOptionsWithDefaults = Required<Web3AuthOptions>;
339+
export type SigType = WEB3AUTH_SIG_TYPE;
340+
341+
export interface ISignerContext {
342+
stateEmitter: SafeEventEmitter;
343+
config: Web3AuthOptionsWithDefaults;
344+
status: COREKIT_STATUS;
345+
state: Web3AuthState;
346+
tKey: TKeyTSS;
347+
keyType: KeyType;
348+
sigType: SigType;
349+
verifier: string;
350+
verifierId: string;
351+
getTssNonce: () => number;
352+
getSessionSignatures: () => Promise<string[]>;
353+
getPubKey(): Buffer;
354+
precomputeSecp256k1(params?: { sessionSignatures?: string[] }): Promise<{
355+
client: Client;
356+
serverCoeffs: Record<string, string>;
357+
signatures: string[];
358+
}>;
359+
setupRemoteSigning(params: Omit<IRemoteClientState, "tssShareIndex">, rehydrate?: boolean): Promise<void>;
360+
createFactor(createFactorParams: CreateFactorParams): Promise<string>;
361+
inputFactorKey(factorKey: string): Promise<void>;
362+
deleteFactor(factorPub: TkeyPoint, factorKey?: BNString): Promise<void>;
363+
getKeyDetails(): Record<string, unknown> & { shareDescriptions: ShareDescriptionMap };
364+
getMetadataKey(): string | undefined;
365+
getMetadataPublicKey(): string | undefined;
366+
getWeb3AuthNetwork(): WEB3AUTH_NETWORK_TYPE;
367+
}
339368

340-
export interface IMPCContext extends IRemoteSignerContext {
369+
export interface IMPCContext {
341370
stateEmitter: SafeEventEmitter;
342371
config: Web3AuthOptionsWithDefaults;
343372
status: COREKIT_STATUS;
344373
state: Web3AuthState;
345374
torusSp: TSSTorusServiceProvider | null;
375+
tKey: TKeyTSS;
376+
keyType: KeyType;
377+
sigType: SigType;
346378
updateState: (newState: Partial<Web3AuthState>) => void;
347379
getUserInfo: () => UserInfo;
348380
setupTkey: (params?: {
@@ -441,8 +473,7 @@ export interface ICoreKit {
441473
* associated metadata.
442474
* @param factorPub - The public key of the factor to delete.
443475
*/
444-
deleteFactor(factorPub: TkeyPoint): Promise<void>;
445-
476+
deleteFactor(factorPub: TkeyPoint, factorKey?: BNString): Promise<void>;
446477
/**
447478
* Logs out the user, terminating the session.
448479
*/
@@ -520,8 +551,6 @@ export interface TkeyLocalStoreData {
520551
factorKey: string;
521552
}
522553

523-
export type SigType = WEB3AUTH_SIG_TYPE;
524-
525554
export interface CoreKitSigner {
526555
keyType: KeyType;
527556
sigType: SigType;

0 commit comments

Comments
 (0)