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.

Paying Stellar reserves and fees in a token is a different package: @cavos/reserve. It is not exported from @cavos/kit.

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 Starknet or Stellar accounts. It derives addresses and checks on-chain status; those accounts are created on the first execute. Native Solana is a system account: ready once this device unwraps the spend key.

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;                        // HKDF salt for the account key — never change it
  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
  vault?: boolean | { url?: string };     // keys in the Cavos vault (needs appId); see /docs/vault

  // --- Starknet-only ---
  paymasterApiKey?: string;               // sponsors deploy + execute (required on Starknet)
  paymasterUrl?: string;

  // --- Solana-only ---
  relayer?: SolanaRelayer;                // gasless fee payer
  feePayer?: Keypair;                     // self-funded fallback
  passkeyPrf?: PasskeyPrfProvider;        // restores from a passkey's DEK copy (single-chain)

  // --- Stellar-only (classic `G…`) ---
  stellarRelayer?: StellarRelayer;        // gasless sponsorship
  stellarSourceKeypair?: StellarKeypair;  // self-funded source/fee-payer
  stellarDeviceKey?: DeviceUnwrapKey;     // unused by the current signer model; keep only if a low-level caller still passes one
  createStellarDeviceKey?: (keyId: string) => Promise<DeviceUnwrapKey>;
}

type CavosWallet = CavosStarknet | 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
}

type ChainStatus = "undeployed" | "ready" | "needs-device-approval";
  • status === "undeployed" → Address derived, no on-chain account. Can execute (first execute deploys). Can signMessage.
  • status === "ready" → This device holds the account key. Can execute.
  • status === "needs-device-approval" → This device holds no key yet. Cannot execute; restore the MasterDEK with the enclave or a passkey.

Instance members (Starknet)

Members on the CavosStarknet instance (wallet.chain === "starknet"). Starknet is the standard OpenZeppelin AccountUpgradeable (v3.0.0) controlled by a stark key derived from the MasterDEK.

MemberDescription
wallet.address: stringThe account address.
wallet.status: ChainStatus"undeployed" | "ready" | "needs-device-approval"
wallet.isDeployed: booleanWhether the account exists on-chain.
wallet.identity: IdentityThe authenticated identity.
wallet.publicKey: stringThe stark public key (hex) the account was deployed with.
wallet.account: AccountThe starknet.js account. Throws on a device that holds no key.
wallet.execute(calls, opts?): Promise<{ transactionHash }>Sign + submit calls, gasless by default. Works on undeployed (deploys first) and ready. fee: 'self' works after deploy. Refuses set_public_key on the account itself.
wallet.signMessage(message): Promise<MessageSignature>Sign SNIP-12 revision 1 typed data off-chain (curve: "stark", with typedData). Works on undeployed and ready.
wallet.signTransaction(calls): Promise<StarknetSignedTransaction>Build + sign a multicall WITHOUT submitting. 2-felt stark signature.
wallet.upgrade(classHash, opts?): Promise<{ transactionHash }>Migrate the account to a newer class; the address is kept.
wallet.hasPasskey(): Promise<boolean>Whether this device was restored with a passkey.
wallet.isReady(): Promise<boolean>Whether this device holds the stark key.
wallet.onStatusChange(listener): () => voidSubscribe to status changes. Returns unsubscribe.

On a new device there is no on-chain device list to update: it restores the MasterDEK (enclave or passkey) and derives the same key. See Multi-device.

Authentication

ExportDescription
CavosAuthHosted login: getGoogleOAuthUrl, getAppleOAuthUrl, handleCallback, sendOtp, verifyOtp, 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
WalletRegistry, RegisteredWallet, RegisterResultOff-chain userId → wallet map (cross-device recognition).
InMemoryWalletRegistry, HttpWalletRegistryRegistry implementations.
generateRecoveryCode()New high-entropy recovery code. Used by grandfathered Stellar only.

Hardware-isolated social recovery

Optional, opt-in per environment. On every chain the enclave seals the MasterDEK. 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.
SocialRecoveryCredential, createSocialRecoveryCredentialThe in-memory social credential.
SocialRecoveryProvider, SocialRecoveryAction, SocialRecoveryResultTypes.

Passkeys

The passkey's PRF encrypts a copy of the MasterDEK that Cavos stores and cannot open (can spend). Signing up never prompts. See Passkeys.

ExportDescription
PasskeyPrfProvider, PasskeyEnrollParams, PasskeyPrfEnrollResultTypes for a passkey PRF provider.
PasskeyPrfWebAuthn PRF helper. Opens a passkey's DEK copy (grandfathered Stellar uses it as an extra signer).

Vault

ExportDescription
VaultClientThe page's side of the Cavos vault. VaultClient.attach({ appId, url? }) mounts the iframe; used by Cavos.connect when vault is set.
startVaultHost, startVaultConfirmFrom @cavos/kit/vault: the code behind the vault's two pages. Cavos serves them; you do not need them to integrate.

Signers pass whole payloads so the vault can read them: Ed25519SpendSigner has signTransaction(message) and signMessage(message), and a Stellar ControlKey has signTransaction(xdr, networkPassphrase), signAuthEntry(preimage) and signMessage(message). signMessage applies the Cavos message prefix itself.

Chain adapters & constants

Starknet

ExportDescription
CavosStarknetNative Starknet client over the OpenZeppelin account. connect, execute(calls), signMessage (stark), signTransaction, upgrade.
ConnectStarknetOptionsOption type for CavosStarknet.connect.
STARKNET_NETWORKS, StarknetNetworkNetwork configs (sepolia, mainnet).
OZ_ACCOUNT_CLASS_HASHThe pinned OpenZeppelin AccountUpgradeable v3.0.0 class hash, declared on mainnet and Sepolia.
CAVOS_PAYMASTER_URLCavos-hosted SNIP-29 paymaster URL per network.
starkKeyFromSeed, starkPublicKeyDerive the stark key (grindKey(HKDF(DEK, appSalt, "cavos-stark-starknet-v1"))) and its public key.
starknetAddressFromPublicKey, starknetAddressFromSeedThe account address for a stark public key or seed.

Solana

ExportDescription
CavosSolanaNative Ed25519 system account. connect, execute(amount, dest), executeInstructions(...), signMessage (ed25519).
ConnectSolanaOptions, RecoverSolanaOptionsOption types (RecoverSolanaOptions is deprecated).
InstructionData, InstructionAccountSerializable instruction shape.
SolanaRelayer, SolanaRelayerOptionsFee-payer relayer.
SOLANA_NETWORKS, SolanaNetworkNetwork configs.

Stellar

Classic G… account. Native MasterDEK path shares the DEK with Solana; grandfathered wallets still use extra Horizon signers. See Stellar.

ExportDescription
CavosStellarHigh-level Stellar client. nativeDek is true on the current path. Native: enrollPasskey / setupRecovery no-op; approveThisDeviceWithPasskey / approveThisDeviceWithRecovery throw — reconnect with passkey or enclave. Grandfathered methods remain for older wallets.
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.
PasskeyPrf, PasskeyPrfOptions, PasskeyPrfEnrollParamsWebAuthn PRF helper (passkey DEK copy / grandfathered extra signer).
generateControlKey, controlKeypairFromSeedControl key generation.

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, typedData? }
SignedTransaction, StarknetSignedTransaction, StellarSignedTransaction, SolanaSignedTransactionSign-without-submit results.
SignatureCurve"stark" | "ed25519" (and "secp256r1", no longer produced by Starknet)
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.
NativeDeviceUnwrapKeySecure Enclave/Keystore key that protects the MasterDEK at rest.
NativeControlSignerNative ed25519 control key, used on grandfathered Stellar.
NativePasskeyPrfNative passkey PRF adapter.
getNativeCapabilities()Reports signing, passkey, and PRF support.
getCavosNativeModule()Underlying Expo native module.
deleteDeviceKeys(keyId)Remove native device keys.

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.
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
u256ToFelts, bytesToBigInt, bytesToHex, hexToBytes, bigIntTo32BytesEncoding helpers.

On this page