mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-29 06:01:21 +00:00
Code cleanup from review comments
This commit is contained in:
parent
a944bdebfc
commit
d665c9ef10
@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
// deleteCmd represents the delete command
|
// deleteCmd represents the delete command
|
||||||
var deleteCmd = &cobra.Command{
|
var deleteCmd = &cobra.Command{
|
||||||
Use: "delete <name>",
|
Use: "delete [name]",
|
||||||
Short: "DANGER: Delete a private key from your system",
|
Short: "DANGER: Delete a private key from your system",
|
||||||
RunE: runDeleteCmd,
|
RunE: runDeleteCmd,
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
// getCmd represents the get command
|
// getCmd represents the get command
|
||||||
var getCmd = &cobra.Command{
|
var getCmd = &cobra.Command{
|
||||||
Use: "get <name>",
|
Use: "get [name]",
|
||||||
Short: "Get details of one key",
|
Short: "Get details of one key",
|
||||||
Long: `Return public details of one local key.`,
|
Long: `Return public details of one local key.`,
|
||||||
RunE: runGetCmd,
|
RunE: runGetCmd,
|
||||||
|
@ -33,7 +33,7 @@ const (
|
|||||||
|
|
||||||
// newCmd represents the new command
|
// newCmd represents the new command
|
||||||
var newCmd = &cobra.Command{
|
var newCmd = &cobra.Command{
|
||||||
Use: "new <name>",
|
Use: "new [name]",
|
||||||
Short: "Create a new public/private key pair",
|
Short: "Create a new public/private key pair",
|
||||||
Long: `Add a public/private key pair to the key store.
|
Long: `Add a public/private key pair to the key store.
|
||||||
The password muts be entered in the terminal and not
|
The password muts be entered in the terminal and not
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
// recoverCmd represents the recover command
|
// recoverCmd represents the recover command
|
||||||
var recoverCmd = &cobra.Command{
|
var recoverCmd = &cobra.Command{
|
||||||
Use: "recover <name>",
|
Use: "recover [name]",
|
||||||
Short: "Change the password for a private key",
|
Short: "Change the password for a private key",
|
||||||
RunE: runRecoverCmd,
|
RunE: runRecoverCmd,
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
// updateCmd represents the update command
|
// updateCmd represents the update command
|
||||||
var updateCmd = &cobra.Command{
|
var updateCmd = &cobra.Command{
|
||||||
Use: "update <name>",
|
Use: "update [name]",
|
||||||
Short: "Change the password for a private key",
|
Short: "Change the password for a private key",
|
||||||
RunE: runUpdateCmd,
|
RunE: runUpdateCmd,
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,7 @@ func (s Manager) assertKeyManager() keys.Manager {
|
|||||||
// Create adds a new key to the storage engine, returning error if
|
// Create adds a new key to the storage engine, returning error if
|
||||||
// another key already stored under this name
|
// another key already stored under this name
|
||||||
//
|
//
|
||||||
// algo must be a supported go-crypto algorithm:
|
// algo must be a supported go-crypto algorithm: ed25519, secp256k1
|
||||||
//
|
|
||||||
func (s Manager) Create(name, passphrase, algo string) (keys.Info, string, error) {
|
func (s Manager) Create(name, passphrase, algo string) (keys.Info, string, error) {
|
||||||
gen, err := getGenerator(algo)
|
gen, err := getGenerator(algo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -54,6 +53,12 @@ func (s Manager) Create(name, passphrase, algo string) (keys.Info, string, error
|
|||||||
return info(name, key), phrase, err
|
return info(name, key), phrase, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recover takes a seed phrase and tries to recover the private key.
|
||||||
|
//
|
||||||
|
// If the seed phrase is valid, it will create the private key and store
|
||||||
|
// it under name, protected by passphrase.
|
||||||
|
//
|
||||||
|
// Result similar to New(), except it doesn't return the seed again...
|
||||||
func (s Manager) Recover(name, passphrase, seedphrase string) (keys.Info, error) {
|
func (s Manager) Recover(name, passphrase, seedphrase string) (keys.Info, error) {
|
||||||
words := strings.Split(strings.TrimSpace(seedphrase), " ")
|
words := strings.Split(strings.TrimSpace(seedphrase), " ")
|
||||||
data, err := s.codec.WordsToBytes(words)
|
data, err := s.codec.WordsToBytes(words)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user