all: replace passPHRASE with passWORD in user interactions (#19932)
* Ref #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
This commit is contained in:
committed by
Péter Szilágyi
parent
c9cdf144d5
commit
36994e4e0b
@ -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
|
||||
|
||||
|
@ -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,
|
||||
@ -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 {
|
||||
@ -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.
|
@ -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",
|
||||
|
@ -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]
|
||||
@ -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]
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
@ -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")
|
||||
|
Reference in New Issue
Block a user