mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Allow creating new accounts to be non-interactive (#6602)
* Allow accounts to be made non-interactively * Merge branch 'master' of github.com:prysmaticlabs/prysm into make-accounts-noninteractive * Update validator/node/node.go * Update validator/accounts/v2/list.go
This commit is contained in:
@@ -85,12 +85,14 @@ func DefaultConfig() *Config {
|
||||
}
|
||||
|
||||
// NewKeymanager instantiates a new direct keymanager from configuration options.
|
||||
func NewKeymanager(ctx context.Context, wallet Wallet, cfg *Config) (*Keymanager, error) {
|
||||
func NewKeymanager(ctx context.Context, wallet Wallet, cfg *Config, skipMnemonicConfirm bool) (*Keymanager, error) {
|
||||
k := &Keymanager{
|
||||
wallet: wallet,
|
||||
cfg: cfg,
|
||||
mnemonicGenerator: &EnglishMnemonicGenerator{},
|
||||
keysCache: make(map[[48]byte]bls.SecretKey),
|
||||
wallet: wallet,
|
||||
cfg: cfg,
|
||||
mnemonicGenerator: &EnglishMnemonicGenerator{
|
||||
skipMnemonicConfirm: skipMnemonicConfirm,
|
||||
},
|
||||
keysCache: make(map[[48]byte]bls.SecretKey),
|
||||
}
|
||||
// If the wallet has the capability of unlocking accounts using
|
||||
// passphrases, then we initialize a cache of public key -> secret keys
|
||||
|
||||
@@ -20,7 +20,9 @@ type SeedPhraseFactory interface {
|
||||
// EnglishMnemonicGenerator implements methods for creating
|
||||
// mnemonic seed phrases in english using a given
|
||||
// source of entropy such as a private key.
|
||||
type EnglishMnemonicGenerator struct{}
|
||||
type EnglishMnemonicGenerator struct {
|
||||
skipMnemonicConfirm bool
|
||||
}
|
||||
|
||||
// Generate a mnemonic seed phrase in english using a source of
|
||||
// entropy given as raw bytes.
|
||||
@@ -42,6 +44,9 @@ func (m *EnglishMnemonicGenerator) ConfirmAcknowledgement(phrase string) error {
|
||||
|
||||
===================================================================
|
||||
`, phrase)
|
||||
if m.skipMnemonicConfirm {
|
||||
return nil
|
||||
}
|
||||
// Confirm the user has written down the mnemonic phrase offline.
|
||||
prompt := promptui.Prompt{
|
||||
Label: "Confirm you have written down the recovery words somewhere safe (offline)",
|
||||
|
||||
Reference in New Issue
Block a user