keys

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 27 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"
)
View Source
const KeyDBName = "keys"

KeyDBName is the directory under root where we store the keys

Variables

This section is empty.

Functions

func AddNewKeyRequestHandler

func AddNewKeyRequestHandler(indent bool) http.HandlerFunc

add new key REST handler

func Commands

func Commands() *cobra.Command

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

func DeleteKeyRequestHandler

func DeleteKeyRequestHandler(w http.ResponseWriter, r *http.Request)

delete key REST handler

func GetKeyBase

func GetKeyBase() (keys.Keybase, error)

GetKeyBase initializes a read-only KeyBase based on the configuration.

func GetKeyBaseFromDir added in v0.16.0

func GetKeyBaseFromDir(rootDir string) (keys.Keybase, error)

GetKeyBaseFromDir initializes a read-only keybase at a particular dir.

func GetKeyBaseFromDirWithWritePerm added in v0.25.0

func GetKeyBaseFromDirWithWritePerm(rootDir string) (keys.Keybase, error)

GetKeyBaseFromDirWithWritePerm initializes a keybase at a particular dir with write permissions.

func GetKeyBaseWithWritePerm added in v0.25.0

func GetKeyBaseWithWritePerm() (keys.Keybase, error)

GetKeyBaseWithWritePerm initialize a keybase based on the configuration with write permissions.

func GetKeyInfo added in v0.24.0

func GetKeyInfo(name string) (keys.Info, error)

GetKeyInfo returns key info for a given name. An error is returned if the keybase cannot be retrieved or getting the info fails.

func GetKeyRequestHandler

func GetKeyRequestHandler(indent bool) http.HandlerFunc

get key REST handler

func GetPassphrase added in v0.24.0

func GetPassphrase(name string) (string, error)

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 MarshalJSON

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

marshal keys

func PostProcessResponse added in v0.25.0

func PostProcessResponse(w http.ResponseWriter, cdc *codec.Codec, response interface{}, indent bool)

PostProcessResponse performs post process for rest response

func QueryKeysRequestHandler

func QueryKeysRequestHandler(indent bool) http.HandlerFunc

query key list REST handler

func ReadPassphraseFromStdin added in v0.24.0

func ReadPassphraseFromStdin(name string) (string, error)

ReadPassphraseFromStdin attempts to read a passphrase from STDIN return an error upon failure.

func RecoverRequestHandler added in v0.25.0

func RecoverRequestHandler(indent bool) http.HandlerFunc

RecoverRequestHandler performs key recover request

func RegisterRoutes

func RegisterRoutes(r *mux.Router, indent bool)

resgister REST routes

func SeedRequestHandler

func SeedRequestHandler(w http.ResponseWriter, r *http.Request)

Seed REST request handler

func SetKeyBase

func SetKeyBase(kb keys.Keybase)

used to set the keybase manually in test

func UnmarshalJSON added in v0.16.0

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

unmarshal json

func UpdateKeyRequestHandler

func UpdateKeyRequestHandler(w http.ResponseWriter, r *http.Request)

update key REST handler

Types

type DeleteKeyBody

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

delete key request REST body

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.25.0

func Bech32ConsKeyOutput(keyInfo keys.Info) (KeyOutput, error)

Bech32ConsKeyOutput returns key output for a consensus node's key information.

func Bech32KeyOutput added in v0.19.0

func Bech32KeyOutput(info keys.Info) (KeyOutput, error)

create a KeyOutput in bech32 format

func Bech32KeysOutput added in v0.19.0

func Bech32KeysOutput(infos []keys.Info) ([]KeyOutput, error)

create a list of KeyOutput in bech32 format

func Bech32ValKeyOutput added in v0.25.0

func Bech32ValKeyOutput(keyInfo keys.Info) (KeyOutput, error)

Bech32ValKeyOutput returns key output for a validator's key information.

type NewKeyBody

type NewKeyBody struct {
	Name     string `json:"name"`
	Password string `json:"password"`
	Seed     string `json:"seed"`
}

new key request REST body

type RecoverKeyBody added in v0.25.0

type RecoverKeyBody struct {
	Password string `json:"password"`
	Seed     string `json:"seed"`
}

RecoverKeyBody is recover key request REST body

type UpdateKeyBody

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

update key request REST body

Jump to

Keyboard shortcuts

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