Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename and move secretY string function.
  • Loading branch information
cheme committed Jul 1, 2020
commit 005dfc4a543172911f8d5666f0cc116bb699d3a3
10 changes: 8 additions & 2 deletions client/cli/src/params/keystore_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use sc_service::config::KeystoreConfig;
use std::fs;
use std::path::PathBuf;
use structopt::StructOpt;
use sp_core::crypto::{SecretString, secrety_string_from_str};
use sp_core::crypto::SecretString;

/// default sub directory for the key store
const DEFAULT_KEYSTORE_CONFIG_PATH: &'static str = "keystore";
Expand All @@ -43,7 +43,7 @@ pub struct KeystoreParams {
/// Password used by the keystore.
#[structopt(
long = "password",
parse(try_from_str = secrety_string_from_str),
parse(try_from_str = secret_string_from_str),
conflicts_with_all = &[ "password-interactive", "password-filename" ]
)]
pub password: Option<SecretString>,
Expand All @@ -58,6 +58,12 @@ pub struct KeystoreParams {
pub password_filename: Option<PathBuf>,
}

/// Parse a sercret string, returning a displayable error.
pub fn secret_string_from_str(s: &str) -> Result<SecretString, String> {
Ok(std::str::FromStr::from_str(s)
.map_err(|_e| "Could not get SecretString".to_string())?)
}

impl KeystoreParams {
/// Get the keystore configuration for the parameters
pub fn keystore_config(&self, base_path: &PathBuf) -> Result<KeystoreConfig> {
Expand Down
7 changes: 0 additions & 7 deletions primitives/core/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ pub use secrecy::ExposeSecret;
#[cfg(feature = "std")]
pub use secrecy::SecretString;

#[cfg(feature = "std")]
/// Parse a sercret string, returning a displayable error.
pub fn secrety_string_from_str(s: &str) -> Result<SecretString, String> {
Ok(std::str::FromStr::from_str(s)
.map_err(|_e| "Could not get SecretString".to_string())?)
}

/// The root phrase for our publicly known keys.
pub const DEV_PHRASE: &str = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";

Expand Down