Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split SRP input by word #14016

Merged
merged 21 commits into from
Mar 21, 2022
Merged

Split SRP input by word #14016

merged 21 commits into from
Mar 21, 2022

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Mar 17, 2022

Explanation

Split the secret recovery phrase input field into one field per word. Each word uses a type="password" field. There is a "show/hide toggle" next to each word allowing you to reveal it, but only one word can be revealed at a time.

This is a new design aimed at making our SRP input component more secure. This design makes it impossible to accidentally reveal your entire SRP to anybody nearby. It also acts as additional protection against the complete SRP being stored in a browser autocomplete database (though to be clear, we could find no evidence this was ever occurring).

More information

Figma design: https://www.figma.com/file/8z4Csc3wlOIkUz2OP1eTZW/Secure-UX-Improvements?node-id=1241%3A12046

There have been some changes from the original design (e.g. the addition of the tip about pasting). Also that design was for the "Onboarding V2" flow, so it was not followed exactly. For now this PR targets the old onboarding flow. I will add this new component to the new onboarding flow in the next PR after this.

Screenshots/Screencaps

Before

old

After

new

srp-input.mp4

Manual testing steps

The two screens that have changed are the "Import" page of onboarding, and the "Restore wallet" page accessible from the lock screen. The component and how it behaves should be identical in both places.

Suggestions on which behaviors to test:

  • It should allow manually typing in the SRP, or pasting the entire thing, or pasting each word individually.
  • The clipboard should be cleared on paste, unless the contents are too long (>24 words). In that case, the clipboard is preserved and the paste event is ignored (i.e. no fields are changed).
  • This should be fully navigable via keyboard, and the show/hide toggle should be toggle-able using the spacebar while focused.
  • All fields should be hidden on paste.
  • Only one field should be revealed at a time. Revealing any field hides the others.

@Gudahtt Gudahtt changed the title Split srp input by word Split SRP input by word Mar 17, 2022
@metamaskbot
Copy link
Collaborator

Builds ready [069506c]
Page Load Metrics (1332 ± 48 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint751203148242116
domContentLoaded11841630133010048
load11911630133210048
domInteractive11841630133010048

highlights:

storybook

@metamaskbot
Copy link
Collaborator

Builds ready [d6fdf01]
Page Load Metrics (1408 ± 59 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6614795178
domContentLoaded11931597140412259
load11931597140812359
domInteractive11931597140412259

highlights:

storybook

This new version of the SrpInput component uses a separate field for
each word of the SRP. Only one field can be revealed at a time, making
it less likely that it gets accidentally revealed to somebody.
The "info" style of `ActionableMessage` is the default, so no type is
required.
The method `toBeInTheDocument()` is now used over `not.toBeNull()` to
improve the readability of tests. Likewise, the convenience method
`.clear` is now used to clear fields rather than manually entering the
key combination to clear a field.
@Gudahtt Gudahtt marked this pull request as ready for review March 21, 2022 15:59
@Gudahtt Gudahtt requested a review from a team as a code owner March 21, 2022 15:59
@Gudahtt Gudahtt requested a review from adonesky1 March 21, 2022 15:59
@adonesky1
Copy link
Contributor

adonesky1 commented Mar 21, 2022

Revealing any field hides the others

Could this possibly be annoying for some users who want to be able to visually confirm the whole phrase? Or atleast in larger chunks than 1 at a time?

cc @holantonela

@metamaskbot
Copy link
Collaborator

Builds ready [d9eb3a5]
Page Load Metrics (1374 ± 65 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7515395189
domContentLoaded12081732137113665
load12141732137413565
domInteractive12081732137113665

highlights:

storybook

@Gudahtt
Copy link
Member Author

Gudahtt commented Mar 21, 2022

Could this possibly be annoying for some users who want to be able to visually confirm the whole phrase? Or atleast in larger chunks than 1 at a time?

Potentially, yes. But this was the tradeoff for making it safer to input. Unsure how we could make the process of checking the entire SRP easier. Right now the process would be "tab + tab + space" to navigate to the next word and reveal it.

@holantonela
Copy link

holantonela commented Mar 21, 2022

Or atleast in larger chunks than 1 at a time?

This is interesting.

Unsure how we could make the process of checking the entire SRP easier

We could do that by rendering the SRP as an image.

Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

um okay i love this. Great work

@brad-decker
Copy link
Contributor

brad-decker commented Mar 21, 2022

I checked all steps on chrome and brave (linux) and it worked like a charm.

Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@Gudahtt Gudahtt merged commit 2931957 into develop Mar 21, 2022
@Gudahtt Gudahtt deleted the split-srp-input-by-word branch March 21, 2022 19:09
@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants