keys

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecrypt = errors.New("could not decrypt key with given passphrase")
)

Functions

func GetBech32AddrByPubkey added in v1.0.3

func GetBech32AddrByPubkey(pubkey secp256k1.PubKeySecp256k1) (string, error)

func GetBech32AddrByPubkeyStr added in v1.0.3

func GetBech32AddrByPubkeyStr(pubkeyStr string) (string, error)

func GetCompressedAddress added in v1.0.6

func GetCompressedAddress(uncompressedPubKey string) (crypto.Address, error)

func GetCompressedPubKey added in v1.0.6

func GetCompressedPubKey(uncompressedPubKey string) (compressedPubKey []byte, err error)

params:

uncompressedPubKey: "04b2bf9a87dd7cf1ad998721ffef00713a4d5fb2bae0316eea04268ae877a0bcacd41b5b363911a30c0254ca12148d48e3cd4562e3e4b5d8cd3e6d2107a69754e6"

return value:

compressedPubKey: 33 bytes compressed pubkey
err: is nil if success

func GetUCAddressBech32 added in v1.0.6

func GetUCAddressBech32(uncompressedPubKey string) (string, error)

Types

type CryptoJSON

type CryptoJSON struct {
	Cipher       string                 `json:"cipher"`
	CipherText   string                 `json:"ciphertext"`
	CipherParams cipherparamsJSON       `json:"cipherparams"`
	KDF          string                 `json:"kdf"`
	KDFParams    map[string]interface{} `json:"kdfparams"`
	MAC          string                 `json:"mac"`
}

type EncryptedKeyJSON

type EncryptedKeyJSON struct {
	Address string     `json:"address"`
	Crypto  CryptoJSON `json:"crypto"`
	Id      string     `json:"id"`
	Version string     `json:"version"`
}

type KeyManager

type KeyManager interface {
	Sign(msg tx.StdSignMsg) ([]byte, error)
	SignBytes(msg []byte) ([]byte, error)
	GetPrivKey() crypto.PrivKey
	GetAddr() types.AccAddress
	GetUCPubKey() (UCPubKey []byte, err error)
}

func NewKeyStoreKeyManager

func NewKeyStoreKeyManager(file string, auth string) (KeyManager, error)

func NewKeystoreByImportKeystore added in v1.0.2

func NewKeystoreByImportKeystore(file string, auth string) (KeyManager, error)

type PlainKeyJSON

type PlainKeyJSON struct {
	Address    string `json:"address"`
	PrivateKey string `json:"privatekey"`
	Id         string `json:"id"`
	Version    int    `json:"version"`
}

Jump to

Keyboard shortcuts

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