add a password hash tool
This commit is contained in:
parent
02626865bf
commit
65f4ceae78
1 changed files with 12 additions and 0 deletions
12
src/main.rs
12
src/main.rs
|
@ -52,6 +52,11 @@ enum ToolsCommand {
|
||||||
/// Manage crypto roots
|
/// Manage crypto roots
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
CryptoRoot(CryptoRootCommand),
|
CryptoRoot(CryptoRootCommand),
|
||||||
|
|
||||||
|
PasswordHash {
|
||||||
|
#[clap(env = "AEROGRAMME_PASSWORD")]
|
||||||
|
maybe_password: Option<String>,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
|
@ -190,6 +195,13 @@ async fn main() -> Result<()> {
|
||||||
bail!("Your want to run a 'Companion' command but your configuration file has role 'Provider'.");
|
bail!("Your want to run a 'Companion' command but your configuration file has role 'Provider'.");
|
||||||
},
|
},
|
||||||
(Command::Tools(subcommand), _) => match subcommand {
|
(Command::Tools(subcommand), _) => match subcommand {
|
||||||
|
ToolsCommand::PasswordHash { maybe_password } => {
|
||||||
|
let password = match maybe_password {
|
||||||
|
Some(pwd) => pwd.clone(),
|
||||||
|
None => rpassword::prompt_password("Enter password: ")?,
|
||||||
|
};
|
||||||
|
println!("{}", hash_password(&password)?);
|
||||||
|
},
|
||||||
ToolsCommand::CryptoRoot(crcommand) => {
|
ToolsCommand::CryptoRoot(crcommand) => {
|
||||||
match crcommand {
|
match crcommand {
|
||||||
CryptoRootCommand::New { maybe_password } => {
|
CryptoRootCommand::New { maybe_password } => {
|
||||||
|
|
Loading…
Reference in a new issue