key

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 13 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateHashWithoutSign

func CalculateHashWithoutSign(txBody *types.TxBody) []byte

CalculateHashWithoutSign return hash of tx without sign field

func EncryptKey added in v0.9.0

func EncryptKey(key []byte, pass string) ([]byte, error)

EncryptKey encrypts a key with a given export for exporting

func GenerateAddress

func GenerateAddress(pubkey *ecdsa.PublicKey) []byte

func SignTx

func SignTx(tx *types.Tx, key *aergokey) error

func VerifyTx

func VerifyTx(tx *types.Tx) error

VerifyTx return result to varify sign

func VerifyTxWithAddress added in v0.9.0

func VerifyTxWithAddress(tx *types.Tx, address []byte) error

Types

type Address

type Address = []byte

type Store

type Store struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Store stucture of keystore

func NewStore

func NewStore(storePath string, unlockTimeout uint) *Store

NewStore make new instance of keystore

func (*Store) CloseStore

func (ks *Store) CloseStore()

func (*Store) CreateKey

func (ks *Store) CreateKey(pass string) (Address, error)

CreateKey make new key in keystore and return it's address

func (*Store) ExportKey

func (ks *Store) ExportKey(addr Address, pass string) ([]byte, error)

ExportKey is to export encrypted key

func (*Store) GetAddresses

func (ks *Store) GetAddresses() ([]Address, error)

func (*Store) ImportKey

func (ks *Store) ImportKey(imported []byte, oldpass string, newpass string) (Address, error)

ImportKey is to import encrypted key

func (*Store) Lock

func (ks *Store) Lock(addr Address, pass string) (Address, error)

Lock is to lock account prevent signing

func (*Store) SaveAddress

func (ks *Store) SaveAddress(addr Address) error

func (*Store) Sign

func (ks *Store) Sign(addr Address, pass string, hash []byte) ([]byte, error)

Sign return sign with key in the store

func (*Store) SignTx

func (ks *Store) SignTx(tx *types.Tx, requester []byte) error

SignTx return transaction which signed with unlocked key. if requester is nil, requester is assumed to tx.Account

func (*Store) Unlock

func (ks *Store) Unlock(addr Address, pass string) (Address, error)

Unlock is to unlock account for signing

func (*Store) VerifyTx

func (ks *Store) VerifyTx(tx *types.Tx) error

VerifyTx return result to varify sign

Jump to

Keyboard shortcuts

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