fix(core): zeroize keyfile_encode output + lock-in tests for backup-keyfile-error and malformed-vs-wrong unlock

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01McMF5pUJbCMricmFEnf2sG
This commit is contained in:
adlee-was-taken
2026-06-26 21:45:14 -04:00
parent 2c5af671d0
commit b2bed1c50e
4 changed files with 86 additions and 4 deletions

View File

@@ -56,7 +56,8 @@ pub fn cmd_init(image: Option<PathBuf>, output: PathBuf, key_file: Option<PathBu
// the server would hold both the ciphertext and the key, defeating
// the two-factor model.
let kf_path = root.join(kf);
fs::write(&kf_path, relicario_core::keyfile::keyfile_encode(&secret))
let armored = relicario_core::keyfile::keyfile_encode(&secret);
fs::write(&kf_path, armored.as_slice())
.with_context(|| format!("failed to write key file {}", kf_path.display()))?;
let name = kf
.file_name()