Skip to content

lewis-wow/virtual-webauthn-authenticator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

134 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Virtual WebAuthn Authenticator

codecov

Traditional password authentication is inherently vulnerable to phishing and data breaches. Although the industry is moving toward more secure hardware and platform passkeys, these solutions introduce usability challenges. Users must manage physical devices and risk account lockouts if they lose them. Server-side authenticators offer a more user-friendly alternative. They eliminate the strict dependence on specific hardware but require strong protection of cryptographic material in a cloud environment. This thesis proposes and demonstrates an implementation of such a virtual authenticator in Node.js. The solution includes a web extension to intercept standard WebAuthn API calls and route them to the authenticator web service.

About This Project

This is a thesis project exploring server-side WebAuthn authenticators as an alternative to traditional hardware security keys. It's designed for research and demonstration purposes, not production use.

License: See LICENSE file.

Development prerequisites

  • Node.js 18+
  • pnpm package manager for monorepo
  • Docker & Docker Compose for PostgreSQL and Key Vault

Project Structure

  • apps/ — Main applications
  • packages/ — Shared libraries (auth, crypto, database, UI components, etc.)
  • examples/ — Example Next.js app with passkeys integration

Getting Started

Run in Development Mode

./docker-compose-test.sh  # Start PostgreSQL and Key Vault
pnpm dev --filter '!@repo/nextjs-example'

Without browser extension:

./docker-compose-test.sh  # Start PostgreSQL and Key Vault
pnpm dev --filter '!@repo/nextjs-example' --filter '!@repo/wxt'

Run Tests

pnpm test                   # All tests
pnpm test:unit              # Unit tests
pnpm test:integration       # Integration tests
pnpm coverage               # Coverage report

Authenticator flow

+---------------------------------------------------------------+
|                  RELYING PARTY (Web Server)                   |
+-------------+-------------------------------------------------+
              |
              | 0. INITIATION (Challenge / Options)
              v
+-------------+-------------------------------------------------+
|                   BROWSER (Web Extension)                     |
+-------------+-------------------------------------------------+
|             |                                                 |
|   1. INTERCEPTION (Main World)                                |
|   [ navigator.credentials proxy ] <--- Web App Call           |
|             |                                                 |
|             v window.postMessage                              |
|             |                                                 |
|   2. USER INTERFACE (Content Script)                          |
|   [ Confirmation DOM and UI ]                                 |
|             |                                                 |
|             v chrome.runtime.sendMessage                      |
|             |                                                 |
|   3. NETWORK LAYER (Background Service Worker)                |
|   [ Fetch API Wrapper ]                                       |
|             |                                                 |
+-------------+-------------------------------------------------+
              |
              v HTTPS
              |
+-------------+-------------------------------------------------+
|              VIRTUAL AUTHENTICATOR HOST (Server)              |
+-------------+-------------------------------------------------+
|             |                                                 |
|   4. GATEWAY                                                  |
|   [ API Endpoint ]                                            |
|             |                                                 |
|             v                                                 |
|             |                                                 |
|   5. LOGIC CORE                                               |
|   [ Virtual Authenticator Agent ]                             |
|   (Validation / CBOR / Parameters / Extensions)               |
|             |                                                 |
|             v                                                 |
|             |                                                 |
|   6. STORAGE & CRYPTO                                         |
|   [ Virtual Authenticator ]                                   |
|   (Key Vault / Signing / Counters / Attestation / Extensions) |
|                                                               |
+---------------------------------------------------------------+

Architecture

+------------------------------------------------------------+
|                                                            |
|                   PostgreSQL (Database)                    |
|                                                            |
+-----------+--------------------------------------+---------+
            |                                      |
            |                                      |
            |                                      |
 +----------+---------+                 +----------+---------+       +--------------------+
 |                    |                 |                    |       |                    |
 |    Auth service    |                 |        API         +-------+  Azure Key Vault   |
 |                    |                 |                    |       |                    |
 +----------+-----+---+                 +---+------+---------+       +--------------------+
            |     |                         |      |
            |     |                         |      |
            |     |                         |      |
            |     |                         |      |
     Session|     --------------------------+-|    | JWT
            |     +-------------------------| |    |
            |     |                           |    |
            |     | JWT                API key|    |
            |     |                           |    |
 +----------+-----+---+                 +-----+----+---------+       +--------------------+
 |                    |                 |                    |       |                    |
 |    Console BFF     |                 |   Public API BFF   +-------+    OpenAPI Docs    |
 |                    |                 |                    |       |                    |
 +----------+---------+                 +----------+---------+       +--------------------+
            |                                      |
            |                                      |
     Session|                                      |API key
            |                                      |
            |                                      |
 +----------+---------+                 +----------+---------+
 |                    |                 |                    |
 |  Console Frontend  |                 | Browser Extension  |
 |                    |                 |                    |
 +--------------------+                 +--------------------+

Example Relying Party Application

Try the Next.js passkeys example:

cd examples/nextjs && pnpm db:generate && pnpm db:push && pnpm start

Available at http://localhost:4000.

Configuration

Environment Variables: Managed with dotenvx for dev/test/production with encryption support for secrets.

  • Dev/Test: .env.development, .env.test (plaintext)
  • Production: .env.production (encrypted), decryption key in .env.keys
  • ⚠️ Never commit .env.keys to version control

Key Vault: Uses Azure Key Vault (production) or LowKey Vault (development)

Resources

Specifications:

Key Vault:

Tools & References:

About

Virtual WebAuthn Authenticator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors