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.

@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

Choose a reason for hiding this comment

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

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
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 2dfb344 to bb5cc68 Compare November 12, 2026 11:21
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.96%. Comparing base (5558555) to head (bb5cc68).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/handlers/key.rs 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #384      +/-   ##
==========================================
- Coverage   60.00%   59.96%   -0.05%     
==========================================
  Files          25       25              
  Lines        4736     4726      -10     
==========================================
- Hits         2842     2834       -8     
+ Misses       1894     1892       -2     
Flag Coverage Δ
rust 59.96% <90.00%> (-0.05%) ⬇️

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.

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