Encrypter

Trait Encrypter 

Source
pub trait Encrypter {
    // Required methods
    fn encrypt(&self, value: Bytes, secret: Option<String>) -> Bytes;
    fn decrypt(&self, value: Bytes, secret: Option<String>) -> Bytes;
}
Expand description

The Encrypter should be implemented by objects intending to encrypt or decrypt bytes.

Due to decompiling client side applications, encryption should not to be considered secure, merely obfuscated / hidden from plainsite.

Required Methods§

Source

fn encrypt(&self, value: Bytes, secret: Option<String>) -> Bytes

Encrypts bytes Encrypted (or obfuscated) version of the original.

§Arguments
  • value - The unencrypted data.
  • secret - The secret key to encrypt the data with. Leave blank to use default secret key. (optional, default: empty)
Source

fn decrypt(&self, value: Bytes, secret: Option<String>) -> Bytes

Decrypts bytes. Decrypted (or unobfuscated) version of the encrypted data.

§Arguments
  • value - The encrypted data.
  • secret - The secret key to encrypt the data with. Leave blank to use default secret key. (optional, default: empty)

Implementors§