keys

package
v0.41.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	OutputFormatText = "text"
	OutputFormatJSON = "json"
)

available output formats.

View Source
const (

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

Variables

KeysCdc defines codec to be used with key operations

Functions

func AddKeyCommand added in v0.41.4

func AddKeyCommand() *cobra.Command

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

func Commands

func Commands(defaultNodeHome string) *cobra.Command

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

func DeleteKeyCommand added in v0.41.4

func DeleteKeyCommand() *cobra.Command

DeleteKeyCommand deletes a key from the key store.

func ExportKeyCommand added in v0.41.4

func ExportKeyCommand() *cobra.Command

ExportKeyCommand exports private keys from the key store.

func ImportKeyCommand added in v0.41.4

func ImportKeyCommand() *cobra.Command

ImportKeyCommand imports private keys from a keyfile.

func ListKeysCmd added in v0.41.4

func ListKeysCmd() *cobra.Command

ListKeysCmd lists all keys in the key store.

func MarshalJSON

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

marshal keys

func MigrateCommand added in v0.41.4

func MigrateCommand() *cobra.Command

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

func MnemonicKeyCommand added in v0.41.4

func MnemonicKeyCommand() *cobra.Command

MnemonicKeyCommand computes the bip39 memonic for input entropy.

func NewLegacyKeyBaseFromDir added in v0.41.4

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 added in v0.41.4

func ParseKeyStringCommand() *cobra.Command

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

func RunAddCmd added in v0.41.4

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

input

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

output

  • armor encrypted private key (saved to file)

func ShowKeysCmd added in v0.41.4

func ShowKeysCmd() *cobra.Command

ShowKeysCmd shows key information for a given key name.

func UnmarshalJSON added in v0.16.0

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

unmarshal json

Types

type AddNewKey added in v0.31.0

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 added in v0.41.4

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

NewAddNewKey constructs a new AddNewKey request structure.

type DeleteKeyReq added in v0.31.0

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

DeleteKeyReq requests deleting a key

func NewDeleteKeyReq added in v0.41.4

func NewDeleteKeyReq(password string) DeleteKeyReq

NewDeleteKeyReq constructs a new DeleteKeyReq structure.

type RecoverKey added in v0.31.0

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 added in v0.41.4

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

NewRecoverKey constructs a new RecoverKey request structure.

type UpdateKeyReq added in v0.31.0

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

UpdateKeyReq requests updating a key

func NewUpdateKeyReq added in v0.41.4

func NewUpdateKeyReq(old, new string) UpdateKeyReq

NewUpdateKeyReq constructs a new UpdateKeyReq structure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL