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/ */

    

laranex / laravel-biometric-auth example snippets


return [
    'table' => env('BIOMETRIC_AUTH_TABLE', 'biometrics'),

    'signature_algorithm' => env('BIOMETRIC_AUTH_ALGORITHM', OPENSSL_ALGO_SHA256),
];

// 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");
bash
php artisan vendor:publish --tag="biometric-auth-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="biometric-auth-config"