accounts

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_OPEN     = 44
	STATUS_CLOSED   = 45
	SESSION_TIMEOUT = 30
)

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() error
}

func NewWallet

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

type WalletKeyStore added in v0.14.0

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

WalletKeyStore keeps a session storage of accounts on the Full Node

func NewWalletKeyStore added in v0.14.0

func NewWalletKeyStore(path string) (*WalletKeyStore, error)

func (*WalletKeyStore) Add added in v0.14.0

func (wks *WalletKeyStore) Add(account Account) error

func (*WalletKeyStore) Close added in v0.14.0

func (wks *WalletKeyStore) Close()

func (*WalletKeyStore) Delete added in v0.14.0

func (wks *WalletKeyStore) Delete(address keys.Address) error

func (*WalletKeyStore) GetAccount added in v0.14.0

func (wks *WalletKeyStore) GetAccount(address keys.Address) (Account, error)

func (*WalletKeyStore) KeyExists added in v0.14.0

func (wks *WalletKeyStore) KeyExists(address keys.Address) bool

func (*WalletKeyStore) ListAddresses added in v0.14.0

func (wks *WalletKeyStore) ListAddresses() ([]keys.Address, error)

func (*WalletKeyStore) Open added in v0.14.0

func (wks *WalletKeyStore) Open(address keys.Address, passphrase string) bool

func (*WalletKeyStore) SignWithAddress added in v0.14.0

func (wks *WalletKeyStore) SignWithAddress(data []byte, address keys.Address) (keys.PublicKey, []byte, error)

func (*WalletKeyStore) VerifyPassphrase added in v0.14.0

func (wks *WalletKeyStore) VerifyPassphrase(address keys.Address, passphrase string) (bool, error)

type WalletStore

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

WalletStore keeps a sessionClose 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() error

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