PHP code example of laranex / laravel-biometric-auth
1. Go to this page and download the library: Download laranex/laravel-biometric-auth library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Use Laranex\LaravelBiometricAuth\Traits\HasBiometrics in your Authenticable Model such as User, Admin
class User extends Authenticatable {
use Laranex\LaravelBiometricAuth\Traits\HasBiometrics;
}
// Register a new biometric
$user->createBiometric("Public Key in base 64 format, not PEM format");
// Create a challenge for biometric authentication
$biometric = Laranex\LaravelBiometricAuth\Facades\LaravelBiometricAuth::getBiometric("UUID of a biometric");
// Get the authenticable instance
$biometric->instance
// Verify the signature
Laranex\LaravelBiometricAuth\Facades\LaravelBiometricAuth::verifyBiometric("UUID of a biometric", "Signature");
// Revoke a biometric
$user->revokeBiometric("UUID of a biometric");