metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

[IMPROVEMENT] Refactor authentication logic

Open Cal-L opened this issue 3 years ago • 2 comments

Description

We need to refactor our authentication logic to make it more robust and testable. Currently, much of the auth check logic lives in the Login screen, which requires the Login screen to be mounted for the app to work (should be the other way around). Some redundant logic also exists around initial auth check vs login CTA, which we will consolidate in the refactor. Proposal is to pull out auth business logic into an AuthService, which will handle auth between app states + expose log in and log out logic for any components to consume. Refer to ReviewManager.ts.ts as an existing example of how this will be architected.

Technical Details

  • Pull authentication logic from Login.js to new service named AuthService.ts
  • May have to handle auth status between app states through use of AppState module
  • Replace all instances listed below to use functions from AuthService.ts
    • onboarding (create account)
    • onboarding (import account)
    • log in
    • log out
    • change login methods(remember me, biometric)
    • change password
  • Initialize AuthService, either in Root or App file
  • TBD: Mock AuthService for test cases?

Acceptance Criteria

  • Usual login test cases with and without biometrics

    • Include biometric (fingerprint) being present, but disabled in app level settings. Toggle Sign in with Biometrics to OFF and Sign in with device PIN to ON. Ensure that fingerprint does NOT grant access.
  • Metrics to add to user profile properties:

    • ‘Remember Me’ setting: ON or OFF
    • ‘Biometrics’ setting: ON or OFF
    • ‘Password’ set: YES or NO

Cal-L avatar Dec 06 '21 19:12 Cal-L

Hey team! Please add your planning poker estimate with ZenHub @blackdevelopa @cortisiko

sethkfman avatar Jan 19 '22 17:01 sethkfman

Added additional acceptance criteria around disabling biometric and enabling device pin.

plasmacorral avatar Feb 16 '22 22:02 plasmacorral

Closing, PRs have been merged.

chrisleewilcox avatar Mar 13 '23 20:03 chrisleewilcox