Skip to content

Ask for device authentication before sensitive confirm actions - #365

Closed
subhannaeem wants to merge 10 commits into
mainfrom
fix/auth-before-sensitive-actions
Closed

subhannaeem wants to merge 10 commits into
mainfrom
fix/auth-before-sensitive-actions

Conversation

@subhannaeem

@subhannaeem subhannaeem commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor
  • Sending, signing, pairing, product approvals and phrase backups now ask for screen lock or biometrics, matching iOS.
  • Cancelling changes nothing. Other failures show “Couldn't confirm it's you”.
  • Messages now appear above bottom sheets instead of behind them.

Closes #339

Testing

proof-pr365-device-auth.mp4
pairing-auth-success-annotated.mp4
  • 6 unit tests for the authentication helper, all passing (./gradlew :tools:biometrics:impl:testNightlyUnitTest)

@subhannaeem subhannaeem self-assigned this Nov 23, 2026
@subhannaeem
subhannaeem marked this pull request as ready for review November 23, 2026 18:47
}

return try {
runCancellableCatching { authMethod.authenticateUser() }.flatten()

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.

minor: Why catch around authenticateUser() here instead of making BiometricPromptAuthenticationMethod return a failure when there is no activity, as its Result type promises?

@subhannaeem subhannaeem Nov 24, 2026 •

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.

@mikyar
The method now returns failures directly and reuses the checked activity, so the service catch and extra executor are gone.

Comment on lines +35 to +40
biometricsService.performOneTimeAuthentication()
.onSuccess {
context.deliverApproved()
router.back()
}
.onFailure { showPresentationError(AuthenticationFailedPresentationError(it)) }

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.

minor: Can we have one helper for this gate and its AuthenticationFailedPresentationError mapping? Same block in PaymentRequestViewModel, TransactionSignViewModel, PairRequestViewModel, SendEnterAmountViewModel and both backup ViewModels.

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.

@mikyar
Added onAuthenticated to BaseViewModel to handle success and errors. All seven gates now use it, including both backup ViewModels.

mikyar
mikyar previously approved these changes Nov 24, 2026
@subhannaeem
subhannaeem requested a review from mikyar November 24, 2026 13:44
@valentunn

Copy link
Copy Markdown
Contributor

Needs UX confirmation from @SabitKadyr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android. Finding #790

4 participants