Documentation
¶
Index ¶
- Variables
- func GetFieldNameForKey(unknownKey Key) (string, error)
- func NewInMemory(ds sqlutil.DataSource, scryptParams utils.ScryptParams, lggr logger.Logger) *master
- func NewORM(ds sqlutil.DataSource, lggr logger.Logger) ksORM
- type Aptos
- type AptosLooppSigner
- type CSA
- type Cosmos
- type CosmosLoopKeystore
- type DKGEncrypt
- type DKGSign
- type DefaultEVMChainIDFunc
- type Eth
- type Key
- type KeyNotFoundError
- type LegacyKeyStorage
- type Master
- type OCR
- type OCR2
- type ORM
- type P2P
- type Solana
- type SolanaSigner
- type StarkNet
- type StarknetLooppSigner
- type VRF
Constants ¶
This section is empty.
Variables ¶
var ( ErrLocked = errors.New("Keystore is locked") ErrKeyNotFound = errors.New("Key not found") ErrKeyExists = errors.New("Key already exists") )
var ErrCSAKeyExists = errors.New("can only have 1 CSA key")
ErrCSAKeyExists describes the error when the CSA key already exists
var (
ErrMissingVRFKey = errors.New("unable to find VRF key")
)
var (
ErrNoP2PKey = errors.New("no p2p keys exist")
)
Functions ¶
func GetFieldNameForKey ¶
func NewInMemory ¶ added in v2.7.0
func NewInMemory(ds sqlutil.DataSource, scryptParams utils.ScryptParams, lggr logger.Logger) *master
NewInMemory sets up a keystore which NOOPs attempts to access the `encrypted_key_rings` table. Accessing `evm.key_states` will still hit the DB.
Types ¶
type Aptos ¶ added in v2.13.1
type Aptos interface {
Get(id string) (aptoskey.Key, error)
GetAll() ([]aptoskey.Key, error)
Create(ctx context.Context) (aptoskey.Key, error)
Add(ctx context.Context, key aptoskey.Key) error
Delete(ctx context.Context, id string) (aptoskey.Key, error)
Import(ctx context.Context, keyJSON []byte, password string) (aptoskey.Key, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
Sign(ctx context.Context, id string, msg []byte) (signature []byte, err error)
}
type AptosLooppSigner ¶ added in v2.13.1
type AptosLooppSigner struct {
Aptos
}
AptosSigner implements github.com/smartcontractkit/chainlink-common/pkg/loop.Keystore interface and the requirements Handles signing for Apots Messages
type CSA ¶
type CSA interface {
Get(id string) (csakey.KeyV2, error)
GetAll() ([]csakey.KeyV2, error)
Create(ctx context.Context) (csakey.KeyV2, error)
Add(ctx context.Context, key csakey.KeyV2) error
Delete(ctx context.Context, id string) (csakey.KeyV2, error)
Import(ctx context.Context, keyJSON []byte, password string) (csakey.KeyV2, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
}
type CSAKeystoreInterface interface {
type Cosmos ¶
type Cosmos interface {
Get(id string) (cosmoskey.Key, error)
GetAll() ([]cosmoskey.Key, error)
Create(ctx context.Context) (cosmoskey.Key, error)
Add(ctx context.Context, key cosmoskey.Key) error
Delete(ctx context.Context, id string) (cosmoskey.Key, error)
Import(ctx context.Context, keyJSON []byte, password string) (cosmoskey.Key, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
}
type CosmosLoopKeystore ¶ added in v2.6.0
type CosmosLoopKeystore struct {
Cosmos
}
CosmosLoopKeystore implements the github.com/smartcontractkit/chainlink-common/pkg/loop.Keystore interface and handles signing for Cosmos messages.
type DKGEncrypt ¶
type DKGEncrypt interface {
Get(id string) (dkgencryptkey.Key, error)
GetAll() ([]dkgencryptkey.Key, error)
Create(ctx context.Context) (dkgencryptkey.Key, error)
Add(ctx context.Context, key dkgencryptkey.Key) error
Delete(ctx context.Context, id string) (dkgencryptkey.Key, error)
Import(ctx context.Context, keyJSON []byte, password string) (dkgencryptkey.Key, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
}
DKGEncrypt provides encryption keys for the DKG.
type DKGSign ¶
type DKGSign interface {
Get(id string) (dkgsignkey.Key, error)
GetAll() ([]dkgsignkey.Key, error)
Create(ctx context.Context) (dkgsignkey.Key, error)
Add(ctx context.Context, key dkgsignkey.Key) error
Delete(ctx context.Context, id string) (dkgsignkey.Key, error)
Import(ctx context.Context, keyJSON []byte, password string) (dkgsignkey.Key, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
}
DKGSign provides signing keys for the DKG.
type DefaultEVMChainIDFunc ¶
DefaultEVMChainIDFunc is a func for getting a default evm chain ID - necessary because it is lazily evaluated
type Eth ¶
type Eth interface {
Get(ctx context.Context, id string) (ethkey.KeyV2, error)
GetAll(ctx context.Context) ([]ethkey.KeyV2, error)
Create(ctx context.Context, chainIDs ...*big.Int) (ethkey.KeyV2, error)
Delete(ctx context.Context, id string) (ethkey.KeyV2, error)
Import(ctx context.Context, keyJSON []byte, password string, chainIDs ...*big.Int) (ethkey.KeyV2, error)
Export(ctx context.Context, id string, password string) ([]byte, error)
Enable(ctx context.Context, address common.Address, chainID *big.Int) error
Disable(ctx context.Context, address common.Address, chainID *big.Int) error
Add(ctx context.Context, address common.Address, chainID *big.Int) error
EnsureKeys(ctx context.Context, chainIDs ...*big.Int) error
SubscribeToKeyChanges(ctx context.Context) (ch chan struct{}, unsub func())
SignTx(ctx context.Context, fromAddress common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
EnabledKeysForChain(ctx context.Context, chainID *big.Int) (keys []ethkey.KeyV2, err error)
GetRoundRobinAddress(ctx context.Context, chainID *big.Int, addresses ...common.Address) (address common.Address, err error)
CheckEnabled(ctx context.Context, address common.Address, chainID *big.Int) error
GetState(ctx context.Context, id string, chainID *big.Int) (ethkey.State, error)
GetStatesForKeys(ctx context.Context, keys []ethkey.KeyV2) ([]ethkey.State, error)
GetStateForKey(ctx context.Context, key ethkey.KeyV2) (ethkey.State, error)
GetStatesForChain(ctx context.Context, chainID *big.Int) ([]ethkey.State, error)
EnabledAddressesForChain(ctx context.Context, chainID *big.Int) (addresses []common.Address, err error)
XXXTestingOnlySetState(ctx context.Context, keyState ethkey.State)
XXXTestingOnlyAdd(ctx context.Context, key ethkey.KeyV2)
}
Eth is the external interface for EthKeyStore
type KeyNotFoundError ¶
KeyNotFoundError is returned when we don't find a requested key
func (KeyNotFoundError) Error ¶
func (e KeyNotFoundError) Error() string
type LegacyKeyStorage ¶
type LegacyKeyStorage struct {
// contains filtered or unexported fields
}
func (*LegacyKeyStorage) StoreUnsupported ¶
func (k *LegacyKeyStorage) StoreUnsupported(allRawKeysJson []byte, keyRing *keyRing) error
StoreUnsupported will store the raw keys that no longer have support in the node it will check if raw json contains keys that have not been added to the key ring and stores them internally
func (*LegacyKeyStorage) UnloadUnsupported ¶
func (k *LegacyKeyStorage) UnloadUnsupported(supportedRawKeyRingJson []byte) ([]byte, error)
UnloadUnsupported will inject the unsupported keys into the raw key ring json
type Master ¶
type Master interface {
CSA() CSA
DKGSign() DKGSign
DKGEncrypt() DKGEncrypt
Eth() Eth
OCR() OCR
OCR2() OCR2
P2P() P2P
Solana() Solana
Cosmos() Cosmos
StarkNet() StarkNet
Aptos() Aptos
VRF() VRF
Unlock(ctx context.Context, password string) error
IsEmpty(ctx context.Context) (bool, error)
}
func New ¶
func New(ds sqlutil.DataSource, scryptParams utils.ScryptParams, lggr logger.Logger) Master
type OCR ¶
type OCR interface {
Get(id string) (ocrkey.KeyV2, error)
GetAll() ([]ocrkey.KeyV2, error)
Create(ctx context.Context) (ocrkey.KeyV2, error)
Add(ctx context.Context, key ocrkey.KeyV2) error
Delete(ctx context.Context, id string) (ocrkey.KeyV2, error)
Import(ctx context.Context, keyJSON []byte, password string) (ocrkey.KeyV2, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
}
type OCR2 ¶
type OCR2 interface {
Get(id string) (ocr2key.KeyBundle, error)
GetAll() ([]ocr2key.KeyBundle, error)
GetAllOfType(chaintype.ChainType) ([]ocr2key.KeyBundle, error)
Create(context.Context, chaintype.ChainType) (ocr2key.KeyBundle, error)
Add(ctx context.Context, key ocr2key.KeyBundle) error
Delete(ctx context.Context, id string) error
Import(ctx context.Context, keyJSON []byte, password string) (ocr2key.KeyBundle, error)
Export(id string, password string) ([]byte, error)
EnsureKeys(ctx context.Context, enabledChains ...chaintype.ChainType) error
}
type P2P ¶
type P2P interface {
Get(id p2pkey.PeerID) (p2pkey.KeyV2, error)
GetAll() ([]p2pkey.KeyV2, error)
Create(ctx context.Context) (p2pkey.KeyV2, error)
Add(ctx context.Context, key p2pkey.KeyV2) error
Delete(ctx context.Context, id p2pkey.PeerID) (p2pkey.KeyV2, error)
Import(ctx context.Context, keyJSON []byte, password string) (p2pkey.KeyV2, error)
Export(id p2pkey.PeerID, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
GetOrFirst(id p2pkey.PeerID) (p2pkey.KeyV2, error)
}
type Solana ¶
type Solana interface {
Get(id string) (solkey.Key, error)
GetAll() ([]solkey.Key, error)
Create(ctx context.Context) (solkey.Key, error)
Add(ctx context.Context, key solkey.Key) error
Delete(ctx context.Context, id string) (solkey.Key, error)
Import(ctx context.Context, keyJSON []byte, password string) (solkey.Key, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
Sign(ctx context.Context, id string, msg []byte) (signature []byte, err error)
}
type SolanaSigner ¶ added in v2.1.0
type SolanaSigner struct {
Solana
}
SolanaSigner adapts Solana to loop.Keystore.
type StarkNet ¶
type StarkNet interface {
Get(id string) (starkkey.Key, error)
GetAll() ([]starkkey.Key, error)
Create(ctx context.Context) (starkkey.Key, error)
Add(ctx context.Context, key starkkey.Key) error
Delete(ctx context.Context, id string) (starkkey.Key, error)
Import(ctx context.Context, keyJSON []byte, password string) (starkkey.Key, error)
Export(id string, password string) ([]byte, error)
EnsureKey(ctx context.Context) error
}
type StarknetLooppSigner ¶ added in v2.3.0
type StarknetLooppSigner struct {
StarkNet
}
StarknetLooppSigner implements github.com/smartcontractkit/chainlink-common/pkg/loop.Keystore interface and the requirements of signature d/encoding of the github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/txm.NewKeystoreAdapter
func (*StarknetLooppSigner) Accounts ¶ added in v2.3.0
func (lk *StarknetLooppSigner) Accounts(ctx context.Context) ([]string, error)
TODO what is this supposed to return for starknet?
func (*StarknetLooppSigner) Sign ¶ added in v2.3.0
Sign implements loop.Keystore hash is expected to be the byte representation of big.Int the returned []byte is an encoded github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/starknet.Signature. this enables compatibility with github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/txm.NewKeystoreAdapter
type VRF ¶
type VRF interface {
Get(id string) (vrfkey.KeyV2, error)
GetAll() ([]vrfkey.KeyV2, error)
Create(ctx context.Context) (vrfkey.KeyV2, error)
Add(ctx context.Context, key vrfkey.KeyV2) error
Delete(ctx context.Context, id string) (vrfkey.KeyV2, error)
Import(ctx context.Context, keyJSON []byte, password string) (vrfkey.KeyV2, error)
Export(id string, password string) ([]byte, error)
GenerateProof(id string, seed *big.Int) (vrfkey.Proof, error)
}