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.
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.
| Member | Description |
|---|---|
wallet.address: string | The account address. |
wallet.status: ChainStatus | "undeployed" | "ready" | "needs-device-approval" |
wallet.isDeployed: boolean | Whether the account exists on-chain. |
wallet.identity: Identity | The authenticated identity. |
wallet.publicKey: string | The stark public key (hex) the account was deployed with. |
wallet.account: Account | The 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): () => void | Subscribe 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
| Export | Description |
|---|---|
CavosAuth | Hosted login: getGoogleOAuthUrl, getAppleOAuthUrl, handleCallback, sendOtp, verifyOtp, 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 |
|---|---|
WalletRegistry, RegisteredWallet, RegisterResult | Off-chain userId → wallet map (cross-device recognition). |
InMemoryWalletRegistry, HttpWalletRegistry | Registry 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.
| 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. |
SocialRecoveryCredential, createSocialRecoveryCredential | The in-memory social credential. |
SocialRecoveryProvider, SocialRecoveryAction, SocialRecoveryResult | Types. |
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.
| Export | Description |
|---|---|
PasskeyPrfProvider, PasskeyEnrollParams, PasskeyPrfEnrollResult | Types for a passkey PRF provider. |
PasskeyPrf | WebAuthn PRF helper. Opens a passkey's DEK copy (grandfathered Stellar uses it as an extra signer). |
Vault
| Export | Description |
|---|---|
VaultClient | The page's side of the Cavos vault. VaultClient.attach({ appId, url? }) mounts the iframe; used by Cavos.connect when vault is set. |
startVaultHost, startVaultConfirm | From @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
| Export | Description |
|---|---|
CavosStarknet | Native Starknet client over the OpenZeppelin account. connect, execute(calls), signMessage (stark), signTransaction, upgrade. |
ConnectStarknetOptions | Option type for CavosStarknet.connect. |
STARKNET_NETWORKS, StarknetNetwork | Network configs (sepolia, mainnet). |
OZ_ACCOUNT_CLASS_HASH | The pinned OpenZeppelin AccountUpgradeable v3.0.0 class hash, declared on mainnet and Sepolia. |
CAVOS_PAYMASTER_URL | Cavos-hosted SNIP-29 paymaster URL per network. |
starkKeyFromSeed, starkPublicKey | Derive the stark key (grindKey(HKDF(DEK, appSalt, "cavos-stark-starknet-v1"))) and its public key. |
starknetAddressFromPublicKey, starknetAddressFromSeed | The account address for a stark public key or seed. |
Solana
| Export | Description |
|---|---|
CavosSolana | Native Ed25519 system account. connect, execute(amount, dest), executeInstructions(...), signMessage (ed25519). |
ConnectSolanaOptions, RecoverSolanaOptions | Option types (RecoverSolanaOptions is deprecated). |
InstructionData, InstructionAccount | Serializable instruction shape. |
SolanaRelayer, SolanaRelayerOptions | Fee-payer relayer. |
SOLANA_NETWORKS, SolanaNetwork | Network configs. |
Stellar
Classic G… account. Native MasterDEK path shares the DEK with Solana;
grandfathered wallets still use extra Horizon signers. See Stellar.
| Export | Description |
|---|---|
CavosStellar | High-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, 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. |
PasskeyPrf, PasskeyPrfOptions, PasskeyPrfEnrollParams | WebAuthn PRF helper (passkey DEK copy / grandfathered extra signer). |
generateControlKey, controlKeypairFromSeed | Control key generation. |
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, typedData? } |
SignedTransaction, StarknetSignedTransaction, StellarSignedTransaction, SolanaSignedTransaction | Sign-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)
| Export | Description |
|---|---|
CavosProvider, useCavos, CavosAuthModal | React Native context, hook, and native auth UI. |
Cavos | Native connect entry point. |
NativeCavosAuth, NativeCavosAuthError | Native auth adapters. |
NativeDeviceUnwrapKey | Secure Enclave/Keystore key that protects the MasterDEK at rest. |
NativeControlSigner | Native ed25519 control key, used on grandfathered Stellar. |
NativePasskeyPrf | Native 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.
| 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. |
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 |
|---|---|
u256ToFelts, bytesToBigInt, bytesToHex, hexToBytes, bigIntTo32Bytes | Encoding helpers. |