account

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeystoreAddress

func GetKeystoreAddress(path string) (string, error)

GetKeystoreAddress gets the address info from a keystore json file

Types

type Account

type Account struct {
	Path     string
	Address  types.Address
	PrivKey  *crypto.PrivateKey
	Unlocked bool
}

Account offers method to operate ecdsa keys stored in a keystore file path

func NewAccountFromFile

func NewAccountFromFile(filePath string) (*Account, error)

NewAccountFromFile create account from file.

func (*Account) Addr

func (acc *Account) Addr() string

Addr return addr

func (*Account) AddrType

func (acc *Account) AddrType() types.Address

AddrType returns Address interface of the account

func (*Account) PrivateKey

func (acc *Account) PrivateKey() *crypto.PrivateKey

PrivateKey returns the accounts private key in compressed byte format

func (*Account) PubKeyHash

func (acc *Account) PubKeyHash() []byte

PubKeyHash returns Public Key Hash of the account

func (*Account) PublicKey

func (acc *Account) PublicKey() []byte

PublicKey returns the account's public key in compressed byte format

func (*Account) SaveWithPassphrase

func (acc *Account) SaveWithPassphrase(passphrase string) error

SaveWithPassphrase save account with passphrase

func (*Account) Sign

func (acc *Account) Sign(messageHash *crypto.HashType) (*crypto.Signature, error)

Sign calculates an ECDSA signature of messageHash using privateKey. returns error if account is locked or sign process failed

func (*Account) UnlockWithPassphrase

func (acc *Account) UnlockWithPassphrase(passphrase string) error

UnlockWithPassphrase unlocks an account and generate its private key

Jump to

Keyboard shortcuts

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