feat: Add Passkey support

- Added a button for logging in with Passkeys in `login.blade.php`
- Refactored the `register` method and added the `login` method in `auth.js`
- Made various modifications and additions to the passkey functionality in `PasskeysController.php`
- Added event listener for login-passkey element in `app.js`
- Modified the passkeys table schema and made modifications to `Passkey.php`
- Changed the redirect route in the `login` method of `AuthController.php`
- Made modifications and additions to the routes in `web.php`
- Added `"web-auth/webauthn-lib": "^4.7"` to the list of required packages in `composer.json`
- Changed the redirect URL in `AdminTest.php`
This commit is contained in:
Jonny Barnes 2023-10-27 20:22:40 +01:00
parent 2fb8339d91
commit 03c8f20a8c
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
18 changed files with 982 additions and 363 deletions

View file

@ -13,27 +13,11 @@ class Passkey extends Model
{
use HasFactory;
/**
* Save and access the passkey appropriately.
*/
protected function passkey(): Attribute
{
return Attribute::make(
get: static fn ($value) => stream_get_contents($value),
set: static fn ($value) => pg_escape_bytea($value),
);
}
/**
* Save and access the transports appropriately.
*/
protected function transports(): Attribute
{
return Attribute::make(
get: static fn ($value) => json_decode($value, true, 512, JSON_THROW_ON_ERROR),
set: static fn ($value) => json_encode($value, JSON_THROW_ON_ERROR),
);
}
/** @inerhitDoc */
protected $fillable = [
'passkey_id',
'passkey',
];
public function user(): BelongsTo
{