NERO
API Reference

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.

FieldTypeRequiredDescription
backendUrlstringYesBase URL for Nero MPC backend
apiKeystringNoProject API key in request headers
deviceIdstringNoStable device identifier
chainIdnumberNoDefault EVM chain ID (default: 689)
wsUrlstringNoWebSocket URL for real-time MPC coordination (required for Pedersen)
storagePrefixstringNoNamespace prefix for storage keys (default: "nero")
autoConnectbooleanNoAuto-reconnect session on initialization (default: true)
uiConfigUIConfigNoVisual customization for modal components
sessionTimenumberNoSession lifetime override in seconds
protocol"pedersen" | "dkls"NoMPC protocol selection (default: "dkls")
storageStorageAdapterNoCustom storage implementation

UIConfig

Passed via SDKConfig.uiConfig. Used by React and Modal UI layers.

FieldTypeDescription
appNamestringApplication name displayed in modals
logoLightstringLight mode logo URL
logoDarkstringDark mode logo URL
mode"light" | "dark" | "auto"Theme mode
themeobjectCSS color overrides: primary, secondary, background, text, border

ChainConfig

FieldTypeRequiredDescription
chainIdnumberYesEIP-155 chain ID
chainNamestringYesInternal machine-readable name
displayNamestringYesHuman-readable name
nativeCurrency.namestringYesFull name of the native token
nativeCurrency.symbolstringYesTicker symbol
nativeCurrency.decimalsnumberYesDecimal precision (always 18 for EVM)
rpcUrlsstring[]YesOrdered list of JSON-RPC endpoints
blockExplorerUrlsstring[]NoBlock explorer base URLs
isTestnetbooleanYesFlag distinguishing testnets
entryPointAddressstringNoERC-4337 EntryPoint contract address
simpleAccountFactoryAddressstringNoSimpleAccount factory contract address
bundlerUrlstringNoERC-4337 bundler endpoint
paymasterUrlstringNoPaymaster service endpoint

Authentication and Session Types

User

Populated after successful login.

FieldTypeDescription
idstringUnique user identifier
emailstring | undefinedUser's email address
displayNamestring | undefinedUser's display name
walletAddressstring | undefinedAssociated wallet address
createdAtDateAccount creation timestamp

AuthTokens

Token bundle used for API authorization.

FieldTypeDescription
accessTokenstringShort-lived JWT for API requests
refreshTokenstringLong-lived token for access token renewal
expiresAtnumberUnix timestamp for access token expiration
dappSharestring | undefinedOpaque 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.

FieldTypeDescription
partyIdnumberParty index
privateSharestringHex-encoded private polynomial share
publicSharestringHex-encoded public counterpart
thresholdnumberSigning threshold t
totalPartiesnumberTotal parties n

DKGSessionState

In-memory state maintained during DKG protocol rounds.

FieldTypeDescription
sessionIdstringUnique session identifier
roundDKGRoundCurrent protocol round
commitmentsMap<number, DKGCommitment>Party commitments collected
receivedSharesMap<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.

FieldTypeDescription
rstringECDSA r component
sstringECDSA s component
vnumberRecovery parameter
fullSignaturestringConcatenated hex signature

Wallet and Key Material Types

WalletInfo

Describes the user's MPC wallet (returned by WalletAPI).

FieldTypeDescription
eoaAddressstringEthereum address from public key
smartWalletAddressstring | undefinedERC-4337 smart account address
publicKeystringHex-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.

FieldTypeDescription
privateKeystringHex-encoded full private key
walletAddressstringDerived Ethereum address
publicKeystringHex-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:

CodeDescription
NOT_AUTHENTICATEDUser not logged in
RECOVERY_REQUIREDClient key share missing; recovery flow needed
SIGNING_SESSION_CONFLICTAnother signing session active
DKG_FAILEDDistributed Key Generation failed
DKLS_KEYGEN_FAILEDDKLS key generation error
INVALID_SHAREPeer share verification failure
TOKEN_EXPIREDAccess token expired
NETWORK_ERRORCommunication failure

SDKEvent / SDKEventMap

Type definitions for the SDK event system. See the NeroMpcSDK Class reference for the full event list.

On this page