Skip to content

Commit

Permalink
all: replace passPHRASE with passWORD in user interactions (ethereum#…
Browse files Browse the repository at this point in the history
…19932)

* Ref ethereum#19906 - replace passPHRASE with passWORD in any user interactions

this skips doccomments and variablenames to minimize impact. It does
however include a rename of the `ethkey` `changepassphrase` parameter

* console: fix JavaScript error capitalization
  • Loading branch information
SjonHortensius authored and karalabe committed Aug 12, 2019
1 parent c9cdf14 commit 36994e4
Show file tree
Hide file tree
Showing 19 changed files with 94 additions and 94 deletions.
2 changes: 1 addition & 1 deletion accounts/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions accounts/external/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
}

func (api *ExternalSigner) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
return []byte{}, fmt.Errorf("passphrase-operations not supported on external signers")
return []byte{}, fmt.Errorf("password-operations not supported on external signers")
}

func (api *ExternalSigner) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
return nil, fmt.Errorf("passphrase-operations not supported on external signers")
return nil, fmt.Errorf("password-operations not supported on external signers")
}
func (api *ExternalSigner) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
return nil, fmt.Errorf("passphrase-operations not supported on external signers")
return nil, fmt.Errorf("password-operations not supported on external signers")
}

func (api *ExternalSigner) listAccounts() ([]common.Address, error) {
Expand Down
2 changes: 1 addition & 1 deletion accounts/keystore/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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.
Expand Down
2 changes: 1 addition & 1 deletion accounts/keystore/plain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion accounts/keystore/testdata/keystore/README
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
4 changes: 2 additions & 2 deletions cmd/clef/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ Response
### account_export

#### Export account from keystore
Export a private key from the keystore. The exported private key is encrypted with the original passphrase. When the
key is imported later this passphrase is required.
Export a private key from the keystore. The exported private key is encrypted with the original password. When the
key is imported later this password is required.

#### Arguments
- account [address]: export private key that is associated with this account
Expand Down
12 changes: 6 additions & 6 deletions cmd/clef/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func setCredential(ctx *cli.Context) error {
utils.Fatalf("Invalid address specified: %s", addr)
}
address := common.HexToAddress(addr)
password := getPassPhrase("Please enter a passphrase to store for this address:", true)
password := getPassPhrase("Please enter a password to store for this address:", true)
fmt.Println()

stretchedKey, err := readMasterKey(ctx, nil)
Expand Down Expand Up @@ -845,17 +845,17 @@ func testExternalUI(api *core.SignerAPI) {
// TODO: there are many `getPassPhrase` functions, it will be better to abstract them into one.
func getPassPhrase(prompt string, confirmation bool) string {
fmt.Println(prompt)
password, err := console.Stdin.PromptPassword("Passphrase: ")
password, err := console.Stdin.PromptPassword("Password: ")
if err != nil {
utils.Fatalf("Failed to read passphrase: %v", err)
utils.Fatalf("Failed to read password: %v", err)
}
if confirmation {
confirm, err := console.Stdin.PromptPassword("Repeat passphrase: ")
confirm, err := console.Stdin.PromptPassword("Repeat password: ")
if err != nil {
utils.Fatalf("Failed to read passphrase confirmation: %v", err)
utils.Fatalf("Failed to read password confirmation: %v", err)
}
if password != confirm {
utils.Fatalf("Passphrases do not match")
utils.Fatalf("Passwords do not match")
}
}
return password
Expand Down
16 changes: 8 additions & 8 deletions cmd/clef/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Enter 'ok' to proceed:
The master seed of clef will be locked with a password.
Please specify a password. Do not forget this password!
Passphrase:
Repeat passphrase:
Password:
Repeat password:
A master seed has been generated into /home/martin/.clef/masterseed.json
Expand Down Expand Up @@ -124,7 +124,7 @@ $ sha256sum rules.js
$ clef attest 645b58e4f945e24d0221714ff29f6aa8e860382ced43490529db1695f5fcc71c
Decrypt master seed of clef
Passphrase:
Password:
INFO [07-01|13:25:03.290] Ruleset attestation updated sha256=645b58e4f945e24d0221714ff29f6aa8e860382ced43490529db1695f5fcc71c
```

Expand Down Expand Up @@ -193,12 +193,12 @@ In order to make more useful rules - like signing transactions - the signer need
```text
$ clef setpw 0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3
Please enter a passphrase to store for this address:
Passphrase:
Repeat passphrase:
Please enter a password to store for this address:
Password:
Repeat password:
Decrypt master seed of clef
Passphrase:
Passpword:
INFO [07-01|14:05:56.031] Credential store updated key=0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3
```

Expand Down Expand Up @@ -237,7 +237,7 @@ f163a1738b649259bb9b369c593fdc4c6b6f86cc87e343c3ba58faee03c2a178 rules.js
$ clef attest f163a1738b649259bb9b369c593fdc4c6b6f86cc87e343c3ba58faee03c2a178
Decrypt master seed of clef
Passphrase:
Password:
INFO [07-01|14:11:28.509] Ruleset attestation updated sha256=f163a1738b649259bb9b369c593fdc4c6b6f86cc87e343c3ba58faee03c2a178
```

Expand Down
12 changes: 6 additions & 6 deletions cmd/ethkey/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ It is possible to refer to a file containing the message.
To sign a message contained in a file, use the --msgfile flag.


### `ethkey changepassphrase <keyfile>`
### `ethkey changepassword <keyfile>`

Change the passphrase of a keyfile.
Change the password of a keyfile.
use the `--newpasswordfile` to point to the new password file.


## Passphrases
## Passwords

For every command that uses a keyfile, you will be prompted to provide the
passphrase for decrypting the keyfile. To avoid this message, it is possible
to pass the passphrase by using the `--passwordfile` flag pointing to a file that
contains the passphrase.
password for decrypting the keyfile. To avoid this message, it is possible
to pass the password by using the `--passwordfile` flag pointing to a file that
contains the password.

## JSON

Expand Down
14 changes: 7 additions & 7 deletions cmd/ethkey/changepassphrase.go → cmd/ethkey/changepassword.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ import (

var newPassphraseFlag = cli.StringFlag{
Name: "newpasswordfile",
Usage: "the file that contains the new passphrase for the keyfile",
Usage: "the file that contains the new password for the keyfile",
}

var commandChangePassphrase = cli.Command{
Name: "changepassphrase",
Usage: "change the passphrase on a keyfile",
Name: "changepassword",
Usage: "change the password on a keyfile",
ArgsUsage: "<keyfile>",
Description: `
Change the passphrase of a keyfile.`,
Change the password of a keyfile.`,
Flags: []cli.Flag{
passphraseFlag,
newPassphraseFlag,
Expand All @@ -58,12 +58,12 @@ Change the passphrase of a keyfile.`,
}

// Get a new passphrase.
fmt.Println("Please provide a new passphrase")
fmt.Println("Please provide a new password")
var newPhrase string
if passFile := ctx.String(newPassphraseFlag.Name); passFile != "" {
content, err := ioutil.ReadFile(passFile)
if err != nil {
utils.Fatalf("Failed to read new passphrase file '%s': %v", passFile, err)
utils.Fatalf("Failed to read new password file '%s': %v", passFile, err)
}
newPhrase = strings.TrimRight(string(content), "\r\n")
} else {
Expand All @@ -73,7 +73,7 @@ Change the passphrase of a keyfile.`,
// Encrypt the key with the new passphrase.
newJson, err := keystore.EncryptKey(key, newPhrase, keystore.StandardScryptN, keystore.StandardScryptP)
if err != nil {
utils.Fatalf("Error encrypting with new passphrase: %v", err)
utils.Fatalf("Error encrypting with new password: %v", err)
}

// Then write the new keyfile in place of the old one.
Expand Down
2 changes: 1 addition & 1 deletion cmd/ethkey/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func init() {
var (
passphraseFlag = cli.StringFlag{
Name: "passwordfile",
Usage: "the file that contains the passphrase for the keyfile",
Usage: "the file that contains the password for the keyfile",
}
jsonFlag = cli.BoolFlag{
Name: "json",
Expand Down
6 changes: 3 additions & 3 deletions cmd/ethkey/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func TestMessageSignVerify(t *testing.T) {
generate := runEthkey(t, "generate", keyfile)
generate.Expect(`
!! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foobar"}}
Repeat passphrase: {{.InputLine "foobar"}}
Password: {{.InputLine "foobar"}}
Repeat password: {{.InputLine "foobar"}}
`)
_, matches := generate.ExpectRegexp(`Address: (0x[0-9a-fA-F]{40})\n`)
address := matches[1]
Expand All @@ -48,7 +48,7 @@ Repeat passphrase: {{.InputLine "foobar"}}
sign := runEthkey(t, "signmessage", keyfile, message)
sign.Expect(`
!! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foobar"}}
Password: {{.InputLine "foobar"}}
`)
_, matches = sign.ExpectRegexp(`Signature: ([0-9a-f]+)\n`)
signature := matches[1]
Expand Down
12 changes: 6 additions & 6 deletions cmd/ethkey/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ import (
// promptPassphrase prompts the user for a passphrase. Set confirmation to true
// to require the user to confirm the passphrase.
func promptPassphrase(confirmation bool) string {
passphrase, err := console.Stdin.PromptPassword("Passphrase: ")
passphrase, err := console.Stdin.PromptPassword("Password: ")
if err != nil {
utils.Fatalf("Failed to read passphrase: %v", err)
utils.Fatalf("Failed to read password: %v", err)
}

if confirmation {
confirm, err := console.Stdin.PromptPassword("Repeat passphrase: ")
confirm, err := console.Stdin.PromptPassword("Repeat password: ")
if err != nil {
utils.Fatalf("Failed to read passphrase confirmation: %v", err)
utils.Fatalf("Failed to read password confirmation: %v", err)
}
if passphrase != confirm {
utils.Fatalf("Passphrases do not match")
utils.Fatalf("Passwords do not match")
}
}

Expand All @@ -58,7 +58,7 @@ func getPassphrase(ctx *cli.Context) string {
if passphraseFile != "" {
content, err := ioutil.ReadFile(passphraseFile)
if err != nil {
utils.Fatalf("Failed to read passphrase file '%s': %v",
utils.Fatalf("Failed to read password file '%s': %v",
passphraseFile, err)
}
return strings.TrimRight(string(content), "\r\n")
Expand Down
30 changes: 15 additions & 15 deletions cmd/geth/accountcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ Print a short summary of all accounts`,
Creates a new account and prints the address.
The account is saved in encrypted format, you are prompted for a passphrase.
The account is saved in encrypted format, you are prompted for a password.
You must remember this passphrase to unlock your account in the future.
You must remember this password to unlock your account in the future.
For non-interactive use the passphrase can be specified with the --password flag:
For non-interactive use the password can be specified with the --password flag:
Note, this is meant to be used for testing only, it is a bad idea to save your
password to file or expose in any other way.
Expand All @@ -142,12 +142,12 @@ password to file or expose in any other way.
Update an existing account.
The account is saved in the newest version in encrypted format, you are prompted
for a passphrase to unlock the account and another to save the updated file.
for a password to unlock the account and another to save the updated file.
This same command can therefore be used to migrate an account of a deprecated
format to the newest format or change the password for an account.
For non-interactive use the passphrase can be specified with the --password flag:
For non-interactive use the password can be specified with the --password flag:
geth account update [options] <address>
Expand All @@ -174,11 +174,11 @@ Prints the address.
The keyfile is assumed to contain an unencrypted private key in hexadecimal format.
The account is saved in encrypted format, you are prompted for a passphrase.
The account is saved in encrypted format, you are prompted for a password.
You must remember this passphrase to unlock your account in the future.
You must remember this password to unlock your account in the future.
For non-interactive use the passphrase can be specified with the -password flag:
For non-interactive use the password can be specified with the -password flag:
geth account import [options] <keyfile>
Expand Down Expand Up @@ -247,17 +247,17 @@ func getPassPhrase(prompt string, confirmation bool, i int, passwords []string)
if prompt != "" {
fmt.Println(prompt)
}
password, err := console.Stdin.PromptPassword("Passphrase: ")
password, err := console.Stdin.PromptPassword("Password: ")
if err != nil {
utils.Fatalf("Failed to read passphrase: %v", err)
utils.Fatalf("Failed to read password: %v", err)
}
if confirmation {
confirm, err := console.Stdin.PromptPassword("Repeat passphrase: ")
confirm, err := console.Stdin.PromptPassword("Repeat password: ")
if err != nil {
utils.Fatalf("Failed to read passphrase confirmation: %v", err)
utils.Fatalf("Failed to read password confirmation: %v", err)
}
if password != confirm {
utils.Fatalf("Passphrases do not match")
utils.Fatalf("Passwords do not match")
}
}
return password
Expand All @@ -268,7 +268,7 @@ func ambiguousAddrRecovery(ks *keystore.KeyStore, err *keystore.AmbiguousAddrErr
for _, a := range err.Matches {
fmt.Println(" ", a.URL)
}
fmt.Println("Testing your passphrase against all of them...")
fmt.Println("Testing your password against all of them...")
var match *accounts.Account
for _, a := range err.Matches {
if err := ks.Unlock(a, auth); err == nil {
Expand All @@ -279,7 +279,7 @@ func ambiguousAddrRecovery(ks *keystore.KeyStore, err *keystore.AmbiguousAddrErr
if match == nil {
utils.Fatalf("None of the listed files could be unlocked.")
}
fmt.Printf("Your passphrase unlocked %s\n", match.URL)
fmt.Printf("Your password unlocked %s\n", match.URL)
fmt.Println("In order to avoid this warning, you need to remove the following duplicate key files:")
for _, a := range err.Matches {
if a != *match {
Expand Down
Loading

0 comments on commit 36994e4

Please sign in to comment.