Download the PHP package wuninsu/nativephp-biometrics without Composer
On this page you can find all versions of the php package wuninsu/nativephp-biometrics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wuninsu/nativephp-biometrics
More information about wuninsu/nativephp-biometrics
Files in wuninsu/nativephp-biometrics
Package nativephp-biometrics
Short Description Fingerprint, Face ID and Touch ID prompts for NativePHP Mobile apps.
License MIT
Informations about the package nativephp-biometrics
NativePHP Biometrics
Fingerprint, Face ID and Touch ID prompts for NativePHP Mobile v4 apps.
- Android:
androidx.biometricBiometricPrompt(Class 3 / strong biometrics). - iOS:
LocalAuthentication(Face ID, Touch ID, Optic ID).
The prompt answers one question: is the phone's owner holding it? The fingerprint or face never reaches the app. To protect a secret behind the prompt, keep the secret itself in secure storage (for example wuninsu/nativephp-secure-storage), and use the prompt to decide whether the app may use it.
Early release (0.x). The PHP side is covered by tests and the Android code compiles against NativePHP Mobile 4.6. Testing on real phones is in progress, so the API may still change before 1.0.
Requirements
- PHP 8.3+
nativephp/mobile^4.6.1 (from 4.6.1, NativePHP only accepts events from the phone that implementDispatchableFromNative; use v0.1.0 of this plugin with 4.6.0)- Android 8 (API 26) or newer, iOS 18.2 or newer
Install
NativePHP compiles only the plugins you register. If your app has no app/Providers/NativeServiceProvider.php yet, publish it first:
Then register the plugin and rebuild the native project:
The plugin adds NSFaceIDUsageDescription ("Use Face ID to unlock the app.") to the iOS Info.plist. Apple requires it before Face ID can be used.
Use
Can the phone do it?
Show the prompt
The prompt runs on the phone's screen, so its result arrives later, as the Wuninsu\NativeBiometrics\Events\Completed event.
Or listen for the event anywhere (a Laravel listener, or #[On] / #[OnNative] in a component):
$event->error is null on success, otherwise one of: cancelled, failed, lockout, not_enrolled, unavailable, timeout. A single unrecognised finger or face does not end the prompt; the phone lets the user try again.
Use ->id('…') to match the event to the prompt that started it, and ->event(MyEvent::class) to receive another event class (its constructor takes bool $success, ?string $id, ?string $error).
Only on the phone
The plugin's native code exists only in a real build (php artisan native:run or a release). It is not in the NativePHP Jump app, and there is no bridge on a web server or in tests. Biometrics::isAvailable() is true only inside a built app that contains this plugin.
Testing
Bridge functions
| Function | Parameters | Returns |
|---|---|---|
WuninsuBiometrics.Status |
none | {available, biometry, reason?, deviceSecure} |
WuninsuBiometrics.Prompt |
id, event, title, subtitle?, reason, cancel, allowDeviceCredential |
{started: true}, then the event {success, id, error} |
License
MIT