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:
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 have a limited duration (default 24h). Before they expire (or during the grace period), you can renew them:Session Policies
Session keys can be restricted by policies to limit the damage if a session key is compromised.1. Allowed Contracts
You can restrict a session key to only be able to call specific contract addresses. This is implemented using a Merkle Tree of allowed contract addresses on-chain. If a transaction attempts to call a contract not in the allowed list, the account contract will reject it.2. Spending Limits
You can define maximum spending limits for specific tokens (e.g., STRK, ETH) per session. The account contract tracks the total amount spent by the session and prevents exceeding the limit.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.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.

