feat: WebAuthn passkey authentication with IP-conditional remote login - #79
Open
mahdiwafy wants to merge 1 commit into
Open
feat: WebAuthn passkey authentication with IP-conditional remote login#79mahdiwafy wants to merge 1 commit into
mahdiwafy wants to merge 1 commit into
Conversation
Owner
|
Request for revision with concrete security and migration requirements. Passkey authentication is relevant, but it must be separated from unrelated auth/UI changes and reconciled with VansRouter’s existing session and remote-auth gates. Please provide:
Please keep dependency and migration changes scoped to passkeys. Do not introduce a second migration runner. |
Per maintainer feedback on Vanszs#79: - migration renumbered 005 -> 006 (avoids collision with api-key-limits migration 005); unique, monotonic, idempotent CREATE TABLE IF NOT EXISTS. - single-use server-bound challenge: login_challenge cookie httpOnly, secure, sameSite lax, path-scoped, 120s expiry, deleted on use. - RP ID/origin derived from public origin; 127.0.0.1/[::1] -> localhost (fixed bracket form). - no bypass: dashboardGuard keeps /api/auth/passkey/login public only for the handshake; all other routes still require verifyDashboardAuthToken. - tests: RP config (origin derivation, localhost mapping, Host fallback, port strip), challenge cookie contract (single-use/expiry), no-bypass gates.
Author
|
Per your #79 review notes:
Tests: |
mahdiwafy
force-pushed
the
pr/passkey-auth
branch
from
August 4, 2026 09:26
47c5995 to
b481705
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add WebAuthn passkey authentication support. Users can now register biometric (Touch ID, Face ID, Windows Hello) or security key passkeys for passwordless login, managed per-device via Google Password Manager, Apple iCloud Keychain, or any FIDO2-compatible credential manager.
What's Included
Database
passkeystable in local SQLite schema (migration v5)Backend — WebAuthn Ceremony API Routes
POST /api/auth/passkey/register/start— generate registration challenge (auth required)POST /api/auth/passkey/register/finish— verify registration response, store credentialPOST /api/auth/passkey/login/start— generate authentication challenge (public)POST /api/auth/passkey/login/finish— verify assertion, issue JWT session cookieGET|DELETE /api/auth/passkey/manage— list and delete registered passkeysIP Detection + Conditional Auth
remoteAuthMode:"password"(default),"passkey", or"both"isLocalRequest()system — localhost always has full accessremoteAuthMode:"password": traditional password form (default, backward compatible)"passkey": passkey-only login (password form hidden for remote users)"both": both passkey button and password form shownpasskeysEnabledauto-flips totruewhen the first passkey is registeredUI Changes
/login): New "Sign in with Passkey" button when passkeys are available/masuk): Same passkey support in Indonesian locale/dashboard/profile): Full passkey management sectionSettings
passkeysEnabled— auto-managed, set totruewhen first passkey registeredremoteAuthMode— controls remote login method availabilityArchitecture
@simplewebauthn/server(v13) for server-side WebAuthn verification@simplewebauthn/browser(v13) for client-side credential creation/assertionpasskey: trueto track login methodUsage
Testing