pub struct MessageEncryptor {
#[allow(dead_code)]
secret_key: [u8; 32],
#[allow(dead_code)]
public_key: [u8; 32],
}
impl MessageEncryptor {
pub fn new() -> Self {
Self {
secret_key: [0u8; 32],
public_key: [0u8; 32],
}
}
pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, EncryptionError> {
Ok(plaintext.to_vec())
}
pub fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, EncryptionError> {
Ok(ciphertext.to_vec())
}
}
impl Default for MessageEncryptor {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Clone)]
pub struct EncryptionError {
pub message: String,
}
impl EncryptionError {
pub fn new(message: impl Into<String>) -> Self {
Self {
message: message.into(),
}
}
}
impl std::fmt::Display for EncryptionError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.message)
}
}
impl std::error::Error for EncryptionError {}