CavosProvider
The provider component that initializes the SDK and provides context to child components.Config Props
useCavos Hook
Access SDK functionality from any child component:State Properties
| Property | Type | Description |
|---|---|---|
isAuthenticated | boolean | User is authenticated (OAuth or passkey) |
user | UserInfo | null | User info from OAuth (or placeholder for passkey) |
address | string | null | Wallet address if loaded |
isLoading | boolean | SDK is initializing or processing |
hasActiveSession | boolean | Session is active and not expired |
requiresWalletCreation | boolean | User needs to create wallet (shows modal) |
walletStatus | WalletStatus | Detailed wallet deployment and session state |
Action Methods
login(provider, credentials?, redirectUri?)
Start authentication flow: Social Login (Google/Apple):register(provider, credentials)
Register a new user with email/password:createWallet()
Create or recover a wallet:login().
execute(calls)
Execute transactions using session keys:[!NOTE] All transactions are signed with the session key and are gasless. No signature prompt appears.
signMessage(messageHash)
Sign a message with the session key:logout()
Clear session and wallet:deleteAccount()
Permanently delete account:Additional Methods
Thecavos instance provides additional utility methods:
WalletStatus
ThewalletStatus object provides detailed information about your wallet’s on-chain state:
[!NOTE]walletStatus.isReadyistrueonly when the account is deployed and the session is registered. Both steps happen automatically afterlogin()— no manual calls needed.
Session Management Methods
registerSession()
Register a session key on-chain. This activates your session and enables signature-free transactions.[!IMPORTANT] After callingregisterSession(),walletStatus.isSessionActivewill automatically update totrue.
revokeSession(sessionKey?)
Revoke a session key on-chain. If nosessionKey is provided, revokes the current active session.
[!NOTE] This operation requires JWT verification on-chain and uses the OAuth signature.
emergencyRevokeAllSessions()
Revoke all active sessions for the wallet. Use this if you suspect a session key has been compromised.[!WARNING] This invalidates all sessions immediately. You’ll need to create and register a new session to transact again.
exportSession()
Export the current session as a base64-encoded token for use in the Cavos CLI or other tools.[!NOTE] The exported token contains the session private key and wallet address. Store it securely and never share it publicly.Manage session keys for signature-free transactions:
Session Properties
| Property | Type | Description |
|---|---|---|
hasActiveSession | boolean | Session is active and not expired |
Session Methods
createSession(policy)
Create a session with a policy defining allowed actions:
[!IMPORTANT]
After createSession(), the user’s private key is cleared from memory. Only the session key remains.
clearSession()
Invalidate the current session:executeWithSession(calls)
Execute transactions with the session key:Complete Example
Session Policy Reference
Best Practices
- Limit scope: Only include methods your app actually needs
- Short expiration: Use 1 hour or less for sensitive operations
- Re-create on demand: Create new sessions when needed rather than long-lived ones
- Check before execute: Always verify
hasActiveSessionbeforeexecute()

