diff options
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/address.rs | 2 | ||||
| -rw-r--r-- | src/cmd/export.rs | 19 | ||||
| -rw-r--r-- | src/cmd/new.rs | 2 | ||||
| -rw-r--r-- | src/cmd/sign.rs | 5 |
4 files changed, 23 insertions, 5 deletions
diff --git a/src/cmd/address.rs b/src/cmd/address.rs index b0322b2..199de69 100644 --- a/src/cmd/address.rs +++ b/src/cmd/address.rs @@ -6,7 +6,7 @@ use anyhow::Result; use structopt::StructOpt; #[derive(Debug, StructOpt)] -#[structopt(about = "print account public address")] +#[structopt(about = "Print account public address")] pub struct Options { #[structopt(flatten)] account: AccountOptions, diff --git a/src/cmd/export.rs b/src/cmd/export.rs new file mode 100644 index 0000000..1e78098 --- /dev/null +++ b/src/cmd/export.rs @@ -0,0 +1,19 @@ +//! Module implementing the `export` subcommand for displaying an account's +//! private key. + +use crate::cmd::AccountOptions; +use anyhow::Result; +use structopt::StructOpt; + +#[derive(Debug, StructOpt)] +#[structopt(about = "Export a private key")] +pub struct Options { + #[structopt(flatten)] + account: AccountOptions, +} + +pub fn run(options: Options) -> Result<()> { + let key = options.account.private_key()?; + println!("0x{}", hex::encode(key.secret())); + Ok(()) +} diff --git a/src/cmd/new.rs b/src/cmd/new.rs index 699b825..95af22a 100644 --- a/src/cmd/new.rs +++ b/src/cmd/new.rs @@ -6,7 +6,7 @@ use anyhow::Result; use structopt::StructOpt; #[derive(Debug, StructOpt)] -#[structopt(about = "generate a new HD wallet mnemonic")] +#[structopt(about = "Generate a new HD wallet mnemonic")] pub struct Options { /// The number of words for the mnemonic phrase. #[structopt(short = "n", long, default_value = "12")] diff --git a/src/cmd/sign.rs b/src/cmd/sign.rs index 59095ae..bf88849 100644 --- a/src/cmd/sign.rs +++ b/src/cmd/sign.rs @@ -1,5 +1,4 @@ -//! Module implementing the `address` subcommand for displaying the public -//! address for corresponding account. +//! Module implementing the `sign` subcommand for generating ECDSA signatures. use crate::{cmd::AccountOptions, hash}; use anyhow::{Context as _, Result}; @@ -7,7 +6,7 @@ use std::convert::TryInto; use structopt::StructOpt; #[derive(Debug, StructOpt)] -#[structopt(about = "print account public address")] +#[structopt(about = "Sign a message")] pub struct Options { #[structopt(flatten)] account: AccountOptions, |
