#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::{borrow::Cow, string::String, vec::Vec};
#[cfg(feature = "std")]
use std::{borrow::Cow, string::String, vec::Vec};
use async_trait::async_trait;
use thiserror::Error;
#[cfg(feature = "std")]
use anyhow::Error as AnyhowError;
#[derive(Debug, Error)]
pub enum SecretError {
#[error("not found: {0}")]
NotFound(String),
#[error("permission denied: {0}")]
Permission(String),
#[error("backend error: {0}")]
Backend(Cow<'static, str>),
#[cfg(feature = "std")]
#[error(transparent)]
Other(#[from] AnyhowError),
}
pub type Result<T> = core::result::Result<T, SecretError>;
#[async_trait]
pub trait SecretsManager: Send + Sync {
async fn read(&self, path: &str) -> Result<Vec<u8>>;
async fn write(&self, path: &str, bytes: &[u8]) -> Result<()>;
async fn delete(&self, path: &str) -> Result<()>;
}