Function web3_keystore::decrypt
source · [−]pub fn decrypt<S>(
keystore: &KeyStore,
password: S
) -> Result<Vec<u8>, KeyStoreError>where
S: AsRef<[u8]>,Expand description
Decrypts an encrypted keystore using the provided password.
Decryption supports the Scrypt and PBKDF2 key derivation functions.
Example
use web3_keystore::{decrypt, new_random};
let mut rng = rand::thread_rng();
let password = "super-secret-password";
let (keystore, secret) = new_random(&mut rng, password).unwrap();
let private_key = decrypt(&keystore, password).unwrap();
assert_eq!(secret, private_key);