Skip to content

mask recovery phrase input#367

Merged
leofelix077 merged 9 commits intomainfrom
lf-mask-paste-recovery-phrase
Sep 16, 2025
Merged

mask recovery phrase input#367
leofelix077 merged 9 commits intomainfrom
lf-mask-paste-recovery-phrase

Conversation

@leofelix077
Copy link
Copy Markdown
Collaborator

Closes #306

Screen.Recording.2025-09-12.at.13.21.04.mov

@leofelix077 leofelix077 self-assigned this Sep 12, 2025
@leofelix077 leofelix077 added the enhancement New feature or request label Sep 12, 2025
@CassioMG
Copy link
Copy Markdown
Contributor

can we add the mask/unmask button?
Screenshot 2025-09-12 at 12 23 45

Comment thread src/i18n/locales/en/translations.json
Comment thread src/components/sds/RecoveryPhraseInput/index.tsx Outdated
Comment thread src/components/sds/RecoveryPhraseInput/index.tsx Outdated
Comment thread src/components/sds/RecoveryPhraseInput/index.tsx Outdated
@CassioMG
Copy link
Copy Markdown
Contributor

@leofelix077 could we make sure the recovery phrase is trimmed when we paste it? it's removing accent and lowercasing but it is not trimming so it still fails for me.

also there is something not working correctly, when I paste a recovery phrase with uppercase and accents it fixes them but when I tap "Import wallet" it still throws an error as if the recovery phrase is wrong. Then if I delete a letter and re-type it and tap on "Importa wallet" then it works fine.

another thing with the mask/unmask button: if you paste the recovery phrase then delete a single letter and tap on the mask/unmask button it doesn't work, it will only work for the new letters you type. For the ones that were pasted it takes no effect.

@leofelix077 leofelix077 reopened this Sep 15, 2025
@leofelix077
Copy link
Copy Markdown
Collaborator Author

@CassioMG simplified the logic a bit to remove the masking only from completed words (blur/focus logic) and adjusted the issues with the masked value on deletions. + the trimming for paste

Comment thread src/helpers/recoveryPhrase.ts Outdated
export const normalizeAndTrimText = (text: string): string =>
normalizeText(text).trim().replace(/\n/g, " ");
export const normalizeAndTrimRecoveryPhrase = (text: string): string =>
normalizeRecoveryPhrase(text).trim().replace(/\n/g, " ");
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.

@leofelix077 should we do the replace() here first and call trim() as the last action? So to avoid replacing a line break at the end of the string with a space which would break the validation

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

true. done

@CassioMG
Copy link
Copy Markdown
Contributor

@leofelix077 thanks for the adjustments, the functionality/UX is looking great to me now. The only thing I noticed is that it's still displaying the Invalid mnemonic (see bip39) error message. I've reinstalled it on my Simulator to make sure it'd get the updated translations but I'm still getting this error message.

Are you able to see the new error message on your device?

Screenshot 2025-09-16 at 10 41 25

@leofelix077
Copy link
Copy Markdown
Collaborator Author

@CassioMG adjusted this part now

@leofelix077 leofelix077 merged commit ae31aa7 into main Sep 16, 2025
4 checks passed
@leofelix077 leofelix077 deleted the lf-mask-paste-recovery-phrase branch September 16, 2025 18:56
@github-actions github-actions Bot mentioned this pull request Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pasting recovery phrase should mask all words by default

2 participants