Documentation
¶
Index ¶
- Constants
- func BufferStdin() *bufio.Reader
- 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 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 MockKeyBase() keys.Keybase
- func PrintInfo(cdc *wire.Codec, info keys.Info)
- func PrintInfos(cdc *wire.Codec, infos []keys.Info)
- func ReadPassphraseFromStdin(name string) (string, error)
- 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 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 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 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 ReadPassphraseFromStdin ¶
ReadPassphraseFromStdin attempts to read a passphrase from STDIN return an error upon failure.
Types ¶
type KeyOutput ¶
type KeyOutput struct { Name string `json:"name"` Type string `json:"type"` Address sdk.AccAddress `json:"address"` PubKey string `json:"pub_key"` Seed string `json:"seed,omitempty"` }
used for outputting keys.Info over REST
func Bech32KeyOutput ¶
create a KeyOutput in bech32 format