Laragear WebAuthn implementation for Laravel Nova to authenticate users with passkeys: fingerprints, patterns and biometrics.
composer require codebarista/nova-webauthn
Run the following command to publish and run the Laragear WebAuthn migrations.
php artisan codebarista:webauthn-setup
Add the WebAuthnAuthenticatable
contract and the WebAuthnAuthentication
trait to the User class, or any other that
uses authentication.
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laragear\Webauthn\Contracts\WebAuthnAuthenticatable;
use Laragear\Webauthn\WebAuthnAuthentication;
class User extends Authenticatable implements WebAuthnAuthenticatable
{
use WebAuthnAuthentication;
// ...
}
Finally, add the NovaWebauthn
registration form to the fields array of the Nova User Resource.
namespace App\Nova;
use Codebarista\NovaWebauthn\NovaWebauthn;
use Laravel\Nova\Http\Requests\NovaRequest;
class User extends Resource
{
public function fields(NovaRequest $request): array
{
return [
// ...
NovaWebauthn::make(),
];
}
}
Note: Make sure that passkey registration and login are done via a secure https connection.
The MIT License (MIT). Please see License File for more information.