Skip to content

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

Open
chukwudiikeh wants to merge 1 commit into
bitcoindevkit:masterfrom
chukwudiikeh:refactor/key-rename-flags
Open

chukwudiikeh wants to merge 1 commit into
bitcoindevkit:masterfrom
chukwudiikeh:refactor/key-rename-flags

Conversation

@chukwudiikeh

@chukwudiikeh chukwudiikeh commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #381

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.

@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.

@emma31-dev emma31-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@chukwudiikeh
chukwudiikeh force-pushed the refactor/key-rename-flags branch from 2dfb344 to bb5cc68 Compare November 12, 2026 11:21
@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.42%. Comparing base (537fbb9) to head (6b27694).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #384   +/-   ##
=======================================
  Coverage   59.42%   59.42%           
=======================================
  Files          24       24           
  Lines        4498     4498           
=======================================
  Hits         2673     2673           
  Misses       1825     1825           
Flag Coverage Δ
rust 59.42% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tvpeter tvpeter added this to the CLI 4.1.0 milestone Nov 18, 2026
@vadim-anfv

Copy link
Copy Markdown
Collaborator

@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.

Reviewing #383 first, and #384 after it is rebased on top of the merged #383, so the two land in order.

One small thing: the description says this depends on #382, which is the issue.
I think PR #383 is meant.

@chukwudiikeh

Copy link
Copy Markdown
Contributor Author

Thanks @vadim-anfv, fixed the description to point at #383. I'll rebase this onto master once #383 is merged.

@chukwudiikeh
chukwudiikeh force-pushed the refactor/key-rename-flags branch from d88c683 to 1d0daf6 Compare December 1, 2026 08:13
@chukwudiikeh

Copy link
Copy Markdown
Contributor Author

@vadim-anfv PR #383 is merged, so I've rebased this onto master it's now a single commit with just the rename.

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
@chukwudiikeh
chukwudiikeh force-pushed the refactor/key-rename-flags branch from d9e1342 to 6b27694 Compare December 3, 2026 14:32

@vadim-anfv vadim-anfv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The rename is complete, no old flag name is left anywhere in the tree. One suggestion on the changelog below, otherwise this reads good to me.

Comment thread CHANGELOG.md
Comment on lines 24 to 25
- Fixed `key restore` ignoring `--password`, which restored passphrase-protected mnemonics to the wrong key
- Fixed `key generate` silently producing a 24-word mnemonic for any `--entropy` value other than 12; values other than 12 and 24 are now rejected

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These two entries sit in the same [Unreleased] section as the rename below them, so at release they will point at flags that no longer exist. Keeping the old name next to the new one fixes that:

Suggested change
- Fixed `key restore` ignoring `--password`, which restored passphrase-protected mnemonics to the wrong key
- Fixed `key generate` silently producing a 24-word mnemonic for any `--entropy` value other than 12; values other than 12 and 24 are now rejected
- Fixed `key restore` ignoring `--password` (now `--passphrase`), which restored passphrase-protected mnemonics to the wrong key
- Fixed `key generate` silently producing a 24-word mnemonic for any `--entropy` (now `--word_count`) value other than 12; values other than 12 and 24 are now rejected

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

4 participants