109 lines
4.1 KiB
TypeScript
109 lines
4.1 KiB
TypeScript
/**
|
|
* MPC Service Enums
|
|
*
|
|
* Domain enumerations for MPC service
|
|
*/
|
|
|
|
// ============================================================================
|
|
// PartyShareType - Type of party share
|
|
// ============================================================================
|
|
export enum PartyShareType {
|
|
WALLET = 'wallet', // User wallet key share
|
|
ADMIN = 'admin', // Admin multi-sig share
|
|
RECOVERY = 'recovery', // Recovery key share
|
|
}
|
|
|
|
// ============================================================================
|
|
// PartyShareStatus - Status of a party share
|
|
// ============================================================================
|
|
export enum PartyShareStatus {
|
|
ACTIVE = 'active', // Share is currently active
|
|
ROTATED = 'rotated', // Share has been rotated (replaced)
|
|
REVOKED = 'revoked', // Share has been revoked
|
|
}
|
|
|
|
// ============================================================================
|
|
// SessionType - Type of MPC session
|
|
// ============================================================================
|
|
export enum SessionType {
|
|
KEYGEN = 'keygen', // Key generation session
|
|
SIGN = 'sign', // Signing session
|
|
REFRESH = 'refresh', // Key refresh/rotation session
|
|
}
|
|
|
|
// ============================================================================
|
|
// SessionStatus - Status of an MPC session
|
|
// ============================================================================
|
|
export enum SessionStatus {
|
|
PENDING = 'pending', // Session created, waiting for parties
|
|
IN_PROGRESS = 'in_progress', // Session is running
|
|
COMPLETED = 'completed', // Session completed successfully
|
|
FAILED = 'failed', // Session failed
|
|
TIMEOUT = 'timeout', // Session timed out
|
|
CANCELLED = 'cancelled', // Session was cancelled
|
|
}
|
|
|
|
// ============================================================================
|
|
// ParticipantStatus - Status of a party within a session
|
|
// ============================================================================
|
|
export enum ParticipantStatus {
|
|
PENDING = 'pending', // Party has not joined yet
|
|
JOINED = 'joined', // Party has joined the session
|
|
READY = 'ready', // Party is ready to start
|
|
PROCESSING = 'processing', // Party is actively participating
|
|
COMPLETED = 'completed', // Party has completed its part
|
|
FAILED = 'failed', // Party encountered an error
|
|
TIMEOUT = 'timeout', // Party timed out
|
|
}
|
|
|
|
// ============================================================================
|
|
// ChainType - Blockchain type for key derivation
|
|
// ============================================================================
|
|
export enum ChainType {
|
|
ETHEREUM = 'ethereum', // Ethereum and EVM-compatible chains
|
|
BITCOIN = 'bitcoin', // Bitcoin
|
|
KAVA = 'kava', // Kava blockchain
|
|
DST = 'dst', // DST chain
|
|
BSC = 'bsc', // Binance Smart Chain
|
|
}
|
|
|
|
// ============================================================================
|
|
// KeyCurve - Elliptic curve type
|
|
// ============================================================================
|
|
export enum KeyCurve {
|
|
SECP256K1 = 'secp256k1', // Bitcoin, Ethereum
|
|
ED25519 = 'ed25519', // Solana, etc.
|
|
}
|
|
|
|
// Chain configuration mappings
|
|
export const CHAIN_CONFIG: Record<ChainType, {
|
|
curve: KeyCurve;
|
|
addressPrefix?: string;
|
|
derivationPath: string;
|
|
}> = {
|
|
[ChainType.ETHEREUM]: {
|
|
curve: KeyCurve.SECP256K1,
|
|
addressPrefix: '0x',
|
|
derivationPath: "m/44'/60'/0'/0/0",
|
|
},
|
|
[ChainType.BITCOIN]: {
|
|
curve: KeyCurve.SECP256K1,
|
|
derivationPath: "m/44'/0'/0'/0/0",
|
|
},
|
|
[ChainType.KAVA]: {
|
|
curve: KeyCurve.SECP256K1,
|
|
addressPrefix: 'kava',
|
|
derivationPath: "m/44'/459'/0'/0/0",
|
|
},
|
|
[ChainType.DST]: {
|
|
curve: KeyCurve.SECP256K1,
|
|
addressPrefix: 'dst',
|
|
derivationPath: "m/44'/118'/0'/0/0",
|
|
},
|
|
[ChainType.BSC]: {
|
|
curve: KeyCurve.SECP256K1,
|
|
addressPrefix: '0x',
|
|
derivationPath: "m/44'/60'/0'/0/0",
|
|
},
|
|
};
|