laranex/laravel-biometric-auth

A laravel package to provide asymmetric biometric authentication

v1.0.0 2024-02-21 08:24 UTC

README

A laravel package to provide asymmetric biometric authentication

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

openssl 3.0^ is required to work with keys from iOS

IMPORTANT: 1.x is for laravel version between ^5.8.x and 9.x Please upgrade to the 2.x to use with laravel 10.x.

Installation

You can install the package via composer:

composer require laranex/laravel-biometric-auth

You can publish and run the migrations with:

php artisan vendor:publish --tag="biometric-auth-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="biometric-auth-config"

This is the contents of the published config file:

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

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

Usage

// 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");

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.