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,5 +1,5 @@
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::read_keypair;
use solana_sdk::signature::read_keypair_file;
// Return an error if a pubkey cannot be parsed.
pub fn is_pubkey(string: String) -> Result<(), String> {
@@ -11,7 +11,7 @@ pub fn is_pubkey(string: String) -> Result<(), String> {
// Return an error if a keypair file cannot be parsed.
pub fn is_keypair(string: String) -> Result<(), String> {
read_keypair(&string)
read_keypair_file(&string)
.map(|_| ())
.map_err(|err| format!("{:?}", err))
}