Types
Complete TypeScript type definitions from src/types/index.ts
TypeScript Types
All types are defined in src/types/index.ts and organized into logical categories: Configuration, Authentication and Session, MPC Protocol, Storage, Wallet and Key Material, Backup and Recovery, and SDK Events and Errors.
Configuration Types
SDKConfig
Top-level configuration object passed to the NeroMpcSDK constructor.
| Field | Type | Required | Description |
|---|---|---|---|
backendUrl | string | Yes | Base URL for Nero MPC backend |
apiKey | string | No | Project API key in request headers |
deviceId | string | No | Stable device identifier |
chainId | number | No | Default EVM chain ID (default: 689) |
wsUrl | string | No | WebSocket URL for real-time MPC coordination (required for Pedersen) |
storagePrefix | string | No | Namespace prefix for storage keys (default: "nero") |
autoConnect | boolean | No | Auto-reconnect session on initialization (default: true) |
uiConfig | UIConfig | No | Visual customization for modal components |
sessionTime | number | No | Session lifetime override in seconds |
protocol | "pedersen" | "dkls" | No | MPC protocol selection (default: "dkls") |
storage | StorageAdapter | No | Custom storage implementation |
UIConfig
Passed via SDKConfig.uiConfig. Used by React and Modal UI layers.
| Field | Type | Description |
|---|---|---|
appName | string | Application name displayed in modals |
logoLight | string | Light mode logo URL |
logoDark | string | Dark mode logo URL |
mode | "light" | "dark" | "auto" | Theme mode |
theme | object | CSS color overrides: primary, secondary, background, text, border |
ChainConfig
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | EIP-155 chain ID |
chainName | string | Yes | Internal machine-readable name |
displayName | string | Yes | Human-readable name |
nativeCurrency.name | string | Yes | Full name of the native token |
nativeCurrency.symbol | string | Yes | Ticker symbol |
nativeCurrency.decimals | number | Yes | Decimal precision (always 18 for EVM) |
rpcUrls | string[] | Yes | Ordered list of JSON-RPC endpoints |
blockExplorerUrls | string[] | No | Block explorer base URLs |
isTestnet | boolean | Yes | Flag distinguishing testnets |
entryPointAddress | string | No | ERC-4337 EntryPoint contract address |
simpleAccountFactoryAddress | string | No | SimpleAccount factory contract address |
bundlerUrl | string | No | ERC-4337 bundler endpoint |
paymasterUrl | string | No | Paymaster service endpoint |
Authentication and Session Types
User
Populated after successful login.
| Field | Type | Description |
|---|---|---|
id | string | Unique user identifier |
email | string | undefined | User's email address |
displayName | string | undefined | User's display name |
walletAddress | string | undefined | Associated wallet address |
createdAt | Date | Account creation timestamp |
AuthTokens
Token bundle used for API authorization.
| Field | Type | Description |
|---|---|---|
accessToken | string | Short-lived JWT for API requests |
refreshToken | string | Long-lived token for access token renewal |
expiresAt | number | Unix timestamp for access token expiration |
dappShare | string | undefined | Opaque session portability token |
SocialLoginResponse
Response from OAuth/social login containing user, tokens, and a wallet sub-object indicating requiresKeyGeneration status.
SessionStatus
Current state of the user's authentication session.
MPC Protocol Types
KeyShare
The client's key share in threshold ECDSA protocol.
| Field | Type | Description |
|---|---|---|
partyId | number | Party index |
privateShare | string | Hex-encoded private polynomial share |
publicShare | string | Hex-encoded public counterpart |
threshold | number | Signing threshold t |
totalParties | number | Total parties n |
DKGSessionState
In-memory state maintained during DKG protocol rounds.
| Field | Type | Description |
|---|---|---|
sessionId | string | Unique session identifier |
round | DKGRound | Current protocol round |
commitments | Map<number, DKGCommitment> | Party commitments collected |
receivedShares | Map<number, DKGShare> | Shares received from parties |
SigningRequest
Input to signing protocol. Supports three types:
"transaction"-- Transaction signing"message"-- Personal message signing (EIP-191)"typed_data"-- Typed data signing (EIP-712)
Signature
Final assembled Ethereum-compatible signature.
| Field | Type | Description |
|---|---|---|
r | string | ECDSA r component |
s | string | ECDSA s component |
v | number | Recovery parameter |
fullSignature | string | Concatenated hex signature |
Wallet and Key Material Types
WalletInfo
Describes the user's MPC wallet (returned by WalletAPI).
| Field | Type | Description |
|---|---|---|
eoaAddress | string | Ethereum address from public key |
smartWalletAddress | string | undefined | ERC-4337 smart account address |
publicKey | string | Hex-encoded public key |
KeyMaterialResponse
Payload from WalletAPI.getKeyMaterial() including encryptedShare and protocol metadata (e.g., pedersen-dkg-v1 or dkls).
ReconstructedKey
Returned when assembling the full private key for local signing or recovery.
| Field | Type | Description |
|---|---|---|
privateKey | string | Hex-encoded full private key |
walletAddress | string | Derived Ethereum address |
publicKey | string | Hex-encoded public key |
Backup and Recovery Types
BackupData
Structure for password-encrypted key share backups.
RecoveryMethod
Defines the recovery approach (password-based, social recovery, etc.).
Factor
Represents a single authentication/recovery factor stored on the backend.
Storage Interface
StorageAdapter
Interface for persisting key shares and session data.
export interface StorageAdapter {
get(key: string): Promise<string | null>;
set(key: string, value: string): Promise<void>;
delete(key: string): Promise<void>;
clear(): Promise<void>;
}The SDK defaults to IndexedDBStorage. Provide a custom StorageAdapter implementation via SDKConfig.storage for alternative storage backends.
Error Types
SDKErrorCode
Common error codes across the SDK:
| Code | Description |
|---|---|
NOT_AUTHENTICATED | User not logged in |
RECOVERY_REQUIRED | Client key share missing; recovery flow needed |
SIGNING_SESSION_CONFLICT | Another signing session active |
DKG_FAILED | Distributed Key Generation failed |
DKLS_KEYGEN_FAILED | DKLS key generation error |
INVALID_SHARE | Peer share verification failure |
TOKEN_EXPIRED | Access token expired |
NETWORK_ERROR | Communication failure |
SDKEvent / SDKEventMap
Type definitions for the SDK event system. See the NeroMpcSDK Class reference for the full event list.