Documentation ¶
Index ¶
- Constants
- Variables
- func AddKeyCommand() *cobra.Command
- func Commands() *cobra.Command
- func DeleteKeyCommand() *cobra.Command
- func ExportKeyCommand() *cobra.Command
- func ImportKeyCommand() *cobra.Command
- func ListKeysCmd() *cobra.Command
- func MarshalJSON(o interface{}) ([]byte, error)
- func MigrateCommand() *cobra.Command
- func MnemonicKeyCommand() *cobra.Command
- func NewInMemoryKeyBase() keys.Keybase
- func NewKeyBaseFromDir(rootDir string, opts ...keys.KeybaseOption) (keys.Keybase, error)
- func ParseKeyStringCommand() *cobra.Command
- func RunAddCmd(cmd *cobra.Command, args []string, kb keys.Keybase, inBuf *bufio.Reader) error
- func ShowKeysCmd() *cobra.Command
- func UnmarshalJSON(bz []byte, ptr interface{}) error
- func UpdateKeyCommand() *cobra.Command
- type AddNewKey
- type DeleteKeyReq
- type RecoverKey
- type UpdateKeyReq
Constants ¶
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"
)
Variables ¶
var KeysCdc *codec.Codec
KeysCdc defines codec to be used with key operations
Functions ¶
func AddKeyCommand ¶
AddKeyCommand defines a keys command to add a generated or recovered private key to keybase.
func Commands ¶
Commands registers a sub-tree of commands to interact with local private key storage.
func DeleteKeyCommand ¶
DeleteKeyCommand deletes a key from the key store.
func ExportKeyCommand ¶
ExportKeyCommand exports private keys from the key store.
func ImportKeyCommand ¶
ImportKeyCommand imports private keys from a keyfile.
func MigrateCommand ¶
MigrateCommand migrates key information from legacy keybase to OS secret store.
func MnemonicKeyCommand ¶
MnemonicKeyCommand computes the bip39 memonic for input entropy.
func NewInMemoryKeyBase ¶ added in v0.1.3
NewInMemoryKeyBase returns a storage-less keybase.
func NewKeyBaseFromDir ¶ added in v0.1.3
NewKeyBaseFromDir initializes a keybase at the rootDir directory. Keybase options can be applied when generating this new Keybase.
func ParseKeyStringCommand ¶
ParseKeyStringCommand parses an address from hex to bech32 and vice versa.
func RunAddCmd ¶
input
- bip39 mnemonic
- bip39 passphrase
- bip44 path
- local encryption password
output
- armor encrypted private key (saved to file)
func ShowKeysCmd ¶
ShowKeysCmd shows key information for a given key name.
func UpdateKeyCommand ¶ added in v0.1.3
UpdateKeyCommand changes the password of a key in the keybase. It takes no effect on keys managed by new the keyring-based keybase implementation.
Types ¶
type AddNewKey ¶
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 ¶
NewAddNewKey constructs a new AddNewKey request structure.
type DeleteKeyReq ¶
type DeleteKeyReq struct {
Password string `json:"password"`
}
DeleteKeyReq requests deleting a key
func NewDeleteKeyReq ¶
func NewDeleteKeyReq(password string) DeleteKeyReq
NewDeleteKeyReq constructs a new DeleteKeyReq structure.
type RecoverKey ¶
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 ¶
func NewRecoverKey(password, mnemonic string, account, index int) RecoverKey
NewRecoverKey constructs a new RecoverKey request structure.
type UpdateKeyReq ¶
type UpdateKeyReq struct { OldPassword string `json:"old_password"` NewPassword string `json:"new_password"` }
UpdateKeyReq requests updating a key
func NewUpdateKeyReq ¶
func NewUpdateKeyReq(old, new string) UpdateKeyReq
NewUpdateKeyReq constructs a new UpdateKeyReq structure.