Documentation
¶
Index ¶
- func GetKeystoreAddress(path string) (string, error)
- func ReadPassphraseStdin() (string, error)
- type Account
- func (acc *Account) Addr() string
- func (acc *Account) PrivateKey() *crypto.PrivateKey
- func (acc *Account) PubKeyHash() []byte
- func (acc *Account) PublicKey() []byte
- func (acc *Account) Sign(messageHash *crypto.HashType) (*crypto.Signature, error)
- func (acc *Account) UnlockWithPassphrase(passphrase string) error
- type Manager
- func (wlt *Manager) DumpPrivKey(address, passphrase string) (string, error)
- func (wlt *Manager) GetAccount(pubKeyHash string) (account *Account, exist bool)
- func (wlt *Manager) ListAccounts() []*Account
- func (wlt *Manager) NewAccount(passphrase string) (string, string, error)
- func (wlt *Manager) NewAccountWithPrivKey(privKey *crypto.PrivateKey, passphrase string) (string, string, error)
- func (wlt *Manager) Sign(msg []byte, pubKeyHash, passphrase string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKeystoreAddress ¶
GetKeystoreAddress gets the address info from a keystore json file
func ReadPassphraseStdin ¶
ReadPassphraseStdin reads passphrase from stdin without echo passphrase into terminal
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account offers method to operate ecdsa keys stored in a keystore file path
func NewAccountFromFile ¶
NewAccountFromFile create account from file.
func (*Account) PrivateKey ¶
func (acc *Account) PrivateKey() *crypto.PrivateKey
PrivateKey returns the accounts private key in compressed byte format
func (*Account) PubKeyHash ¶
PubKeyHash returns Public Key Hash of the account
func (*Account) Sign ¶
Sign calculates an ECDSA signature of messageHash using privateKey. returns error if account is locked or sign process failed
func (*Account) UnlockWithPassphrase ¶
UnlockWithPassphrase unlocks an account and generate its private key
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a directory based type to manipulate account Operation add/delete/query, import/export and sign are supported
func NewWalletManager ¶
NewWalletManager creates a wallet manager from files in the path
func (*Manager) DumpPrivKey ¶
DumpPrivKey returns an account's private key bytes in hex string format
func (*Manager) GetAccount ¶
GetAccount checks if this Manager contains this public key and returns the related account if it exists
func (*Manager) ListAccounts ¶
ListAccounts returns all the addresses of keystore files in directory
func (*Manager) NewAccount ¶
NewAccount creates a ecdsa key pair and store them in a file encrypted by the passphrase user entered returns a hexstring format public key hash, address and error
func (*Manager) NewAccountWithPrivKey ¶
func (wlt *Manager) NewAccountWithPrivKey(privKey *crypto.PrivateKey, passphrase string) (string, string, error)
NewAccountWithPrivKey store the give private key in a file encrypted by the passphrase user entered returns a hexstring format public key hash, address and error