Feat/add passkeys
This PR adds support for passkeys to Fortify by wrapping the new laravel/passkeys composer package. For the frontend it can be paired with the official @laravel/passkeys JavaScript client.
Passkeys can be enabled in the features section of config/fortify.php
'features' => [
// ...
Features::passkeys(),
],
and configured via a dedicated passkeys block
'passkeys' => [
'relying_party_id' => parse_url(config('app.url'), PHP_URL_HOST),
'allowed_origins' => [config('app.url')],
'user_handle_secret' => config('app.key'),
'timeout' => 60000,
],
The User model should implement Laravel\Fortify\Contracts\PasskeyUser and use the Laravel\Fortify\PasskeyAuthenticatable trait.
use Laravel\Fortify\Contracts\PasskeyUser;
use Laravel\Fortify\PasskeyAuthenticatable;
class User extends Authenticatable implements PasskeyUser
{
use Notifiable, PasskeyAuthenticatable;
}
Seven new endpoints are added for login (GET /passkeys/login/options, POST /passkeys/login), password confirmation (GET /passkeys/confirm/options, POST /passkeys/confirm), and passkey management (GET /user/passkeys/options, POST /user/passkeys, DELETE /user/passkeys/{passkey})
A draft update to the Fortify docs with more information can be found here: https://github.com/laravel/docs/compare/fortify-passkeys?expand=1