encrypt

Function encrypt 

Source
pub fn encrypt<'k, Key, Payload>(key: Key, payload: Payload) -> Option<Vec<u8>>
where Key: Into<&'k Key<Aes256GcmSiv>>, Payload: AsRef<[u8]>,
Expand description

Encrypts the payload with AES256 GCM SIV. The iv is randomly generated for each call.

Returns None if an error occurred.

ยงExample

let key = get_key();
let payload = "supersecretpayload";

let encrypted = crypter::encrypt(&key, payload);