Overview
The Hive credential system provides encrypted storage for API keys, OAuth tokens, and other secrets. Credentials are encrypted at rest using Fernet (AES-128-CBC + HMAC) and can be refreshed automatically via OAuth2 providers.Architecture
The credential system consists of three main components:Storage
Encrypted file storage, environment variables, or external vaults
Providers
Lifecycle management for OAuth2 tokens and API key validation
Store
Unified interface with caching and template resolution
Setup
Initialize Credential Store
The quickstart script initializes the credential store automatically. For manual setup:Storage Backends
Encrypted File Storage (Recommended)
Encrypted file storage provides secure at-rest encryption with local caching.Environment Variable Storage
Read credentials from environment variables (read-only).Composite Storage
Layer multiple storage backends with fallback:Credential Types
API Key
Simple static API keys.OAuth2 Token
OAuth2 access tokens with automatic refresh.Username/Password
Basic auth credentials.Using Credentials
Get Credential
Template Resolution
Resolve credential templates in strings:Register Usage Specs
Define how tools use credentials:OAuth2 Integration
The framework supports OAuth2 with automatic token refresh.Setup OAuth2 Provider
Automatic Token Refresh
Tokens are refreshed automatically on access:Aden Server Sync
Sync credentials from Aden authentication server:Credential Management
List Credentials
Find by Alias
Validate Credentials
Delete Credentials
Security Best Practices
Encryption Key Management
Encryption Key Management
- Never commit
HIVE_CREDENTIAL_KEYto version control - Store key in a secrets manager (AWS Secrets Manager, HashiCorp Vault)
- Rotate encryption keys periodically
- Use different keys for dev/staging/prod
- Back up the key securely (losing it means losing all credentials)
Credential Storage
Credential Storage
- Use encrypted file storage for production
- Set restrictive file permissions:
chmod 600 ~/.hive/credentials/credentials/* - Enable full-disk encryption on the server
- Use encrypted volumes in Docker/Kubernetes
- Never log credential values
API Keys
API Keys
- Use scoped tokens with minimal permissions
- Set expiration dates on tokens when possible
- Rotate API keys regularly
- Monitor API usage for anomalies
- Revoke compromised keys immediately
OAuth2 Tokens
OAuth2 Tokens
- Store refresh tokens securely
- Implement token refresh error handling
- Set short TTLs on access tokens
- Use PKCE (Proof Key for Code Exchange) when available
- Validate token scopes before use
Testing
Create a test credential store:Troubleshooting
Decryption Failed
Decryption Failed
Error:
Failed to decrypt credential 'xxx': ...Causes:HIVE_CREDENTIAL_KEYnot set or incorrect- Credential encrypted with different key
- Corrupted credential file
Credential Not Found
Credential Not Found
Error:
Credential 'xxx' not foundSolution:Token Refresh Failed
Token Refresh Failed
Error:
Failed to refresh credential 'xxx': ...Causes:- Refresh token expired
- OAuth2 provider unreachable
- Invalid client credentials
- Re-authenticate with the OAuth2 provider
- Check provider status page
- Verify client_id and client_secret
Next Steps
Self-Hosting
Set up your own Hive instance
LLM Providers
Configure LLM provider credentials