keymanager

package
v1.0.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: GPL-3.0 Imports: 27 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotSign = errors.New("cannot sign")

ErrCannotSign is returned whenever a signing attempt fails.

View Source
var ErrDenied = errors.New("signing attempt denied")

ErrDenied is returned whenever a signing attempt is denied.

View Source
var ErrNoSuchKey = errors.New("no such key")

ErrNoSuchKey is returned whenever a request is made for a key of which a key manager is unaware.

Functions

This section is empty.

Types

type Direct

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

Direct is a key manager that holds all secret keys directly.

func NewDirect

func NewDirect(sks []*bls.SecretKey) *Direct

NewDirect creates a new direct key manager from the secret keys provided to it.

func (*Direct) FetchValidatingKeys

func (km *Direct) FetchValidatingKeys() ([][48]byte, error)

FetchValidatingKeys fetches the list of public keys that should be used to validate with.

func (*Direct) Sign

func (km *Direct) Sign(pubKey [48]byte, root [32]byte) (*bls.Signature, error)

Sign signs a message for the validator to broadcast.

type Interop

type Interop struct {
	*Direct
}

Interop is a key manager that deterministically generates keys.

func NewInterop

func NewInterop(input string) (*Interop, string, error)

NewInterop creates a key manager using a number of interop keys at a given offset.

type KeyManager

type KeyManager interface {
	// FetchValidatingKeys fetches the list of public keys that should be used to validate with.
	FetchValidatingKeys() ([][48]byte, error)
	// Sign signs a message for the validator to broadcast.
	// Note that the domain should already be part of the root, but it is passed along for security purposes.
	Sign(pubKey [48]byte, root [32]byte) (*bls.Signature, error)
}

KeyManager controls access to private keys by the validator.

func NewKeystore

func NewKeystore(input string) (KeyManager, string, error)

NewKeystore creates a key manager populated with the keys from the keystore at the given path.

func NewRemoteWallet

func NewRemoteWallet(input string) (KeyManager, string, error)

NewRemoteWallet creates a key manager populated with the keys from walletd.

func NewWallet added in v0.3.2

func NewWallet(input string) (KeyManager, string, error)

NewWallet creates a key manager populated with the keys from a wallet at the given path.

type Keystore

type Keystore struct {
	*Direct
}

Keystore is a key manager that loads keys from a standard keystore.

type ProtectingKeyManager added in v0.3.2

type ProtectingKeyManager interface {
	// SignGeneric signs a generic root.
	// Note that the domain should already be part of the root, but it is provided for authorisation purposes.
	SignGeneric(pubKey [48]byte, root [32]byte, domain [32]byte) (*bls.Signature, error)

	// SignProposal signs a block proposal for the validator to broadcast.
	SignProposal(pubKey [48]byte, domain [32]byte, data *ethpb.BeaconBlockHeader) (*bls.Signature, error)

	// SignAttestation signs an attestation for the validator to broadcast.
	SignAttestation(pubKey [48]byte, domain [32]byte, data *ethpb.AttestationData) (*bls.Signature, error)
}

ProtectingKeyManager provides access to a keymanager that protects its clients from slashing events.

type Remote added in v1.0.0

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

Remote is a key manager that accesses a remote wallet daemon.

func (*Remote) FetchValidatingKeys

func (km *Remote) FetchValidatingKeys() ([][48]byte, error)

FetchValidatingKeys fetches the list of public keys that should be used to validate with.

func (*Remote) RefreshValidatingKeys

func (km *Remote) RefreshValidatingKeys() error

RefreshValidatingKeys refreshes the list of validating keys from the remote signer.

func (*Remote) Sign

func (km *Remote) Sign(pubKey [48]byte, root [32]byte) (*bls.Signature, error)

Sign without protection is not supported by remote keymanagers.

func (*Remote) SignAttestation

func (km *Remote) SignAttestation(pubKey [48]byte, domain [32]byte, data *ethpb.AttestationData) (*bls.Signature, error)

SignAttestation signs an attestation for the validator to broadcast.

func (*Remote) SignGeneric

func (km *Remote) SignGeneric(pubKey [48]byte, root [32]byte, domain [32]byte) (*bls.Signature, error)

SignGeneric signs a generic message for the validator to broadcast.

func (*Remote) SignProposal

func (km *Remote) SignProposal(pubKey [48]byte, domain [32]byte, data *ethpb.BeaconBlockHeader) (*bls.Signature, error)

SignProposal signs a block proposal for the validator to broadcast.

type Unencrypted

type Unencrypted struct {
	*Direct
}

Unencrypted is a key manager that loads keys from an unencrypted store.

func NewUnencrypted

func NewUnencrypted(input string) (*Unencrypted, string, error)

NewUnencrypted creates a keymanager from a file of unencrypted keys.

type Wallet added in v0.3.2

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

Wallet is a key manager that loads keys from a local Ethereum 2 wallet.

func (*Wallet) FetchValidatingKeys added in v0.3.2

func (km *Wallet) FetchValidatingKeys() ([][48]byte, error)

FetchValidatingKeys fetches the list of public keys that should be used to validate with.

func (*Wallet) Sign added in v0.3.2

func (km *Wallet) Sign(pubKey [48]byte, root [32]byte) (*bls.Signature, error)

Sign signs a message for the validator to broadcast.

Jump to

Keyboard shortcuts

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