Repository navigation
feat(auth): implement passkeys and webauthn authentication - #30
Merged
Merged
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
AmanKrSahu
force-pushed
the
feat/passkey-authentication
branch
from
September 5, 2026 17:34
f32abc5 to
c1d1f56
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.
Overview
This Pull Request implements full Passkeys / WebAuthn (FIDO2) authentication support in AuthKit (Task 3.3 in
docs/audit/2026-07-20/task.md— FR-4). It provides phishing-resistant, passwordless authentication using platform authenticators (FaceID, TouchID, Windows Hello) and roaming hardware security keys (YubiKey).The implementation integrates seamlessly with AuthKit's existing authentication architecture, session management, multi-factor authentication (MFA) layer, Redis challenge storage, immutable audit logging, outbound webhook triggers, and the OpenID Connect (OIDC) interaction pipeline.
Key Changes by Functional Area
1. FIDO2 / WebAuthn Core Architecture (
@simplewebauthn/server)WebAuthnServiceencapsulating registration and authentication ceremonies (generateRegistrationOptions,verifyRegistration,generateAuthenticationOptions,verifyAuthentication,listAuthenticators,deleteAuthenticator).src/core/common/utils/webauthn.util.tsto maintain strict separation of concerns.webauthn:challenge:{userId/email/interactionId}) and invalidated immediately upon verification to prevent replay attacks.2. Data Persistence & Authenticator Security
AuthenticatorModel: Added a persistent Prisma schema model supporting 1:N relations withUser, uniquecredentialIdindexing, cascade deletions, and byte array (Bytes) storage for public keys and authenticator IDs (aaguid).3. Direct Login & OIDC Interaction Pipeline
/api/v1/webauthn/*endpoints for registering authenticators, authenticating users with discoverable credentials (resident keys), listing active passkeys, and revoking authenticators./interaction/:uid/webauthn/*endpoints allowing users to complete passwordless authentication and satisfy MFA steps seamlessly within the OIDC authorization code flow.4. Event Bus, Auditing & Webhook Ingestion
WEBAUTHN_REGISTER,WEBAUTHN_AUTHENTICATE,WEBAUTHN_DELETE) capturing device transports, client IP, and user-agent metadata.eventBusto publishwebauthn.registered,webauthn.authenticated, andwebauthn.deletedevents for HMAC-SHA256 signed external webhook delivery.src/core/workers/webhook-queue.worker.tsin alignment with the system service architecture.Documentation & API Synchronization
README.md: Documented WebAuthn feature capabilities and environment variables (WEBAUTHN_RP_NAME,WEBAUTHN_RP_ID,WEBAUTHN_ORIGIN).docs/api_endpoints.md: Added endpoint specifications, request payloads, and response structures for all 7 WebAuthn endpoints.docs/security_architecture.md: Documented FIDO2 challenge flows, clone detection, user verification policies, and audit logging integration.docs/testing_architecture.md: Added test architecture specifications for WebAuthn unit, integration, and E2E journeys.docs/api-specs/openapi.json: Generated and formatted OpenAPI 3.0 specs with full WebAuthn route definitions.docs/api-specs/AuthKit.postman_collection.json: Added a complete Postman collection folder for testing WebAuthn ceremonies and device management.docs/audit/2026-07-20/task.md: Marked Task 3.3 (FR-4) as Done.Verification & Test Summary
tsc --noEmit).pnpm lint,pnpm format:check).tests/unit/webauthn.service.test.ts(14 passing tests)tests/integration/webauthn-endpoints.test.ts(5 passing tests)tests/e2e/webauthn-journeys.test.ts(Registration