EncryptedBlobStore

Struct EncryptedBlobStore 

Source
pub struct EncryptedBlobStore { /* private fields */ }
Expand description

Encrypted blob store that uses epoch-scoped keys for encryption.

Blobs are encrypted with the active epoch’s key at insertion time. The epoch ID, nonce, and AAD are recorded in BlobInfo so the correct key can be resolved at decryption time.

If the epoch has expired or is missing, decryption fails closed.

Implementations§

Source§

impl EncryptedBlobStore

Source

pub fn new(key_manager: KeyEpochManager) -> Self

Create a new blob store backed by the given key manager.

Source

pub fn put( &mut self, blob_id: BlobId, plaintext: &[u8], ) -> Result<BlobInfo, SecureStoreError>

Encrypt plaintext with the active epoch key and store it.

Returns the BlobInfo needed to later decrypt the blob.

§Errors
Source

pub fn get(&self, blob_info: &BlobInfo) -> Result<Vec<u8>, SecureStoreError>

Decrypt and return the plaintext for a previously stored blob.

The blob_info provides the epoch ID, nonce, and AAD needed for decryption. The epoch’s key must still be available (not expired).

§Errors
Source

pub fn remove(&mut self, blob_id: &BlobId) -> Result<(), SecureStoreError>

Remove a blob from the store.

§Errors
Source

pub fn key_manager(&self) -> &KeyEpochManager

Access the underlying key manager.

Source

pub fn key_manager_mut(&mut self) -> &mut KeyEpochManager

Mutable access to the underlying key manager (for rotation/expiry).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.