Skip to content

refactor(key)!: rename --entropy and --password flags - #384

Open
chukwudiikeh wants to merge 2 commits into
bitcoindevkit:masterfrom
chukwudiikeh:refactor/key-rename-flags
Open

chukwudiikeh wants to merge 2 commits into
bitcoindevkit:masterfrom
chukwudiikeh:refactor/key-rename-flags

Conversation

@chukwudiikeh

Copy link
Copy Markdown
Contributor

Fixes #381

Depends on #382. This branch is built on top of it because both change the same code; only the last commit (refactor(key)!: ...) belongs to this PR. I'll rebase once #382 is merged.

key generate --entropy takes a number of words, not an amount of entropy, and --password is the BIP-39 passphrase. This PR renames:

  • key generate --entropy → --word_count (-e → -w). The WORD_COUNT env var is unchanged.
  • --password → --passphrase (env PASSWORD → PASSPHRASE) in key generate and key restore, along with the struct fields.The passphrase doc comment, shown by --help, now says that restoring needs the same mnemonic and passphrase, and that a different passphrase gives a different key rather than an error.I used --word_count to match most flags and key derive --derivation_path; if --word-count is preferred, it's a one-word change.

Changed

BREAKING: key generate --entropy/-e is now --word_count/-w, and --password/PASSWORD is now --passphrase/PASSPHRASE in key generate and key restore.

GenerateKeyCommand and RestoreKeyCommand repeated the same steps to
derive the master key from a mnemonic, and the duplication is how
bitcoindevkit#372 happened. Move them into key_from_mnemonic, called by both, and
use the Display impl of Mnemonic instead of the manual fold, which
gives the same output.

Fixes bitcoindevkit#382
@chukwudiikeh

Copy link
Copy Markdown
Contributor Author

@tvpeter @vadim-anfv please can you review when you have time. Built on #383, so only the last commit is new here. Used --word_count.

Rename key generate --entropy to --word_count (-e to -w), since the
value is a number of words, and --password to --passphrase (env
PASSWORD to PASSPHRASE) in key generate and key restore, the BIP-39
term. Expand the passphrase doc comment shown by --help, and update
the tests and changelog.

Fixes bitcoindevkit#381

@emma31-dev emma31-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

key command: rename --entropy to --word-count and --password to --passphrase

2 participants