use std::path::PathBuf;
use thiserror::Error;
use crate::SecretRef;
#[derive(Debug, Error)]
pub enum SecretError {
#[error("secret not found at {path}")]
NotFound { path: PathBuf },
#[error("cluster secrets require a cluster-backed resolver")]
ClusterNotImplemented,
#[error("cluster secret {name} not found in the local raft replica")]
ClusterNotFound { name: String },
#[error("cluster secret {name} failed to decrypt")]
ClusterDecrypt { name: String },
#[error("cluster KEK unavailable: {reason}")]
Kek { reason: String },
#[error("I/O error reading {path}: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
}
pub trait SecretResolver {
fn resolve(&self, r: &SecretRef) -> Result<Vec<u8>, SecretError>;
}