Skip to content

Fix(Android): Add "unknown" authentication method option for Android#81

Merged
mrejdak merged 2 commits into
sbaiahmed1:mainfrom
software-mansion-labs:mrejdak/fix-android-auth-codes
Mar 25, 2026
Merged

Fix(Android): Add "unknown" authentication method option for Android#81
mrejdak merged 2 commits into
sbaiahmed1:mainfrom
software-mansion-labs:mrejdak/fix-android-auth-codes

Conversation

@mrejdak

@mrejdak mrejdak commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Added "unknown" authentication method option for older Android APIs that could return it

This is necessary according to https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationResult#getAuthenticationType() and https://developer.android.com/reference/androidx/biometric/BiometricPrompt#AUTHENTICATION_RESULT_TYPE_UNKNOWN()

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of unknown biometric authentication results. Unknown authentication types are now properly distinguished and returned to the application, rather than being treated as a default case.

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ad9b8fc3-affc-4464-b683-56012383b625

📥 Commits

Reviewing files that changed from the base of the PR and between 2aa8a1d and 36590ec.

📒 Files selected for processing (2)
  • android/src/main/java/com/sbaiahmed1/reactnativebiometrics/ReactNativeBiometricsSharedImpl.kt
  • src/types.ts

📝 Walkthrough

Walkthrough

The pull request adds explicit handling for unknown biometric authentication results by mapping them to a new AuthType.Unknown enum value of -1. Previously, unknown authentication types defaulted to 0. This change updates both the Android implementation and TypeScript type definitions to distinguish between unknown and no-authentication scenarios.

Changes

Cohort / File(s) Summary
Android Biometric Authentication
android/src/main/java/com/sbaiahmed1/reactnativebiometrics/ReactNativeBiometricsSharedImpl.kt
Added explicit handling for BiometricPrompt.AUTHENTICATION_RESULT_TYPE_UNKNOWN, mapping it to -1 in both biometric success handlers instead of defaulting to 0.
TypeScript Type Definitions
src/types.ts
Added Unknown = -1 enum member to AuthType export, enabling type-safe representation of unknown authentication results.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 When auth returns a mystery unknown,
No longer treated as zero alone!
Now -1 marks the cryptic reply,
Types and logic aligned, oh my!
Unknown now has its rightful place. 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding support for an unknown authentication method on Android.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mrejdak
mrejdak merged commit a3a90ea into sbaiahmed1:main Mar 25, 2026
6 checks passed
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.

1 participant