Repository navigation
Conversation
A password, private key or web wallet export password prompt panicked with a stack trace when standard input was not a terminal. The command now says which value it could not ask for and which flag supplies it, and exits 1. Behaviour on a terminal is unchanged. AI disclosure: prepared with AI assistance (OpenAI Codex and Claude by Anthropic). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
create --import accepted a mnemonic with a doubled space or a tab between words and derived other keys than the same words written normally. Such a mnemonic is now refused unless --normalize-mnemonic (single spaces) or --raw-mnemonic (the separators as typed, the earlier behaviour) is given. AI disclosure: prepared with AI assistance (OpenAI Codex and Claude by Anthropic). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on: #132, which must be merged first: the tests here use its command-line test helper. Until then this branch also contains that commit; the change of this PR is the last commit.
Problem. Every key of a wallet, the secp256k1 key tree and the ML-DSA-44 keys, is derived from the exact bytes of the mnemonic, while the validity check splits the mnemonic on any run of white space.
create --importtherefore accepted the words with a doubled space or a tab between two of them and derived a different wallet than the same words written normally: one that a written-down backup of the words does not restore. Nothing told the user.Change.
create --importreads each mnemonic and compares it with the same words joined by single spaces (libhtnwallet.NormalizeMnemonic, which already exists).--normalize-mnemonicuses single spaces and therefore other keys than an older wallet created from the uneven text;--raw-mnemonickeeps the separators as typed, the earlier behaviour, to restore such an older wallet. The mnemonic itself is not echoed.--normalize-mnemonica notice says that spacing was changed and how to restore an older wallet instead. Giving both flags is an error.Validation.
TestImportedMnemonicSpacing(keys package) checks which text is used in each mode.TestCreateImportMnemonicReportsNormalizedWhitespace,TestRawMnemonicHelpDescribesLegacySpacingandTestLegacyMnemonicReimportRequiresSpacingChoiceruncreateas a child process: the notice, the help text, that a reimport without a choice or with both flags leaves an existing keys file unchanged, and that--raw-mnemonicrestores the same keys as before. All four fail with the old code (it imported the uneven text silently and had neither flag) and pass after; they call functions and flags this change adds, so they do not build on the base as written.gofmt -l,go vet ./cmd/htnwallet/...andgo test -race -count=1 ./cmd/htnwallet/...pass with Go 1.27.4 on linux/amd64.Compatibility and limits. Only
create --importchanges, and only for mnemonics with uneven spacing; normally written mnemonics import as before. A script that imported such a mnemonic must now add one of the two flags. Keys files and the daemon are unaffected. This is older than ML-DSA-44 and independent of the fork.AI disclosure: prepared with AI assistance (OpenAI Codex and Claude by Anthropic).