solana-keygen: Support pubkey recovery directly from seed phrase (#7149)
This commit is contained in:
parent
d7a82783be
commit
4fe1716c7a
|
@ -4,7 +4,9 @@ use clap::{
|
||||||
crate_description, crate_name, values_t_or_exit, App, AppSettings, Arg, ArgMatches, SubCommand,
|
crate_description, crate_name, values_t_or_exit, App, AppSettings, Arg, ArgMatches, SubCommand,
|
||||||
};
|
};
|
||||||
use num_cpus;
|
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::{
|
use solana_sdk::{
|
||||||
pubkey::write_pubkey_file,
|
pubkey::write_pubkey_file,
|
||||||
signature::{
|
signature::{
|
||||||
|
@ -138,6 +140,11 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Path to keypair file"),
|
.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(
|
||||||
Arg::with_name("outfile")
|
Arg::with_name("outfile")
|
||||||
.short("o")
|
.short("o")
|
||||||
|
@ -192,6 +199,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
let keypair = if infile == "-" {
|
let keypair = if infile == "-" {
|
||||||
let mut stdin = std::io::stdin();
|
let mut stdin = std::io::stdin();
|
||||||
read_keypair(&mut 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 {
|
} else {
|
||||||
read_keypair_file(infile)?
|
read_keypair_file(infile)?
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue