aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/export.rs
blob: 1e7809875976b32c90151c07fe002ee7a4ab73d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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(())
}