mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Add tty password input (#2503)
* Add tty password input * Move password from core/service to core/cli * Fix test build error * Password should be entered only once if it's for decoding * Update Cargo.lock from rebuild
This commit is contained in:
@@ -365,6 +365,11 @@ fn fill_network_configuration(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn input_keystore_password() -> Result<String, String> {
|
||||
rpassword::read_password_from_tty(Some("Keystore password: "))
|
||||
.map_err(|e| format!("{:?}", e))
|
||||
}
|
||||
|
||||
fn create_run_node_config<F, S>(
|
||||
cli: RunCmd, spec_factory: S, impl_name: &'static str, version: &VersionInfo
|
||||
) -> error::Result<FactoryFullConfiguration<F>>
|
||||
@@ -374,6 +379,9 @@ where
|
||||
{
|
||||
let spec = load_spec(&cli.shared_params, spec_factory)?;
|
||||
let mut config = service::Configuration::default_with_spec(spec.clone());
|
||||
if cli.interactive_password {
|
||||
config.password = input_keystore_password()?
|
||||
}
|
||||
|
||||
config.impl_name = impl_name;
|
||||
config.impl_commit = version.commit;
|
||||
|
||||
@@ -395,6 +395,10 @@ pub struct RunCmd {
|
||||
/// Enable authoring even when offline.
|
||||
#[structopt(long = "force-authoring")]
|
||||
pub force_authoring: bool,
|
||||
|
||||
/// Interactive password for validator key.
|
||||
#[structopt(short = "i")]
|
||||
pub interactive_password: bool,
|
||||
}
|
||||
|
||||
/// Stores all required Cli values for a keyring test account.
|
||||
|
||||
Reference in New Issue
Block a user