use std::path::PathBuf;
use crate::error::{BuildError, CredentialError};
use crate::handle::{Channel, CredentialHandle};
pub trait CredentialStore: Send + Sync + 'static {
type Account: Clone + Send + Sync;
fn channel(&self) -> Channel;
fn get(&self, handle: &CredentialHandle) -> Result<Self::Account, CredentialError>;
fn issue(&self, account_id: &str, agent_id: &str) -> Result<CredentialHandle, CredentialError>;
fn list(&self) -> Vec<String>;
fn allow_agents(&self, account_id: &str) -> Vec<String>;
fn validate(&self) -> ValidationReport;
}
#[derive(Debug, Default)]
pub struct ValidationReport {
pub accounts_ok: usize,
pub warnings: Vec<String>,
pub insecure_paths: Vec<PathBuf>,
pub unused: Vec<String>,
pub errors: Vec<BuildError>,
}
impl ValidationReport {
pub fn is_clean(&self) -> bool {
self.errors.is_empty() && self.insecure_paths.is_empty()
}
}