Versions in this module Expand all Collapse all v1 v1.0.2 Jan 31, 2023 v1.0.1 Jan 25, 2023 Changes in this version + var ErrAlreadyExists = errors.New("key already exists") + var ErrAlreadyUnlocked = errors.New("already unlocked") + var ErrLocked = errors.New("key is locked") + var ErrNotFound = errors.New("key is not found") + type CachedKeystore struct + func NewCachedKeystore(backend RawKeystoreI) *CachedKeystore + func (c *CachedKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error + func (c *CachedKeystore) Get(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error) + func (c *CachedKeystore) GetUnlocked(pubkey validatorpk.PubKey) (*encryption.PrivateKey, error) + func (c *CachedKeystore) Has(pubkey validatorpk.PubKey) bool + func (c *CachedKeystore) Unlock(pubkey validatorpk.PubKey, auth string) error + func (c *CachedKeystore) Unlocked(pubkey validatorpk.PubKey) bool + type FileKeystore struct + func NewDefaultFileRawKeystore(dir string) *FileKeystore + func NewFileKeystore(dir string, enc *encryption.Keystore) *FileKeystore + func (f *FileKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error + func (f *FileKeystore) Get(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error) + func (f *FileKeystore) Has(pubkey validatorpk.PubKey) bool + func (f *FileKeystore) PathOf(pubkey validatorpk.PubKey) string + type KeystoreI interface + GetUnlocked func(pubkey validatorpk.PubKey) (*encryption.PrivateKey, error) + Unlock func(pubkey validatorpk.PubKey, auth string) error + Unlocked func(pubkey validatorpk.PubKey) bool + type MemKeystore struct + func NewMemKeystore() *MemKeystore + func (m *MemKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error + func (m *MemKeystore) Get(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error) + func (m *MemKeystore) Has(pubkey validatorpk.PubKey) bool + type RawKeystoreI interface + Add func(pubkey validatorpk.PubKey, key []byte, auth string) error + Get func(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error) + Has func(pubkey validatorpk.PubKey) bool + type Signer struct + func NewSigner(backend KeystoreI) *Signer + func (s *Signer) Sign(pubkey validatorpk.PubKey, digest []byte) ([]byte, error) + type SignerI interface + Sign func(pubkey validatorpk.PubKey, digest []byte) ([]byte, error) + type SyncedKeystore struct + func NewDefaultFileKeystore(dir string) *SyncedKeystore + func NewDefaultMemKeystore() *SyncedKeystore + func NewSyncedKeystore(backend KeystoreI) *SyncedKeystore + func (s *SyncedKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error + func (s *SyncedKeystore) Get(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error) + func (s *SyncedKeystore) GetUnlocked(pubkey validatorpk.PubKey) (*encryption.PrivateKey, error) + func (s *SyncedKeystore) Has(pubkey validatorpk.PubKey) bool + func (s *SyncedKeystore) Unlock(pubkey validatorpk.PubKey, auth string) error + func (s *SyncedKeystore) Unlocked(pubkey validatorpk.PubKey) bool