Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type EthConfig ¶
type Identity ¶
type Identity interface {
// GetPrivateKey return *ecdsa.PrivateKey, it include PublicKey and ethereum Address shortly
GetPrivateKey() (*ecdsa.PrivateKey, error)
// New creates new account in keystore.
// Do not open created account.
New(passphrase string) error
// Open opens loaded account
Open(passphrase string) error
// Import imports existing account from given json and pass-phrase
Import(json []byte, passphrase string) error
// ImportECDSA imports existing account from given private key and pass-phrase
ImportECDSA(key *ecdsa.PrivateKey, passphrase string) error
}
Identity interface uses for auth and detect all objects in network source implementation going to go-ethereum accounting its need to be storing wallets in one dir and opened it by passphrase
func NewIdentity ¶
NewIdentity creates new identity instance which operates given key storage dir
type KeyOpener ¶
type KeyOpener interface {
// GetPassPhraser return PassPhraser interface
// that provides pass phrase for loaded keys
GetPassPhraser() PassPhraser
// OpenKeystore opens key storage.
// Bool param is true if keystore did not exist and was created.
OpenKeystore() (bool, error)
// GetKey returns private key from opened storage
GetKey() (*ecdsa.PrivateKey, error)
}
KeyOpener is interface for loading Eth keys
func DefaultKeyOpener ¶
DefaultKeyOpener return KeyOpener configured for using with pre-defined pass-phrase or retrieve pass-phrase interactively
func NewKeyOpener ¶
func NewKeyOpener(keyDir string, pf PassPhraser) KeyOpener
NewKeyOpener returns KeyOpener that able to open keys
type KeyStorager ¶
type KeyStorager interface {
// KeyStore returns path to key store
KeyStore() string
// PassPhrase returns passphrase for keystore
PassPhrase() string
}
KeyStorager interface describe an item that must know something about a path to the keystore and a passphrase
type PassPhraser ¶
PassPhraser is interface for retrieving pass phrase for Eth keys
If you want to retrieve pass phrases reader different ways (e.g: from file, from env variables, interactively from terminal) you must implement PassPhraser reader a different way and pass it to KeyOpener instance
func NewInteractivePassPhraser ¶
func NewInteractivePassPhraser() PassPhraser
NewInteractivePassPhraser implements PassPhraser that prompts user for pass-phrase and read it from terminal's Stdin
func NewStaticPassPhraser ¶
func NewStaticPassPhraser(p string) PassPhraser
type Printer ¶
type Printer interface {
Printf(format string, i ...interface{})
}
Printer interface describe anything that can print something somehow on a something.
func NewFmtPrinter ¶
func NewFmtPrinter() Printer
func NewSilentPrinter ¶
func NewSilentPrinter() Printer
NewSilentPrinter returns new printer which can prints nothing