Download the PHP package misakstvanu/laravel-fortify-passkeys without Composer
On this page you can find all versions of the php package misakstvanu/laravel-fortify-passkeys. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download misakstvanu/laravel-fortify-passkeys
More information about misakstvanu/laravel-fortify-passkeys
Files in misakstvanu/laravel-fortify-passkeys
Package laravel-fortify-passkeys
Short Description Passkeys backend implementation for Laravel Fortify
License MIT
Informations about the package laravel-fortify-passkeys
[!WARNING]
This project is currently under development
Laravel Passkeys
This package provides a simple way to authenticate users using passkeys.
Authentication processes are based on web-auth/webauthn-lib
package. On frontend, the opposite functionality is provided by @simplewebauthn/browser
package.
Installation
-
Install the package via composer:
-
Service provider will be auto discovered. If you want to register it manually, add the following line to your
config/app.php
-
Publish migration to create
passkeys
table: - (optional) Publish the config file:
Configuration
-
Implement an interface
Misakstvanu\LaravelPasskeys\Contracts\PasskeyAuthentication
on yourUser
model: -
Set up
passkeys
relation on yourUser
model: - Once you have published the config file, you can configure the package by editing the
config/passkeys.php
file. The variables are:
user_model
- the model that will be used to authenticate the user. Default:App\Models\User
route_prefix
- prefix for the 4 routes this package loads. Default:passkeys
route_middleware
- middleware that will be applied to the routes. Default:['web']
username_column
- the column that will be used to find the user. Default:email
relying_party_ids
- an array of domains that will be allowed insecure connection, use with caution. Default:[]
registration_user_validation
- validation rules that will be applied to the request when registering new user. These values will then be persisted with the new user. Default:[]
Usage
There are 4 named routes that make everything work:
POST 'passkeys.login.start'
- login route, accepts email
or other field specified in your config. If a user with the given username/email exists and has a passkey registered, credential request options will be returned. If the user does not exist, HTTP 404 will be returned instead.
POST 'passkeys.login.verify'
- login route, accepts passkey response. If the passkey authentication passes, the user will be logged in. If the passkey authentication fails, an exception with additional information is thrown.
POST 'passkeys.register.start'
- registration route, accepts email
or other field specified in your config. Credential request options is returned.
POST 'passkeys.register.verify'
- registration route, accepts passkey response. If the passkey registration passes and an user is currently logged in, the passkey will be added to the existing account, if no one is currently logged in, an account will be created from the username/email and any additional data specified in config and sent along with this request. If the passkey registration fails, an exception with additional information is thrown.
JS Example
Below is minimal example of how to use this package with js @simplewebauthn/browser
.
All versions of laravel-fortify-passkeys with dependencies
laravel/framework Version ^10.28
web-auth/webauthn-lib Version ^4.7
laravel/fortify Version ^1.20