Skip to content

phi-beta/fido2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FIDO2 Authentication Project

A complete implementation of FIDO2/WebAuthn authentication experience from scratch.

Features

  • Passwordless Authentication: Complete FIDO2/WebAuthn implementation
  • Modern UI: Clean, responsive React frontend
  • Secure Backend: Node.js/Express server with proper WebAuthn handling
  • Cross-Platform: Works with various authenticators (fingerprint, security keys, etc.)

Architecture

Backend (Node.js/Express)

  • WebAuthn server implementation using @simplewebauthn/server
  • RESTful API endpoints for registration and authentication
  • In-memory user storage (can be extended to use databases)
  • CORS and security middleware

Frontend (React)

  • Modern, responsive UI built with React
  • WebAuthn client implementation using @simplewebauthn/browser
  • Real-time authentication status updates
  • Support for multiple authenticators per user

Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • A modern web browser with WebAuthn support
  • An authenticator device (fingerprint reader, security key, etc.)

Installation

  1. Install all dependencies:
npm run install-all
  1. Start the development servers:
npm run dev

This will start:

Production Build

npm run build
npm start

Usage

  1. Registration Flow:

    • Enter a username
    • Click "Register with FIDO2"
    • Follow your device's authentication prompts
    • Your authenticator will be registered
  2. Authentication Flow:

    • Enter your username
    • Click "Authenticate with FIDO2"
    • Use your registered authenticator
    • You'll be authenticated

Security Features

  • Attestation: Verifies authenticator legitimacy
  • Assertion: Validates authentication attempts
  • Challenge-Response: Prevents replay attacks
  • Origin Validation: Ensures requests come from authorized domains
  • User Verification: Supports biometric and PIN verification

Browser Support

  • Chrome 67+
  • Firefox 60+
  • Safari 14+
  • Edge 18+

Development

Project Structure

fido2/
├── server/                 # Backend server
│   ├── index.js           # Main server file
│   ├── routes/            # API routes
│   └── utils/             # Utility functions
├── client/                # React frontend
│   ├── src/
│   │   ├── components/    # React components
│   │   ├── services/      # API services
│   │   └── utils/         # Utility functions
│   └── public/
└── package.json

API Endpoints

  • POST /api/register/begin - Start registration process
  • POST /api/register/finish - Complete registration
  • POST /api/authenticate/begin - Start authentication process
  • POST /api/authenticate/finish - Complete authentication
  • GET /api/user/:username - Get user information

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published