valkeystore

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyUnlocked = errors.New("already unlocked")
	ErrLocked          = errors.New("key is locked")
)
View Source
var (
	ErrNotFound      = errors.New("key is not found")
	ErrAlreadyExists = errors.New("key already exists")
)

Functions

This section is empty.

Types

type CachedKeystore

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

func NewCachedKeystore

func NewCachedKeystore(backend RawKeystoreI) *CachedKeystore

func (*CachedKeystore) Add

func (c *CachedKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error

func (*CachedKeystore) Get

func (*CachedKeystore) GetUnlocked

func (c *CachedKeystore) GetUnlocked(pubkey validatorpk.PubKey) (*encryption.PrivateKey, error)

func (*CachedKeystore) Has

func (c *CachedKeystore) Has(pubkey validatorpk.PubKey) bool

func (*CachedKeystore) Unlock

func (c *CachedKeystore) Unlock(pubkey validatorpk.PubKey, auth string) error

func (*CachedKeystore) Unlocked

func (c *CachedKeystore) Unlocked(pubkey validatorpk.PubKey) bool

type FileKeystore

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

func NewDefaultFileRawKeystore

func NewDefaultFileRawKeystore(dir string) *FileKeystore

func NewFileKeystore

func NewFileKeystore(dir string, enc *encryption.Keystore) *FileKeystore

func (*FileKeystore) Add

func (f *FileKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error

func (*FileKeystore) Get

func (f *FileKeystore) Get(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error)

func (*FileKeystore) Has

func (f *FileKeystore) Has(pubkey validatorpk.PubKey) bool

func (*FileKeystore) PathOf

func (f *FileKeystore) PathOf(pubkey validatorpk.PubKey) string

type KeystoreI

type KeystoreI interface {
	RawKeystoreI
	Unlock(pubkey validatorpk.PubKey, auth string) error
	Unlocked(pubkey validatorpk.PubKey) bool
	GetUnlocked(pubkey validatorpk.PubKey) (*encryption.PrivateKey, error)
}

type MemKeystore

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

func NewMemKeystore

func NewMemKeystore() *MemKeystore

func (*MemKeystore) Add

func (m *MemKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error

func (*MemKeystore) Get

func (m *MemKeystore) Get(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error)

func (*MemKeystore) Has

func (m *MemKeystore) Has(pubkey validatorpk.PubKey) bool

type RawKeystoreI

type RawKeystoreI interface {
	Has(pubkey validatorpk.PubKey) bool
	Add(pubkey validatorpk.PubKey, key []byte, auth string) error
	Get(pubkey validatorpk.PubKey, auth string) (*encryption.PrivateKey, error)
}

type Signer

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

func NewSigner

func NewSigner(backend KeystoreI) *Signer

func (*Signer) Sign

func (s *Signer) Sign(pubkey validatorpk.PubKey, digest []byte) ([]byte, error)

type SignerI

type SignerI interface {
	Sign(pubkey validatorpk.PubKey, digest []byte) ([]byte, error)
}

type SyncedKeystore

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

func NewDefaultFileKeystore

func NewDefaultFileKeystore(dir string) *SyncedKeystore

func NewDefaultMemKeystore

func NewDefaultMemKeystore() *SyncedKeystore

func NewSyncedKeystore

func NewSyncedKeystore(backend KeystoreI) *SyncedKeystore

func (*SyncedKeystore) Add

func (s *SyncedKeystore) Add(pubkey validatorpk.PubKey, key []byte, auth string) error

func (*SyncedKeystore) Get

func (*SyncedKeystore) GetUnlocked

func (s *SyncedKeystore) GetUnlocked(pubkey validatorpk.PubKey) (*encryption.PrivateKey, error)

func (*SyncedKeystore) Has

func (s *SyncedKeystore) Has(pubkey validatorpk.PubKey) bool

func (*SyncedKeystore) Unlock

func (s *SyncedKeystore) Unlock(pubkey validatorpk.PubKey, auth string) error

func (*SyncedKeystore) Unlocked

func (s *SyncedKeystore) Unlocked(pubkey validatorpk.PubKey) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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