keystore

package
v1.10.0-beta5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCSAKeyExists = errors.New("can only have 1 CSA key")

ErrCSAKeyExists describes the error when the CSA key already exists

View Source
var ErrLocked = errors.New("Keystore is locked")
View Source
var (
	ErrMissingVRFKey = errors.New("unable to find VRF key")
)
View Source
var (
	ErrNoP2PKey = errors.New("no p2p keys exist")
)
View Source
var (
	ErrNoSolanaKey = errors.New("no solana keys exist")
)
View Source
var (
	ErrNoStarkNetKey = errors.New("no starknet keys exist")
)
View Source
var (
	ErrNoTerraKey = errors.New("no terra keys exist")
)

Functions

func GetFieldNameForKey added in v1.10.0

func GetFieldNameForKey(unknownKey Key) (string, error)

func NewORM added in v1.0.0

func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig) ksORM

Types

type CSA

type CSA interface {
	Get(id string) (csakey.KeyV2, error)
	GetAll() ([]csakey.KeyV2, error)
	Create() (csakey.KeyV2, error)
	Add(key csakey.KeyV2) error
	Delete(id string) (csakey.KeyV2, error)
	Import(keyJSON []byte, password string) (csakey.KeyV2, error)
	Export(id string, password string) ([]byte, error)
	EnsureKey() error

	GetV1KeysAsV2() ([]csakey.KeyV2, error)
}

type CSAKeystoreInterface interface {

type DKGEncrypt added in v1.7.0

type DKGEncrypt interface {
	Get(id string) (dkgencryptkey.Key, error)
	GetAll() ([]dkgencryptkey.Key, error)
	Create() (dkgencryptkey.Key, error)
	Add(key dkgencryptkey.Key) error
	Delete(id string) (dkgencryptkey.Key, error)
	Import(keyJSON []byte, password string) (dkgencryptkey.Key, error)
	Export(id string, password string) ([]byte, error)
	EnsureKey() error
}

DKGEncrypt provides encryption keys for the DKG.

type DKGSign added in v1.6.0

type DKGSign interface {
	Get(id string) (dkgsignkey.Key, error)
	GetAll() ([]dkgsignkey.Key, error)
	Create() (dkgsignkey.Key, error)
	Add(key dkgsignkey.Key) error
	Delete(id string) (dkgsignkey.Key, error)
	Import(keyJSON []byte, password string) (dkgsignkey.Key, error)
	Export(id string, password string) ([]byte, error)
	EnsureKey() error
}

DKGSign provides signing keys for the DKG.

type DefaultEVMChainIDFunc added in v1.2.0

type DefaultEVMChainIDFunc func() (defaultEVMChainID *big.Int, err error)

DefaultEVMChainIDFunc is a func for getting a default evm chain ID - necessary because it is lazily evaluated

type Eth

type Eth interface {
	Get(id string) (ethkey.KeyV2, error)
	GetAll() ([]ethkey.KeyV2, error)
	Create(chainIDs ...*big.Int) (ethkey.KeyV2, error)
	Delete(id string) (ethkey.KeyV2, error)
	Import(keyJSON []byte, password string, chainIDs ...*big.Int) (ethkey.KeyV2, error)
	Export(id string, password string) ([]byte, error)

	Enable(address common.Address, chainID *big.Int, qopts ...pg.QOpt) error
	Disable(address common.Address, chainID *big.Int, qopts ...pg.QOpt) error
	Reset(address common.Address, chainID *big.Int, nonce int64, qopts ...pg.QOpt) error

	GetNextNonce(address common.Address, chainID *big.Int, qopts ...pg.QOpt) (int64, error)
	IncrementNextNonce(address common.Address, chainID *big.Int, currentNonce int64, qopts ...pg.QOpt) error

	EnsureKeys(chainIDs ...*big.Int) error
	SubscribeToKeyChanges() (ch chan struct{}, unsub func())

	SignTx(fromAddress common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)

	EnabledKeysForChain(chainID *big.Int) (keys []ethkey.KeyV2, err error)
	GetRoundRobinAddress(chainID *big.Int, addresses ...common.Address) (address common.Address, err error)
	CheckEnabled(address common.Address, chainID *big.Int) error

	GetState(id string, chainID *big.Int) (ethkey.State, error)
	GetStatesForKeys([]ethkey.KeyV2) ([]ethkey.State, error)
	GetStatesForChain(chainID *big.Int) ([]ethkey.State, error)

	XXXTestingOnlySetState(ethkey.State)
	XXXTestingOnlyAdd(key ethkey.KeyV2)
}

Eth is the external interface for EthKeyStore

type Key added in v1.0.0

type Key interface {
	ID() string
}

type KeyNotFoundError added in v1.1.0

type KeyNotFoundError struct {
	ID      string
	KeyType string
}

KeyNotFoundError is returned when we don't find a requested key

func (KeyNotFoundError) Error added in v1.1.0

func (e KeyNotFoundError) Error() string

type Master

type Master interface {
	CSA() CSA
	DKGSign() DKGSign
	DKGEncrypt() DKGEncrypt
	Eth() Eth
	OCR() OCR
	OCR2() OCR2
	P2P() P2P
	Solana() Solana
	Terra() Terra
	StarkNet() StarkNet
	VRF() VRF
	Unlock(password string) error
	Migrate(vrfPassword string, f DefaultEVMChainIDFunc) error
	IsEmpty() (bool, error)
}

func New

func New(db *sqlx.DB, scryptParams utils.ScryptParams, lggr logger.Logger, cfg pg.QConfig) Master

type OCR

type OCR interface {
	Get(id string) (ocrkey.KeyV2, error)
	GetAll() ([]ocrkey.KeyV2, error)
	Create() (ocrkey.KeyV2, error)
	Add(key ocrkey.KeyV2) error
	Delete(id string) (ocrkey.KeyV2, error)
	Import(keyJSON []byte, password string) (ocrkey.KeyV2, error)
	Export(id string, password string) ([]byte, error)
	EnsureKey() error

	GetV1KeysAsV2() ([]ocrkey.KeyV2, error)
}

type OCR2 added in v1.2.0

type OCR2 interface {
	Get(id string) (ocr2key.KeyBundle, error)
	GetAll() ([]ocr2key.KeyBundle, error)
	GetAllOfType(chaintype.ChainType) ([]ocr2key.KeyBundle, error)
	Create(chaintype.ChainType) (ocr2key.KeyBundle, error)
	Add(key ocr2key.KeyBundle) error
	Delete(id string) error
	Import(keyJSON []byte, password string) (ocr2key.KeyBundle, error)
	Export(id string, password string) ([]byte, error)
	EnsureKeys() error
}

type P2P added in v1.0.0

type P2P interface {
	Get(id p2pkey.PeerID) (p2pkey.KeyV2, error)
	GetAll() ([]p2pkey.KeyV2, error)
	Create() (p2pkey.KeyV2, error)
	Add(key p2pkey.KeyV2) error
	Delete(id p2pkey.PeerID) (p2pkey.KeyV2, error)
	Import(keyJSON []byte, password string) (p2pkey.KeyV2, error)
	Export(id p2pkey.PeerID, password string) ([]byte, error)
	EnsureKey() error

	GetV1KeysAsV2() ([]p2pkey.KeyV2, error)

	GetOrFirst(id p2pkey.PeerID) (p2pkey.KeyV2, error)
}

type Solana added in v1.2.0

type Solana interface {
	Get(id string) (solkey.Key, error)
	GetAll() ([]solkey.Key, error)
	Create() (solkey.Key, error)
	Add(key solkey.Key) error
	Delete(id string) (solkey.Key, error)
	Import(keyJSON []byte, password string) (solkey.Key, error)
	Export(id string, password string) ([]byte, error)
	EnsureKey() error
}

type StarkNet added in v1.6.0

type StarkNet interface {
	Get(id string) (stark.Key, error)
	GetAll() ([]stark.Key, error)
	Create() (stark.Key, error)
	Add(key stark.Key) error
	Delete(id string) (stark.Key, error)
	Import(keyJSON []byte, password string) (stark.Key, error)
	Export(id string, password string) ([]byte, error)
	EnsureKey() error
}

type Terra added in v1.2.0

type Terra interface {
	Get(id string) (terrakey.Key, error)
	GetAll() ([]terrakey.Key, error)
	Create() (terrakey.Key, error)
	Add(key terrakey.Key) error
	Delete(id string) (terrakey.Key, error)
	Import(keyJSON []byte, password string) (terrakey.Key, error)
	Export(id string, password string) ([]byte, error)
	EnsureKey() error
}

type VRF

type VRF interface {
	Get(id string) (vrfkey.KeyV2, error)
	GetAll() ([]vrfkey.KeyV2, error)
	Create() (vrfkey.KeyV2, error)
	Add(key vrfkey.KeyV2) error
	Delete(id string) (vrfkey.KeyV2, error)
	Import(keyJSON []byte, password string) (vrfkey.KeyV2, error)
	Export(id string, password string) ([]byte, error)

	GenerateProof(id string, seed *big.Int) (vrfkey.Proof, error)

	GetV1KeysAsV2(password string) ([]vrfkey.KeyV2, error)
}

Jump to

Keyboard shortcuts

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