API reference
Public exports of @cavos/kit — the surface you build against.
Everything below is exported from the package root: import { ... } from "@cavos/kit".
React Native-specific exports are available from @cavos/kit/react-native.
Cavos
The high-level entry point. Most apps only use this.
Cavos.connect(options): Promise<CavosWallet & CavosSession>
Unified entry point. Pick one or more chains and a network environment; the
kit resolves the concrete network (sepolia / solana-devnet for testnet, mainnet
otherwise) and returns a multi-chain session. The session IS the default chain's
wallet, augmented with methods to access other configured chains.
Connect never deploys. It derives addresses and checks on-chain status, but
account creation happens lazily on the first execute call per chain.
interface ConnectOptions {
// Multi-chain (recommended)
chains?: Chain[]; // chains to configure (e.g. ["solana", "stellar"])
defaultChain?: Chain; // must be in `chains`
// Single-chain (deprecated back-compat)
chain?: Chain; // treated as chains: [chain], defaultChain: chain
network: "testnet" | "mainnet"; // resolves to each chain's concrete network
appSalt: string; // device-key namespace (not the address)
auth?: AuthProvider; // pass `auth` OR `identity`
identity?: Identity;
appId?: string; // hosted registry + relayers
environment?: "development" | "production"; // Cavos console environment
backendUrl?: string; // defaults to Cavos hosted services
rpcUrl?: string; // single-chain only; use rpcUrls for multi-chain
rpcUrls?: Partial<Record<Chain, string>>; // per-chain RPC overrides
registry?: WalletRegistry; // off-chain userId -> wallet map
recovery?: RecoveryClient; // device-approval relay (Starknet)
createSigner?: (keyId: string) => Promise<DeviceSigner>; // native / tests
// --- Starknet-only ---
paymasterApiKey?: string; // sponsors deploy + execute (required on Starknet)
paymasterUrl?: string;
classHash?: string;
// --- Solana-only ---
programId?: string; // device-account program override
relayer?: SolanaRelayer; // gasless sponsorship
feePayer?: Keypair; // self-funded fallback
// --- Stellar-only (classic `G…` multisig) ---
stellarRelayer?: StellarRelayer; // gasless sponsorship
stellarSourceKeypair?: StellarKeypair; // self-funded source/fee-payer
stellarDeviceKey?: DeviceUnwrapKey; // this device's ECDH unwrap key
createStellarDeviceKey?: (keyId: string) => Promise<DeviceUnwrapKey>;
}
type CavosWallet = Cavos | CavosSolana | CavosStellar;
interface CavosSession {
chains: Chain[]; // configured chains
defaultChain: Chain; // the default chain
wallet(chain: Chain): CavosWallet; // get wallet for a chain
chainStatus(chain: Chain): ChainStatus; // get status for a chain
chainAddress(chain: Chain): string; // get address for a chain
enrollPasskeySession(passkey, params): Promise<{ publicKey }>;
setupRecoverySession(code): Promise<void>;
}
type ChainStatus = "undeployed" | "ready" | "needs-device-approval";status === "undeployed"→ Address derived, no on-chain account. Can execute (first execute deploys). Can signMessage.status === "ready"→ Account deployed, this device authorized. Can execute.status === "needs-device-approval"→ Account deployed, this device not authorized. Cannot execute.
Instance members (Starknet)
Members on the Cavos instance (wallet.chain === "starknet").
| Member | Description |
|---|---|
cavos.address: string | The smart account address. |
cavos.status: ChainStatus | "undeployed" | "ready" | "needs-device-approval" |
cavos.isDeployed: boolean | Whether the account exists on-chain. |
cavos.pendingRequestId: string | null | Device-addition request id when status is needs-device-approval. |
cavos.identity: Identity | The authenticated identity. |
cavos.publicKey: DevicePublicKey | This device's public key. |
cavos.execute(calls, opts?): Promise<{ transactionHash }> | Sign + submit calls, gasless. Works on undeployed (deploys first) and ready. |
cavos.signMessage(message): Promise<MessageSignature> | Sign an arbitrary message off-chain. Works on undeployed and ready. |
cavos.signTransaction(calls): Promise<StarknetSignedTransaction> | Build + sign a multicall WITHOUT submitting. |
cavos.addSigner(pubkey, opts?): Promise<{ transactionHash }> | Authorize another device's key on-chain. |
cavos.removeSigner(pubkey, opts?): Promise<{ transactionHash }> | Revoke a device key on-chain. |
cavos.upgrade(classHash, opts?): Promise<{ transactionHash }> | Migrate the account to a newer class. |
cavos.enrollPasskey(passkey, params, opts?): Promise<{ publicKey, transactionHash? }> | Create a passkey + register it as an approver. Works on undeployed (pending until first execute). |
cavos.addApprover(pubkey, opts?): Promise<{ transactionHash? }> | Register an already-enrolled passkey pubkey as an approver. Works on undeployed. |
cavos.hasPasskey(): Promise<boolean> | Whether this account has a passkey approver. |
cavos.isApprover(pubkey): Promise<boolean> | Whether pubkey is a registered approver. |
cavos.isReady(): Promise<boolean> | Re-check if this device is authorized (polls chain). |
cavos.approveThisDeviceWithPasskey(opts): Promise<{ transactionHash }> | Use a synced passkey to authorize this device. |
cavos.passkeyLeafForThisDevice(): Promise<{ leaf, nonce }> | This device's passkey leaf + on-chain nonce. |
cavos.submitPasskeyApproval(assertion, leaves, leafIndex, nonce, submit?): Promise<{ transactionHash }> | Submit add_signer_via_passkey. |
cavos.setupRecovery(code, opts?): Promise<{ transactionHash } | undefined> | Register a backup signer. Works on undeployed (pending until first execute). |
cavos.onStatusChange(listener): () => void | Subscribe to status changes. Returns unsubscribe. |
Cavos.recover(options): Promise<Cavos>
Recover after losing every device using a saved recovery code. (Starknet path;
Solana uses CavosSolana.recover. On Stellar you reconnect and call
wallet.approveThisDeviceWithRecovery(code).)
interface RecoveryOptions {
code: string;
identity: Identity;
network: "testnet" | "mainnet";
appSalt: string;
paymasterApiKey: string;
appId?: string;
backendUrl?: string;
rpcUrl?: string;
paymasterUrl?: string;
classHash?: string;
address?: string; // optional when appId set (registry lookup)
registry?: WalletRegistry;
auth?: AuthProvider;
createSigner?: (keyId: string) => Promise<DeviceSigner>;
}Authentication
| Export | Description |
|---|---|
CavosAuth | Hosted login: getGoogleOAuthUrl, getAppleOAuthUrl, handleCallback, sendOtp, verifyOtp, sendMagicLink, authenticate. Also useExternalSocialRecoveryToken(idToken) to drive social recovery from your own login. |
StaticIdentity | Wrap a { userId, email } you already have as an AuthProvider. |
AuthProvider, Identity | Types for the auth contract. |
Recovery & multi-device
| Export | Description |
|---|---|
RecoveryClient, PendingDeviceRequest | Interface for the non-custodial device-approval relay. |
HttpRecoveryClient | HTTP implementation talking to the Cavos backend. |
WalletRegistry, RegisteredWallet, RegisterResult | Off-chain userId → wallet map (cross-device recognition). |
InMemoryWalletRegistry, HttpWalletRegistry | Registry implementations. |
BackupSigner | Passphrase-derived signer (DeviceSigner). |
generateRecoveryCode() | New high-entropy recovery code. |
deriveBackupKey(code) | Deterministic keypair from a recovery code. |
Hardware-isolated social recovery
Optional, opt-in per environment. See Hardware-isolated recovery.
| Export | Description |
|---|---|
SocialRecoveryClient | Client for the recovery enclave. enroll(...), recover(...), confirmEnrollment(...). |
SocialRecoveryClientOptions | { baseUrl, appId, attestation, environment? }. |
AttestationPolicy | Which enclave you accept: { pcr0 }, the SHA-384 measurement of the Nitro enclave image. |
DEFAULT_SOCIAL_RECOVERY_ATTESTATION | The policy for the enclave Cavos operates (AWS Nitro), pinned in this package. |
enrollHardwareIsolatedRecovery, recoverHardwareIsolatedDevice | Chain-aware coordinators. |
CoordinatedRecoveryResult | Result including readyAt when a timelock applies. |
SocialRecoveryCredential, createSocialRecoveryCredential | The in-memory social credential. |
SocialRecoveryProvider, SocialRecoveryAction, SocialRecoveryResult | Types. |
Passkeys
A second factor for approving new devices — not a transaction signer. See Passkeys.
| Export | Description |
|---|---|
PasskeySigner | Browser WebAuthn signer. static isSupported(), enroll(...), assert(...). |
PasskeySignerOptions, PasskeyEnrollParams, EnrolledPasskey | Types. |
PasskeyAssertion | Parsed WebAuthn assertion. |
approveDeviceEverywhere(wallets, passkey) | Approve this device across multiple wallets with a single passkey prompt. |
PasskeyApprovable | Interface implemented by Cavos and CavosSolana. |
Signers
| Export | Description |
|---|---|
WebCryptoSigner | Browser silent device signer (non-extractable P-256 in IndexedDB). |
PasskeySigner | Browser WebAuthn passkey signer. |
DeviceSigner, DevicePublicKey, DeviceSignature | Signer types. |
Chain adapters & constants
Starknet
| Export | Description |
|---|---|
StarknetAdapter | Computes addresses, builds calls, serializes signatures. |
STARKNET_NETWORKS, StarknetNetwork | Network configs (sepolia, mainnet). |
DEVICE_ACCOUNT_CLASS_HASH, UDC_ADDRESS | Deployed class hash + Universal Deployer. |
StarknetDeviceSigner | Drop-in starknet.js SignerInterface. |
Solana
| Export | Description |
|---|---|
CavosSolana | High-level Solana client. connect, execute(amount, dest), executeInstructions(...), signMessage(...), signTransaction(...), addSigner, removeSigner, setupRecovery, static recover. |
ConnectSolanaOptions, RecoverSolanaOptions | Option types. |
InstructionData, InstructionAccount | Serializable instruction shape. |
SolanaRelayer, SolanaRelayerOptions | Gasless relayer. |
SolanaAdapter, SolanaAdapterOptions | Low-level adapter. |
SOLANA_NETWORKS, SolanaNetwork | Network configs. |
DEVICE_ACCOUNT_PROGRAM_ID, SECP256R1_PROGRAM_ID | Program ids. |
Stellar
Classic G… multisig account. See Stellar.
| Export | Description |
|---|---|
CavosStellar | High-level Stellar client. connect, execute(amount, dest), signMessage(...), signTransaction(...), balance(), invokeContract(...), signXdr(...), addTrustline(...), tokenBalance(...), enrollPasskey(prfOutput), setupRecovery(code), approveThisDeviceWithPasskey(...), approveThisDeviceWithRecovery(...), hasPasskey, isReady, listDevices(), removeDevice(...). |
ConnectStellarOptions, StellarConnectStatus | Option/status types. |
StellarAdapter, StellarAdapterOptions | Low-level adapter. |
StellarRelayer, StellarRelayerOptions, StellarRelayKind | Gasless relayer. |
STELLAR_NETWORKS, StellarNetwork, HORIZON_URL, SOROBAN_RPC_URL, XLM_DECIMALS | Network configs. |
TrustlessWorkEscrow, deployEscrow, buildEscrowScVal | Trustless Work escrow wrapper. |
DeviceUnwrapKey, LocalDeviceUnwrapKey, WebCryptoDeviceUnwrapKey, deviceSlotId | Device ECDH key. |
PasskeyPrf, PasskeyPrfOptions, PasskeyPrfEnrollParams | WebAuthn PRF helper. |
generateControlKey, controlKeypairFromSeed | Control key generation. |
generateDEK, sealControlSeed, openControlSeed, wrapDEK, unwrapDEK, eciesWrapDEK, eciesUnwrapDEK, derivePasskeyKEK, deriveRecoveryKEK | Envelope crypto. |
toDataEntries, fromDataEntries, AccountEnvelope | Envelope serialization. |
Shared interface types
| Export | Description |
|---|---|
ChainAdapter, ChainCall, ComputeAddressParams, ExecuteOptions | Multi-chain interface types. |
Chain | "starknet" | "solana" | "stellar" |
NetworkEnv | "testnet" | "mainnet" |
CavosWallet | Union of all wallet types. |
CavosSession | Multi-chain session interface. |
ChainStatus | "undeployed" | "ready" | "needs-device-approval" |
MessageSignature | { signature, publicKey, curve } |
SignedTransaction, StarknetSignedTransaction, StellarSignedTransaction, SolanaSignedTransaction | Sign-without-submit results. |
SignatureCurve | "secp256r1" | "ed25519" |
CAVOS_MESSAGE_PREFIX, prefixedMessageBytes(message) | Off-chain message prefix scheme. |
React Native exports (@cavos/kit/react-native)
| Export | Description |
|---|---|
CavosProvider, useCavos, CavosAuthModal | React Native context, hook, and native auth UI. |
Cavos | Native connect entry point. |
NativeCavosAuth, NativeCavosAuthError | Native auth adapters. |
NativeDeviceSigner | Secure Enclave/Keystore P-256 signer. |
NativeDeviceUnwrapKey | P-256 ECDH key for Stellar. |
NativePasskeySigner, NativePasskeyPrf | Native passkey adapters. |
getNativeCapabilities() | Reports signing, ECDH, passkey, and PRF support. |
getCavosNativeModule() | Underlying Expo native module. |
deleteDeviceKeys(keyId) | Remove native device keys. |
approveDeviceEverywhere | Shared passkey approval helper. |
See React Native for installation.
React (@cavos/kit/react)
React bindings shipped under the /react subpath. See React.
| Export | Description |
|---|---|
CavosProvider | Wrap your app; manages wallet + modal. Props include config, modal, identity. |
validateCavosConfig(config) | Config problems as CavosConfigProblem[]. |
checkAppSaltDrift(config, storage?) | Reports changed appSalt. |
formatConfigProblems(problems) | Render problems as console lines. |
useCavos() | Primary hook — full wallet surface including setChain, session, configuredChains. |
useCavosAuth() | Thin subset for modal/auth only. |
ApproveDevicePage, RevokeDevicePage | Device lifecycle pages. |
DeviceFlowState, DeviceFlowStatus | Types for device flow render props. |
chainForNetwork(network) | Map concrete network to Chain. |
configForNetwork(network, configs) | Pick config for a network. |
CavosAuthModal | Customizable login modal. |
CavosConfig, CavosModalConfig, CavosAuthModalProps, CavosProviderProps, CavosContextValue, UserInfo, WalletStatus | Types. |
Chain and NetworkEnv are exported from the core entry
(@cavos/kit), not from @cavos/kit/react.
Low-level crypto (advanced)
| Export | Description |
|---|---|
signatureToFelts, recoverYParity | secp256r1 signature ↔ 5-felt Starknet encoding. |
u256ToFelts, bytesToBigInt, bytesToHex, hexToBytes, bigIntTo32Bytes | Encoding helpers. |
base64urlEncode, webauthnDigest, recoverCandidatePublicKeys, batchChallenge, lowS | WebAuthn helpers. |
appNamespace, appNamespaceFelt | App namespacing helpers. |