Skip to main content

install

Function install 

Source
pub fn install(encryptor: Encryptor)
Expand description

Makes encryptor the one Encrypted and Deterministic use.

Ctx calls it with the keys of SECRET_KEY_BASE; call it yourself in tests of code that reads encrypted columns.

ยงExamples

use ocre::encryption::{self, Encrypted, Encryptor};

encryption::install(Encryptor::new(&"t".repeat(64), &[]).unwrap());
let stored = encryption::installed().unwrap().encrypt("42");
let value: Encrypted = serde_json::from_value(serde_json::json!(stored)).unwrap();
assert_eq!(value.as_str(), "42");