Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateAndConfirmMnemonic(mnemonicLanguage string, skipMnemonicConfirm bool) (string, error)
- type Keymanager
- func (km *Keymanager) DeleteKeystores(ctx context.Context, publicKeys [][]byte) ([]*ethpbservice.DeletedKeystoreStatus, error)
- func (km *Keymanager) ExtractKeystores(ctx 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) ([][fieldparams.BLSPubkeyLength]byte, error)
- func (km *Keymanager) ImportKeystores(ctx context.Context, keystores []*keymanager.Keystore, passwords []string) ([]*ethpbservice.ImportedKeystoreStatus, error)
- func (km *Keymanager) ListKeymanagerAccounts(ctx context.Context, cfg keymanager.ListKeymanagerAccountConfig) error
- func (km *Keymanager) RecoverAccountsFromMnemonic(ctx context.Context, mnemonic, mnemonicLanguage, mnemonicPassphrase string, ...) error
- func (km *Keymanager) Sign(ctx context.Context, req *validatorpb.SignRequest) (bls.Signature, error)
- func (km *Keymanager) SubscribeAccountChanges(pubKeysChan chan [][fieldparams.BLSPubkeyLength]byte) event.Subscription
- func (km *Keymanager) ValidatingAccountNames(_ context.Context) ([]string, error)
- type MnemonicGenerator
- type SetupConfig
Constants ¶
const ( // DerivationPathFormat describes the structure of how keys are derived from a master key. DerivationPathFormat = "m / purpose / coin_type / account_index / withdrawal_key / validating_key" // ValidatingKeyDerivationPathTemplate defining the hierarchical path for validating // keys for Prysm Ethereum validators. According to EIP-2334, the format is as follows: // m / purpose / coin_type / account_index / withdrawal_key / validating_key ValidatingKeyDerivationPathTemplate = "m/12381/3600/%d/0/0" )
Variables ¶
var ( DefaultMnemonicLanguage = "english" ErrUnsupportedMnemonicLanguage = errors.New("unsupported mnemonic language") )
ErrUnsupportedMnemonicLanguage is returned when trying to use an unsupported mnemonic language.
Functions ¶
Types ¶
type Keymanager ¶
type Keymanager struct {
// contains filtered or unexported fields
}
Keymanager implementation for derived, HD keymanager using EIP-2333 and EIP-2334.
func NewKeymanager ¶
func NewKeymanager( ctx context.Context, cfg *SetupConfig, ) (*Keymanager, error)
NewKeymanager instantiates a new derived keymanager from configuration options.
func (*Keymanager) DeleteKeystores ¶
func (km *Keymanager) DeleteKeystores( ctx context.Context, publicKeys [][]byte, ) ([]*ethpbservice.DeletedKeystoreStatus, error)
DeleteKeystores for a derived keymanager.
func (*Keymanager) ExtractKeystores ¶
func (km *Keymanager) ExtractKeystores( ctx 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 validating private keys from the keymanager.
func (*Keymanager) FetchValidatingPublicKeys ¶
func (km *Keymanager) FetchValidatingPublicKeys(ctx context.Context) ([][fieldparams.BLSPubkeyLength]byte, error)
FetchValidatingPublicKeys fetches the list of validating public keys from the keymanager.
func (*Keymanager) ImportKeystores ¶
func (km *Keymanager) ImportKeystores( ctx context.Context, keystores []*keymanager.Keystore, passwords []string, ) ([]*ethpbservice.ImportedKeystoreStatus, error)
ImportKeystores for a derived keymanager.
func (*Keymanager) ListKeymanagerAccounts ¶
func (km *Keymanager) ListKeymanagerAccounts(ctx context.Context, cfg keymanager.ListKeymanagerAccountConfig) error
func (*Keymanager) RecoverAccountsFromMnemonic ¶
func (km *Keymanager) RecoverAccountsFromMnemonic( ctx context.Context, mnemonic, mnemonicLanguage, mnemonicPassphrase string, numAccounts int, ) error
RecoverAccountsFromMnemonic given a mnemonic phrase, is able to regenerate N accounts from a derived seed, encrypt them according to the EIP-2334 JSON standard, and write them to disk. Then, the mnemonic is never stored nor used by the validator.
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 [][fieldparams.BLSPubkeyLength]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(_ context.Context) ([]string, error)
ValidatingAccountNames for the derived keymanager.
type MnemonicGenerator ¶
type MnemonicGenerator struct {
// contains filtered or unexported fields
}
MnemonicGenerator implements methods for creating mnemonic seed phrases in english using a given source of entropy such as a private key.
func (*MnemonicGenerator) ConfirmAcknowledgement ¶
func (m *MnemonicGenerator) ConfirmAcknowledgement(phrase string) error
ConfirmAcknowledgement displays the mnemonic phrase to the user and confirms the user has written down the phrase securely offline.
type SetupConfig ¶
SetupConfig includes configuration values for initializing a keymanager, such as passwords, the wallet, and more.