laravel/passkeys
Add passwordless WebAuthn/passkey authentication to Laravel. Install migrations, add a trait/contract to your User model, and use the @laravel/passkeys JS client for registration and login. Includes built-in routes for login, confirmation, and passkey management.
PasskeyAuthenticatable trait and PasskeyUser contract align with Laravel’s authentication ecosystem, reducing architectural friction.GenerateRegistrationOptions, VerifyPasskey) allows for granular customization without monolithic overrides, enabling incremental adoption.PasskeyVerified and PasskeyDeleted integrate with Laravel’s event system, enabling audit logging, analytics, or third-party integrations (e.g., SIEM tools).User model.
Zero breaking changes to existing auth logic (e.g., Auth::attempt() remains functional).@laravel/passkeys) abstracts WebAuthn complexities, allowing React/Vue/Svelte integrations with minimal boilerplate./passkeys/*) and middleware-protected, preventing conflicts with existing endpoints.| Risk Area | Mitigation | Severity |
|---|---|---|
| WebAuthn Browser Support | Tested on Chrome 115+, Safari 16+, Edge 115+. Fallback to password auth if unsupported (via middleware). | Low |
| Database Transactions | Pessimistic locking in VerifyPasskey prevents race conditions in high-concurrency scenarios (e.g., 10K+ users). Requires transactional DB (MySQL InnoDB, PostgreSQL). |
Medium |
| Custom Model Binding | Fixed in v0.2.0 (PR #23). Ensure Passkeys::useUserModel() and Passkeys::usePasskeyModel() are called before routes load. |
Low |
| Dependency Updates | Pinned GitHub Actions SHAs and Dependabot config reduce supply-chain risks. webauthn-lib v5.3 is stable but may require minor PHP 8.1+ adjustments in future. | Medium |
| Passkey Management UX | Default routes assume web middleware. For API-only apps, override middleware to api. |
Low |
| Legacy PHP Support | Requires PHP 8.1+ (for named arguments, attributes). PHP 8.0 may need polyfills or compatibility layer. | Medium |
SELECT ... FOR UPDATE).authorizeLoginUsing() callback.@laravel/passkeys) simplifies integration, but test cross-origin iframes (e.g., embedded widgets).PasskeyVerified) to log to SIEM tools or data lakes.ValidationException.relying_party_id is scoped per tenant (e.g., tenant1.yourdomain.com).AuthenticatorSelectionCriteria in GenerateRegistrationOptions.webauthn-lib for breaking changes.| Component | Compatibility | Notes |
|---|---|---|
| Backend | Laravel 8.83+ (PHP 8.1+). | Tested with Laravel 10.x. Laravel 9.x may require minor adjustments for named arguments. |
| Frontend | Modern browsers (Chrome 115+, Safari 16+, Edge 115+). | npm client works with React 18+, Vue 3+, Svelte 4+. |
| Database | MySQL 8.0+, PostgreSQL 13+, SQLite 3.35+. | Transactions required for pessimistic locking. |
| Auth Systems | Laravel auth scaffolding (e.g., use Illuminate\Foundation\Auth\User). |
Sanctum/Passport users: Passkeys replace traditional sessions/tokens but coexist with existing auth guards. |
| DevOps | Docker, Kubernetes, or bare metal. | No infrastructure changes needed. |
| Monitoring | Laravel Horizon, Sentry, or custom logging. | Events (PasskeyVerified) integrate with Laravel’s logging or third-party tools. |
Phase 1: Pilot (2-4 Weeks)
PasskeyAuthenticatable to User model.Passkeys::ignoreRoutes() if issues arise.Phase 2: Core Integration (4-6 Weeks)
relying_party_id and allowed_origins in config.authorizeLoginUsing() for business logic (e.g., banned users).Phase 3: Advanced Features (Optional)
GenerateVerificationOptions for user-bound verification (e.g., "Confirm payment").AuthenticatorSelectionCriteria for hardware key policies.guard() config to specify which flows use passkeys.GenerateVerificationOptions.PasskeyUser contract for **custom modelsHow can I help you explore Laravel packages today?