Skip to content

Commit

Permalink
Bump secrecy from 0.6.0 to 0.7.0 (paritytech#7568)
Browse files Browse the repository at this point in the history
* Bump secrecy from 0.6.0 to 0.7.0

Bumps [secrecy](https://github.com/iqlusioninc/crates) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/iqlusioninc/crates/releases)
- [Commits](iqlusioninc/crates@secrecy/v0.6.0...secrecy/v0.7.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Fix compilation errors

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pierre Krieger <[email protected]>
  • Loading branch information
2 people authored and darkfriend77 committed Jan 11, 2021
1 parent a99fd9a commit 33f9b5b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 7 additions & 16 deletions client/cli/src/params/keystore_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ use std::fs;
use std::path::PathBuf;
use structopt::StructOpt;
use crate::error;
use sp_core::crypto::{SecretString, Zeroize};
use std::str::FromStr;
use sp_core::crypto::SecretString;

/// default sub directory for the key store
const DEFAULT_KEYSTORE_CONFIG_PATH: &'static str = "keystore";
Expand Down Expand Up @@ -72,21 +71,15 @@ impl KeystoreParams {
let password = if self.password_interactive {
#[cfg(not(target_os = "unknown"))]
{
let mut password = input_keystore_password()?;
let secret = std::str::FromStr::from_str(password.as_str())
.map_err(|()| "Error reading password")?;
password.zeroize();
Some(secret)
let password = input_keystore_password()?;
Some(SecretString::new(password))
}
#[cfg(target_os = "unknown")]
None
} else if let Some(ref file) = self.password_filename {
let mut password = fs::read_to_string(file)
let password = fs::read_to_string(file)
.map_err(|e| format!("{}", e))?;
let secret = std::str::FromStr::from_str(password.as_str())
.map_err(|()| "Error reading password")?;
password.zeroize();
Some(secret)
Some(SecretString::new(password))
} else {
self.password.clone()
};
Expand All @@ -104,10 +97,8 @@ impl KeystoreParams {
let (password_interactive, password) = (self.password_interactive, self.password.clone());

let pass = if password_interactive {
let mut password = rpassword::read_password_from_tty(Some("Key password: "))?;
let pass = Some(FromStr::from_str(&password).map_err(|()| "Error reading password")?);
password.zeroize();
pass
let password = rpassword::read_password_from_tty(Some("Key password: "))?;
Some(SecretString::new(password))
} else {
password
};
Expand Down
2 changes: 1 addition & 1 deletion primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tiny-bip39 = { version = "0.8", optional = true }
regex = { version = "1.3.1", optional = true }
num-traits = { version = "0.2.8", default-features = false }
zeroize = { version = "1.0.0", default-features = false }
secrecy = { version = "0.6.0", default-features = false }
secrecy = { version = "0.7.0", default-features = false }
lazy_static = { version = "1.4.0", default-features = false, optional = true }
parking_lot = { version = "0.10.0", optional = true }
sp-debug-derive = { version = "2.0.0", path = "../debug-derive" }
Expand Down

0 comments on commit 33f9b5b

Please sign in to comment.