primitives/prelude/traits/
encrypter.rs

1use bytes::Bytes;
2
3/// The Encrypter should be implemented by objects intending to encrypt or decrypt bytes.
4/// 
5/// Due to decompiling client side applications, encryption should not to be considered secure, merely obfuscated / hidden from plainsite.
6///
7pub trait Encrypter {
8    /// Encrypts bytes
9    /// Encrypted (or obfuscated) version of the original.
10    /// 
11    /// # Arguments
12    /// 
13    /// * `value` - The unencrypted data.
14    /// * `secret` - The secret key to encrypt the data with.  Leave blank to use default secret key. (optional, default: empty)
15    /// 
16    fn encrypt(&self, value: Bytes, secret: Option<String>) -> Bytes;
17
18    /// Decrypts bytes.
19    /// Decrypted (or unobfuscated) version of the encrypted data.
20    /// 
21    /// # Arguments
22    /// 
23    /// * `value` - The encrypted data.
24    /// * `secret` - The secret key to encrypt the data with.  Leave blank to use default secret key. (optional, default: empty)
25    /// 
26    fn decrypt(&self, value: Bytes, secret: Option<String>) -> Bytes;
27}