Guide for rotating the master encryption key used to encrypt Key B in the database.
- Suspected key compromise
- Employee departure with key access
- Scheduled rotation (recommended: annually)
- Security audit requirement
openssl rand -base64 32wrangler secret put MASTER_ENCRYPTION_KEY_NEWRe-encrypt all existing seals with new key (requires custom migration script).
wrangler secret put MASTER_ENCRYPTION_KEY
# Enter the new key valuewrangler secret delete MASTER_ENCRYPTION_KEY_NEWKey rotation requires brief downtime (5-10 minutes) during re-encryption.
Keep old key in secure backup for 30 days in case rollback is needed.
Always test rotation in staging environment first.