util

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelegatedFromEthAddr

func DelegatedFromEthAddr(addr common.Address) (address.Address, error)

func DeriveAddrFromPk

func DeriveAddrFromPk(pk *ecdsa.PrivateKey) (common.Address, address.Address, error)

func DeriveAddrFromPkString

func DeriveAddrFromPkString(pk string) (common.Address, address.Address, error)

func DeriveAddressFromPk

func DeriveAddressFromPk(pk *ecdsa.PrivateKey) (common.Address, error)

func IsZeroAddress

func IsZeroAddress(address common.Address) bool

IsZeroAddress validate if it's a 0 address

func KeyStore

func KeyStore() *keystore.KeyStore

func NewAccountsStore

func NewAccountsStore(filename string) error

func NewAgentStore

func NewAgentStore(filename string) error

func NewBackupsStore

func NewBackupsStore(filename string) error

func NewKeyStore

func NewKeyStore(keydir string)

func NewKeyStoreLegacy

func NewKeyStoreLegacy(filename string) error

func TruncateAddr

func TruncateAddr(addr string) string

Types

type AccountsStorage

type AccountsStorage struct {
	*Storage
}

func AccountsStore

func AccountsStore() *AccountsStorage

func (*AccountsStorage) GetAddrs

func (a *AccountsStorage) GetAddrs(key string) (common.Address, address.Address, error)

type AgentStorage

type AgentStorage struct {
	*Storage
}

func AgentStore

func AgentStore() *AgentStorage

type BackupsStorage

type BackupsStorage struct {
	*Storage
}

func BackupsStore

func BackupsStore() *BackupsStorage

func (*BackupsStorage) Invalidate

func (a *BackupsStorage) Invalidate()

type ErrKeyNotFound

type ErrKeyNotFound struct {
	Key string
}

func (*ErrKeyNotFound) Error

func (e *ErrKeyNotFound) Error() string

type KeyStorage

type KeyStorage struct {
	*Storage
}

type KeyStorageLegacy

type KeyStorageLegacy struct {
	*Storage
}

func KeyStoreLegacy

func KeyStoreLegacy() *KeyStorageLegacy

func (*KeyStorageLegacy) GetAddrs

func (s *KeyStorageLegacy) GetAddrs(key KeyType) (common.Address, address.Address, error)

func (*KeyStorageLegacy) GetPrivate

func (s *KeyStorageLegacy) GetPrivate(key KeyType) (*ecdsa.PrivateKey, error)

func (*KeyStorageLegacy) SetKey

func (s *KeyStorageLegacy) SetKey(key KeyType, pk *ecdsa.PrivateKey) error

type KeyType

type KeyType string
const (
	OwnerKey    KeyType = "owner"
	OperatorKey KeyType = "operator"
	RequestKey  KeyType = "request"
)

type Storage

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

Storage is a structure that holds the filename and a map of key-value pairs.

func NewStorage

func NewStorage(filename string, defaultMap map[string]string, writable bool) (*Storage, error)

NewStorage creates a new Storage instance and initializes it with the given filename.

func (*Storage) AccountNames

func (s *Storage) AccountNames() []string

AccountNames retrieves a list of all the account names

func (*Storage) Delete

func (s *Storage) Delete(key string) error

Delete removes a key-value pair from the data map and saves the data to the file.

func (*Storage) Get

func (s *Storage) Get(key string) (string, error)

Get retrieves the value associated with the given key.

func (*Storage) Set

func (s *Storage) Set(key, value string) error

Set sets a key-value pair in the data map and saves the data to the file.

type StorageData

type StorageData map[string]string

Jump to

Keyboard shortcuts

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