wallet

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: Apache-2.0, MIT Imports: 12 Imported by: 30

Documentation

Index

Constants

View Source
const (
	KNamePrefix  = "wallet-"
	KTrashPrefix = "trash-"
	KDefault     = "default"
	KTBLS        = "bls"
	KTSecp256k1  = "secp256k1"
)

Variables

This section is empty.

Functions

func ActSigType added in v0.3.0

func ActSigType(typ string) crypto.SigType

Types

type Key

type Key struct {
	types.KeyInfo

	PublicKey []byte
	Address   address.Address
}

func GenerateKey

func GenerateKey(typ crypto.SigType) (*Key, error)

func NewKey

func NewKey(keyinfo types.KeyInfo) (*Key, error)

type MemKeyStore

type MemKeyStore struct {
	// contains filtered or unexported fields
}

func NewMemKeyStore

func NewMemKeyStore() *MemKeyStore

func (*MemKeyStore) Delete

func (mks *MemKeyStore) Delete(k string) error

Delete removes a key from keystore

func (*MemKeyStore) Get

func (mks *MemKeyStore) Get(k string) (types.KeyInfo, error)

Get gets a key out of keystore and returns KeyInfo corresponding to named key

func (*MemKeyStore) List

func (mks *MemKeyStore) List() ([]string, error)

List lists all the keys stored in the KeyStore

func (*MemKeyStore) Put

func (mks *MemKeyStore) Put(k string, ki types.KeyInfo) error

Put saves a key info under given name

type Wallet

type Wallet struct {
	// contains filtered or unexported fields
}

func KeyWallet

func KeyWallet(keys ...*Key) *Wallet

func NewWallet

func NewWallet(keystore types.KeyStore) (*Wallet, error)

func (*Wallet) DeleteKey added in v0.4.0

func (w *Wallet) DeleteKey(addr address.Address) error

func (*Wallet) Export

func (w *Wallet) Export(addr address.Address) (*types.KeyInfo, error)

func (*Wallet) GenerateKey

func (w *Wallet) GenerateKey(typ crypto.SigType) (address.Address, error)

func (*Wallet) GetDefault

func (w *Wallet) GetDefault() (address.Address, error)

func (*Wallet) HasKey

func (w *Wallet) HasKey(addr address.Address) (bool, error)

func (*Wallet) Import

func (w *Wallet) Import(ki *types.KeyInfo) (address.Address, error)

func (*Wallet) ListAddrs

func (w *Wallet) ListAddrs() ([]address.Address, error)

func (*Wallet) SetDefault

func (w *Wallet) SetDefault(a address.Address) error

func (*Wallet) Sign

func (w *Wallet) Sign(ctx context.Context, addr address.Address, msg []byte) (*crypto.Signature, error)

Jump to

Keyboard shortcuts

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