laragear/webauthn
Laravel package to authenticate users with WebAuthn passkeys (biometrics, device keys). Provides request validation and login flow with attestation/assertion support, compatible with Octane. Note: superseded by laravel/passkeys and unmaintained.
Pros:
eloquent-webauthn driver, enabling seamless fallback to password auth (password_fallback: true).paragonie/sodium_compat).WebAuthnAuthenticatable contract and WebAuthnAuthentication trait for clean, reusable user model integration.Cons:
laravel/passkeys is now the maintained standard. This package’s archival status introduces technical debt risk (e.g., unpatched vulnerabilities, lack of Laravel 13+ compatibility).@laragear/webpass JS library or custom middleware).webauthn_credentials table (or customizable variant). Migration conflicts possible if using other auth packages (e.g., Sanctum, Passport).@laragear/webpass (separate npm package) for client-side WebAuthn flows. Alternative: Manual JS implementation using the WebAuthn API.| Risk Area | Severity | Mitigation |
|---|---|---|
| Deprecated Package | High | Migrate to laravel/passkeys post-PoC. Track laragear/webauthn for critical fixes. |
| Crypto Vulnerabilities | Medium | Audit OpenSSL/Sodium configurations; prefer EdDSA (Sodium) for forward secrecy. |
| CSRF/Session Issues | Medium | Implement custom CSRF middleware for WebAuthn routes or use @laragear/webpass. |
| Schema Conflicts | Low | Test migration in staging; consider soft-deleting old auth tables if migrating. |
| Browser/Device Support | Low | Use feature detection (e.g., Webpass.isUnsupported()) with fallback UIs. |
Why Use This Over laravel/passkeys?
laragear/webauthn dependencies).laravel/passkeys ASAP.How Will This Scale?
id/user_id is critical).openssl_* functions are thread-safe under load.laravel/horizon or Swoole workers.Fallback Auth Strategy
password_fallback: true) interact with existing auth (e.g., Sanctum API tokens)?Compliance
Long-Term Maintenance
laravel/passkeys?laragear/webauthn logic.ext-openssl (required) and ext-sodium (recommended).@laragear/webpass) or custom WebAuthn API calls. Frameworks (React/Vue) require manual integration.Assessment Phase:
PoC Implementation:
composer require laragear/webauthn.php artisan webauthn:install to publish config/migration.WebAuthnAuthenticatable in the User model.auth.php with eloquent-webauthn driver.Gradual Rollout:
userless() for resident keys).password_fallback: false) after adoption threshold.Migration to laravel/passkeys:
webauthn_credentials and passkeys tables.laragear/webauthn routes/controllers post-migration.| Component | Compatibility | Notes |
|---|---|---|
| Laravel Auth | ✅ Full (extends Eloquent provider) | Supports guards, sessions, API tokens (if using Sanctum/Passport). |
| Laravel Octane | ✅ Optimized | Test under high load (OpenSSL bottlenecks possible). |
| Frontend Frameworks | ⚠️ Manual JS required (no official Vue/React adapters) | Use @laragear/webpass or webauthn-polyfill. |
| Multi-Tenant | ❌ Not natively supported | Customize RelayingPartyID per tenant in attestation requests. |
| 2FA Integration | ✅ Possible (see Laragear TwoFactor) | Combine with TOTP/HOTP for layered security. |
Prerequisites:
ext-openssl and ext-sodium (or paragonie/sodium_compat).Core Setup:
php artisan webauthn:install.php artisan migrate.User Model:
WebAuthnAuthenticatable contract and WebAuthnAuthentication trait.Routing:
web.php (disable CSRF):
WebAuthnRoutes::register()->withoutMiddleware(VerifyCsrfToken::class);
Controllers:
AttestationRequest/AttestedRequest for registration.AssertedRequest for login (e.g., public function login(AssertedRequest $request)).Frontend:
@laragear/webpass or use native WebAuthn API:
// Example: Resident key registration
const { success } = await Webpass.attest("/webauthn/register/options", "/webauthn/register");
Testing:
How can I help you explore Laravel packages today?