Documentation ¶
Overview ¶
Copyright (C) 2018 go-gamc authors
This file is part of the go-gamc library.
the go-gamc library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
the go-gamc library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the go-gamc library. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func ZeroBytes(bytes []byte)
- type AddressManager
- func (am *AddressManager) Accounts() []*core.Address
- func (am *AddressManager) Contains(addr *core.Address) bool
- func (am *AddressManager) Export(addr *core.Address, passphrase []byte) ([]byte, error)
- func (am *AddressManager) GetMnemonic(addr *core.Address, passphrase []byte) (string, error)
- func (am *AddressManager) GetPrivateKeyBytMnemonic(memo string) ([]byte, error)
- func (am *AddressManager) Import(keyjson, passphrase []byte) (*core.Address, error)
- func (am *AddressManager) ImportByPrivateKey(prikey, passphrase []byte) (*core.Address, error)
- func (am *AddressManager) Load(keyjson, passphrase []byte) (*core.Address, error)
- func (am *AddressManager) LoadPrivate(privatekey, passphrase []byte) (*core.Address, error)
- func (am *AddressManager) Lock(addr *core.Address) error
- func (am *AddressManager) NewAddress(passphrase []byte) (*core.Address, error)
- func (am *AddressManager) RemoveAddress(addr *core.Address, passphrase []byte) error
- func (am *AddressManager) SignBlock(addr *core.Address, block *core.Block) error
- func (am *AddressManager) SignHash(addr *core.Address, hash byteutils.Hash) ([]byte, error)
- func (am *AddressManager) Unlock(addr *core.Address, passphrase []byte, duration time.Duration) error
- func (am *AddressManager) UpdatePassphrase(addr *core.Address, oldPassphrase, newPassphrase []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAddressNotFound address is not found. ErrAddressNotFound = errors.New("address is not found") // ErrAddressIsLocked address locked. ErrAddressIsLocked = errors.New("address is locked") ErrInvalidPrivateKey = errors.New("private key is invalid") ErrInvalidMnemonic = errors.New("mnemonic is invalid") )
Functions ¶
Types ¶
type AddressManager ¶
type AddressManager struct {
// contains filtered or unexported fields
}
func NewAddressManager ¶
func NewAddressManager(config *config.Config) (*AddressManager, error)
func (*AddressManager) Accounts ¶
func (am *AddressManager) Accounts() []*core.Address
Accounts returns slice of address
func (*AddressManager) Contains ¶
func (am *AddressManager) Contains(addr *core.Address) bool
Contains returns if contains address
func (*AddressManager) GetMnemonic ¶
GetMnemonic
func (*AddressManager) GetPrivateKeyBytMnemonic ¶
func (am *AddressManager) GetPrivateKeyBytMnemonic(memo string) ([]byte, error)
func (*AddressManager) Import ¶
func (am *AddressManager) Import(keyjson, passphrase []byte) (*core.Address, error)
Import import a key file to keystore, compatible ethereum keystore file, write to file
func (*AddressManager) ImportByPrivateKey ¶
func (am *AddressManager) ImportByPrivateKey(prikey, passphrase []byte) (*core.Address, error)
func (*AddressManager) Load ¶
func (am *AddressManager) Load(keyjson, passphrase []byte) (*core.Address, error)
Load load a key file to keystore, unable to write file
func (*AddressManager) LoadPrivate ¶
func (am *AddressManager) LoadPrivate(privatekey, passphrase []byte) (*core.Address, error)
LoadPrivate load a private key to keystore, unable to write file
func (*AddressManager) Lock ¶
func (am *AddressManager) Lock(addr *core.Address) error
Lock lock address
func (*AddressManager) NewAddress ¶
func (am *AddressManager) NewAddress(passphrase []byte) (*core.Address, error)
NewAccount returns a new address and keep it in keystore
func (*AddressManager) RemoveAddress ¶
func (am *AddressManager) RemoveAddress(addr *core.Address, passphrase []byte) error
Remove remove address and encrypted private key from keystore
func (*AddressManager) Unlock ¶
func (am *AddressManager) Unlock(addr *core.Address, passphrase []byte, duration time.Duration) error
Unlock unlock address with passphrase
func (*AddressManager) UpdatePassphrase ¶
func (am *AddressManager) UpdatePassphrase(addr *core.Address, oldPassphrase, newPassphrase []byte) error
Update update addr locked passphrase