mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-07-30 15:26:14 +00:00
Two ways a stale legacy NSEC could override or resurrect an nsec the vault already owns (issue #553): - initialize() re-applied env/blob values onto live settings after bootstrap had decrypted the authoritative nsec, so a stale NSEC left in .env would clobber it on restart (e.g. after rotating the key in the admin UI). _apply_to_live_settings now never re-applies secret fields; bootstrap_secrets is their only writer. - An empty encrypted_nsec could not distinguish "never migrated" from "intentionally cleared", so clearing the identity via the admin API and restarting re-imported the old NSEC from env/blob. Record vault ownership in a new secrets.nsec_managed column (set on legacy import and on every set_nsec write); bootstrap skips the legacy import once the vault owns the nsec, so a cleared identity stays cleared. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>