Skip to content

refactor: Replace device security toggle in settings + deprecate remember me + introduce auth capabilities functionality#25994

Merged
Cal-L merged 89 commits into
mainfrom
refactor/MCWP-305-replace-auth-preference-toggles
Feb 20, 2026
Merged

refactor: Replace device security toggle in settings + deprecate remember me + introduce auth capabilities functionality#25994
Cal-L merged 89 commits into
mainfrom
refactor/MCWP-305-replace-auth-preference-toggles

Conversation

@Cal-L

@Cal-L Cal-L commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Description

This change replaces the legacy authentication toggles in settings (biometrics, passcode, and remember me) with a consolidated toggle: Device Authentication. With the new implementation, we support three authentication tiers: Remember Me (Legacy), Biometrics, and Passcode/Pin/Pattern (Consolidated into Device Authentication). Since Remember Me is deprecated, users using the feature will initially see a Remember Me toggle (to preserve backwards compatibility). However, once turned off, Remember Me will never be shown again. New users will never see the Remember Me option. We are also supporting backwards compatibility with respect to the other two authentication preferences: biometrics and passcode. The app will continue to respect the option that the user has chosen as long as the auth preference is toggled on.

The toggles and authentication system is also designed to support the transition into a more seamless authentication system: Biometrics first authentication with device passcode fallback. In other words, users will be able to use any biometrics or device passcode to access their wallet. For example, if a user disables biometrics in the OS settings while auth preferences is enabled in the app, the app will automatically fallback to use device passcode as opposed to password. Password is used as a fallback whenever authentication preferences is disabled by a user in the app. This is why the toggle is labeled as Device Authentication, because the device handles which auth tier to use.

Changelog

CHANGELOG entry:

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-305

Manual testing steps

Remember Me (new users won't see this option anymore)

  • With Remember Me previously toggled on
  • User should see Remember Me toggle in Settings
  • Turn off Remember Me
  • With biometrics enabled in OS settings, device toggle should now show biometrics option (or device authentication for Android)
  • With biometrics disabled in OS settings, device toggle should now show passcode option (or device authentication for Android)

Legacy biometrics on iOS (force use biometrics)

  • Turn on biometrics
  • App should prompt biometrics when locked
  • Turn off biometrics in OS
  • App should fallback to use password
  • User should see CTA in settings that links into OS settings to re-enable device authentication
  • Turn on biometrics in OS settings
  • App should now prompt biometrics
  • Turn off biometrics toggle in settings
  • App should now fallback to password

Legacy Passcode on iOS (force use passcode)

  • Turn on passcode
  • App should prompt passcode when locked
  • Turn off passcode in OS
  • App should fallback to use password
  • User should see CTA in settings that links into OS settings to re-enable device authentication
  • Turn on passcode in OS settings
  • App should now prompt passcode
  • Turn off passcode toggle in settings
  • App should now fallback to password

Device Authentication (Consolidated behavior)

  • If biometrics is enabled in OS
  • Turn on device authentication toggle
  • App should prompt biometrics when locked
  • Turn off biometrics in OS
  • App should fallback to use passcode
  • Turn off passcode in OS
  • User should see CTA in settings that links into OS settings to re-enable device authentication
  • Turn on biometrics in OS
  • App should prompt biometrics when locked
  • Turn off device authentication in settings
  • App should now fallback to password

Screenshots/Recordings

Before

After

Turning off Remember Me

turn-off-remember-me.mov

Legacy biometrics

legacy-biometrics.mov

Legacy passcode

legacy-passcode.mov

Device authentication on iOS

device-auth-ios.mov

Device authentication on Android

device-authentication-android.mov

Device authentication on Login screen

device-authentication-login.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches login and security-settings authentication flows (capability detection, unlock entry points, and preference updates), so regressions could block sign-in or mis-handle auth state despite solid test updates.

Overview
Consolidates authentication UX around a single “Device Authentication” capability model. The login screen replaces the platform-specific BiometryButton (and its many icon variants) with a new DeviceAuthenticationButton that renders a single SecurityKey icon and shows/hides based on useAuthCapabilities and lock state.

Refactors Security Settings and Remember Me deprecation flow. The legacy settings sections for biometrics/passcode and the Remember Me toggle are removed and replaced with a new DeviceSecurityToggle that derives the target auth type via getAuthCapabilities, supports a settings CTA when OS auth must be enabled, handles password-required errors via EnterPasswordSimple callbacks, and uses optimistic UI state. Disabling Remember Me via TurnOffRememberMeModal now always restores PASSWORD auth and clears PREVIOUS_AUTH_TYPE_BEFORE_REMEMBER_ME, with modal button styling made configurable via cancelButtonMode.

Tests and snapshots are updated accordingly (new toggle/button tests, updated selectors, and improved async/trace handling in login tests).

Written by Cursor Bugbot for commit 9a0dae8. This will update automatically on new commits. Configure here.

Cal-L added 28 commits February 4, 2026 08:13
…tor/MCWP-305-consolidate-biometrics-and-passcode
…tor/MCWP-305-consolidate-biometrics-and-passcode
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Simplify hook

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Expose auth methods

// TODO: Remove this once we have a proper way to handle biometrics
await StorageWrapper.setItem(PASSCODE_DISABLED, TRUE);
await StorageWrapper.setItem(BIOMETRY_CHOICE_DISABLED, TRUE);
await SecureKeychain.setGenericPassword(password, authType);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Greatly simplify store password to just pass through auth type

default:
await SecureKeychain.setGenericPassword(password, undefined);
// Keep Redux in sync with keychain so getAuthCapabilities reflects actual access control
this.updateOsAuthEnabled(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is where osAuthEnabled is updated since it reflects the status of stored password result

isEnrolledAsync(),
supportedAuthenticationTypesAsync(),
getEnrolledLevelAsync(),
StorageWrapper.getItem(BIOMETRY_CHOICE_DISABLED),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also account for legacy flags in auth capabilities derivation

authStorageType = AUTHENTICATION_TYPE.PASSWORD;
}
// The auth type used for keychain storage
const authType = getAuthType({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Derive auth type from util

});

// Ex - "Face ID", "Device Passcode", "Password"
const authLabel = getAuthLabel({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Derive auth label from util

authStorageType: AUTHENTICATION_TYPE;
authType: AUTHENTICATION_TYPE;
/** True when device auth cannot be used until the user changes device settings */
deviceAuthRequiresSettings: boolean;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Boolean to indicate if we should show a link to open OS settings for enabling device authentication

const defaultOptions = {
// Default options used for storing credentials in the keychain
// Do not re-use for other scopes unless you know what you are doing
const defaultCredentialsOptions: Keychain.SetOptions = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed invalid properties

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeWalletPlatform
  • Selected Performance tags: @PerformanceLogin
  • Risk Level: high
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a significant refactoring of the authentication system in MetaMask Mobile. The changes include:

  1. Core Authentication Refactoring:

    • Authentication.ts: Major changes to storePassword method, getAuthCapabilities, and new updateOsAuthEnabled method
    • SecureKeychain.ts: Simplified keychain storage with unified access control (BIOMETRY_ANY_OR_DEVICE_PASSCODE)
    • New AUTHENTICATION_TYPE.DEVICE_AUTHENTICATION type, deprecating BIOMETRIC, PASSCODE, and REMEMBER_ME
  2. UI Changes:

    • Login screen: Replaced BiometryButton with DeviceAuthenticationButton, simplified auth flow using useAuthCapabilities hook
    • Security Settings: New DeviceSecurityToggle component replacing LoginOptionsSettings and RememberMeOptionSection
    • Deleted components: BiometryButton, LoginOptionsSettings, RememberMeOptionSection
  3. Migration 120: New migration to derive osAuthEnabled from existing auth preferences for existing users

  4. Test ID Changes: BIOMETRICS_TOGGLE and DEVICE_PASSCODE_TOGGLE replaced with DEVICE_SECURITY_TOGGLE

Selected Tags Reasoning:

  • SmokeAccounts: Required because changes affect account security flows including SRP protection, credential display, and authentication mechanisms. The Login screen changes and Security Settings changes directly impact account access flows.
  • SmokeWalletPlatform: Required because changes affect core wallet platform features including the login/unlock flow, security settings, and wallet lifecycle. The migration affects existing users' authentication preferences.

The changes don't directly affect:

  • Transaction confirmations (SmokeConfirmations)
  • Network management (SmokeNetworkAbstractions/SmokeNetworkExpansion)
  • Trading features (SmokeTrade, SmokePerps, SmokePredictions)
  • Card features (SmokeCard)
  • Ramps (SmokeRamps)
  • Multi-chain API (SmokeMultiChainAPI)
  • Identity sync (SmokeIdentity)
  • Snaps (FlaskBuildTests)

Performance Test Selection:
The changes significantly affect the login and authentication flow. The Login screen now uses useAuthCapabilities hook which fetches authentication capabilities asynchronously. The SecureKeychain.getGenericPassword method has been modified with new access control options. These changes could impact login/unlock performance, making @PerformanceLogin appropriate to verify there's no performance regression in the authentication flow.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@MarioAslau MarioAslau left a comment

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.

LGTM

@Cal-L Cal-L enabled auto-merge February 19, 2026 23:17

@vinnyhoward vinnyhoward left a comment

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.

LGTM

@Cal-L Cal-L added this pull request to the merge queue Feb 20, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Feb 20, 2026
Merged via the queue into main with commit 4808001 Feb 20, 2026
97 of 98 checks passed
@Cal-L Cal-L deleted the refactor/MCWP-305-replace-auth-preference-toggles branch February 20, 2026 00:25
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Feb 20, 2026
@github-actions github-actions Bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 20, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 20, 2026
@metamaskbot metamaskbot added the release-7.68.0 Issue or pull request that will be included in release 7.68.0 label Feb 20, 2026
@Cal-L Cal-L restored the refactor/MCWP-305-replace-auth-preference-toggles branch March 18, 2026 21:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no changelog required No changelog entry is required for this change No QA Needed Apply this label when your PR does not need any QA effort. no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.68.0 Issue or pull request that will be included in release 7.68.0 size-XL team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants