diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2021-07-31 11:34:58 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2021-07-31 11:34:58 +0200 |
| commit | 177d24325a098e6e62ee9445a0a3cf59a119628c (patch) | |
| tree | 1fc041da39f22296042094605d1ab8d87f78cc58 /src/cmd/public_key.rs | |
| parent | ca26395c8305467985709bb873ee98e6e4fdea75 (diff) | |
add commpand for export public key
Diffstat (limited to 'src/cmd/public_key.rs')
| -rw-r--r-- | src/cmd/public_key.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/cmd/public_key.rs b/src/cmd/public_key.rs new file mode 100644 index 0000000..31e5d0a --- /dev/null +++ b/src/cmd/public_key.rs @@ -0,0 +1,26 @@ +//! Module implementing the `address` subcommand for displaying the public +//! address for corresponding account. + +use crate::cmd::AccountOptions; +use anyhow::Result; +use structopt::StructOpt; + +#[derive(Debug, StructOpt)] +pub struct Options { + #[structopt(flatten)] + account: AccountOptions, +} + +pub fn run(options: Options) -> Result<()> { + println!( + "0x{}", + hex::encode( + &options + .account + .private_key()? + .public() + .serialize_uncompressed() + ) + ); + Ok(()) +} |
