pub struct SecretsBroker<B, P>where
B: SecretsBackend,
P: KeyProvider,{ /* private fields */ }Expand description
High-level API that pairs a backend with the envelope crypto stack.
Implementations§
Source§impl<B, P> SecretsBroker<B, P>where
B: SecretsBackend,
P: KeyProvider,
impl<B, P> SecretsBroker<B, P>where
B: SecretsBackend,
P: KeyProvider,
Sourcepub fn new(backend: B, crypto: EnvelopeService<P>) -> Self
pub fn new(backend: B, crypto: EnvelopeService<P>) -> Self
Construct a new broker façade from the provided backend and crypto service.
Sourcepub fn put_secret(
&mut self,
meta: SecretMeta,
data: &[u8],
) -> Result<SecretVersion>
pub fn put_secret( &mut self, meta: SecretMeta, data: &[u8], ) -> Result<SecretVersion>
Encrypt and store a secret, returning the version assigned by the backend.
Sourcepub fn get_secret(
&mut self,
uri: &SecretUri,
) -> DecryptResult<Option<BrokerSecret>>
pub fn get_secret( &mut self, uri: &SecretUri, ) -> DecryptResult<Option<BrokerSecret>>
Retrieve and decrypt the latest revision of a secret.
Sourcepub fn get_secret_version(
&mut self,
uri: &SecretUri,
version: Option<u64>,
) -> DecryptResult<Option<BrokerSecret>>
pub fn get_secret_version( &mut self, uri: &SecretUri, version: Option<u64>, ) -> DecryptResult<Option<BrokerSecret>>
Retrieve and decrypt a specific revision of a secret.
Sourcepub fn list_secrets(
&self,
scope: &Scope,
category_prefix: Option<&str>,
name_prefix: Option<&str>,
) -> Result<Vec<SecretListItem>>
pub fn list_secrets( &self, scope: &Scope, category_prefix: Option<&str>, name_prefix: Option<&str>, ) -> Result<Vec<SecretListItem>>
List available secrets for a scope with optional category/name prefixes.
Sourcepub fn delete_secret(&self, uri: &SecretUri) -> Result<SecretVersion>
pub fn delete_secret(&self, uri: &SecretUri) -> Result<SecretVersion>
Soft-delete a secret (tombstone).
Sourcepub fn versions(&self, uri: &SecretUri) -> Result<Vec<SecretVersion>>
pub fn versions(&self, uri: &SecretUri) -> Result<Vec<SecretVersion>>
Fetch all versions known for a secret.
Sourcepub fn exists(&self, uri: &SecretUri) -> Result<bool>
pub fn exists(&self, uri: &SecretUri) -> Result<bool>
Determine whether the latest revision of the secret exists.
Sourcepub fn crypto(&self) -> &EnvelopeService<P>
pub fn crypto(&self) -> &EnvelopeService<P>
Borrow the envelope service for custom workflows.
Sourcepub fn crypto_mut(&mut self) -> &mut EnvelopeService<P>
pub fn crypto_mut(&mut self) -> &mut EnvelopeService<P>
Mutable access to the envelope service (mainly for tests).
Auto Trait Implementations§
impl<B, P> Freeze for SecretsBroker<B, P>
impl<B, P> RefUnwindSafe for SecretsBroker<B, P>where
B: RefUnwindSafe,
P: RefUnwindSafe,
impl<B, P> Send for SecretsBroker<B, P>
impl<B, P> Sync for SecretsBroker<B, P>
impl<B, P> Unpin for SecretsBroker<B, P>
impl<B, P> UnsafeUnpin for SecretsBroker<B, P>where
B: UnsafeUnpin,
P: UnsafeUnpin,
impl<B, P> UnwindSafe for SecretsBroker<B, P>where
B: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request