Documentation ¶
Overview ¶
Package account is a generated GoMock package.
Index ¶
- Variables
- func CreateAddress() (address, pubKey, privKey string, err error)
- func FromAddress(accountAddress string) common.Address
- func ParseAccountString(account string) (accounts.Account, error)
- func ToAddress(accountAddress string) *common.Address
- type GethServiceProvider
- type Info
- type Manager
- func (m *Manager) Accounts() ([]gethcommon.Address, error)
- func (m *Manager) AddressToDecryptedAccount(address, password string) (accounts.Account, *keystore.Key, error)
- func (m *Manager) CreateAccount(password string) (Info, string, error)
- func (m *Manager) CreateChildAccount(parentAddress, password string) (address, pubKey string, err error)
- func (m *Manager) ImportOnboardingAccount(id string, password string) (Info, string, error)
- func (m *Manager) Logout()
- func (m *Manager) RecoverAccount(password, mnemonic string) (Info, error)
- func (m *Manager) RemoveOnboarding()
- func (m *Manager) SelectAccount(walletAddress, chatAddress, password string) error
- func (m *Manager) SelectedChatAccount() (*SelectedExtKey, error)
- func (m *Manager) SelectedWalletAccount() (*SelectedExtKey, error)
- func (m *Manager) SetChatAccount(privKey *ecdsa.PrivateKey)
- func (m *Manager) StartOnboarding(accountsCount, mnemonicPhraseLength int) ([]*OnboardingAccount, error)
- func (m *Manager) VerifyAccountPassword(keyStoreDir, address, password string) (*keystore.Key, error)
- type MockGethServiceProvider
- type MockGethServiceProviderMockRecorder
- type Onboarding
- type OnboardingAccount
- type SelectedExtKey
Constants ¶
This section is empty.
Variables ¶
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") ErrNoAccountSelected = errors.New("no account has been selected, please login") ErrInvalidMasterKeyCreated = errors.New("can not create master extended key") ErrOnboardingNotStarted = errors.New("onboarding must be started before choosing an account") ErrOnboardingAccountNotFound = errors.New("cannot find onboarding account with the given id") )
errors
var (
ErrInvalidAccountAddressOrKey = errors.New("cannot parse address or key to valid account address")
)
errors
var ErrInvalidMnemonicPhraseLength = errors.New("mnemonic phrase length; valid lengths are 12, 15, 18, 21, and 24")
ErrInvalidMnemonicPhraseLength is returned if the requested mnemonic length is invalid. Valid lengths are 12, 15, 18, 21, and 24.
Functions ¶
func CreateAddress ¶ added in v0.35.0
func FromAddress ¶
FromAddress converts account address from string to common.Address. The function is useful to format "From" field of send transaction struct.
func ParseAccountString ¶
ParseAccountString parses hex encoded string and returns is as accounts.Account.
Types ¶
type GethServiceProvider ¶
type GethServiceProvider interface { AccountManager() (*accounts.Manager, error) AccountKeyStore() (*keystore.KeyStore, error) }
GethServiceProvider provides required geth services.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager represents account manager interface.
func NewManager ¶
func NewManager(geth GethServiceProvider) *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) 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 ¶
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) ImportOnboardingAccount ¶ added in v0.35.0
ImportOnboardingAccount imports the account specified by id and encrypts it with password.
func (*Manager) RecoverAccount ¶
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) RemoveOnboarding ¶ added in v0.35.0
func (m *Manager) RemoveOnboarding()
RemoveOnboarding reset the current onboarding struct setting it to nil and deleting the accounts from memory.
func (*Manager) SelectAccount ¶
SelectAccount selects current account, by verifying that address has corresponding account which can be decrypted using provided password. Once verification is done, all previous identities are removed).
func (*Manager) SelectedChatAccount ¶ added in v0.35.0
func (m *Manager) SelectedChatAccount() (*SelectedExtKey, error)
SelectedChatAccount returns currently selected chat account
func (*Manager) SelectedWalletAccount ¶
func (m *Manager) SelectedWalletAccount() (*SelectedExtKey, error)
SelectedWalletAccount returns currently selected wallet account
func (*Manager) SetChatAccount ¶ added in v0.35.0
func (m *Manager) SetChatAccount(privKey *ecdsa.PrivateKey)
SetChatAccount initializes selectedChatAccount with privKey
func (*Manager) StartOnboarding ¶ added in v0.35.0
func (m *Manager) StartOnboarding(accountsCount, mnemonicPhraseLength int) ([]*OnboardingAccount, error)
StartOnboarding starts the onboarding process generating accountsCount accounts and returns a slice of OnboardingAccount.
type MockGethServiceProvider ¶
type MockGethServiceProvider struct {
// contains filtered or unexported fields
}
MockGethServiceProvider is a mock of GethServiceProvider interface
func NewMockGethServiceProvider ¶
func NewMockGethServiceProvider(ctrl *gomock.Controller) *MockGethServiceProvider
NewMockGethServiceProvider creates a new mock instance
func (*MockGethServiceProvider) AccountKeyStore ¶
func (m *MockGethServiceProvider) AccountKeyStore() (*keystore.KeyStore, error)
AccountKeyStore mocks base method
func (*MockGethServiceProvider) AccountManager ¶
func (m *MockGethServiceProvider) AccountManager() (*accounts.Manager, error)
AccountManager mocks base method
func (*MockGethServiceProvider) EXPECT ¶
func (m *MockGethServiceProvider) EXPECT() *MockGethServiceProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockGethServiceProviderMockRecorder ¶
type MockGethServiceProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockGethServiceProviderMockRecorder is the mock recorder for MockGethServiceProvider
func (*MockGethServiceProviderMockRecorder) AccountKeyStore ¶
func (mr *MockGethServiceProviderMockRecorder) AccountKeyStore() *gomock.Call
AccountKeyStore indicates an expected call of AccountKeyStore
func (*MockGethServiceProviderMockRecorder) AccountManager ¶
func (mr *MockGethServiceProviderMockRecorder) AccountManager() *gomock.Call
AccountManager indicates an expected call of AccountManager
type Onboarding ¶ added in v0.35.0
type Onboarding struct {
// contains filtered or unexported fields
}
Onboarding is a struct contains a slice of OnboardingAccount.
func NewOnboarding ¶ added in v0.35.0
func NewOnboarding(n, mnemonicPhraseLength int) (*Onboarding, error)
NewOnboarding returns a new onboarding struct generating n accounts.
func (*Onboarding) Account ¶ added in v0.35.0
func (o *Onboarding) Account(id string) (*OnboardingAccount, error)
Account returns an OnboardingAccount by id.
func (*Onboarding) Accounts ¶ added in v0.35.0
func (o *Onboarding) Accounts() []*OnboardingAccount
Accounts return the list of OnboardingAccount generated.
type OnboardingAccount ¶ added in v0.35.0
type OnboardingAccount struct { ID string `json:"id"` Info Info `json:"info"` // contains filtered or unexported fields }
OnboardingAccount is returned during onboarding and contains its ID and the mnemonic to re-generate the same account Info keys.
type SelectedExtKey ¶
type SelectedExtKey struct { Address common.Address AccountKey *keystore.Key SubAccounts []accounts.Account }
SelectedExtKey is a container for the selected (logged in) external account.
func (*SelectedExtKey) Hex ¶
func (k *SelectedExtKey) Hex() string
Hex dumps address of a given extended key as hex string.