account

package
v0.0.0-...-919ab28 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2017 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAddressToAccountMappingFailure  = errors.New("cannot retrieve a valid account for a given address")
	ErrAccountToKeyMappingFailure      = errors.New("cannot retrieve a valid key for a given account")
	ErrWhisperIdentityInjectionFailure = errors.New("failed to inject identity into Whisper")
	ErrWhisperClearIdentitiesFailure   = errors.New("failed to clear whisper identities")
	ErrNoAccountSelected               = errors.New("no account has been selected, please login")
	ErrInvalidMasterKeyCreated         = errors.New("can not create master extended key")
)

errors

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager represents account manager interface

func NewManager

func NewManager(nodeManager common.NodeManager) *Manager

NewManager returns new node account manager

func (*Manager) Accounts

func (m *Manager) Accounts() ([]gethcommon.Address, error)

Accounts returns list of addresses for selected account, including subaccounts.

func (*Manager) AccountsRPCHandler

func (m *Manager) AccountsRPCHandler() rpc.Handler

AccountsRPCHandler returns RPC Handler for the Accounts() method.

func (*Manager) AddressToDecryptedAccount

func (m *Manager) AddressToDecryptedAccount(address, password string) (accounts.Account, *keystore.Key, error)

AddressToDecryptedAccount tries to load decrypted key for a given account. The running node, has a keystore directory which is loaded on start. Key file for a given address is expected to be in that directory prior to node start.

func (*Manager) CreateAccount

func (m *Manager) CreateAccount(password string) (address, pubKey, mnemonic string, err error)

CreateAccount creates an internal geth account BIP44-compatible keys are generated: CKD#1 is stored as account key, CKD#2 stored as sub-account root Public key of CKD#1 is returned, with CKD#2 securely encoded into account key file (to be used for sub-account derivations)

func (*Manager) CreateChildAccount

func (m *Manager) CreateChildAccount(parentAddress, password string) (address, pubKey string, err error)

CreateChildAccount creates sub-account for an account identified by parent address. CKD#2 is used as root for master accounts (when parentAddress is ""). Otherwise (when parentAddress != ""), child is derived directly from parent.

func (*Manager) Logout

func (m *Manager) Logout() error

Logout clears whisper identities

func (*Manager) ReSelectAccount

func (m *Manager) ReSelectAccount() error

ReSelectAccount selects previously selected account, often, after node restart.

func (*Manager) RecoverAccount

func (m *Manager) RecoverAccount(password, mnemonic string) (address, pubKey string, err error)

RecoverAccount re-creates master key using given details. Once master key is re-generated, it is inserted into keystore (if not already there).

func (*Manager) SelectAccount

func (m *Manager) SelectAccount(address, password string) error

SelectAccount selects current account, by verifying that address has corresponding account which can be decrypted using provided password. Once verification is done, decrypted key is injected into Whisper (as a single identity, all previous identities are removed).

func (*Manager) SelectedAccount

func (m *Manager) SelectedAccount() (*common.SelectedExtKey, error)

SelectedAccount returns currently selected account

func (*Manager) VerifyAccountPassword

func (m *Manager) VerifyAccountPassword(keyStoreDir, address, password string) (*keystore.Key, error)

VerifyAccountPassword tries to decrypt a given account key file, with a provided password. If no error is returned, then account is considered verified.

Jump to

Keyboard shortcuts

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