Authentication
AxonVault implements a multi-layer authentication model designed for production-grade security. This guide explains each authentication layer and when to use them.Authentication Layers
AxonVault uses three authentication layers depending on the operation type:| Layer | Purpose | Used For |
|---|---|---|
| API Key + HMAC | Server authentication | All Server Wallet API calls |
| JWT Access Token | User session | Embedded Wallet SDK calls |
| Wallet Auth Token | Signing authorization | Transaction signing operations |
Layer 1: API Key Authentication (Server Wallets)
For server-to-server communication, use HMAC-signed requests with your API credentials.Credentials
When you create an API key in the dashboard, you receive:- Client Key: Public identifier (safe to log)
- Secret Key: Private key for signing (never expose)
Request Signing
Every request must include these headers:| Header | Description |
|---|---|
X-Access-Key | Your Client Key |
X-Signature | HMAC-SHA256 signature |
X-Timestamp | ISO 8601 timestamp |
Signature Generation
The signature is computed over a canonical string:Example Request
Layer 2: JWT Access Token (Embedded Wallets)
For user-facing applications, users authenticate via social login and receive JWT tokens. The Embedded Wallet SDK handles all token management automatically.Social Login Flow
Authenticate User with SDK
The SDK handles authentication and token management automatically:Token Management
The SDK handles token management automatically:- Automatic Storage: Tokens stored securely (httpOnly cookies in browser)
- Automatic Refresh: Tokens refreshed before expiration
- Error Handling: Automatic retry on token expiration
SDK Authentication Guide
Learn more about SDK authentication methods
Supported Providers
| Provider | Status | ID Token Source |
|---|---|---|
| ✅ Live | Google Sign-In | |
| Apple | ✅ Live | Sign in with Apple |
| Email OTP | ✅ Live | AxonVault Email Service |
Layer 3: Wallet Auth Token (Signing Operations)
For sensitive operations like signing transactions, an additional wallet-level authorization is required. The SDK handles this automatically for embedded wallets.When Required
- Signing transactions
- Transferring assets
- Approving token spending
- Any operation that changes on-chain state
How It Works
The Wallet Auth Token binds the signing request to:- The specific wallet
- The exact transaction payload
- A short time window
SDK Handling
For embedded wallets, the SDK automatically handles wallet auth tokens:For server wallets, wallet auth tokens are handled automatically by the server-side SDK. See the Server Wallet API documentation for details.
API Key Types
AxonVault supports different API key types for different use cases:| Type | Permissions | Use Case |
|---|---|---|
| Live | Full access | Production environment |
| Test | Full access (testnet only) | Development and testing |
| Read-Only | Read operations only | Analytics and monitoring |
Key Permissions
You can restrict API keys to specific operations:wallets:read,wallets:writetransactions:read,transactions:writeassets:readpolicies:read,policies:writewebhooks:read,webhooks:write
Error Responses
Authentication errors follow a consistent format:Common Error Codes
| Error Type | HTTP Status | Description |
|---|---|---|
unauthorized | 401 | Invalid or missing credentials |
token_expired | 401 | Access token has expired |
signature_mismatch | 401 | HMAC signature doesn’t match |
wallet_auth_required | 401 | Wallet Auth Token required |
wallet_auth_invalid | 401 | Wallet Auth Token is invalid |
forbidden | 403 | Insufficient permissions |
Security Best Practices
Credential Management
Credential Management
- Store Secret Keys in secure vaults (AWS Secrets Manager, HashiCorp Vault)
- Never commit credentials to version control
- Rotate API keys regularly (recommended: every 90 days)
- Use separate keys for development and production
Request Security
Request Security
- Always use HTTPS
- Validate timestamp freshness (reject requests older than 5 minutes)
- Implement request idempotency for write operations
- Log all authentication attempts for audit
Token Handling
Token Handling
- Store refresh tokens securely (encrypted at rest)
- Implement token refresh before expiration
- Clear tokens on user logout
- Never expose tokens in URLs or logs