Documentation ¶
Overview ¶
Package imported defines an implementation of an on-disk, EIP-2335 keystore.json approach towards defining validator accounts in Prysm. A validating private key is encrypted using a passphrase and its resulting encrypted file is stored as a keystore.json file under a unique, human-readable, account namespace. This imported keymanager approach relies on storing account information on-disk, making it trivial to import, backup and list all associated accounts for a user.
EIP-2335 is a keystore format defined by https://eips.ethereum.org/EIPS/eip-2335 for storing and defining encryption for BLS12-381 private keys, utilized by Ethereum. This keystore.json format is not compatible with the current keystore standard used in eth1 due to a lack of support for KECCAK-256. Passwords utilized for key encryptions are strings of arbitrary unicode characters. The password is first converted to its NFKD representation, stripped of control codes specified in the EIP link above, and finally the password is UTF-8 encoded.
Index ¶
- Constants
- func ResetCaches()
- type AccountsKeystoreRepresentation
- type Keymanager
- func (km *Keymanager) CreateAccountsKeystore(_ context.Context, privateKeys, publicKeys [][]byte) (*AccountsKeystoreRepresentation, error)
- func (km *Keymanager) DeleteAccounts(ctx context.Context, publicKeys [][]byte) error
- func (km *Keymanager) ExtractKeystores(_ context.Context, publicKeys []bls.PublicKey, password string) ([]*keymanager.Keystore, error)
- func (km *Keymanager) FetchValidatingPrivateKeys(ctx context.Context) ([][32]byte, error)
- func (km *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][48]byte, error)
- func (km *Keymanager) ImportKeypairs(ctx context.Context, privKeys, pubKeys [][]byte) error
- func (km *Keymanager) ImportKeystores(ctx context.Context, keystores []*keymanager.Keystore, importsPassword string) error
- func (km *Keymanager) Sign(ctx context.Context, req *validatorpb.SignRequest) (bls.Signature, error)
- func (km *Keymanager) SubscribeAccountChanges(pubKeysChan chan [][48]byte) event.Subscription
- func (km *Keymanager) ValidatingAccountNames() ([]string, error)
- type SetupConfig
Constants ¶
const ( // KeystoreFileNameFormat exposes the filename the keystore should be formatted in. KeystoreFileNameFormat = "keystore-%d.json" // AccountsPath where all imported keymanager keystores are kept. AccountsPath = "accounts" // AccountsKeystoreFileName exposes the name of the keystore file. AccountsKeystoreFileName = "all-accounts.keystore.json" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountsKeystoreRepresentation ¶ added in v1.1.0
type AccountsKeystoreRepresentation struct { Crypto map[string]interface{} `json:"crypto"` ID string `json:"uuid"` Version uint `json:"version"` Name string `json:"name"` }
AccountsKeystoreRepresentation defines an internal Prysm representation of validator accounts, encrypted according to the EIP-2334 standard.
type Keymanager ¶
type Keymanager struct {
// contains filtered or unexported fields
}
Keymanager implementation for imported keystores utilizing EIP-2335.
func NewInteropKeymanager ¶
func NewInteropKeymanager(_ context.Context, offset, numValidatorKeys uint64) (*Keymanager, error)
NewInteropKeymanager instantiates a new imported keymanager with the deterministically generated interop keys.
func NewKeymanager ¶
func NewKeymanager(ctx context.Context, cfg *SetupConfig) (*Keymanager, error)
NewKeymanager instantiates a new imported keymanager from configuration options.
func (*Keymanager) CreateAccountsKeystore ¶ added in v1.1.0
func (km *Keymanager) CreateAccountsKeystore( _ context.Context, privateKeys, publicKeys [][]byte, ) (*AccountsKeystoreRepresentation, error)
CreateAccountsKeystore creates a new keystore holding the provided keys.
func (*Keymanager) DeleteAccounts ¶
func (km *Keymanager) DeleteAccounts(ctx context.Context, publicKeys [][]byte) error
DeleteAccounts takes in public keys and removes the accounts entirely. This includes their disk keystore and cached keystore.
func (*Keymanager) ExtractKeystores ¶
func (km *Keymanager) ExtractKeystores( _ context.Context, publicKeys []bls.PublicKey, password string, ) ([]*keymanager.Keystore, error)
ExtractKeystores retrieves the secret keys for specified public keys in the function input, encrypts them using the specified password, and returns their respective EIP-2335 keystores.
func (*Keymanager) FetchValidatingPrivateKeys ¶
func (km *Keymanager) FetchValidatingPrivateKeys(ctx context.Context) ([][32]byte, error)
FetchValidatingPrivateKeys fetches the list of private keys from the secret keys cache
func (*Keymanager) FetchValidatingPublicKeys ¶
func (km *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][48]byte, error)
FetchValidatingPublicKeys fetches the list of active public keys from the imported account keystores.
func (*Keymanager) ImportKeypairs ¶
func (km *Keymanager) ImportKeypairs(ctx context.Context, privKeys, pubKeys [][]byte) error
ImportKeypairs directly into the keymanager.
func (*Keymanager) ImportKeystores ¶
func (km *Keymanager) ImportKeystores( ctx context.Context, keystores []*keymanager.Keystore, importsPassword string, ) error
ImportKeystores into the imported keymanager from an external source.
func (*Keymanager) Sign ¶
func (km *Keymanager) Sign(ctx context.Context, req *validatorpb.SignRequest) (bls.Signature, error)
Sign signs a message using a validator key.
func (*Keymanager) SubscribeAccountChanges ¶
func (km *Keymanager) SubscribeAccountChanges(pubKeysChan chan [][48]byte) event.Subscription
SubscribeAccountChanges creates an event subscription for a channel to listen for public key changes at runtime, such as when new validator accounts are imported into the keymanager while the validator process is running.
func (*Keymanager) ValidatingAccountNames ¶
func (km *Keymanager) ValidatingAccountNames() ([]string, error)
ValidatingAccountNames for a imported keymanager.
type SetupConfig ¶
SetupConfig includes configuration values for initializing a keymanager, such as passwords, the wallet, and more.