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) |
Action Methods
login(provider, redirectUri?)
Start OAuth authentication: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:useSession Hook
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()

