Skip to main content

open-passkey-fastapi

FastAPI router for passkey (WebAuthn/FIDO2) authentication. Thin wrapper around open-passkey-server -- registers async routes with Pydantic request validation.

Install

pip install open-passkey-fastapi

Quick Start

from fastapi import FastAPI
from open_passkey_fastapi import (
    create_passkey_router,
    PasskeyConfig,
    MemoryChallengeStore,
    MemoryCredentialStore,
)

app = FastAPI()

passkey_router = create_passkey_router(PasskeyConfig(
    rp_id="localhost",
    rp_display_name="My App",
    origin="http://localhost:8000",
    challenge_store=MemoryChallengeStore(),
    credential_store=MemoryCredentialStore(),
))

app.include_router(passkey_router, prefix="/passkey")

With Sessions

from open_passkey_server.session import SessionConfig

passkey_router = create_passkey_router(PasskeyConfig(
    rp_id="example.com",
    rp_display_name="Example",
    origin="https://example.com",
    session=SessionConfig(secret="your-32+-character-hmac-secret"),
))

When session is configured, two additional routes are registered and login/register responses set an HttpOnly session cookie automatically.

Routes

Method Path Description
POST /register/begin Start registration ceremony
POST /register/finish Complete registration
POST /login/begin Start authentication ceremony
POST /login/finish Complete authentication
GET /session Validate session cookie (session config required)
POST /logout Clear session cookie (session config required)

API

create_passkey_router(config: PasskeyConfig) -> APIRouter

Returns a FastAPI APIRouter with the routes above. All route handlers are async. Request bodies are validated with Pydantic models.

Dependencies

  • fastapi>=0.110
  • pydantic>=2.0
  • open-passkey-server
  • open-passkey -- core WebAuthn verification
  • open-passkey-server -- shared server logic
  • open-passkey-flask, open-passkey-django -- alternative framework bindings
  • @open-passkey/sdk (npm) -- browser SDK

License

MIT

Metadata

Release files for open-passkey-fastapi 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-passkey-fastapi 0.1.4
File Size Uploaded
open_passkey_fastapi-0.1.4.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for open-passkey-fastapi 0.1.4
File Interpreter ABI Platform
open_passkey_fastapi-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / open_passkey_fastapi-0.1.4.tar.gz

Download URL open_passkey_fastapi-0.1.4.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3b97ba40b235250987523a045e05a10ed23b726282a62580e2da3dc9e17c6e53
BLAKE2b-256 checksum
How to use checksums
1b8cca73cc0402989f3896b4c0538289486b56a856eb4fc7fc86c948a70caae1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / open_passkey_fastapi-0.1.4-py3-none-any.whl

Download URL open_passkey_fastapi-0.1.4-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e47c0d3e048c6f40b19672a30a18a0e1cd26638f4c8b3bd9b97f77167da5a56
BLAKE2b-256 checksum
How to use checksums
ae4a86cd6c610a4303868c1efb9f312d5e180099e0207514c3db0ffed7a11126
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page