Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Passkeys Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Laravel-Native Integration: The package leverages Laravel’s authentication contracts, middleware, and Eloquent ORM, ensuring seamless fit with existing Laravel applications. The PasskeyAuthenticatable trait and PasskeyUser contract align with Laravel’s authentication ecosystem, reducing architectural friction.
  • WebAuthn Compliance: Built on webauthn.io (v5.3), the package adheres to FIDO2/CTAP2 standards, ensuring interoperability with modern browsers (Chrome, Safari, Edge) and platforms (iOS, macOS, Windows).
  • Modular Design: The action-based architecture (e.g., GenerateRegistrationOptions, VerifyPasskey) allows for granular customization without monolithic overrides, enabling incremental adoption.
  • Event-Driven Extensibility: Events like PasskeyVerified and PasskeyDeleted integrate with Laravel’s event system, enabling audit logging, analytics, or third-party integrations (e.g., SIEM tools).

Integration Feasibility

  • Low-Coupling Implementation: Requires only 3 steps for basic setup:
    1. Composer install.
    2. Publish migrations/config.
    3. Add trait to User model. Zero breaking changes to existing auth logic (e.g., Auth::attempt() remains functional).
  • Frontend Agnostic: The npm client (@laravel/passkeys) abstracts WebAuthn complexities, allowing React/Vue/Svelte integrations with minimal boilerplate.
  • Database Agnostic: Works with any Laravel-supported database (MySQL, PostgreSQL, SQLite) via Eloquent migrations. Custom models support polymorphic relations or accessible models.
  • Route Isolation: Routes are automatically prefixed (/passkeys/*) and middleware-protected, preventing conflicts with existing endpoints.

Technical Risk

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

Key Questions for TPM

  1. Concurrency Requirements:
    • Will your app handle >5K concurrent passkey verifications? If yes, confirm your database supports pessimistic locking (e.g., PostgreSQL SELECT ... FOR UPDATE).
  2. Custom Auth Logic:
    • Do you need to block passkey logins for certain users (e.g., suspended accounts)? If so, implement authorizeLoginUsing() callback.
  3. Frontend Stack:
    • Are you using React/Vue/Svelte? The npm client (@laravel/passkeys) simplifies integration, but test cross-origin iframes (e.g., embedded widgets).
  4. Compliance Needs:
    • Do you require detailed audit logs for passkey events? Extend events (e.g., PasskeyVerified) to log to SIEM tools or data lakes.
  5. Fallback Strategy:
    • Should failed passkey logins fall back to password auth? Configure middleware to handle ValidationException.
  6. Multi-Tenant Support:
    • If using tenancy, ensure relying_party_id is scoped per tenant (e.g., tenant1.yourdomain.com).
  7. Hardware Key Policies:
    • Do you need to enforce platform authenticators (e.g., Touch ID only)? Customize AuthenticatorSelectionCriteria in GenerateRegistrationOptions.
  8. CI/CD Pipeline:
    • Will you auto-update dependencies? Use Dependabot or GitHub Actions to monitor webauthn-lib for breaking changes.

Integration Approach

Stack Fit

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.

Migration Path

  1. Phase 1: Pilot (2-4 Weeks)

    • Scope: Enable passkeys for non-critical user flows (e.g., admin panel, developer portal).
    • Steps:
      1. Install package and publish migrations.
      2. Add PasskeyAuthenticatable to User model.
      3. Implement A/B test (e.g., 10% of users see passkey option).
      4. Monitor failure rates (browser support, UX issues).
    • Rollback Plan: Disable routes via Passkeys::ignoreRoutes() if issues arise.
  2. Phase 2: Core Integration (4-6 Weeks)

    • Scope: Replace passwords for primary auth flows (login, registration).
    • Steps:
      1. Customize relying_party_id and allowed_origins in config.
      2. Implement authorizeLoginUsing() for business logic (e.g., banned users).
      3. Extend events for audit logging.
      4. Test high-concurrency scenarios (e.g., 1K users/minute).
    • Validation: Ensure <1% failure rate in passkey verification.
  3. Phase 3: Advanced Features (Optional)

    • Scope: Passkeys for sensitive actions (2FA, admin actions).
    • Steps:
      1. Use GenerateVerificationOptions for user-bound verification (e.g., "Confirm payment").
      2. Customize AuthenticatorSelectionCriteria for hardware key policies.
      3. Build passkey management UI (e.g., "Add/Remove Passkeys").

Compatibility

  • Existing Auth Systems:
    • Sanctum/Passport: Passkeys replace traditional sessions/tokens but coexist with existing guards. Use guard() config to specify which flows use passkeys.
    • Social Logins: Passkeys complement (not replace) OAuth. Implement parallel flows (e.g., "Login with Passkey" vs. "Login with Google").
    • Multi-Factor Auth (MFA): Passkeys can replace SMS/email OTPs or add a second factor via GenerateVerificationOptions.
  • Legacy Systems:
    • Polymorphic Users: Extend PasskeyUser contract for **custom models
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle