Merge pull request #891 from ethcore/issue-882
passing key path to all invocations
This commit is contained in:
commit
a8eb34ddb8
@ -83,7 +83,7 @@ Parity. Ethereum Client.
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
parity daemon <pid-file> [options]
|
parity daemon <pid-file> [options]
|
||||||
parity account (new | list)
|
parity account (new | list) [options]
|
||||||
parity [options]
|
parity [options]
|
||||||
|
|
||||||
Protocol Options:
|
Protocol Options:
|
||||||
@ -94,7 +94,7 @@ Protocol Options:
|
|||||||
-d --db-path PATH Specify the database & configuration directory path
|
-d --db-path PATH Specify the database & configuration directory path
|
||||||
[default: $HOME/.parity].
|
[default: $HOME/.parity].
|
||||||
--keys-path PATH Specify the path for JSON key files to be found
|
--keys-path PATH Specify the path for JSON key files to be found
|
||||||
[default: $HOME/.web3/keys].
|
[default: $HOME/.parity/keys].
|
||||||
--identity NAME Specify your node's name.
|
--identity NAME Specify your node's name.
|
||||||
|
|
||||||
Account Options:
|
Account Options:
|
||||||
@ -384,7 +384,7 @@ impl Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _keys_path(&self) -> String {
|
fn keys_path(&self) -> String {
|
||||||
self.args.flag_keys_path.replace("$HOME", env::home_dir().unwrap().to_str().unwrap())
|
self.args.flag_keys_path.replace("$HOME", env::home_dir().unwrap().to_str().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ impl Configuration {
|
|||||||
fn execute_account_cli(&self) {
|
fn execute_account_cli(&self) {
|
||||||
use util::keys::store::SecretStore;
|
use util::keys::store::SecretStore;
|
||||||
use rpassword::read_password;
|
use rpassword::read_password;
|
||||||
let mut secret_store = SecretStore::new();
|
let mut secret_store = SecretStore::new_in(Path::new(&self.keys_path()));
|
||||||
if self.args.cmd_new {
|
if self.args.cmd_new {
|
||||||
println!("Please note that password is NOT RECOVERABLE.");
|
println!("Please note that password is NOT RECOVERABLE.");
|
||||||
println!("Type password: ");
|
println!("Type password: ");
|
||||||
@ -538,7 +538,7 @@ impl Configuration {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
|
|
||||||
let account_service = AccountService::new();
|
let account_service = AccountService::new_in(Path::new(&self.keys_path()));
|
||||||
for d in &self.args.flag_unlock {
|
for d in &self.args.flag_unlock {
|
||||||
let a = Address::from_str(clean_0x(&d)).unwrap_or_else(|_| {
|
let a = Address::from_str(clean_0x(&d)).unwrap_or_else(|_| {
|
||||||
die!("{}: Invalid address for --unlock. Must be 40 hex characters, without the 0x at the beginning.", d)
|
die!("{}: Invalid address for --unlock. Must be 40 hex characters, without the 0x at the beginning.", d)
|
||||||
|
@ -128,7 +128,7 @@ impl Default for AccountService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AccountService {
|
impl AccountService {
|
||||||
/// New account service with the default location
|
/// New account service with the keys store in default location
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let secret_store = RwLock::new(SecretStore::new());
|
let secret_store = RwLock::new(SecretStore::new());
|
||||||
secret_store.write().unwrap().try_import_existing();
|
secret_store.write().unwrap().try_import_existing();
|
||||||
@ -137,6 +137,15 @@ impl AccountService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// New account service with the keys store in specific location
|
||||||
|
pub fn new_in(path: &Path) -> Self {
|
||||||
|
let secret_store = RwLock::new(SecretStore::new_in(path));
|
||||||
|
secret_store.write().unwrap().try_import_existing();
|
||||||
|
AccountService {
|
||||||
|
secret_store: secret_store
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn new_test(temp: &::devtools::RandomTempPath) -> Self {
|
fn new_test(temp: &::devtools::RandomTempPath) -> Self {
|
||||||
let secret_store = RwLock::new(SecretStore::new_test(temp));
|
let secret_store = RwLock::new(SecretStore::new_test(temp));
|
||||||
|
Loading…
Reference in New Issue
Block a user