Skip to main content

second_brain_sync/
crypto.rs

1use anyhow::Result;
2
3pub trait SyncEncryptor: Send + Sync {
4    fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>;
5    fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>>;
6}
7
8pub struct PassthroughEncryptor;
9
10impl SyncEncryptor for PassthroughEncryptor {
11    fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>> {
12        Ok(plaintext.to_vec())
13    }
14
15    fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>> {
16        Ok(ciphertext.to_vec())
17    }
18}