pub struct EncryptedCheckpointStore<S> { /* private fields */ }Expand description
Encrypted checkpoint store wrapper.
Wraps any checkpoint store implementation to provide transparent encryption. Checkpoint state bytes are encrypted before storage.
§Example
ⓘ
use cortexai_encryption::{EncryptionKey, EnvelopeEncryptor, EncryptedCheckpointStore};
use cortexai_agents::checkpoint::MemoryCheckpointStore;
let key = EncryptionKey::generate(32);
let encryptor = Arc::new(EnvelopeEncryptor::new(key));
let inner_store = MemoryCheckpointStore::new();
let encrypted_store = EncryptedCheckpointStore::new(inner_store, encryptor);Implementations§
Source§impl<S> EncryptedCheckpointStore<S>
impl<S> EncryptedCheckpointStore<S>
Sourcepub fn new(inner: S, encryptor: Arc<EnvelopeEncryptor>) -> Self
pub fn new(inner: S, encryptor: Arc<EnvelopeEncryptor>) -> Self
Create a new encrypted checkpoint store.
Sourcepub fn encryptor(&self) -> &EnvelopeEncryptor
pub fn encryptor(&self) -> &EnvelopeEncryptor
Get a reference to the encryptor.
Sourcepub fn encrypt_state(
&self,
state: &[u8],
thread_id: &str,
) -> CryptoResult<Vec<u8>>
pub fn encrypt_state( &self, state: &[u8], thread_id: &str, ) -> CryptoResult<Vec<u8>>
Encrypt checkpoint state.
Uses the thread_id as associated data for additional authentication.
Sourcepub fn decrypt_state(
&self,
ciphertext: &[u8],
thread_id: &str,
) -> CryptoResult<Vec<u8>>
pub fn decrypt_state( &self, ciphertext: &[u8], thread_id: &str, ) -> CryptoResult<Vec<u8>>
Decrypt checkpoint state.
Uses the thread_id as associated data for verification.
Trait Implementations§
Source§impl<S: Clone> Clone for EncryptedCheckpointStore<S>
impl<S: Clone> Clone for EncryptedCheckpointStore<S>
Auto Trait Implementations§
impl<S> Freeze for EncryptedCheckpointStore<S>where
S: Freeze,
impl<S> RefUnwindSafe for EncryptedCheckpointStore<S>where
S: RefUnwindSafe,
impl<S> Send for EncryptedCheckpointStore<S>where
S: Send,
impl<S> Sync for EncryptedCheckpointStore<S>where
S: Sync,
impl<S> Unpin for EncryptedCheckpointStore<S>where
S: Unpin,
impl<S> UnsafeUnpin for EncryptedCheckpointStore<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for EncryptedCheckpointStore<S>where
S: 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