mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-18 15:54:13 +00:00
a74cf5de90
* Replace context.Background() with more appropriate context * replace a few context.TODO * Merge refs/heads/master into fix-ctx * Update validator/accounts/v2/accounts_create.go Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Fix tests * fix stream tests * gofmt * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * fix conflicts and remove ctx background uses * fix broken test * Merge branch 'master' into fix-ctx * imports * Merge branch 'fix-ctx' of github.com:prysmaticlabs/prysm into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * fix conflicts * Merge refs/heads/master into fix-ctx * fmt * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * Merge refs/heads/master into fix-ctx * fixes tests
41 lines
1.7 KiB
Go
41 lines
1.7 KiB
Go
package v1
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/shared/bls"
|
|
)
|
|
|
|
// ErrNoSuchKey is returned whenever a request is made for a key of which a key manager is unaware.
|
|
var ErrNoSuchKey = errors.New("no such key")
|
|
|
|
// ErrCannotSign is returned whenever a signing attempt fails.
|
|
var ErrCannotSign = errors.New("cannot sign")
|
|
|
|
// ErrDenied is returned whenever a signing attempt is denied.
|
|
var ErrDenied = errors.New("signing attempt denied")
|
|
|
|
// KeyManager controls access to private keys by the validator.
|
|
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(ctx context.Context, pubKey [48]byte, root [32]byte) (bls.Signature, error)
|
|
}
|
|
|
|
// ProtectingKeyManager provides access to a keymanager that protects its clients from slashing events.
|
|
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)
|
|
}
|