Documentation ¶
Index ¶
- Constants
- func Commands() *cobra.Command
- func GetKeyInfo(name string) (keys.Info, error)
- func GetPassphrase(name string) (string, error)
- func MarshalJSON(o interface{}) ([]byte, error)
- func NewInMemoryKeyBase() keys.Keybase
- func NewKeyBaseFromDir(rootDir string) (keys.Keybase, error)
- func NewKeyBaseFromHomeFlag() (keys.Keybase, error)
- func ReadPassphraseFromStdin(name string) (string, error)
- func UnmarshalJSON(bz []byte, ptr interface{}) error
- 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" // FlagBechPrefix defines a desired Bech32 prefix encoding for a key. FlagDevice = "device" )
const ( OutputFormatText = "text" OutputFormatJSON = "json" )
available output formats.
Variables ¶
This section is empty.
Functions ¶
func Commands ¶
Commands registers a sub-tree of commands to interact with local private key storage.
func GetKeyInfo ¶ added in v0.24.0
GetKeyInfo returns key info for a given name. An error is returned if the keybase cannot be retrieved or getting the info fails.
func GetPassphrase ¶ added in v0.24.0
GetPassphrase returns a passphrase for a given name. It will first retrieve the key info for that name if the type is local, it'll fetch input from STDIN. Otherwise, an empty passphrase is returned. An error is returned if the key info cannot be fetched or reading from STDIN fails.
func NewInMemoryKeyBase ¶ added in v0.31.0
NewInMemoryKeyBase returns a storage-less keybase.
func NewKeyBaseFromDir ¶ added in v0.31.0
NewKeyBaseFromDir initializes a keybase at a particular dir.
func NewKeyBaseFromHomeFlag ¶ added in v0.31.0
NewKeyBaseFromHomeFlag initializes a Keybase based on the configuration.
func ReadPassphraseFromStdin ¶ added in v0.24.0
ReadPassphraseFromStdin attempts to read a passphrase from STDIN return an error upon failure.
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.