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,22 @@
use std::path::PathBuf;
use anyhow::Result;
use crate::AgeKeySource;
pub struct FileSource {
path: PathBuf,
}
impl FileSource {
pub fn new(path: PathBuf) -> Self {
Self { path }
}
}
impl AgeKeySource for FileSource {
fn name(&self) -> &str { "file" }
fn retrieve(&self) -> Result<String> {
std::fs::read_to_string(&self.path)
.map_err(|e| anyhow::anyhow!("cannot read key file {}: {e}", self.path.display()))
}
}