Architecture Overview
Cavos uses session keys bound to OAuth JWTs. Instead of storing a master private key, the SDK generates a fresh session key pair on each login that’s cryptographically linked to the user’s verified identity.How Sessions Work
1. Session Initialization (Pre-Login)
When you calllogin(), the SDK generates a session key pair and computes a nonce before the OAuth redirect:
2. OAuth Redirect
The nonce is included in the OAuth request to Google or Apple.3. JWT Verification
When the user completes OAuth, the JWT returned contains the nonce, proving the identity is linked to that specific browser session.4. On-Chain Registration
The first transaction registers the session by verifying the JWT signature and nonce on-chain.Session Management
The SDK provides methods to manage your active on-chain sessions.Session Renewal
Sessions expire after 24h by default. Within the 48h grace period after expiry, you can renew without a new OAuth login — the old session key signs the renewal request for the new key.execute(): if the session is expired but within the grace period, it renews before executing the transaction.
Explicit Registration
The session key is normally registered on-chain automatically during the first transaction. If you need to register it before any transaction (e.g., to pre-activate a policy), call:
[!WARNING]
If you change the policy after login but before registration, you must call updateSessionPolicy() first — otherwise the stale policy from login time gets registered on-chain.
Session Policies
Session keys can be restricted by policies to limit the damage if a session key is compromised. Policies are enforced by the account contract on every transaction. They are set at session registration time and cannot be changed without creating a new session.allowedContracts
Restricts the session key to specific contract addresses. Any call to a contract not in this list is rejected by the account contract at the validation step.
spendingLimits
Caps the total amount of a given token the session key can transfer. The account contract accumulates spend across all transactions and rejects any call that would exceed the limit.
maxCallsPerTx
Limits the number of calls that may be bundled into a single multicall transaction. Useful for preventing automated abuse.
Session Revocation
If you suspect a session key has been compromised, or simply want to logout securely from a shared device, you have two options:1. Revoke Specific Session
Invalidates a single session key on-chain. ThesessionKey argument is required — pass sessionPublicKey from useCavos() to revoke the current one.
2. Emergency Revoke All
Invalidates all currently active sessions for the wallet by incrementing the global revocation epoch.Session Export/Import
For advanced use cases like command-line tools or multi-device workflows, you can export active sessions and import them elsewhere.Export Session from Dashboard
Export your current active session as a base64-encoded token:[!WARNING] The exported token contains your session private key. Store it securely and never share it publicly.
Import Session in CLI
Once exported, the session can be used in the Cavos CLI without any login:Use Cases
- AI Agents: Export session from your dashboard, give it to an AI agent for autonomous trading/transactions
- CI/CD Pipelines: Automate on-chain deployments without manual signing
- Multi-Device: Use the same session on desktop dashboard and mobile/server CLI
- Batch Operations: Execute multiple transactions quickly from command line
[!NOTE] Exported sessions have the same policies (spending limits, allowed contracts) as configured in the dashboard.
- Non-Custodial: Neither Cavos nor the application ever sees your session private key. It lives only in your browser’s memory.
- Auto-Expiry: Sessions automatically expire, minimizing the impact of a lost device or session key.
- Per-App Isolation: Each app uses a different derivation salt, so a session key for App A cannot sign for App B.
- Enforced Policies: Even if a session key is stolen, the attacker is limited by the allowed contracts and spending limits defined at session creation.

