pub struct EncryptionService { /* private fields */ }Expand description
Encryption service for secrets
Implementations§
Source§impl EncryptionService
impl EncryptionService
Sourcepub fn generate_master_key() -> Vec<u8> ⓘ
pub fn generate_master_key() -> Vec<u8> ⓘ
Generate a random master key (for testing/initialization)
Sourcepub fn encrypt(&self, plaintext: &str) -> Result<(Vec<u8>, EncryptionMetadata)>
pub fn encrypt(&self, plaintext: &str) -> Result<(Vec<u8>, EncryptionMetadata)>
Encrypt a plaintext value
Sourcepub fn decrypt(
&self,
ciphertext: &[u8],
metadata: &EncryptionMetadata,
) -> Result<String>
pub fn decrypt( &self, ciphertext: &[u8], metadata: &EncryptionMetadata, ) -> Result<String>
Decrypt a ciphertext value
Sourcepub fn rotate_key(&mut self, new_master_key: Vec<u8>)
pub fn rotate_key(&mut self, new_master_key: Vec<u8>)
Rotate encryption key (re-encrypt with new key version)
Sourcepub fn key_version(&self) -> u32
pub fn key_version(&self) -> u32
Get current key version
Auto Trait Implementations§
impl Freeze for EncryptionService
impl RefUnwindSafe for EncryptionService
impl Send for EncryptionService
impl Sync for EncryptionService
impl Unpin for EncryptionService
impl UnwindSafe for EncryptionService
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more