Command palette

@yasinsensoy/native

React Native · APIs and utilities

Biometrics

Biometric authentication.

6 exports

Import

import { Biometrics } from "@yasinsensoy/native";

Biometric authentication.

NameTypeDescription
getStatus(options?: { strong?: boolean; }) => Promise<BiometricStatus>Hardware, enrollment and type. strong: on Android only Class 3 biometry counts.
authenticate(options?: AuthenticateOptions) => Promise<AuthenticateResult>Opens the system authentication dialog. The result is { success }; on failure error gives the reason (cancelled, lockout, not-enrolled…).
cancel() => Promise<void>Closes the open authentication dialog (returns cancelled).

Biometry type. optic: Apple Vision Pro Optic ID.

type BiometricType = "face" | "fingerprint" | "iris" | "optic" | "none"

The device's biometry status.

NameTypeDescription
hardwarebooleanIs there biometric hardware.
enrolledbooleanIs a fingerprint/face enrolled (can authentication be done).
typeBiometricTypeType. On Android, if there are several, fingerprint comes first.
deviceCredentialbooleanDoes the device have a screen lock (PIN, pattern, password).

Options for Biometrics.authenticate.

NameTypeDefaultDescription
prompt?string"Kimliğini doğrula"Why authentication is requested (iOS reason, Android title).
subtitle?stringAndroid: subtitle.
description?stringAndroid: description.
cancelLabel?stringCancel button.
fallbackLabel?stringiOS: button shown when biometry fails (returns the fallback result). Hidden if not given and allowDeviceCredential is off.
allowDeviceCredential?booleanfalseAlso accept the screen lock (PIN/password) instead of biometry (Android 10+).
strong?booleanfalseAndroid: strong (Class 3) biometry only.
requireConfirmation?booleanfalseAndroid: require an extra confirm button for face recognition.

Authentication error.

type AuthenticateError = "cancelled" | "fallback" | "lockout" | "not-enrolled" | "not-available" | "passcode-not-set" | "timeout" | "failed"

Authentication result. Errors also resolve (never reject).

NameTypeDescription
successtrue | falseAuthenticated.
errorAuthenticateErrorError code.({ /** Not authenticated. */ success: false; /** Error code. */ error: AuthenticateError; /** Error message from the system. */ message: string; })
messagestringError message from the system.({ /** Not authenticated. */ success: false; /** Error code. */ error: AuthenticateError; /** Error message from the system. */ message: string; })