solana-keygen - Poor mans keypair encryption (#6259)

* SDK: Refactor (read|write)_keypair

Split file opening and data writing operations
Drop filename == "-" stdio signal. It is an app-level feature

* keygen: Move all non-key printing to stderr

* keygen: Adapt to SDK refactor

* keygen: Factor keypair output out to a helper function
This commit is contained in:
Trent Nelson
2019-10-10 17:01:03 -06:00
committed by GitHub
parent f8b36f4658
commit 9cde67086f
13 changed files with 95 additions and 69 deletions

View File

@@ -1,7 +1,7 @@
use clap::{crate_description, crate_name, crate_version, value_t, App, Arg, ArgMatches};
use solana_core::gen_keys::GenKeys;
use solana_drone::drone::DRONE_PORT;
use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil};
use solana_sdk::signature::{read_keypair_file, Keypair, KeypairUtil};
use std::net::SocketAddr;
use std::process::exit;
use std::time::Duration;
@@ -179,7 +179,7 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
});
if matches.is_present("identity") {
args.identity = read_keypair(matches.value_of("identity").unwrap())
args.identity = read_keypair_file(matches.value_of("identity").unwrap())
.expect("can't read client identity");
} else {
args.identity = {