accounts

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGetAccountByAddress = errors.New("account not found for address")

Functions

This section is empty.

Types

type Account

type Account struct {
	Type chain.Type `json:"type"`
	Name string     `json:"name"`

	PublicKey  *keys.PublicKey  `json:"publicKey"`
	PrivateKey *keys.PrivateKey `json:"privateKey"`
}

func GenerateNewAccount added in v0.10.8

func GenerateNewAccount(t chain.Type, name string) (Account, error)

func NewAccount

func NewAccount(t chain.Type, name string, privkey *keys.PrivateKey, pubkey *keys.PublicKey) (Account, error)

func (Account) Address

func (acc Account) Address() keys.Address

func (Account) Bytes

func (acc Account) Bytes() []byte

func (*Account) Data

func (t *Account) Data() serialize.Data

func (*Account) FromBytes

func (acc *Account) FromBytes(msg []byte) *Account

func (*Account) NewDataInstance

func (t *Account) NewDataInstance() serialize.Data

func (*Account) SetData

func (t *Account) SetData(a interface{}) error

func (Account) Sign

func (acc Account) Sign(msg []byte) ([]byte, error)

func (Account) String

func (acc Account) String() string

type AccountData

type AccountData struct {
	Type chain.Type
	Name string

	PublicKeyData  []byte
	PrivateKeyData []byte
}

func (*AccountData) SerialTag

func (ad *AccountData) SerialTag() string

type Wallet

type Wallet interface {
	//returns the account that the wallet holds
	Accounts() []Account

	Add(Account) error

	Delete(Account) error

	GetAccount(address keys.Address) (Account, error)

	SignWithAccountIndex([]byte, int) (keys.PublicKey, []byte, error)

	SignWithAddress([]byte, keys.Address) (keys.PublicKey, []byte, error)

	Close()
}

func NewWallet

func NewWallet(config config.Server, dbDir string) Wallet

type WalletStore

type WalletStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

WalletStore keeps a session storage of accounts on the Full Node

func (WalletStore) Accounts

func (ws WalletStore) Accounts() []Account

Accounts returns all the accounts in the wallet store

func (*WalletStore) Add

func (ws *WalletStore) Add(account Account) error

func (WalletStore) Close

func (ws WalletStore) Close()

func (*WalletStore) Delete

func (ws *WalletStore) Delete(account Account) error

func (WalletStore) GetAccount

func (ws WalletStore) GetAccount(address keys.Address) (Account, error)

func (WalletStore) SignWithAccountIndex

func (ws WalletStore) SignWithAccountIndex(msg []byte, index int) (keys.PublicKey, []byte, error)

func (WalletStore) SignWithAddress

func (ws WalletStore) SignWithAddress(msg []byte, address keys.Address) (keys.PublicKey, []byte, error)

Jump to

Keyboard shortcuts

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