pub mod audit;
pub mod cache;
pub mod error;
pub mod field;
pub mod hardening;
pub mod proxy;
pub mod retry;
pub mod secret_mem;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;
#[cfg(unix)]
pub use audit::SyslogSink;
pub use audit::{AuditEvent, AuditSink, CacheEvent, FileSink, NoopSink, StderrSink, Verb};
pub use cache::{CacheKey, CachePolicy, ProcessCache};
pub use error::{BackendFailureKind, Error};
pub use field::{extract_field, extract_field_from_str};
#[cfg(feature = "memory-lock")]
pub use hardening::lock_secret_pages;
pub use hardening::{
apply_mitigations, check_refusal_conditions, harden_process, install, HardenRefusal,
HardeningToken, MitigationOutcome,
};
pub use proxy::{is_no_proxy, resolve_proxy_from_env, ProxyConfig};
pub use retry::RetryBackend;
pub use secrecy::{ExposeSecret, SecretString};
pub use subtle;
use url::Url;
pub trait Backend: Send + Sync {
fn scheme(&self) -> &'static str;
fn get(&self, url: &Url) -> Result<SecretString, Error>;
fn put(&self, url: &Url, value: &SecretString) -> Result<(), Error>;
fn list(&self, url: &Url) -> Result<Vec<Entry>, Error>;
fn delete(&self, url: &Url) -> Result<(), Error>;
fn exists(&self, url: &Url) -> Result<bool, Error>;
fn validate(&self, _url: &Url) -> Result<(), Error> {
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct Entry {
pub name: String,
pub url: Url,
}
pub fn scheme_from_url(url: &str) -> Result<&str, Error> {
url.split_once("://")
.map(|(scheme, _)| scheme)
.ok_or_else(|| Error::InvalidUrl("missing scheme separator".into()))
}