keystore

package
v0.0.0-...-b9de96a Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorNotInitialized is returned when a bucket is not properly initialized
	ErrorNotInitialized = errors.New("the keystore is not initialized")

	// ErrorAlreadyOpen returned when user tries to open a keystore already open.
	ErrorAlreadyOpen = errors.New("keystore is already open")

	// ErrorNoOpen returned when the keystore is not open.
	ErrorNoOpen = errors.New("open the keystore to start using it")

	// ErrorKeystoreExists returned when a user creates a new keystore over an existing keystore.
	ErrorKeystoreExists = errors.New("cannot create new keystore, it already exists")

	// ErrorKeyNotOnKeystore returned when tried to fetch a key that is not on the keystore
	ErrorKeyNotOnKeystore = errors.New("the specified public key doesn't exists on the keystore")
)

Functions

This section is empty.

Types

type Key

type Key struct {
	Secret common.SecretKey
	Enable bool
	Path   int64
}

func (*Key) Marshal

func (k *Key) Marshal() ([]byte, error)

func (*Key) Unmarshal

func (k *Key) Unmarshal(b []byte) error

type Keystore

type Keystore interface {
	CreateKeystore() error
	OpenKeystore() error
	Close() error
	GenerateNewValidatorKey(amount uint64) ([]*Key, error)
	HasKeysToParticipate() bool

	GetValidatorKey(pubkey [48]byte) (*Key, bool)
	GetValidatorKeys() ([]*Key, error)
	GetMnemonic() string
	GetLastPath() int

	ToggleKey(pub [48]byte, value bool) error
	AddKey(k *Key) error
}

func NewKeystore

func NewKeystore() Keystore

NewKeystore creates a new keystore instance.

Jump to

Keyboard shortcuts

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