What’s encrypted
How it works
- IV (Initialization Vector) — unique random nonce per encryption
- Ciphertext — encrypted data
- Auth tag — integrity verification (detects tampering)
enc:{iv}:{ciphertext}:{tag} allows the system to detect encrypted vs. plaintext values automatically.
Key management
Commune uses a three-layer key protection system:1. Key fingerprint lock
A SHA-256 fingerprint of the encryption key is stored in MongoDB. On every server startup, the current key’s fingerprint is compared against the stored lock. If they don’t match (indicating an unauthorized key change), the server refuses to start.2. Decryption canary
A test value encrypted with the current key is stored and verified on startup. If the canary can’t be decrypted, the key is wrong and the server halts.3. Dual-key rotation
When rotating encryption keys, the system supports reading with both the current and previous key simultaneously. This enables zero-downtime key rotation:- Set the previous key as a fallback
- Deploy with the new key
- Run a re-encryption migration
- Remove the previous key
Encryption scope
Encryption is optional and configurable via environment variables. When no encryption key is set:- Data is stored in plaintext
- All features work identically
- No performance overhead
- All reads and writes go through the encryption layer
- Minimal latency impact (< 1ms per field)
- Database queries on encrypted fields are not possible (search uses separate indexes)
Security considerations
- No key in logs — the encryption key is never logged; only the fingerprint appears in startup logs
- Per-field encryption — each field is encrypted independently with a unique IV
- Double-encryption guard — the system detects already-encrypted values and skips re-encryption
What’s next?
Security Overview
Full picture of all inbound and outbound security layers.
Data Deletion
GDPR-compliant deletion API with audit trail.
Spam Prevention
Inbound and outbound email protection systems.
Email Authentication
DKIM, SPF, and DMARC configuration for your domain.

