From e90df44b43cf2bc5bef652bcbdedda4f3bcec52a Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 14 Jan 2025 10:56:09 +0800 Subject: [PATCH] accounts: replace passPHRASE with passWORD in any user interactions (#19932) --- accounts/errors.go | 2 +- accounts/keystore/keystore.go | 2 +- accounts/keystore/plain_test.go | 2 +- accounts/keystore/testdata/keystore/README | 2 +- cmd/XDC/accountcmd_test.go | 6 +++--- cmd/puppeth/wizard_faucet.go | 2 +- cmd/puppeth/wizard_node.go | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/accounts/errors.go b/accounts/errors.go index 40b21ed179c0..2fed35f9d074 100644 --- a/accounts/errors.go +++ b/accounts/errors.go @@ -35,7 +35,7 @@ var ErrNotSupported = errors.New("not supported") // ErrInvalidPassphrase is returned when a decryption operation receives a bad // passphrase. -var ErrInvalidPassphrase = errors.New("invalid passphrase") +var ErrInvalidPassphrase = errors.New("invalid password") // ErrWalletAlreadyOpen is returned if a wallet is attempted to be opened the // second time. diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go index 0f146a44d4aa..0ed77522e867 100644 --- a/accounts/keystore/keystore.go +++ b/accounts/keystore/keystore.go @@ -42,7 +42,7 @@ import ( var ( ErrLocked = accounts.NewAuthNeededError("password or unlock") ErrNoMatch = errors.New("no key for given address or file") - ErrDecrypt = errors.New("could not decrypt key with given passphrase") + ErrDecrypt = errors.New("could not decrypt key with given password") ) // KeyStoreType is the reflect type of a keystore backend. diff --git a/accounts/keystore/plain_test.go b/accounts/keystore/plain_test.go index a42c75c4ad89..b7c0f5b3a597 100644 --- a/accounts/keystore/plain_test.go +++ b/accounts/keystore/plain_test.go @@ -95,7 +95,7 @@ func TestKeyStorePassphraseDecryptionFail(t *testing.T) { t.Fatal(err) } if _, err = ks.GetKey(k1.Address, account.URL.Path, "bar"); err != ErrDecrypt { - t.Fatalf("wrong error for invalid passphrase\ngot %q\nwant %q", err, ErrDecrypt) + t.Fatalf("wrong error for invalid password\ngot %q\nwant %q", err, ErrDecrypt) } } diff --git a/accounts/keystore/testdata/keystore/README b/accounts/keystore/testdata/keystore/README index c489123c265e..0d4ec3f090cb 100644 --- a/accounts/keystore/testdata/keystore/README +++ b/accounts/keystore/testdata/keystore/README @@ -1,5 +1,5 @@ This directory contains accounts for testing. -The passphrase that unlocks them is "foobar". +The password that unlocks them is "foobar". The "good" key files which are supposed to be loadable are: diff --git a/cmd/XDC/accountcmd_test.go b/cmd/XDC/accountcmd_test.go index dad6b45b6909..9bd57a350f24 100644 --- a/cmd/XDC/accountcmd_test.go +++ b/cmd/XDC/accountcmd_test.go @@ -175,7 +175,7 @@ func TestWalletImportBadPassword(t *testing.T) { XDC.Expect(` !! Unsupported terminal, password will be echoed. Passphrase: {{.InputLine "wrong"}} -Fatal: could not decrypt key with given passphrase +Fatal: could not decrypt key with given password `) } @@ -219,7 +219,7 @@ Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 2/3 Passphrase: {{.InputLine "wrong2"}} Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 3/3 Passphrase: {{.InputLine "wrong3"}} -Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could not decrypt key with given passphrase) +Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could not decrypt key with given password) `) } @@ -281,7 +281,7 @@ func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) { "--password", "testdata/wrong-passwords.txt", "--unlock", "0,2") defer XDC.ExpectExit() XDC.Expect(` -Fatal: Failed to unlock account 0 (could not decrypt key with given passphrase) +Fatal: Failed to unlock account 0 (could not decrypt key with given password) `) } diff --git a/cmd/puppeth/wizard_faucet.go b/cmd/puppeth/wizard_faucet.go index 5c145d5447e7..e449067e49aa 100644 --- a/cmd/puppeth/wizard_faucet.go +++ b/cmd/puppeth/wizard_faucet.go @@ -147,7 +147,7 @@ func (w *wizard) deployFaucet() { infos.node.keyPass = w.readPassword() if _, err := keystore.DecryptKey([]byte(infos.node.keyJSON), infos.node.keyPass); err != nil { - log.Error("Failed to decrypt key with given passphrase") + log.Error("Failed to decrypt key with given password") infos.node.keyJSON = "" infos.node.keyPass = "" } diff --git a/cmd/puppeth/wizard_node.go b/cmd/puppeth/wizard_node.go index 13c9efb9f630..a1d4d12722d0 100644 --- a/cmd/puppeth/wizard_node.go +++ b/cmd/puppeth/wizard_node.go @@ -142,7 +142,7 @@ func (w *wizard) deployNode(boot bool) { infos.keyPass = w.readPassword() if _, err := keystore.DecryptKey([]byte(infos.keyJSON), infos.keyPass); err != nil { - log.Error("Failed to decrypt key with given passphrase") + log.Error("Failed to decrypt key with given password") return } }