derived

package
v3.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: GPL-3.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

View Source
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

This section is empty.

Functions

func GenerateAndConfirmMnemonic

func GenerateAndConfirmMnemonic(
	skipMnemonicConfirm bool,
) (string, error)

GenerateAndConfirmMnemonic requires confirming the generated mnemonics.

Types

type EnglishMnemonicGenerator

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

EnglishMnemonicGenerator implements methods for creating mnemonic seed phrases in english using a given source of entropy such as a private key.

func (*EnglishMnemonicGenerator) ConfirmAcknowledgement

func (m *EnglishMnemonicGenerator) ConfirmAcknowledgement(phrase string) error

ConfirmAcknowledgement displays the mnemonic phrase to the user and confirms the user has written down the phrase securely offline.

func (*EnglishMnemonicGenerator) Generate

func (_ *EnglishMnemonicGenerator) Generate(data []byte) (string, error)

Generate a mnemonic seed phrase in english using a source of entropy given as raw bytes.

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, 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

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 SetupConfig

type SetupConfig struct {
	Wallet           iface.Wallet
	ListenForChanges bool
}

SetupConfig includes configuration values for initializing a keymanager, such as passwords, the wallet, and more.

Jump to

Keyboard shortcuts

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