cosmos-sdk/client/keys/root.go
Ethan Buchman 1ee8deed2b Merge PR #2090: Improve crypto/keys and add keys mnemonic and keys new commands
* crypto/keys/hd: use btcec to remove dep on tendermint

* crypto/keys/bcrypt: improve comment about fork

* crypto/keys/bip39 -> crypto/keys/bip39/fundraiser

* crypto/keys/bip39: bring in fork of tyler-smith

* crypto/keys/hd: update dep

* crypto/keys: update deps

* crypto/keys: move mintkey.go into new crypto/keys/mintkey

* crypto/keys/hd: NewParamsFromPath

* crypto/keys: keybase.Derive takes a bip39 passphrase too

* crypto/keys/hd: BIP44Params.DerivationPath

* gaiacli keys: add commands new and mnemonic

* fix lints

* minor fixes from review

* update Gopkg.toml

* add tendermint fork of golang.org/x/crypto
* pin some transitive deps

* crypto/keys/bcrypt: remove

* remove in favour of fork of golang.org/x/crypto/bcrypt at github.com/tendermint/crypto/bcrypt

* crypto/keys/bip39: remove completely

* use fork cosmos/go-bip39 instead

* Gopkg.toml: dont use master

* Pull in changes from my PR

* fixes from review

* enforce min len for --unsafe-entropy

* lint fix

* feedback from review

* fix dep
2018-10-17 13:37:58 -04:00

44 lines
1.3 KiB
Go

package keys
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/gorilla/mux"
"github.com/spf13/cobra"
)
// Commands registers a sub-tree of commands to interact with
// local private key storage.
func Commands() *cobra.Command {
cmd := &cobra.Command{
Use: "keys",
Short: "Add or view local private keys",
Long: `Keys allows you to manage your local keystore for tendermint.
These keys may be in any format supported by go-crypto and can be
used by light-clients, full nodes, or any other application that
needs to sign with a private key.`,
}
cmd.AddCommand(
mnemonicKeyCommand(),
newKeyCommand(),
addKeyCommand(),
listKeysCmd,
showKeysCmd(),
client.LineBreak,
deleteKeyCommand(),
updateKeyCommand(),
)
return cmd
}
// resgister REST routes
func RegisterRoutes(r *mux.Router, indent bool) {
r.HandleFunc("/keys", QueryKeysRequestHandler(indent)).Methods("GET")
r.HandleFunc("/keys", AddNewKeyRequestHandler(indent)).Methods("POST")
r.HandleFunc("/keys/seed", SeedRequestHandler).Methods("GET")
r.HandleFunc("/keys/{name}/recover", RecoverRequestHandler(indent)).Methods("POST")
r.HandleFunc("/keys/{name}", GetKeyRequestHandler(indent)).Methods("GET")
r.HandleFunc("/keys/{name}", UpdateKeyRequestHandler).Methods("PUT")
r.HandleFunc("/keys/{name}", DeleteKeyRequestHandler).Methods("DELETE")
}