Unlocking with secrets.

This commit is contained in:
Tomasz Drwięga
2017-06-06 18:06:40 +02:00
parent 241de230bb
commit a5299bdb1a
10 changed files with 69 additions and 12 deletions

View File

@@ -114,6 +114,8 @@ usage! {
or |c: &Config| otry!(c.account).keys_iterations.clone(),
flag_no_hardware_wallets: bool = false,
or |c: &Config| otry!(c.account).disable_hardware.clone(),
flag_fast_unlock: bool = false,
or |c: &Config| otry!(c.account).fast_unlock.clone(),
flag_force_ui: bool = false,
@@ -424,6 +426,7 @@ struct Account {
password: Option<Vec<String>>,
keys_iterations: Option<u32>,
disable_hardware: Option<bool>,
fast_unlock: Option<bool>,
}
#[derive(Default, Debug, PartialEq, RustcDecodable)]
@@ -927,6 +930,7 @@ mod tests {
password: Some(vec!["passwdfile path".into()]),
keys_iterations: None,
disable_hardware: None,
fast_unlock: None,
}),
ui: Some(Ui {
force: None,

View File

@@ -99,6 +99,8 @@ Account Options:
deriving key from the password (bigger is more
secure) (default: {flag_keys_iterations}).
--no-hardware-wallets Disables hardware wallet support. (default: {flag_no_hardware_wallets})
--fast-unlock Use way faster unlocking mode. This setting causes raw secrets to be stored
unprotected in memory. (default: {flag_fast_unlock})
UI Options:
--force-ui Enable Trusted UI WebSocket endpoint,

View File

@@ -497,6 +497,7 @@ impl Configuration {
password_files: self.args.flag_password.clone(),
unlocked_accounts: to_addresses(&self.args.flag_unlock)?,
enable_hardware_wallets: !self.args.flag_no_hardware_wallets,
enable_fast_unlock: self.args.flag_fast_unlock,
};
Ok(cfg)

View File

@@ -180,6 +180,7 @@ pub struct AccountsConfig {
pub password_files: Vec<String>,
pub unlocked_accounts: Vec<Address>,
pub enable_hardware_wallets: bool,
pub enable_fast_unlock: bool,
}
impl Default for AccountsConfig {
@@ -190,6 +191,7 @@ impl Default for AccountsConfig {
password_files: Vec::new(),
unlocked_accounts: Vec::new(),
enable_hardware_wallets: true,
enable_fast_unlock: false,
}
}
}

View File

@@ -777,6 +777,7 @@ fn prepare_account_provider(spec: &SpecType, dirs: &Directories, data_dir: &str,
let account_settings = AccountProviderSettings {
enable_hardware_wallets: cfg.enable_hardware_wallets,
hardware_wallet_classic_key: spec == &SpecType::Classic,
fast_unlock: cfg.enable_fast_unlock,
};
let account_provider = AccountProvider::new(
Box::new(EthStore::open_with_iterations(dir, cfg.iterations).map_err(|e| format!("Could not open keys directory: {}", e))?),