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". That is the embedded wallet (embedded wallets, embedded wallet SDK) surface. 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 / stellar-testnet for testnet, each chain's mainnet for mainnet) 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
  socialRecovery?: SocialRecoveryClient;  // low-level: your own enclave client (React uses `socialRecovery: true`)
  socialRecoveryCredential?: SocialRecoveryCredential;

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

  // --- Solana-only ---
  relayer?: SolanaRelayer;                // sponsored fee payer
  tollUrl?: string;                       // where `fee: { token }` settles; defaults to the hosted service
  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): ConnectStatus; // get status for a chain
  chainAddress(chain: Chain): string;     // get address for a chain
}

type ConnectStatus = "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: ConnectStatus"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, getGitHubOAuthUrl, getTelegramOAuthUrl, handleCallback, sendOtp, verifyOtp, authenticate. Also useExternalSocialRecoveryToken(idToken) to drive social recovery from your own login. GitHub and Telegram are web-only (enclave redemption); see Authentication → GitHub and Authentication → Telegram.
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()Deprecated. Kept for compatibility. Current wallets do not use recovery codes; restore with the enclave or a passkey.

Hardware-isolated social recovery

Optional, opt-in per environment. On every chain the enclave seals the MasterDEK. See Hardware-isolated recovery and the 0.5.0 changelog for the signed-release path it introduced.

ExportDescription
SocialRecoveryClientClient for the recovery enclave. enroll(...), recover(...), confirmEnrollment(...).
SocialRecoveryClientOptions{ baseUrl, appId, attestation, environment? }.
AttestationPolicyWhich enclave you accept: { pcr0?, release? }. pcr0 is the SHA-384 measurement of the Nitro image (a string or list). release is an EnclaveReleasePolicy. A policy with only pcr0 is a strict pin with no Sigstore fallback. See Hardware-isolated recovery.
EnclaveReleasePolicy{ repository, repositoryId, ownerId, workflow, environment, minVersion }. Default 0.6.0 values: cavos-labs/cavos-recovery, repository id 1333734222, owner id 216094156, workflow .github/workflows/release.yml, environment release, minVersion 3.
DEFAULT_SOCIAL_RECOVERY_ATTESTATIONThe policy for the enclave Cavos operates: no pinned pcr0, only a Sigstore bundle from {backendUrl}/api/enclave/releases/{pcr0} that verifies against release.
SocialRecoveryCredential, createSocialRecoveryCredentialThe in-memory social credential. createSocialRecoveryCredential(idToken) takes only the token.
SIGN_IN_AGAIN_TO_RECOVER0.6.1. The error a recovery throws when the record was sealed by an earlier enclave release than the sign-in. The next sign-in within the hour runs on that release. See One sealing key per release.
LOGIN_RELEASE_MISMATCH0.6.1. "login_release_mismatch", the backend's refusal code behind SIGN_IN_AGAIN_TO_RECOVER.
SocialRecoveryProvider, SocialRecoveryAction, SocialRecoveryResultTypes. SocialRecoveryProvider is "google" | "apple" | "email" | "github" | "telegram".

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.

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 whose key derives from the same MasterDEK as Solana. See Stellar.

ExportDescription
CavosStellarHigh-level Stellar client. A new device restores the MasterDEK with the enclave or a passkey.
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 (opens a passkey's DEK copy).
generateControlKey, controlKeypairFromSeedControl key generation.

Shared interface types

ExportDescription
ChainCall, ExecuteOptionsCall and execute-option types shared across chains.
Chain"starknet" | "solana" | "stellar"
NetworkEnv"testnet" | "mainnet"
CavosWalletUnion of all wallet types.
ConnectStatus"undeployed" | "ready" | "needs-device-approval" (the type of wallet.status).
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.

CavosSession is shown in the type sketch above but is not exported by name. Use Awaited<ReturnType<typeof Cavos.connect>> for the session type and ConnectStatus for a status.

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.
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