Function encryptodon::encrypt
source · pub fn encrypt(
status: String,
pub_key: String,
priv_key: String
) -> Result<String, String>
Expand description
for encrypting the communication with their pub and your priv.
let your_keys = encryptodon::generate_keys();
let their_keys = encryptodon::generate_keys();
// your end
let status = "Pachyderm Goes Private 🐘🕶️".to_string();
let encrypted_status = encryptodon::encrypt(status.clone(), their_keys.public(), your_keys.private()).unwrap();
// their end
let decrypted_status = encryptodon::decrypt(encrypted_status, your_keys.public(), their_keys.private()).unwrap();
assert_eq!(decrypted_status, status);