account

package
v2.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashMessage added in v2.4.0

func HashMessage(data []byte) hash.Hash256

HashMessage hash the message using preamble

func RecoverAddress added in v2.4.0

func RecoverAddress(messageHash, signature []byte) (address.Address, error)

RecoverAddress recover address by message hash and signature

Types

type Account

type Account interface {
	// Address returns the IoTeX address
	Address() address.Address
	// PrivateKey returns the embedded private key interface
	PrivateKey() crypto.PrivateKey
	// PublicKey returns the embedded public key interface
	PublicKey() crypto.PublicKey
	// Sign signs the message using the private key
	Sign([]byte) ([]byte, error)
	// Verify verifies the message using the public key
	Verify([]byte, []byte) bool
	// Zero zeroes the private key data
	Zero()
	// SignMessage signs the message using preamble
	SignMessage(data []byte) ([]byte, error)
}

Account is a user account

func HexStringToAccount

func HexStringToAccount(privateKey string) (Account, error)

HexStringToAccount generates an account from private key string

func NewAccount

func NewAccount() (Account, error)

NewAccount generates a new account

func PrivateKeyToAccount

func PrivateKeyToAccount(key crypto.PrivateKey) (Account, error)

PrivateKeyToAccount generates an account from an existing private key interface

type Accounts

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

Accounts type

func NewAccounts

func NewAccounts() *Accounts

NewAccounts return Accounts instance

func (*Accounts) AddAccount

func (acts *Accounts) AddAccount(acc Account) error

AddAccount add an account

func (*Accounts) Create

func (acts *Accounts) Create() (Account, error)

Create new account

func (*Accounts) GetAccount

func (acts *Accounts) GetAccount(addr address.Address) (Account, error)

GetAccount by address

func (*Accounts) RemoveAccount

func (acts *Accounts) RemoveAccount(addr address.Address)

RemoveAccount removes an account

Jump to

Keyboard shortcuts

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