-
Notifications
You must be signed in to change notification settings - Fork 0
Installation & Setup
- Local Development Setup
- Docker Containerization
- Cloud Deployment with Render
- Configuration Options
- Google Cloud Storage Setup
- Post-Quantum Cryptography Setup
- Troubleshooting Guide
To set up the Post-Quantum WebAuthn Platform for local development, follow these step-by-step instructions using Python virtual environments and pip dependency management.
- Python 3.12 or higher with pip
- Git for repository cloning
- A modern browser with WebAuthn support (Chrome, Edge, Safari, or Firefox)
Create and activate a Python virtual environment, then install dependencies from requirements.txt:
Windows (PowerShell):
py -3.12 -m venv .venv
.\.venv\scripts\activate
python -m pip install --upgrade pip
pip install -r requirements.txtmacOS/Linux:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txtThe requirements.txt file specifies essential dependencies including Flask, fido2, cryptography, cbor2, and Google Cloud Storage libraries that enable the core WebAuthn functionality and cloud integration.
Section sources
- requirements.txt
- README.adoc
The platform provides a comprehensive Dockerfile for containerized deployment, which handles both build and runtime environments with proper liboqs integration.
The Dockerfile uses a multi-stage build process with separate builder and runtime stages:
docker build -t postquantum-webauthn-platform .The build process:
- Uses python:3.12-slim as base image
- Installs build dependencies (build-essential, cmake, git, etc.)
- Copies prebuilt liboqs libraries to /opt/liboqs
- Configures library paths via ldconfig
- Installs Python dependencies including the liboqs-python wheel
- Creates a minimal runtime image with only necessary components
The runtime container exposes port 8000 and uses gunicorn as the WSGI server. The CMD instruction includes LD_PRELOAD to ensure liboqs is properly loaded:
CMD ["/bin/sh", "-c", "export LD_PRELOAD=/opt/liboqs/lib/liboqs.so; exec gunicorn --bind 0.0.0.0:${PORT:-8000} server.app:app"]Environment variables can be passed to customize the runtime behavior, particularly the PORT variable which defaults to 8000.
Section sources
- Dockerfile
The platform includes a render.yaml configuration file for seamless deployment to the Render cloud platform.
The render.yaml file defines a web service with the following specifications:
- Service type: web
- Name: python-fido2-webauthn-demo
- Runtime: docker (using the provided Dockerfile)
- Plan: free tier
- Automatic deployment on git push
services:
- type: web
name: python-fido2-webauthn-demo
runtime: docker
plan: free
dockerfilePath: ./Dockerfile
dockerContext: .
autoDeploy: trueWhen deploying to Render, configure the following environment variables in the web service settings:
- FIDO_SERVER_SECRET_KEY: Cryptographic key for Flask session management
- FIDO_SERVER_RP_NAME: Relying Party name (e.g., "My WebAuthn Service")
- FIDO_SERVER_RP_ID: Relying Party identifier (domain name)
- FIDO_SERVER_GCS_ENABLED: Set to "true" to enable Google Cloud Storage
- FIDO_SERVER_GCS_PROJECT: Google Cloud project ID
- FIDO_SERVER_GCS_BUCKET: Cloud Storage bucket name
- FIDO_SERVER_GCS_CREDENTIALS_JSON: Service account credentials JSON
The free plan on Render provides basic hosting capabilities. For production workloads, consider upgrading to a higher tier to:
- Increase CPU and memory allocation
- Enable persistent storage
- Configure custom domains with SSL
- Set up environment-specific deployments (staging, production)
- Adjust instance count based on authentication request volume
Section sources
- render.yaml
- server/server/config.py
The server configuration is managed through environment variables and the config.py file, providing flexibility for different deployment scenarios.
The following configuration options can be set via environment variables in server/server/config.py:
- DEBUG: Enables debug mode when set to "true", providing detailed error messages and auto-reloading
- SECRET_KEY: Cryptographic key for session management, configurable via FIDO_SERVER_SECRET_KEY environment variable or file
- STORAGE_BACKEND: Determines storage mechanism (local filesystem or Google Cloud Storage)
- GOOGLE_CLOUD_PROJECT: Specifies the Google Cloud project for GCS integration
- MDS_ROOT_CERTS: Root certificates for FIDO Metadata Service validation
The system resolves the secret key through a hierarchy of sources:
- FIDO_SERVER_SECRET_KEY environment variable
- FIDO_SERVER_SECRET_KEY_FILE pointing to a key file
- Generated key stored in instance/session-secret.key
The key resolution process ensures secure default behavior while allowing flexible configuration for different environments.
Configure the Relying Party (RP) settings:
- FIDO_SERVER_RP_NAME: Display name for the service
- FIDO_SERVER_RP_ID: Domain identifier for WebAuthn operations
These values can be overridden by environment variables and are used to create the PublicKeyCredentialRpEntity for WebAuthn protocol compliance.
Section sources
- server/server/config.py
The platform supports Google Cloud Storage (GCS) for persistent credential storage and metadata management.
Enable GCS integration by setting the FIDO_SERVER_GCS_ENABLED environment variable to "true". When disabled, the system defaults to local file storage.
To configure GCS integration, set the following environment variables:
- FIDO_SERVER_GCS_BUCKET: Name of the GCS bucket for storage
- FIDO_SERVER_GCS_PROJECT: Google Cloud project ID
- FIDO_SERVER_GCS_CREDENTIALS_FILE: Path to service account key file, or
- FIDO_SERVER_GCS_CREDENTIALS_JSON: Service account credentials as JSON string
The system supports multiple authentication methods:
- Service account key file via FIDO_SERVER_GCS_CREDENTIALS_FILE
- Service account credentials JSON via FIDO_SERVER_GCS_CREDENTIALS_JSON
- Default application credentials when running on Google Cloud
The cloud_storage.py module provides retry logic for transient failures and implements operations including:
- upload_bytes: Store binary data in GCS
- download_bytes: Retrieve data from GCS
- delete_blob: Remove stored objects
- list_blob_names: Enumerate stored items
- blob_exists: Check object existence
The system automatically creates the storage client and validates bucket accessibility during startup.
Section sources
- server/server/cloud_storage.py
- server/server/startup.py
The platform integrates liboqs for post-quantum cryptographic algorithms, specifically supporting ML-DSA variants.
The system supports the following ML-DSA algorithms:
- ML-DSA-44 (COSE algorithm ID -48)
- ML-DSA-65 (COSE algorithm ID -49)
- ML-DSA-87 (COSE algorithm ID -50)
These are mapped in the PQC_ALGORITHM_ID_TO_NAME dictionary in pqc.py and automatically detected when liboqs is available.
The platform includes prebuilt liboqs components in the prebuilt_liboqs/linux-x86_64 directory. During Docker build, these are copied to /opt/liboqs and configured in the library path.
For manual setup:
- Build liboqs with ML-DSA enabled:
cmake -S . -B build -DOQS_BUILD_SIG_MLDSA=ON - Install the shared library to a location in the system library path
- Set LD_LIBRARY_PATH to include the liboqs library directory
- Install the liboqs-python bindings via pip
Verify PQC setup by running:
python -c "import oqs; print(oqs.get_enabled_sigs())"The output should include ML-DSA-44, ML-DSA-65, and ML-DSA-87 in the list of enabled signature mechanisms.
Section sources
- server/server/pqc.py
- prebuilt_liboqs/linux-x86_64
- Dockerfile
Symptom: ImportError: oqs bindings are unavailable Solution:
- Verify liboqs shared library is in the library path
- Check LD_LIBRARY_PATH includes the liboqs library directory
- Ensure the library file (liboqs.so or oqs.dll) is accessible
- Validate architecture compatibility (x86_64)
Symptom: Unable to access FIDO security keys Solution: Linux: Add udev rules for FIDO devices:
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="*", ATTRS{idProduct}=="*", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/99-fido.rules
sudo udevadm control --reload-rulesmacOS: Ensure the application has permission to access USB devices in System Preferences > Security & Privacy > Privacy > USB.
Symptom: Failed to download metadata BLOB Solution:
- Verify network connectivity to https://mds3.fidoalliance.org/
- Check firewall rules allow outbound HTTPS traffic
- Validate TLS certificate trust chain
- Ensure the FIDO_METADATA_TRUST_ROOT_CERT is correctly configured
Symptom: Failed to verify Google Cloud Storage readiness Solution:
- Verify FIDO_SERVER_GCS_ENABLED is set to "true"
- Confirm FIDO_SERVER_GCS_BUCKET is correctly specified
- Validate service account credentials have proper permissions (Storage Object Admin)
- Check network connectivity to Google Cloud APIs
Symptom: WebAuthn not working due to insecure context Solution:
- Use mkcert to generate locally-trusted development certificates
- Name certificate files as demo.ftsafe.demo.pem and demo.ftsafe.demo-key.pem
- Ensure the hostname in the certificate matches the server configuration
- Run the server with SSL context pointing to the certificate files
Section sources
- server/server/pqc.py
- server/server/cloud_storage.py
- server/server/app.py
- README.adoc