PHP code example of r0073rr0r / laravel-webauthn
1. Go to this page and download the library: Download r0073rr0r/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/ */
r0073rr0r / laravel-webauthn example snippets
'rp_id' => env('WEBAUTHN_RP_ID', parse_url(config('app.url'), PHP_URL_HOST) ?: 'localhost'),
'allowed_origins' => [
env('APP_URL'),
],
'
'allowed_algorithms' => [
-7, // ES256 (Elliptic Curve P-256) - Most common, used by Chrome passkeys and YubiKey
-35, // ES384 (Elliptic Curve P-384)
-36, // ES512 (Elliptic Curve P-521)
-257, // RS256 (RSA) - Used by some older hardware security keys
],
'rate_limit' => [
'enabled' => env('WEBAUTHN_RATE_LIMIT_ENABLED', true),
'max_attempts' => env('WEBAUTHN_RATE_LIMIT_ATTEMPTS', 5),
'decay_minutes' => env('WEBAUTHN_RATE_LIMIT_DECAY', 1),
],
'timeout' => env('WEBAUTHN_TIMEOUT', 60000), // 60 seconds default
'key_name' => [
'min_length' => env('WEBAUTHN_KEY_NAME_MIN', 3),
'max_length' => env('WEBAUTHN_KEY_NAME_MAX', 64),
],
'audit_log' => [
'enabled' => env('WEBAUTHN_AUDIT_LOG_ENABLED', true),
'channel' => env('WEBAUTHN_AUDIT_LOG_CHANNEL', 'daily'),
],
// config/logging.php
'channels' => [
// ... existing channels ...
'webauthn-email' => [
'driver' => 'mail',
'level' => 'info',
'to' => env('WEBAUTHN_AUDIT_EMAIL', '[email protected] '),
'subject' => 'WebAuthn Security Event',
],
],
// config/logging.php
'webauthn-slack' => [
'driver' => 'slack',
'url' => env('WEBAUTHN_SLACK_WEBHOOK_URL'),
'username' => 'WebAuthn Bot',
'emoji' => ':warning:',
'level' => 'info',
],
bash
php artisan vendor:publish --provider="r0073rr0r\WebAuthn\WebAuthnServiceProvider"
bash
php artisan vendor:publish --tag=webauthn
bash
php artisan migrate