Documentation ¶
Index ¶
- Variables
- func CreateAddress() (address, pubKey, privKey string, err error)
- func FromAddress(accountAddress string) types.Address
- func ParseAccountString(account string) (types.Account, error)
- func ToAddress(accountAddress string) *types.Address
- type ErrZeroAddress
- type GethManager
- type Info
- type LoginParams
- type Manager
- func (m *Manager) Accounts() ([]types.Address, error)
- func (m *Manager) AccountsGenerator() *generator.Generator
- func (m *Manager) AddressToDecryptedAccount(address, password string) (types.Account, *types.Key, error)
- func (m *Manager) CreateAccount(password string) (Info, string, error)
- func (m *Manager) GetKeystore() types.KeyStore
- func (m *Manager) ImportAccount(privateKey *ecdsa.PrivateKey, password string) (types.Address, error)
- func (m *Manager) ImportOnboardingAccount(id string, password string) (Info, string, error)
- func (m *Manager) ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, password string) (address, pubKey string, err error)
- func (m *Manager) Logout()
- func (m *Manager) MainAccountAddress() (types.Address, error)
- func (m *Manager) MigrateKeyStoreDir(oldDir, newDir string, addresses []string) error
- func (m *Manager) RecoverAccount(password, mnemonic string) (Info, error)
- func (m *Manager) RemoveOnboarding()
- func (m *Manager) SelectAccount(loginParams LoginParams) error
- func (m *Manager) SelectedChatAccount() (*SelectedExtKey, error)
- func (m *Manager) SetAccountAddresses(main types.Address, secondary ...types.Address)
- func (m *Manager) SetChatAccount(privKey *ecdsa.PrivateKey)
- func (m *Manager) StartOnboarding(accountsCount, mnemonicPhraseLength int) ([]*OnboardingAccount, error)
- func (m *Manager) VerifyAccountPassword(keyStoreDir, address, password string) (*types.Key, error)
- func (m *Manager) WatchAddresses() []types.Address
- 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") ErrAccountKeyStoreMissing = errors.New("account key store is not set") )
errors
var ( ErrInvalidAccountAddressOrKey = errors.New("cannot parse address or key to valid account address") ErrInvalidMnemonicPhraseLength = errors.New("invalid mnemonic phrase length; valid lengths are 12, 15, 18, 21, and 24") )
errors
Functions ¶
func CreateAddress ¶ added in v0.35.0
func FromAddress ¶
FromAddress converts account address from string to types.Address. The function is useful to format "From" field of send transaction struct.
func ParseAccountString ¶
ParseAccountString parses hex encoded string and returns is as types.Account.
Types ¶
type ErrZeroAddress ¶ added in v0.35.0
type ErrZeroAddress struct {
// contains filtered or unexported fields
}
func (*ErrZeroAddress) Error ¶ added in v0.35.0
func (e *ErrZeroAddress) Error() string
type GethManager ¶ added in v0.39.0
type GethManager struct { *Manager // contains filtered or unexported fields }
GethManager represents account manager interface.
func NewGethManager ¶ added in v0.39.7
func NewGethManager() *GethManager
NewGethManager returns new node account manager.
func (*GethManager) GetManager ¶ added in v0.39.0
func (m *GethManager) GetManager() *accounts.Manager
func (*GethManager) InitKeystore ¶ added in v0.39.0
func (m *GethManager) InitKeystore(keydir string) error
InitKeystore sets key manager and key store.
type LoginParams ¶ added in v0.35.0
type LoginParams struct { ChatAddress types.Address `json:"chatAddress"` Password string `json:"password"` MainAccount types.Address `json:"mainAccount"` WatchAddresses []types.Address `json:"watchAddresses"` }
func ParseLoginParams ¶ added in v0.35.0
func ParseLoginParams(paramsJSON string) (LoginParams, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager represents account manager interface.
func (*Manager) Accounts ¶
Accounts returns list of addresses for selected account, including subaccounts.
func (*Manager) AccountsGenerator ¶ added in v0.35.0
AccountsGenerator returns accountsGenerator.
func (*Manager) AddressToDecryptedAccount ¶
func (m *Manager) AddressToDecryptedAccount(address, password string) (types.Account, *types.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) GetKeystore ¶ added in v0.35.0
GetKeystore is only used in tests
func (*Manager) ImportAccount ¶ added in v0.35.0
func (m *Manager) ImportAccount(privateKey *ecdsa.PrivateKey, password string) (types.Address, error)
ImportAccount imports the account specified with privateKey.
func (*Manager) ImportOnboardingAccount ¶ added in v0.35.0
ImportOnboardingAccount imports the account specified by id and encrypts it with password.
func (*Manager) ImportSingleExtendedKey ¶ added in v0.35.0
func (m *Manager) ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, password string) (address, pubKey string, err error)
ImportSingleExtendedKey imports an extended key setting it in both the PrivateKey and ExtendedKey fields of the Key struct. ImportExtendedKey is used in older version of Status where PrivateKey is set to be the BIP44 key at index 0, and ExtendedKey is the extended key of the BIP44 key at index 1.
func (*Manager) MainAccountAddress ¶ added in v0.35.0
MainAccountAddress returns currently selected watch addresses.
func (*Manager) MigrateKeyStoreDir ¶ added in v0.55.1
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 ¶
func (m *Manager) SelectAccount(loginParams LoginParams) error
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) SetAccountAddresses ¶ added in v0.35.0
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.
func (*Manager) VerifyAccountPassword ¶
VerifyAccountPassword tries to decrypt a given account key file, with a provided password. If no error is returned, then account is considered verified.
func (*Manager) WatchAddresses ¶ added in v0.35.0
WatchAddresses returns currently selected watch addresses.
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 types.Address AccountKey *types.Key SubAccounts []types.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.