Documentation
¶
Overview ¶
Package store provides local keystore management for TRON accounts.
Index ¶
- Variables
- func AddressFromAccountName(name string) (string, error)
- func CloseAll()
- func DefaultLocation() string
- func DescribeLocalAccounts()
- func DoesNamedAccountExist(name string) bool
- func FromAccountName(name string) *keystore.KeyStore
- func FromAddress(addr string) *keystore.KeyStore
- func InitConfigDir()
- func LocalAccounts() []string
- func SetDefaultLocation(directory string)
- func SetKeystoreFactory(fn func(string) *keystore.KeyStore)
- func UnlockedKeystore(from, passphrase string) (*keystore.KeyStore, *keystore.Account, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoUnlockBadPassphrase is returned when an account cannot be unlocked with the given passphrase. ErrNoUnlockBadPassphrase = fmt.Errorf("could not unlock account with passphrase, perhaps need different phrase") )
Functions ¶
func AddressFromAccountName ¶
AddressFromAccountName returns the Base58 address for the named account, or an error if not found.
func CloseAll ¶ added in v0.24.3
func CloseAll()
CloseAll closes all tracked keystores and resets the factory to production defaults. This is a safety net for test cleanup.
func DefaultLocation ¶
func DefaultLocation() string
DefaultLocation returns the current default keystore directory path.
func DescribeLocalAccounts ¶
func DescribeLocalAccounts()
DescribeLocalAccounts prints all account alias names and their addresses to stdout.
func DoesNamedAccountExist ¶
DoesNamedAccountExist reports whether an account alias with the given name exists locally.
func FromAccountName ¶
FromAccountName returns a KeyStore loaded from the named account's directory.
func FromAddress ¶
FromAddress will return nil if the Base58 string is not found in the imported accounts. Non-matching keystores are closed to prevent goroutine leaks.
func InitConfigDir ¶
func InitConfigDir()
InitConfigDir creates the account keystore directory if it does not exist.
func LocalAccounts ¶
func LocalAccounts() []string
LocalAccounts returns the alias names of all locally stored accounts.
func SetDefaultLocation ¶
func SetDefaultLocation(directory string)
SetDefaultLocation updates the default keystore directory and creates it if needed.
func SetKeystoreFactory ¶ added in v0.24.3
SetKeystoreFactory replaces the function used to create keystores. Pass keystore.ForPathLight in tests for faster key derivation.
Types ¶
This section is empty.