feat: v0.5.0, supports ChaCha20/Poly1305

This commit is contained in:
2023-10-22 19:05:38 +08:00
parent 83464dfb28
commit bb07aec896
10 changed files with 105 additions and 125 deletions

View File

@@ -20,6 +20,14 @@ impl Cryptor {
}
}
pub fn get_name(&self) -> String {
let name = match self {
Cryptor::Aes256Gcm => consts::TINY_ENC_AES_GCM,
Cryptor::ChaCha20Poly1305 => consts::TINY_ENC_CHACHA20_POLY1305,
};
name.to_string()
}
pub fn encryptor(self, key: &[u8], nonce: &[u8]) -> XResult<Box<dyn Encryptor>> {
get_encryptor(self, key, nonce)
}