Key Management and Rotation
Question this page answers: How do I rotate keys without downtime while keeping read/write compatibility?
Core concept
Section titled “Core concept”- One-line definition:
KeyResolverdecouples key lifecycle decisions from application business logic. - Why it matters: key generation/activation/retirement can evolve without rewriting send/tracking flows.
- Configuration example (
safe): activekidfor encrypt, old/new/new2 for decrypt. - Common mistake: removing previous decrypt
kidtoo early after rollout.
Rollout recipe
Section titled “Rollout recipe”- Choose adapter source:
ENV,AWS KMS, orVault Transit. - Apply percentage rollout with
createRollingKeyResolver(10% -> 50% -> 100%). - Keep multi-kid decrypt enabled to support two consecutive rotations (A->B->C).
Risk labels
Section titled “Risk labels”safe: active encrypt key + multi-kid decryptcaution: instant 100% rollout without monitoringunsafe: decrypt set excludes previous key ids