hammer-editor/server
Adam Brown 2424a3d2ba Add prune-key subcommand to remove unused key generations
After a rotation + convergence, old content key generations linger in the
keyring as dead weight, and deleting the wrong one by hand destroys data.
prune-key reads the keyring (provider or --in), checks the database for which
content generations still protect rows, and drops every non-active generation
with zero rows on it; the active generation is never removed.

A generation still referenced is kept and reported (skip + report), so the
sweep never half-strands data. An explicit --key that is active or still
referenced fails instead of silently no-opping. The tokenHmac role needs no
database: only the active token key verifies tokens, so every non-active
generation is already dead.

KeyPruner holds the pure logic; the command resolves in-use key ids from new
distinctCiphers queries via AesGcmContentEncryptor.keyIdForTag. A parity test
pins all convergence queries to fold the legacy tag identically.
2026-06-18 00:11:24 -07:00
..
src Add prune-key subcommand to remove unused key generations 2026-06-18 00:11:24 -07:00
build.gradle.kts Make review snapshots polymorphic and default to plaintext encryption 2026-06-16 20:32:33 -07:00