Skip to content

chore: Abstract unlock method into Authentication service#23958

Merged
sethkfman merged 26 commits intomainfrom
chore/6008-abstract-auth-api-cal
Jan 13, 2026
Merged

chore: Abstract unlock method into Authentication service#23958
sethkfman merged 26 commits intomainfrom
chore/6008-abstract-auth-api-cal

Conversation

@Cal-L
Copy link
Copy Markdown
Contributor

@Cal-L Cal-L commented Dec 12, 2025

Description

This PR introduces a consolidated unlockWallet method in the Authentication service. In follow up PRs, we will be replacing both userEntryAuth and appTriggeredAuth invocations with this new method. Under the hood, unlockWallet handles both manual and biometric password login as well as seedless onboarding checks. Unit tests has been provided to validate functionality.

Changelog

CHANGELOG entry:

Related issues

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

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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

Adds a unified wallet unlock path and supporting utilities to streamline login flows and error handling.

  • Introduces Authentication.unlockWallet to handle manual/biometric login, seedless rehydration/password sync checks, post-login ops, and navigation to onboarding or home
  • Adds utils (handlePasswordSubmissionError, checkPasswordRequirement), constants (error strings, MIN_PASSWORD_LENGTH), and types (UnlockWalletErrorType) for granular error handling
  • Exposes unlockWallet via useAuthentication hook
  • Resets biometrics after password change and tidies lockApp (explicit keyring lock, state reset, navigation)
  • Extensive unit tests for unlockWallet and new utils; adjusts existing tests (e.g., vault recreation failure expectations)
  • Adds placeholder store/sagas/authentication.ts for future state machine integration

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

@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.

@Cal-L Cal-L added the team-mobile-platform Mobile Platform team label Dec 12, 2025
@github-actions github-actions bot added size-L and removed size-M labels Dec 19, 2025
@github-actions github-actions bot added size-M and removed size-L labels Dec 19, 2025
@github-actions github-actions bot added size-L and removed size-M labels Jan 9, 2026
@Cal-L Cal-L added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jan 9, 2026
@Cal-L Cal-L added the No QA Needed Apply this label when your PR does not need any QA effort. label Jan 9, 2026
@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Jan 9, 2026
@Cal-L Cal-L added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Jan 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeCore, SmokeAccounts, SmokeWalletPlatform, SmokeWalletUX, SmokeIdentity
  • Risk Level: high
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

The changes are in the critical app/core/Authentication/ module, which handles wallet unlocking, biometric authentication, password management, and seedless onboarding flows.

Key changes include:

  1. New unlockWallet method - A comprehensive method for unlocking the wallet that handles:

    • Existing users vs new users (navigation to onboarding vs home)
    • Password derivation from biometric credentials (FaceID, TouchID, Pincode)
    • Seedless onboarding flows (oauth2Login, rehydrateSeedPhrase, syncPasswordAndUnlockWallet)
    • Post-login operations (dispatchLogin, dispatchPasswordSet, postLoginAsyncOperations)
    • Error handling with proper error types
  2. New utility functions for password error handling and validation

  3. New constants and types for unlock wallet error messages and error types

  4. Hook update exposing unlockWallet through useAuthentication

  5. Saga file (commented out) for future authentication state machine

While the saga code is commented out and the unlockWallet method isn't actively called in production code yet (only exposed through hook), the Authentication module is a critical dependency for:

  • Login/unlock flows
  • Security settings
  • Reveal private credentials
  • Delete wallet functionality
  • Identity effects

The changes also include modifications to the lockApp method with additional comments and the syncPasswordAndUnlockWallet method (removed some error handling code in tests).

Given the high-risk nature of authentication changes and their potential impact on core wallet functionality, comprehensive testing is warranted.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Jan 12, 2026
@Cal-L Cal-L added this pull request to the merge queue Jan 12, 2026
@sethkfman sethkfman removed this pull request from the merge queue due to a manual request Jan 12, 2026
@sethkfman sethkfman added this pull request to the merge queue Jan 12, 2026
Merged via the queue into main with commit f223cad Jan 13, 2026
85 checks passed
@sethkfman sethkfman deleted the chore/6008-abstract-auth-api-cal branch January 13, 2026 00:14
@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 Jan 13, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2026
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jan 13, 2026
@metamaskbot metamaskbot added the release-7.62.0 Issue or pull request that will be included in release 7.62.0 label Jan 13, 2026
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.62.0 Issue or pull request that will be included in release 7.62.0 size-L team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants