cosmos-sdk: Index | Files

package keys

import ""


Package Files

add.go codec.go delete.go export.go import.go list.go migrate.go mnemonic.go parse.go root.go show.go types.go utils.go


const (
    // FlagAddress is the flag for the user's address on the command line.
    FlagAddress = "address"
    // FlagPublicKey represents the user's public key on the command line.
    FlagPublicKey = "pubkey"
    // FlagBechPrefix defines a desired Bech32 prefix encoding for a key.
    FlagBechPrefix = "bech"
    // FlagDevice indicates that the information should be shown in the device
    FlagDevice = "device"
const (
    OutputFormatText = "text"
    OutputFormatJSON = "json"

available output formats.

const (

    // DefaultKeyPass contains the default key password for genesis transactions
    DefaultKeyPass = "12345678"


var KeysCdc *codec.Codec

KeysCdc defines codec to be used with key operations

func AddKeyCommand Uses

func AddKeyCommand() *cobra.Command

AddKeyCommand defines a keys command to add a generated or recovered private key to keybase.

func Commands Uses

func Commands(defaultNodeHome string) *cobra.Command

Commands registers a sub-tree of commands to interact with local private key storage.

func DeleteKeyCommand Uses

func DeleteKeyCommand() *cobra.Command

DeleteKeyCommand deletes a key from the key store.

func ExportKeyCommand Uses

func ExportKeyCommand() *cobra.Command

ExportKeyCommand exports private keys from the key store.

func ImportKeyCommand Uses

func ImportKeyCommand() *cobra.Command

ImportKeyCommand imports private keys from a keyfile.

func ListKeysCmd Uses

func ListKeysCmd() *cobra.Command

ListKeysCmd lists all keys in the key store.

func MarshalJSON Uses

func MarshalJSON(o interface{}) ([]byte, error)

marshal keys

func MigrateCommand Uses

func MigrateCommand() *cobra.Command

MigrateCommand migrates key information from legacy keybase to OS secret store.

func MnemonicKeyCommand Uses

func MnemonicKeyCommand() *cobra.Command

MnemonicKeyCommand computes the bip39 memonic for input entropy.

func NewLegacyKeyBaseFromDir Uses

func NewLegacyKeyBaseFromDir(rootDir string, opts ...cryptokeyring.KeybaseOption) (cryptokeyring.LegacyKeybase, error)

NewLegacyKeyBaseFromDir initializes a legacy keybase at the rootDir directory. Keybase options can be applied when generating this new Keybase.

func ParseKeyStringCommand Uses

func ParseKeyStringCommand() *cobra.Command

ParseKeyStringCommand parses an address from hex to bech32 and vice versa.

func RunAddCmd Uses

func RunAddCmd(cmd *cobra.Command, args []string, kb keyring.Keyring, inBuf *bufio.Reader) error


- bip39 mnemonic
- bip39 passphrase
- bip44 path
- local encryption password


- armor encrypted private key (saved to file)

func ShowKeysCmd Uses

func ShowKeysCmd() *cobra.Command

ShowKeysCmd shows key information for a given key name.

func UnmarshalJSON Uses

func UnmarshalJSON(bz []byte, ptr interface{}) error

unmarshal json

type AddNewKey Uses

type AddNewKey struct {
    Name     string `json:"name"`
    Password string `json:"password"`
    Mnemonic string `json:"mnemonic"`
    Account  int    `json:"account,string,omitempty"`
    Index    int    `json:"index,string,omitempty"`

AddNewKey request a new key

func NewAddNewKey Uses

func NewAddNewKey(name, password, mnemonic string, account, index int) AddNewKey

NewAddNewKey constructs a new AddNewKey request structure.

type DeleteKeyReq Uses

type DeleteKeyReq struct {
    Password string `json:"password"`

DeleteKeyReq requests deleting a key

func NewDeleteKeyReq Uses

func NewDeleteKeyReq(password string) DeleteKeyReq

NewDeleteKeyReq constructs a new DeleteKeyReq structure.

type RecoverKey Uses

type RecoverKey struct {
    Password string `json:"password"`
    Mnemonic string `json:"mnemonic"`
    Account  int    `json:"account,string,omitempty"`
    Index    int    `json:"index,string,omitempty"`

RecoverKeyBody recovers a key

func NewRecoverKey Uses

func NewRecoverKey(password, mnemonic string, account, index int) RecoverKey

NewRecoverKey constructs a new RecoverKey request structure.

type UpdateKeyReq Uses

type UpdateKeyReq struct {
    OldPassword string `json:"old_password"`
    NewPassword string `json:"new_password"`

UpdateKeyReq requests updating a key

func NewUpdateKeyReq Uses

func NewUpdateKeyReq(old, new string) UpdateKeyReq

NewUpdateKeyReq constructs a new UpdateKeyReq structure.

Package keys imports 29 packages (graph) and is imported by 47 packages. Updated 2020-07-29. Refresh now. Tools for package owners.