1. Go to this page and download the library: Download faiare/laravel-webauthn 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 Faiare\LaravelWebAuthn\Facades\WebAuthn;
use Illuminate\Support\Facades\DB;
// info must be a string
$info = request()->input('credential');
$publicKey = WebAuthn::register($info);
// store the public key, example...
DB::table('web_authn_keys')->insert([
'webauthn_id' => $publicKey->webauthnId,
'webauthn_key' => $publicKey->webauthnKey,
]);
use Faiare\LaravelWebAuthn\Facades\WebAuthn;
$publicKey = WebAuthn::prepareForAuthenticate();
use Faiare\LaravelWebAuthn\Facades\WebAuthn;
use \Illuminate\Support\Facades\DB;
// info must be a string
$info = request()->input('credential');
$webAuthnId = WebAuthn::parseWebAuthnId($info);
// table must have a column named webauthn_id, webauthn_key
$webAuthnKey = DB::table('web_authn_keys')->where('webauthn_id', $webAuthnId)->first();
$success = WebAuthn::authenticate($info, $webAuthnKey);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.