Documentation ¶
Index ¶
- Constants
- func BufferStdin() *bufio.Reader
- func ErrKeyNameConflict(name string) error
- func ErrMissingName() error
- func ErrMissingPassword() error
- func ErrMissingSeed() error
- func GetCheckPassword(prompt, prompt2 string, buf *bufio.Reader) (string, error)
- func GetConfirmation(prompt string, buf *bufio.Reader) (bool, error)
- func GetKey(name string) (keys.Info, error)
- func GetKeyBase() (keys.Keybase, error)
- func GetKeyBaseFromDB(db dbm.DB) keys.Keybase
- func GetKeyBaseFromDir(rootDir string) (keys.Keybase, error)
- func GetKeyBaseFromDirWithWritePerm(rootDir string) (keys.Keybase, error)
- func GetKeyBaseWithWritePerm() (keys.Keybase, error)
- func GetKeyInfo(name string) (keys.Info, error)
- func GetPassphrase(name string) (string, error)
- func GetPassword(prompt string, buf *bufio.Reader) (pass string, err error)
- func GetSeed(prompt string, buf *bufio.Reader) (seed string, err error)
- func InputIsTty() bool
- func MarshalJSON(o interface{}) ([]byte, error)
- func MockKeyBase() keys.Keybase
- func PostProcessResponse(w http.ResponseWriter, cdc *codec.Codec, response interface{}, indent bool)
- func PrintInfos(cdc *codec.Codec, infos []keys.Info)
- func PrintKeyAddress(info keys.Info, bechKeyOut BechKeyOutFn)
- func PrintKeyInfo(keyInfo keys.Info, bechKeyOut BechKeyOutFn)
- func PrintKeyOutput(ko KeyOutput)
- func PrintPubKey(info keys.Info, bechKeyOut BechKeyOutFn)
- func ReadKeystorePassphraseFromStdin() (string, error)
- func ReadPassphraseFromStdin(name string) (string, error)
- func UnmarshalJSON(bz []byte, ptr interface{}) error
- type BechKeyOutFn
- type KeyOutput
Constants ¶
const KeyDBName = "keys"
KeyDBName is the directory under root where we store the keys
const MinPassLength = 8
MinPassLength is the minimum acceptable password length
Variables ¶
This section is empty.
Functions ¶
func BufferStdin ¶
BufferStdin is used to allow reading prompts for stdin multiple times, when we read from non-tty
func ErrKeyNameConflict ¶ added in v0.7.0
func ErrMissingName ¶ added in v0.7.0
func ErrMissingName() error
func ErrMissingPassword ¶ added in v0.7.0
func ErrMissingPassword() error
func ErrMissingSeed ¶ added in v0.7.0
func ErrMissingSeed() error
func GetCheckPassword ¶
GetCheckPassword will prompt for a password twice to verify they match (for creating a new password). It enforces the password length. Only parses password once if input is piped in.
func GetConfirmation ¶
GetConfirmation will request user give the confirmation from stdin. "y", "Y", "yes", "YES", and "Yes" all count as confirmations. If the input is not recognized, it will ask again.
func GetKeyBase ¶
initialize a keybase based on the configuration
func GetKeyBaseFromDB ¶
GetKeyBase initializes a keybase based on the given db. The KeyBase manages all activity requiring access to a key.
func GetKeyBaseFromDir ¶
initialize a keybase based on the configuration
func GetKeyBaseFromDirWithWritePerm ¶ added in v0.7.0
GetKeyBaseFromDirWithWritePerm initializes a keybase at a particular dir with write permissions.
func GetKeyBaseWithWritePerm ¶ added in v0.7.0
GetKeyBaseWithWritePerm initialize a keybase based on the configuration with write permissions.
func GetKeyInfo ¶
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 ¶
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 GetPassword ¶
GetPassword will prompt for a password one-time (to sign a tx) It enforces the password length
func InputIsTty ¶ added in v0.15.0
func InputIsTty() bool
inputIsTty returns true iff we have an interactive prompt, where we can disable echo and request to repeat the password. If false, we can optimize for piped input from another command
func MockKeyBase ¶
MockKeyBase generates an in-memory keybase that will be discarded useful for --dry-run to generate a seed phrase without storing the key
func PostProcessResponse ¶ added in v0.7.0
func PostProcessResponse(w http.ResponseWriter, cdc *codec.Codec, response interface{}, indent bool)
PostProcessResponse performs post process for rest response
func PrintKeyAddress ¶ added in v0.7.0
func PrintKeyAddress(info keys.Info, bechKeyOut BechKeyOutFn)
func PrintKeyInfo ¶ added in v0.7.0
func PrintKeyInfo(keyInfo keys.Info, bechKeyOut BechKeyOutFn)
func PrintKeyOutput ¶ added in v0.7.0
func PrintKeyOutput(ko KeyOutput)
func PrintPubKey ¶ added in v0.7.0
func PrintPubKey(info keys.Info, bechKeyOut BechKeyOutFn)
func ReadKeystorePassphraseFromStdin ¶ added in v0.15.0
func ReadPassphraseFromStdin ¶
ReadPassphraseFromStdin attempts to read a passphrase from STDIN return an error upon failure.
Types ¶
type BechKeyOutFn ¶ added in v0.7.0
func GetBechKeyOut ¶ added in v0.7.0
func GetBechKeyOut(bechPrefix string) (BechKeyOutFn, error)
type KeyOutput ¶
type KeyOutput struct { Name string `json:"name"` Type string `json:"type"` Address string `json:"address"` PubKey string `json:"pub_key"` Seed string `json:"seed,omitempty"` }
used for outputting keys.Info over REST
func Bech32ConsKeyOutput ¶ added in v0.7.0
Bech32ConsKeyOutput returns key output for a consensus node's key information.
func Bech32KeyOutput ¶
Bech32KeyOutput create a KeyOutput in bech32 format
func Bech32KeysOutput ¶
create a list of KeyOutput in bech32 format