Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup remote signer #215

Open
wants to merge 9 commits into
base: feat/remoteSigner-V4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,640 changes: 2,329 additions & 3,311 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3auth/mpc-core-kit",
"version": "4.1.6-alpha.0",
"version": "4.2.1-alpha.0",
"description": "MPC CoreKit SDK for web3Auth",
"keywords": [
"web3Auth/mpc-core-kit",
Expand Down Expand Up @@ -80,6 +80,7 @@
"@toruslabs/torus-scripts": "^6.1.2",
"@toruslabs/tss-dkls-lib": "^5.0.0-alpha.0",
"@toruslabs/tss-frost-lib": "^2.0.0-alpha.0",
"@toruslabs/tss-frost-lib-bip340": "^0.1.0-alpha.0",
"@types/chai": "^4.3.16",
"@types/elliptic": "^6.4.18",
"@types/jsonwebtoken": "^9.0.7",
Expand Down
60 changes: 52 additions & 8 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { SafeEventEmitter } from "@web3auth/auth";
import BN from "bn.js";

import { FactorKeyTypeShareDescription, TssShareType, USER_PATH, WEB3AUTH_NETWORK } from "./constants";
import { IRemoteClientState, IRemoteSignerContext } from "./plugins/ICustomSigner";
import { ISessionSigGenerator } from "./plugins/ISessionSigGenerator";
import { ISessionSigGenerator } from "./plugins/SessionSigGenerator/ISessionSigGenerator";
import { IDklsSignConfig, IFrostSignConfig, IRemoteFactor, ISigner } from "./plugins/Signer/ISigner";

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

Expand Down Expand Up @@ -186,7 +186,7 @@ export interface Web3AuthState {
tssPubKey?: Buffer;
accountIndex: number;
factorKey?: BN;
remoteClient?: IRemoteClientState;
remoteFactor?: IRemoteFactor;
}

export type WEB3AUTH_NETWORK_TYPE = (typeof WEB3AUTH_NETWORK)[keyof typeof WEB3AUTH_NETWORK];
Expand Down Expand Up @@ -336,13 +336,60 @@ export interface Web3AuthOptions {
useClientGeneratedTSSKey?: boolean;
}
export type Web3AuthOptionsWithDefaults = Required<Web3AuthOptions>;
export type SigType = WEB3AUTH_SIG_TYPE;

export interface ISignerContext {
stateEmitter: SafeEventEmitter;
config: Web3AuthOptionsWithDefaults;
status: COREKIT_STATUS;
state: Web3AuthState;
tKey: TKeyTSS;
keyType: KeyType;
sigType: SigType;
verifier: string;
verifierId: string;
getTssNonce: () => number;
getSessionSignatures: () => Promise<string[]>;
getPubKey(): Buffer;
precomputeSecp256k1(params?: { sessionSignatures?: string[] }): Promise<{
client: Client;
serverCoeffs: Record<string, string>;
signatures: string[];
}>;
preSetupDKLSSigningConfig(): Promise<IDklsSignConfig>;
preSetupFrostSigningConfig(): Promise<IFrostSignConfig>;
setCustomSigner(customSigner: ISigner, remoteFactor?: IRemoteFactor): Promise<void>;
}

export interface IFactorManagerContext {
stateEmitter: SafeEventEmitter;
config: Web3AuthOptionsWithDefaults;
status: COREKIT_STATUS;
state: Web3AuthState;
tKey: TKeyTSS;
keyType: KeyType;
sigType: SigType;
verifier: string;
verifierId: string;
getWeb3AuthNetwork(): WEB3AUTH_NETWORK_TYPE;
createFactor(createFactorParams: CreateFactorParams): Promise<string>;
deleteFactor(factorPub: TkeyPoint, factorKey?: BNString): Promise<void>;
getMetadataKey(): string | undefined;
getMetadataPublicKey(): string;
getKeyDetails(): Record<string, unknown> & {
shareDescriptions: ShareDescriptionMap;
};
}

export interface IMPCContext extends IRemoteSignerContext {
export interface IMPCContext {
stateEmitter: SafeEventEmitter;
config: Web3AuthOptionsWithDefaults;
status: COREKIT_STATUS;
state: Web3AuthState;
torusSp: TSSTorusServiceProvider | null;
tKey: TKeyTSS;
keyType: KeyType;
sigType: SigType;
updateState: (newState: Partial<Web3AuthState>) => void;
getUserInfo: () => UserInfo;
setupTkey: (params?: {
Expand Down Expand Up @@ -441,8 +488,7 @@ export interface ICoreKit {
* associated metadata.
* @param factorPub - The public key of the factor to delete.
*/
deleteFactor(factorPub: TkeyPoint): Promise<void>;

deleteFactor(factorPub: TkeyPoint, factorKey?: BNString): Promise<void>;
/**
* Logs out the user, terminating the session.
*/
Expand Down Expand Up @@ -520,8 +566,6 @@ export interface TkeyLocalStoreData {
factorKey: string;
}

export type SigType = WEB3AUTH_SIG_TYPE;

export interface CoreKitSigner {
keyType: KeyType;
sigType: SigType;
Expand Down
Loading