solana-keygen: Support pubkey recovery directly from seed phrase (#7149)

This commit is contained in:
Justin Starry 2019-11-26 15:30:07 -05:00 committed by GitHub
parent d7a82783be
commit 4fe1716c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -4,7 +4,9 @@ use clap::{
crate_description, crate_name, values_t_or_exit, App, AppSettings, Arg, ArgMatches, SubCommand,
};
use num_cpus;
use solana_clap_utils::keypair::{keypair_from_seed_phrase, SKIP_SEED_PHRASE_VALIDATION_ARG};
use solana_clap_utils::keypair::{
keypair_from_seed_phrase, ASK_KEYWORD, SKIP_SEED_PHRASE_VALIDATION_ARG,
};
use solana_sdk::{
pubkey::write_pubkey_file,
signature::{
@ -138,6 +140,11 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.takes_value(true)
.help("Path to keypair file"),
)
.arg(
Arg::with_name(SKIP_SEED_PHRASE_VALIDATION_ARG.name)
.long(SKIP_SEED_PHRASE_VALIDATION_ARG.long)
.help(SKIP_SEED_PHRASE_VALIDATION_ARG.help),
)
.arg(
Arg::with_name("outfile")
.short("o")
@ -192,6 +199,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
let keypair = if infile == "-" {
let mut stdin = std::io::stdin();
read_keypair(&mut stdin)?
} else if infile == ASK_KEYWORD {
let skip_validation = matches.is_present(SKIP_SEED_PHRASE_VALIDATION_ARG.name);
keypair_from_seed_phrase("pubkey recovery", skip_validation)?
} else {
read_keypair_file(infile)?
};