OAuth Wallets with JWT Verification
Cavos creates self-custodial StarkNet wallets tied to your OAuth identity (Google, Apple, or Firebase). Your wallet address is deterministically derived from your provider’s user ID, ensuring the same account always gets the same wallet across devices.How It Works
Authentication Flow
- User Authenticates: Login with Google, Apple, or Firebase email/password
- JWT Issued: Provider returns a signed JWT token with user identity
- Session Key Generated: SDK creates a temporary ECDSA keypair (Stark curve)
- Nonce Computation:
nonce = Poseidon(sessionPubKey, maxBlock, randomness) - Address Derivation:
addressSeed = Poseidon(sub, app_salt)→ deterministic wallet address - On-Chain Verification: Smart contract verifies JWT RSA signature and registers session key
JWT Verification On-Chain
Unlike traditional session keys, Cavos uses JWT signature verification directly on-chain:- Contract verifies RSA-2048 signature of JWT
- Validates nonce matches session public key
- Registers session key for this session
- Executes transaction
- Signed with lightweight session key signature
- No need to re-verify full JWT
- Much cheaper gas cost
Session Keys
Session keys are temporary signing keys that expire after a configured duration:| Property | Description |
|---|---|
| Lifetime | ~24 hours (configurable via sessionDuration) |
| Storage | SessionStorage (cleared on browser close) |
| Renewal | Can generate new session key and re-register |
| Revocation | Automatic on expiry or manual logout |
- No policy restrictions (full wallet control)
- Registered on-chain via JWT verification
- Expire based on block height, not timestamp
- Can be renewed during grace period
Security Model
| Aspect | Behavior |
|---|---|
| JWT Token | Issued by OAuth provider, verified on-chain |
| Session Key | Generated client-side, registered via JWT |
| Wallet Address | Deterministically derived from OAuth sub claim |
| Private Key | Never stored - wallets are OAuth-based, not key-based |
| Expiration | Session keys expire after ~24 hours |
| Renewal | Generate new session key, verify with same JWT |
[!IMPORTANT] Cavos wallets are OAuth-based, not private-key-based. Your identity (Google/Apple/Firebase account) IS your wallet. No seed phrases, no private keys to manage.
Address Derivation
Wallet addresses are computed deterministically:- sub: OAuth user ID (Google:
google-oauth2|123, Firebase:uid) - app_salt: Per-app salt (isolates wallets between apps)
- Same user + Same app = Same wallet address
Authentication Methods
OAuth Providers (Google/Apple)
- Identity: Email, name, profile picture
- Verification: JWT signed by provider’s RSA keys
- Recovery: Login again with same account
- Cross-device: Same OAuth account = same wallet everywhere
Email/Password (Firebase)
- Identity: Email (verified required)
- Verification: Custom JWT signed by Cavos with RSA-2048
- Recovery: Login with same email/password
- Security: Email verification prevents unauthorized access
Passkey-Only
- Identity: Anonymous (no email)
- Verification: WebAuthn passkey
- Recovery: Device-based (iCloud Keychain, Google Password Manager)
- Privacy: No personal information collected
Gasless Transactions
All transactions through Cavos are gasless by default. Users never need to hold ETH.How It Works
- User initiates a transaction via
execute() - SDK signs with session key and sends to AVNU Paymaster
- Paymaster sponsors the gas fee
- Transaction is executed on-chain
AVNU Paymaster
Cavos uses AVNU’s paymaster infrastructure:| Network | Paymaster | Cost |
|---|---|---|
| Starknet Sepolia | Shared | Free |
| Starknet Mainnet | Per-app | Paid via dashboard |
Account Abstraction (AA)
Starknet has native account abstraction, meaning every account is a smart contract. Cavos wallets use a custom OAuth account contract:Account Features
- JWT Verification: On-chain RSA signature verification
- Session Keys: Lightweight signing after JWT registration
- Self-Deploy: Accounts deploy themselves via paymaster
- Multi-call: Execute multiple transactions atomically
- Upgradeable: Account logic can be upgraded
Deployment
Accounts are deployed automatically after login. Cavos handles this entirely in the background:- Wallet address is computed deterministically from OAuth identity
- Account can receive funds before deployment (precomputed address)
- After login, the SDK automatically:
- Deploys the account contract via paymaster (gasless)
- Registers the session key on-chain using the JWT signature
- Updates
walletStatus.isReady = truewhen complete
- All subsequent transactions use the lightweight session key signature
login().
Transaction Flow
After Login (Automatic Setup)
Transactions (All Automatic)
If the session isn’t registered yet (e.g., background registration still in progress), execute() automatically falls back to JWT signature to register + execute in one atomic transaction.
Session Key Renewal
When session key expires:Authentication Flows
OAuth (Google/Apple)
Email/Password (Firebase)
Passkey-Only (Anonymous)
Network Support
| Network | Status | Paymaster |
|---|---|---|
| Starknet Mainnet | Supported | AVNU (paid) |
| Starknet Sepolia | Supported | AVNU (free) |
Key Advantages
| Feature | Benefit |
|---|---|
| No Seed Phrases | Your OAuth account IS your wallet |
| Cross-Device | Same login = same wallet everywhere |
| Gasless | Never need to buy crypto to transact |
| Self-Deploy | No relayer, account deploys itself |
| On-Chain Verification | JWT signature verified on-chain |
| Secure | Session keys expire, JWT can’t be reused |

