pub struct EnvelopeService<P>where
P: KeyProvider,{ /* private fields */ }Expand description
High-level service responsible for encrypting and decrypting secret records.
Implementations§
Source§impl<P> EnvelopeService<P>where
P: KeyProvider,
impl<P> EnvelopeService<P>where
P: KeyProvider,
Sourcepub fn new(provider: P, cache: DekCache, algorithm: EncryptionAlgorithm) -> Self
pub fn new(provider: P, cache: DekCache, algorithm: EncryptionAlgorithm) -> Self
Constructs a new service with the supplied components.
Sourcepub fn from_env(provider: P) -> Result<Self>
pub fn from_env(provider: P) -> Result<Self>
Builds a service using environment configuration and default cache parameters.
Sourcepub fn algorithm(&self) -> EncryptionAlgorithm
pub fn algorithm(&self) -> EncryptionAlgorithm
Currently configured algorithm.
Sourcepub fn encrypt_record(
&mut self,
meta: SecretMeta,
plaintext: &[u8],
) -> Result<SecretRecord>
pub fn encrypt_record( &mut self, meta: SecretMeta, plaintext: &[u8], ) -> Result<SecretRecord>
Encrypts plaintext into a SecretRecord using envelope encryption.
Sourcepub fn decrypt_record(
&mut self,
record: &SecretRecord,
) -> DecryptResult<Vec<u8>>
pub fn decrypt_record( &mut self, record: &SecretRecord, ) -> DecryptResult<Vec<u8>>
Decrypts the ciphertext of a SecretRecord.
Auto Trait Implementations§
impl<P> Freeze for EnvelopeService<P>where
P: Freeze,
impl<P> RefUnwindSafe for EnvelopeService<P>where
P: RefUnwindSafe,
impl<P> Send for EnvelopeService<P>
impl<P> Sync for EnvelopeService<P>
impl<P> Unpin for EnvelopeService<P>where
P: Unpin,
impl<P> UnsafeUnpin for EnvelopeService<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for EnvelopeService<P>where
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