wallet

package
v0.0.0-...-bc1f52c Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPubKey

func GetPubKey(privKey []byte) ([]byte, error)

Types

type IWallets

type IWallets interface {
	Create([]byte) (*Seed, error)
	Close() error
	DBExists() bool
	Seed([]byte, []byte) (*Seed, error)
	GetSeeds() ([]SeedNoPrivKey, error)
	UpdateSeeds([]SeedNoPrivKey)
	Validate([]byte) bool
	GetUserAddress([]byte) string
}

type Seed

type Seed struct {
	Address   []byte
	Timestamp int64
	PubKey    []byte
	PrivKey   []byte
	Mnemonic  []byte
	ExtraData map[string]interface{}
}

Seed represents each 'item' in the blockchain

type SeedNoPrivKey

type SeedNoPrivKey struct {
	Timestamp int64
	Address   []byte
	Password  []byte
}

type Wallets

type Wallets struct {
	File      string
	Seeds     []SeedNoPrivKey
	TempSeeds []SeedNoPrivKey
	// contains filtered or unexported fields
}

Wallets represent a wallet adapter.

func New

func New(cfg config.Wallet, log *zap.Logger) (*Wallets, error)

New represent a new wallet adapter.

func (*Wallets) Close

func (w *Wallets) Close() error

Close the wallet adapter.

func (*Wallets) Create

func (w *Wallets) Create(password []byte) (*Seed, error)

Create a new seed by associating it with a password.

func (*Wallets) DBExists

func (w *Wallets) DBExists() bool

func (*Wallets) GetSeeds

func (w *Wallets) GetSeeds() ([]SeedNoPrivKey, error)

GetSeeds get all seeds in local memory.

func (*Wallets) GetUserAddress

func (w *Wallets) GetUserAddress(privKey []byte) string

func (*Wallets) Seed

func (w *Wallets) Seed(mnemonic, password []byte) (*Seed, error)

Seed finds a seed from a combination of a password and a mnemonic.

func (*Wallets) UpdateSeeds

func (w *Wallets) UpdateSeeds(seed []SeedNoPrivKey)

UpdateSeeds update the local list of seeds. @todo update wallet database

func (*Wallets) Validate

func (w *Wallets) Validate(privKey []byte) bool

Validate a private key.

Jump to

Keyboard shortcuts

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