This package provides Biometric authentication and authorization for MoonShine admin panel. It's based on Passkeys technology using WebAuthn protocol. Biometrics allows to login to the admin panel using such technologies as Apple FaceID, Apple TouchID, Android Fingerprint, Windows Hello, Password Managers with Passkey support, etc.
Your admin panel should use HTTPS scheme only. Even the localhost.
Use composer to install MoonShine Passkeys package:
composer require jampire/moonshine-passkeys --with-all-dependencies
php artisan migratePublish a config file:
php artisan vendor:publish --provider="Jampire\MoonshinePasskeys\PasskeyServiceProvider" --tag=configThis package is designed to work in MoonShine only. You first need to install it. Please read the documentation on how to install and configure MoonShine.
| MoonShine | MoonShine Passkeys | Currently supported |
|---|---|---|
| >= v4.0 | >= v0.1 | yes |
Auto-installer is coming soon...
The most critical config option is passkeys.rp_id. It should match the base URL your Admin Panel is running on.
Passkeys are working with MoonShine User model. It should implement
Jampire\MoonshinePasskeys\Models\Contracts\PasskeyContract interface.
- If you are already using the custom MoonShine User model, you need just to add PasskeyContract interface
and
Jampire\MoonshinePasskeys\Models\Concerns\HasPasskeystrait to your model. - If you are using default MoonShine User model, you need to create new model that extends MoonShine User model, and implement PasskeyContract interface:
<?php
declare(strict_types=1);
namespace App\Models;
use Jampire\MoonshinePasskeys\Models\Concerns\HasPasskeys;
use Jampire\MoonshinePasskeys\Models\Contracts\PasskeyContract;
use MoonShine\Laravel\Models\MoonshineUser;
final class Admin extends MoonshineUser implements PasskeyContract
{
use HasPasskeys;
public function getTable(): string
{
return (new parent())->getTable();
}
}Then you need to tell MoonShine to use your new model:
// config/moonshine.php
return [
// ...
// Authentication and profile
'auth' => [
// ...
'model' => \App\Models\Admin::class,
// ...
],
// ...
];Next step is to tell MoonShine to use LoginForm provided by this package:
// config/moonshine.php
return [
// ...
// Authentication and profile
'forms' => [
// ...
'login' => \Jampire\MoonshinePasskeys\Components\LoginForm::class,
// ...
],
// ...
];It replaces the standard MoonShine Login form. For now, it doesn't support Authentication pipelines.
Please review config/passkeys.php. All important options are described there.
Passkey component is installed in the user's profile page (admin/page/profile-page by default):
Here is an example of how the package works on MacBook with iCloud Keychain and Conditional UI enabled:
By default, to be able to login with traditional password, you need to type your email and click Login button.
The password field will appear. Type the password and click Login button again.
More detailed documentation is coming soon...
Thank you for considering contributing to MoonShine Passkeys project! You can read the contribution guide here.
Please review and abide by the Code of Conduct.
MoonShine Passkeys is open-sourced software licensed under the MIT license.

