Repository navigation
fix(restore): accept a recovery phrase pasted with its word numbers - #231
Open
coolstack-coder wants to merge 1 commit into
Open
coolstack-coder wants to merge 1 commit into
coolstack-coder wants to merge 1 commit into
Conversation
Password managers and other wallets' backups often list the phrase as "1. abandon 2. ability …". Only the punctuation was stripped, so each number stayed as a word: a numbered 12-word phrase filled 24 pills with 12 marked unknown, and a numbered 24-word phrase was cut off halfway. Restore stayed disabled until the user retyped every word. Numbers standing alone are now dropped when the text is split into words. No wordlist word holds a digit, and a SeedQR is decoded before this runs.
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.
Problem
Password managers and other wallets' backups often copy the phrase with its numbers:
1. abandon 2. ability ….cleanMnemonicTextstrips the punctuation but keeps the digits, so each number becomes a word. On Restore:placeWordscuts it to the first 24, so half the phrase is lost.Restore stays disabled until the user retypes every word.
Fix
Drop tokens that are only digits in
cleanMnemonicText. That covers paste and scan (mnemonicWords), typing (mnemonicWordsAsTyped) andnormalizeMnemonicinsetSecret. No word in any supported wordlist holds a digit, and a SeedQR is decoded before this runs, so neither is affected.Tests
A new case in
tests/unit/bip39.test.tscovers1. wordon new lines,1) wordand1.word. It fails onmasterand passes here.tscandeslintare clean.sendDetails.test.tsx› "fills in a payment request opened from home" fails onmastertoo, so it's unrelated to this change.