use bytes::Bytes;
use core::fmt::Debug;
use thiserror::Error;
pub struct EncryptedPayload {
pub payload: Bytes,
pub iv: [u8; 12],
pub key_index: u8,
}
#[derive(Debug, Error)]
#[error("Encryption failed")]
pub struct EncryptionError;
#[derive(Debug, Error)]
#[error("Decryption failed")]
pub struct DecryptionError;
pub trait EncryptionProvider: Send + Sync + Debug {
fn encrypt(&self, payload: Bytes) -> Result<EncryptedPayload, EncryptionError>;
}
pub trait DecryptionProvider: Send + Sync + Debug {
fn decrypt(
&self,
payload: EncryptedPayload,
sender_identity: &str,
) -> Result<Bytes, DecryptionError>;
}