Cavos

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.

TypeScript
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").

MemberDescription
cavos.address: stringThe smart account address.
cavos.status: ChainStatus"undeployed" | "ready" | "needs-device-approval"
cavos.isDeployed: booleanWhether the account exists on-chain.
cavos.pendingRequestId: string | nullDevice-addition request id when status is needs-device-approval.
cavos.identity: IdentityThe authenticated identity.
cavos.publicKey: DevicePublicKeyThis 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): () => voidSubscribe 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).)

TypeScript
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

ExportDescription
CavosAuthHosted login: getGoogleOAuthUrl, getAppleOAuthUrl, handleCallback, sendOtp, verifyOtp, sendMagicLink, authenticate. Also useExternalSocialRecoveryToken(idToken) to drive social recovery from your own login.
StaticIdentityWrap a { userId, email } you already have as an AuthProvider.
AuthProvider, IdentityTypes for the auth contract.

Recovery & multi-device

ExportDescription
RecoveryClient, PendingDeviceRequestInterface for the non-custodial device-approval relay.
HttpRecoveryClientHTTP implementation talking to the Cavos backend.
WalletRegistry, RegisteredWallet, RegisterResultOff-chain userId → wallet map (cross-device recognition).
InMemoryWalletRegistry, HttpWalletRegistryRegistry implementations.
BackupSignerPassphrase-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.

ExportDescription
SocialRecoveryClientClient for the recovery enclave. enroll(...), recover(...), confirmEnrollment(...).
SocialRecoveryClientOptions{ baseUrl, appId, attestation, environment? }.
AttestationPolicyWhich enclave you accept: { pcr0 }, the SHA-384 measurement of the Nitro enclave image.
DEFAULT_SOCIAL_RECOVERY_ATTESTATIONThe policy for the enclave Cavos operates (AWS Nitro), pinned in this package.
enrollHardwareIsolatedRecovery, recoverHardwareIsolatedDeviceChain-aware coordinators.
CoordinatedRecoveryResultResult including readyAt when a timelock applies.
SocialRecoveryCredential, createSocialRecoveryCredentialThe in-memory social credential.
SocialRecoveryProvider, SocialRecoveryAction, SocialRecoveryResultTypes.

Passkeys

A second factor for approving new devices — not a transaction signer. See Passkeys.

ExportDescription
PasskeySignerBrowser WebAuthn signer. static isSupported(), enroll(...), assert(...).
PasskeySignerOptions, PasskeyEnrollParams, EnrolledPasskeyTypes.
PasskeyAssertionParsed WebAuthn assertion.
approveDeviceEverywhere(wallets, passkey)Approve this device across multiple wallets with a single passkey prompt.
PasskeyApprovableInterface implemented by Cavos and CavosSolana.

Signers

ExportDescription
WebCryptoSignerBrowser silent device signer (non-extractable P-256 in IndexedDB).
PasskeySignerBrowser WebAuthn passkey signer.
DeviceSigner, DevicePublicKey, DeviceSignatureSigner types.

Chain adapters & constants

Starknet

ExportDescription
StarknetAdapterComputes addresses, builds calls, serializes signatures.
STARKNET_NETWORKS, StarknetNetworkNetwork configs (sepolia, mainnet).
DEVICE_ACCOUNT_CLASS_HASH, UDC_ADDRESSDeployed class hash + Universal Deployer.
StarknetDeviceSignerDrop-in starknet.js SignerInterface.

Solana

ExportDescription
CavosSolanaHigh-level Solana client. connect, execute(amount, dest), executeInstructions(...), signMessage(...), signTransaction(...), addSigner, removeSigner, setupRecovery, static recover.
ConnectSolanaOptions, RecoverSolanaOptionsOption types.
InstructionData, InstructionAccountSerializable instruction shape.
SolanaRelayer, SolanaRelayerOptionsGasless relayer.
SolanaAdapter, SolanaAdapterOptionsLow-level adapter.
SOLANA_NETWORKS, SolanaNetworkNetwork configs.
DEVICE_ACCOUNT_PROGRAM_ID, SECP256R1_PROGRAM_IDProgram ids.

Stellar

Classic G… multisig account. See Stellar.

ExportDescription
CavosStellarHigh-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, StellarConnectStatusOption/status types.
StellarAdapter, StellarAdapterOptionsLow-level adapter.
StellarRelayer, StellarRelayerOptions, StellarRelayKindGasless relayer.
STELLAR_NETWORKS, StellarNetwork, HORIZON_URL, SOROBAN_RPC_URL, XLM_DECIMALSNetwork configs.
TrustlessWorkEscrow, deployEscrow, buildEscrowScValTrustless Work escrow wrapper.
DeviceUnwrapKey, LocalDeviceUnwrapKey, WebCryptoDeviceUnwrapKey, deviceSlotIdDevice ECDH key.
PasskeyPrf, PasskeyPrfOptions, PasskeyPrfEnrollParamsWebAuthn PRF helper.
generateControlKey, controlKeypairFromSeedControl key generation.
generateDEK, sealControlSeed, openControlSeed, wrapDEK, unwrapDEK, eciesWrapDEK, eciesUnwrapDEK, derivePasskeyKEK, deriveRecoveryKEKEnvelope crypto.
toDataEntries, fromDataEntries, AccountEnvelopeEnvelope serialization.

Shared interface types

ExportDescription
ChainAdapter, ChainCall, ComputeAddressParams, ExecuteOptionsMulti-chain interface types.
Chain"starknet" | "solana" | "stellar"
NetworkEnv"testnet" | "mainnet"
CavosWalletUnion of all wallet types.
CavosSessionMulti-chain session interface.
ChainStatus"undeployed" | "ready" | "needs-device-approval"
MessageSignature{ signature, publicKey, curve }
SignedTransaction, StarknetSignedTransaction, StellarSignedTransaction, SolanaSignedTransactionSign-without-submit results.
SignatureCurve"secp256r1" | "ed25519"
CAVOS_MESSAGE_PREFIX, prefixedMessageBytes(message)Off-chain message prefix scheme.

React Native exports (@cavos/kit/react-native)

ExportDescription
CavosProvider, useCavos, CavosAuthModalReact Native context, hook, and native auth UI.
CavosNative connect entry point.
NativeCavosAuth, NativeCavosAuthErrorNative auth adapters.
NativeDeviceSignerSecure Enclave/Keystore P-256 signer.
NativeDeviceUnwrapKeyP-256 ECDH key for Stellar.
NativePasskeySigner, NativePasskeyPrfNative passkey adapters.
getNativeCapabilities()Reports signing, ECDH, passkey, and PRF support.
getCavosNativeModule()Underlying Expo native module.
deleteDeviceKeys(keyId)Remove native device keys.
approveDeviceEverywhereShared passkey approval helper.

See React Native for installation.

React (@cavos/kit/react)

React bindings shipped under the /react subpath. See React.

ExportDescription
CavosProviderWrap 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, RevokeDevicePageDevice lifecycle pages.
DeviceFlowState, DeviceFlowStatusTypes for device flow render props.
chainForNetwork(network)Map concrete network to Chain.
configForNetwork(network, configs)Pick config for a network.
CavosAuthModalCustomizable login modal.
CavosConfig, CavosModalConfig, CavosAuthModalProps, CavosProviderProps, CavosContextValue, UserInfo, WalletStatusTypes.

Chain and NetworkEnv are exported from the core entry (@cavos/kit), not from @cavos/kit/react.

Low-level crypto (advanced)

ExportDescription
signatureToFelts, recoverYParitysecp256r1 signature ↔ 5-felt Starknet encoding.
u256ToFelts, bytesToBigInt, bytesToHex, hexToBytes, bigIntTo32BytesEncoding helpers.
base64urlEncode, webauthnDigest, recoverCandidatePublicKeys, batchChallenge, lowSWebAuthn helpers.
appNamespace, appNamespaceFeltApp namespacing helpers.

On this page