[][src]Function eth_keystore::new

pub fn new<P, R, S>(
    dir: P,
    rng: &mut R,
    password: S
) -> Result<(Vec<u8>, String), KeystoreError> where
    P: AsRef<Path>,
    R: Rng + CryptoRng,
    S: AsRef<[u8]>, 

Creates a new JSON keystore using the Scrypt key derivation function. The keystore is encrypted by a key derived from the provided password and stored in the provided directory.

Example

use eth_keystore::new;
use std::path::Path;

let dir = Path::new("./keys");
let mut rng = rand::thread_rng();
let (private_key, uuid) = new(&dir, &mut rng, "password_to_keystore")?;