wallet

package
v0.0.0-...-041d6b2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KNamePrefix = "wallet-"
	KDefault    = "default"
)

Variables

This section is empty.

Functions

func ActSigType

func ActSigType(typ types.KeyType) types.SigType

Types

type Default

type Default interface {
	GetDefault() (address.Address, error)
}

type Key

type Key struct {
	types.KeyInfo

	PublicKey []byte
	Address   peer.ID
}

func GenerateKey

func GenerateKey(typ types.KeyType) (*Key, error)

func NewKey

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

NewKey generates a new Key based on private key and signature type it works with both types of signatures Secp256k1 and BLS

type LocalWallet

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

func KeyWallet

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

func NewWallet

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

func (*LocalWallet) GetDefault

func (w *LocalWallet) GetDefault() (peer.ID, error)

func (*LocalWallet) NewKey

func (w *LocalWallet) NewKey(typ types.KeyType) (peer.ID, error)

func (*LocalWallet) Sign

func (w *LocalWallet) Sign(addr peer.ID, msg []byte) (*types.Signature, error)

func (*LocalWallet) WalletHas

func (w *LocalWallet) WalletHas(ctx context.Context, addr peer.ID) (bool, 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

Jump to

Keyboard shortcuts

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