Documentation ¶
Index ¶
- Variables
- func MnemonicPhraseLengthToEntropyStrength(length int) (extkeys.EntropyStrength, error)
- func ValidateKeystoreExtendedKey(key *types.Key) error
- type Account
- type AccountInfo
- type AccountManager
- type GeneratedAccountInfo
- type GeneratedAndDerivedAccountInfo
- type Generator
- func (g *Generator) CreateAccountFromMnemonicAndDeriveAccountsForPaths(mnemonicPhrase string, bip39Passphrase string, paths []string) (GeneratedAndDerivedAccountInfo, error)
- func (g *Generator) CreateAccountFromPrivateKey(privateKeyHex string) (IdentifiedAccountInfo, error)
- func (g *Generator) DeriveAddresses(accountID string, pathStrings []string) (map[string]AccountInfo, error)
- func (g *Generator) Generate(mnemonicPhraseLength int, n int, bip39Passphrase string) ([]GeneratedAccountInfo, error)
- func (g *Generator) GenerateAndDeriveAddresses(mnemonicPhraseLength int, n int, bip39Passphrase string, pathStrings []string) ([]GeneratedAndDerivedAccountInfo, error)
- func (g *Generator) ImportJSONKey(json string, password string) (IdentifiedAccountInfo, error)
- func (g *Generator) ImportMnemonic(mnemonicPhrase string, bip39Passphrase string) (GeneratedAccountInfo, error)
- func (g *Generator) ImportPrivateKey(privateKeyHex string) (IdentifiedAccountInfo, error)
- func (g *Generator) LoadAccount(address string, password string) (IdentifiedAccountInfo, error)
- func (g *Generator) Reset()
- func (g *Generator) StoreAccount(accountID string, password string) (AccountInfo, error)
- func (g *Generator) StoreDerivedAccounts(accountID string, password string, pathStrings []string) (map[string]AccountInfo, error)
- type IdentifiedAccountInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAccountNotFoundByID is returned when the selected account doesn't exist in memory. ErrAccountNotFoundByID = errors.New("account not found") // ErrAccountCannotDeriveChildKeys is returned when trying to derive child accounts from a normal key. ErrAccountCannotDeriveChildKeys = errors.New("selected account cannot derive child keys") // ErrAccountManagerNotSet is returned when the account mananger instance is not set. ErrAccountManagerNotSet = errors.New("account manager not set") )
View Source
var ( // ErrInvalidKeystoreExtendedKey is returned when the decrypted keystore file // contains some old Status keys. // The old version used to store the BIP44 account at index 0 as PrivateKey, // and the BIP44 account at index 1 as ExtendedKey. // The current version stores the same key as PrivateKey and ExtendedKey. ErrInvalidKeystoreExtendedKey = errors.New("PrivateKey and ExtendedKey are different") ErrInvalidMnemonicPhraseLength = errors.New("invalid mnemonic phrase length; valid lengths are 12, 15, 18, 21, and 24") )
Functions ¶
func MnemonicPhraseLengthToEntropyStrength ¶
func MnemonicPhraseLengthToEntropyStrength(length int) (extkeys.EntropyStrength, error)
MnemonicPhraseLengthToEntropyStrength returns the entropy strength for a given mnemonic length
func ValidateKeystoreExtendedKey ¶
ValidateKeystoreExtendedKey validates the keystore keys, checking that ExtendedKey is the extended key of PrivateKey.
Types ¶
type Account ¶ added in v0.65.0
type Account struct {
// contains filtered or unexported fields
}
func NewAccount ¶ added in v0.65.0
func NewAccount(privateKey *ecdsa.PrivateKey, extKey *extkeys.ExtendedKey) Account
func (*Account) ToAccountInfo ¶ added in v0.65.0
func (a *Account) ToAccountInfo() AccountInfo
func (*Account) ToGeneratedAccountInfo ¶ added in v0.65.0
func (a *Account) ToGeneratedAccountInfo(id string, mnemonic string) GeneratedAccountInfo
func (*Account) ToIdentifiedAccountInfo ¶ added in v0.65.0
func (a *Account) ToIdentifiedAccountInfo(id string) IdentifiedAccountInfo
type AccountInfo ¶
type AccountInfo struct { PrivateKey string `json:"privateKey"` PublicKey string `json:"publicKey"` Address string `json:"address"` }
AccountInfo contains a PublicKey and an Address of an account.
func (AccountInfo) MarshalJSON ¶ added in v0.125.4
func (a AccountInfo) MarshalJSON() ([]byte, error)
type AccountManager ¶
type AccountManager interface { AddressToDecryptedAccount(address, password string) (types.Account, *types.Key, error) ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, password string) (address, pubKey string, err error) ImportAccount(privateKey *ecdsa.PrivateKey, password string) (types.Address, error) }
type GeneratedAccountInfo ¶
type GeneratedAccountInfo struct { IdentifiedAccountInfo Mnemonic string `json:"mnemonic"` }
GeneratedAccountInfo contains IdentifiedAccountInfo and the mnemonic of an account.
func (GeneratedAccountInfo) MarshalJSON ¶ added in v0.125.4
func (g GeneratedAccountInfo) MarshalJSON() ([]byte, error)
type GeneratedAndDerivedAccountInfo ¶
type GeneratedAndDerivedAccountInfo struct { GeneratedAccountInfo Derived map[string]AccountInfo `json:"derived"` }
GeneratedAndDerivedAccountInfo contains GeneratedAccountInfo and derived AccountInfo mapped by derivation path.
func (GeneratedAndDerivedAccountInfo) MarshalJSON ¶ added in v0.125.4
func (g GeneratedAndDerivedAccountInfo) MarshalJSON() ([]byte, error)
type Generator ¶
func New ¶
func New(am AccountManager) *Generator
func (*Generator) CreateAccountFromMnemonicAndDeriveAccountsForPaths ¶ added in v0.114.2
func (*Generator) CreateAccountFromPrivateKey ¶ added in v0.142.1
func (g *Generator) CreateAccountFromPrivateKey(privateKeyHex string) (IdentifiedAccountInfo, error)
func (*Generator) DeriveAddresses ¶
func (*Generator) GenerateAndDeriveAddresses ¶
func (*Generator) ImportJSONKey ¶
func (g *Generator) ImportJSONKey(json string, password string) (IdentifiedAccountInfo, error)
func (*Generator) ImportMnemonic ¶
func (g *Generator) ImportMnemonic(mnemonicPhrase string, bip39Passphrase string) (GeneratedAccountInfo, error)
func (*Generator) ImportPrivateKey ¶
func (g *Generator) ImportPrivateKey(privateKeyHex string) (IdentifiedAccountInfo, error)
func (*Generator) LoadAccount ¶
func (g *Generator) LoadAccount(address string, password string) (IdentifiedAccountInfo, error)
func (*Generator) Reset ¶
func (g *Generator) Reset()
Reset resets the accounts map removing all the accounts from memory.
func (*Generator) StoreAccount ¶
func (g *Generator) StoreAccount(accountID string, password string) (AccountInfo, error)
func (*Generator) StoreDerivedAccounts ¶
type IdentifiedAccountInfo ¶
type IdentifiedAccountInfo struct { AccountInfo ID string `json:"id"` // KeyUID is calculated as sha256 of the master public key and used for key // identification. This is the only information available about the master // key stored on a keycard before the card is paired. // KeyUID name is chosen over KeyID in order to make it consistent with // the name already used in Status and Keycard codebases. KeyUID string `json:"keyUid"` }
IdentifiedAccountInfo contains AccountInfo and the ID of an account.
func (IdentifiedAccountInfo) MarshalJSON ¶ added in v0.125.4
func (i IdentifiedAccountInfo) MarshalJSON() ([]byte, error)
func (*IdentifiedAccountInfo) ToMultiAccount ¶ added in v0.65.0
func (i *IdentifiedAccountInfo) ToMultiAccount() *multiaccounts.Account
Click to show internal directories.
Click to hide internal directories.