feagi_api/security/encryption/
message.rs1pub struct MessageEncryptor {
6 #[allow(dead_code)]
7 secret_key: [u8; 32],
8 #[allow(dead_code)]
9 public_key: [u8; 32],
10}
11
12impl MessageEncryptor {
13 pub fn new() -> Self {
15 Self {
17 secret_key: [0u8; 32],
18 public_key: [0u8; 32],
19 }
20 }
21
22 pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, EncryptionError> {
24 Ok(plaintext.to_vec())
27 }
28
29 pub fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, EncryptionError> {
31 Ok(ciphertext.to_vec())
34 }
35}
36
37impl Default for MessageEncryptor {
38 fn default() -> Self {
39 Self::new()
40 }
41}
42
43#[derive(Debug, Clone)]
45pub struct EncryptionError {
46 pub message: String,
47}
48
49impl EncryptionError {
50 pub fn new(message: impl Into<String>) -> Self {
51 Self {
52 message: message.into(),
53 }
54 }
55}
56
57impl std::fmt::Display for EncryptionError {
58 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
59 write!(f, "{}", self.message)
60 }
61}
62
63impl std::error::Error for EncryptionError {}