new_random

Function new_random 

Source
pub fn new_random<R, S>(
    rng: &mut R,
    password: S,
) -> Result<(KeyStore, Vec<u8>), KeyStoreError>
where R: Rng + CryptoRng, S: AsRef<[u8]>,
Expand description

Creates a new keystore using a random 32 byte secret and the Scrypt key derivation function.

The keystore is encrypted by a key derived from the provided password.

ยงExample

use web3_keystore::new_random;
let mut rng = rand::thread_rng();
let password = "super-secret-password";
let (keystore, secret) = new_random(&mut rng, password).unwrap();
assert_eq!(32, secret.len());