r/u2f-two-factor-bundle
Symfony bundle that adds U2F hardware-key two-factor authentication to your login flow, letting users register and verify USB security keys alongside existing credentials for stronger account protection.
This is a Symfony bundle, not a Laravel package, so "getting started" as a Laravel developer means deciding whether to (a) run a Symfony app alongside/inside your stack, or (b) read the source as a reference implementation for U2F. For most Laravel teams, (b) is still the realistic path — but 0.8.0 widens (a) slightly, since Symfony 5 is now in scope.
Minimal steps if you actually install it:
composer require darookee/u2f-two-factor-bundle in a Symfony app — previously constrained to 2.8/3.x, now reportedly Symfony 5 compatible (confirm the symfony/* and PHP constraints in composer.json before committing; the release note is garbled — "This is no compatible with Symfony 5" almost certainly means now compatible).config/bundles.php (Symfony 4/5 Flex style) rather than app/AppKernel.php.scheb/two-factor-bundle in config/packages/*.yaml and point the firewall's two_factor at the U2F provider. Note the bundle pins an old scheb/two-factor-bundle line — check that it resolves alongside your Symfony 5 version before assuming 0.8.0 "just works."u2f-api.js).Where to look first in the repo:
README.md for the required scheb_two_factor YAML block.Resources/config/services.yml / DependencyInjection/ to see how the U2F server library and provider are wired — on Symfony 5 this is still XML/YAML service definitions, not autowired attributes.First use case: adding a hardware security key as a second factor after password login on a Symfony admin firewall. There is still no Laravel service provider, facade, config publish, or migration — Symfony 5 compatibility did not add a laravel/ bridge. In Laravel you would still reach for web-auth/webauthn-lib or a maintained Laravel WebAuthn/2FA package and only borrow the flow from here.
The package implements the classic U2F two-step handshake through scheb/two-factor-bundle, unchanged by 0.8.0:
RegisterRequest (challenge + appId) → browser JS (u2f.register) prompts the key → response is POSTed back → server validates via the U2F server library and persists keyHandle, publicKey, and counter against the user.SignRequest for the user's stored key handles → browser u2f.sign → server verifies signature and that the counter advanced → session is marked two-factor-complete.Day-to-day integration tips, translated to Laravel terms:
two_factor middleware blocks the session until the U2F assertion is verified.appId/origin fixed for the lifetime of the deployment. Existing key registrations are bound to it; changing domains or http→https invalidates every enrolled key. This is especially relevant if the Symfony 5 move also changes your host/scheme.scheb/two-factor-bundle config keys may need adjusting — re-read the README against your new config rather than copying YAML across.composer.json constraints and the PRs from @jbtronics/@stephanvierkant before you plan an upgrade. Don't refactor a firewall on the strength of a changelog typo.u2f-api.js global in favor of WebAuthn/FIDO2; Chrome and Firefox fail the u2f.register/u2f.sign calls on current versions. A Symfony 5 compatible bundle does not fix an FIDO1 browser API that no longer exists. For new work, WebAuthn is the correct target — this bundle remains a historical reference, not a forward-looking dependency.0 — some devices do, and a strict check locks users out.varchar; truncation produces verification failures that are painful to diagnose.clientData and registrationData/signatureData. Error messages from the U2F library are opaque; also check server/client clock skew against the challenge timestamp.scheb/two-factor-bundle pin plus Symfony 5 constraints, run composer why-not / composer update --dry-run in a throwaway branch before touching application code.samyoul/u2f-php), templates, and routes via Symfony DI — but with ~11 stars, 0 dependents, and a one-line 0.8.0 release after years of dormancy, still treat the code as a sample to fork, not a maintained dependency. The single maintainer-response release is encouraging but not a maintenance commitment; vendor/fork it rather than waiting on upstream.How can I help you explore Laravel packages today?