derived

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: GPL-3.0 Imports: 15 Imported by: 1

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 (m *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) DeleteAccounts

func (km *Keymanager) DeleteAccounts(ctx context.Context, publicKeys [][]byte) error

DeleteAccounts 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) ([][48]byte, error)

FetchValidatingPublicKeys fetches the list of validating public keys from the keymanager.

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 added in v1.2.0

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(_ 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