feat(notsecrets): add age key retrieval with bw/file/prompt sources

This commit is contained in:
Joseph O'Brien
2026-03-31 17:26:10 -04:00
parent ed11aa9bc3
commit 6e78778543
7 changed files with 213 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
use anyhow::Result;
use crate::AgeKeySource;
pub struct PromptSource;
impl AgeKeySource for PromptSource {
fn name(&self) -> &str { "prompt" }
fn retrieve(&self) -> Result<String> {
let key = rpassword::prompt_password("Paste your age private key: ")
.map_err(|e| anyhow::anyhow!("could not read age key from prompt: {e}"))?;
if key.trim().is_empty() {
anyhow::bail!("empty age key entered");
}
Ok(key)
}
}