oz_keystore/keystore/
local.rs

1use std::path::PathBuf;
2
3pub struct LocalClient { }
4
5impl LocalClient {
6  pub fn generate(dir: PathBuf, password: String, name: Option<&str>) -> (Vec<u8>, String) {
7    let mut rng = rand::thread_rng();
8    let result = eth_keystore::new(dir, &mut rng, password, name);
9    result.unwrap()
10  }
11
12  pub fn update(dir: PathBuf, password: String, name: Option<&str>, pk: &[u8]) -> String {
13    let result = eth_keystore::encrypt_key(dir, &mut rand::thread_rng(), pk, password, name);
14    result.unwrap()
15  }
16
17  pub fn load(dir: PathBuf, password: String) -> Vec<u8> {
18    eth_keystore::decrypt_key(dir, password).unwrap()
19  }
20}