Seguridad
Cifrado a nivel de campo para proteger datos sensibles en tus agentes de Astreus
Descripción general#
Astreus incluye cifrado AES-256-GCM integrado para proteger los datos sensibles almacenados en tu base de datos. Esta funcionalidad ofrece cifrado transparente a nivel de campo para conversaciones, prompts del sistema, datos de tareas y contenido de la base de conocimiento.
Configuración rápida#
1. Generar la clave de cifrado#
# Generate a cryptographically secure 256-bit key
openssl rand -hex 322. Configurar el entorno#
# Enable encryption
ENCRYPTION_ENABLED=true
# Your secure master key (keep this secret!)
ENCRYPTION_MASTER_KEY=your-256-bit-encryption-key-here
# Optional: specify algorithm (default: aes-256-gcm)
ENCRYPTION_ALGORITHM=aes-256-gcm3. Uso normal#
import { Agent } from '@astreus-ai/astreus';
// Create agent with sensitive system prompt
const agent = await Agent.create({
name: 'SecureAgent',
systemPrompt: 'Your confidential business logic here', // ← Automatically encrypted
memory: true,
knowledge: true
});
// All interactions automatically encrypted
const response = await agent.ask('Sensitive question here');
// Knowledge uploads automatically encrypted
await agent.knowledge.addDocument(
'Confidential Document',
'Sensitive content here' // ← Automatically encrypted
);Gestión de claves#
Requisitos de la clave maestra#
- Longitud mínima: 32 caracteres (256 bits)
- Generación: usa generadores aleatorios criptográficamente seguros
- Almacenamiento: guárdala de forma segura fuera del código fuente
- Rotación: planifica una rotación periódica de la clave