From 177d24325a098e6e62ee9445a0a3cf59a119628c Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Sat, 31 Jul 2021 11:34:58 +0200 Subject: add commpand for export public key --- src/cmd/public_key.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/cmd/public_key.rs (limited to 'src/cmd') 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(()) +} -- cgit v1.2.3