Credential Security
This guide provides best practices for managing secrets, API keys, and sensitive configurations within Cyne AI to ensure security and operational efficiency.
Core Concepts
Environment Variables
Cyne AI uses a hierarchical system for environment variables:
Character-specific secrets (highest priority).
Environment variables defined in
.env
files.Default values (lowest priority).
Secret Types
Common secrets managed in Cyne AI:
Implementation Guide
Basic Setup
Create a
.env
file from the provided template:Configure environment variable discovery in your code:
Character-Specific Secrets
Define secrets directly in character files for modular configuration:
Access secrets in your code:
Secure Storage
Wallet Management
Handle Solana wallet credentials securely:
Encryption for Secrets
Encrypt sensitive secrets before storage:
Best Practices
1. Environment Segregation
Use separate .env
files for different environments:
.env.development
– Development settings.env.staging
– Staging environment.env.production
– Production environment
2. Secret Validation
Ensure required secrets are defined:
3. Git Security
Exclude sensitive files from version control by adding the following to .gitignore
:
4. Secret Rotation
Regularly rotate secrets to enhance security:
Troubleshooting
Common Issues
Missing Secrets Ensure required environment variables or character-specific secrets are defined:
Invalid Secret Format Validate the format of critical secrets like API keys:
Secret Loading Errors Handle errors gracefully during secret loading:
Security Considerations
1. API Keys Handling
Use strong validation logic for keys.
Rotate keys periodically to reduce risks.
2. Access Control
Restrict access to sensitive secrets using a controlled list.
Log unauthorized access attempts for monitoring.
3. Encryption at Rest
Encrypt all sensitive data stored on disk.
Use AES-256-GCM encryption for strong security.
Related Resources
Configuration Guide: General setup instructions.
Local Development Guide: Best practices for local environments.
Infrastructure Guide: Secure deployment practices.
By following these guidelines, you can manage secrets effectively and securely within the Cyne AI framework, ensuring robust and secure operations.
Last updated