Skip to main content

open-passkey-server

Framework-agnostic server logic for passkey authentication. Handles challenge generation, credential storage, ceremony orchestration, and optional stateless sessions. Used internally by the Flask, FastAPI, and Django bindings.

Install

pip install open-passkey-server

Usage

from open_passkey_server import PasskeyConfig, PasskeyHandler
from open_passkey_server import MemoryChallengeStore, MemoryCredentialStore

config = PasskeyConfig(
    rp_id="example.com",
    rp_display_name="Example",
    origin="https://example.com",
    challenge_store=MemoryChallengeStore(),
    credential_store=MemoryCredentialStore(),
)

handler = PasskeyHandler(config)

# Registration
options = handler.begin_registration(user_id="user_123", username="alice")
# ... client performs navigator.credentials.create() ...
result = handler.finish_registration(user_id="user_123", credential={...})

# Authentication
options = handler.begin_authentication(user_id="user_123")
# ... client performs navigator.credentials.get() ...
result = handler.finish_authentication(user_id="user_123", credential={...})

API

PasskeyHandler(config: PasskeyConfig) -- main class with four methods:

  • begin_registration(user_id, username) -> dict -- returns WebAuthn creation options
  • finish_registration(user_id, credential, prf_supported=False) -> dict -- verifies and stores credential
  • begin_authentication(user_id="") -> dict -- returns WebAuthn request options (discoverable if no user_id)
  • finish_authentication(user_id, credential) -> dict -- verifies assertion, updates sign count

PasskeyConfig -- dataclass:

  • rp_id -- relying party domain (e.g. "example.com")
  • rp_display_name -- human-readable RP name
  • origin -- expected origin (e.g. "https://example.com")
  • challenge_store -- implements ChallengeStore (default: MemoryChallengeStore)
  • credential_store -- implements CredentialStore (default: MemoryCredentialStore)
  • session -- optional SessionConfig for stateless HMAC-SHA256 session cookies

Store Protocols

  • ChallengeStore (ABC) -- store(key, challenge, timeout_seconds), consume(key) -> str
  • CredentialStore (ABC) -- store(cred), get(credential_id), get_by_user(user_id), update(cred), delete(credential_id)

Built-in implementations: MemoryChallengeStore, MemoryCredentialStore (thread-safe, in-memory, for development).

Session (opt-in)

from open_passkey_server.session import SessionConfig

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

When configured, finish_registration and finish_authentication include a sessionToken in the result dict. Framework bindings set this as an HttpOnly cookie automatically.

Dependencies

  • open-passkey (core verification)

Testing

pytest tests/

Related Packages

  • open-passkey -- core WebAuthn verification (no HTTP)
  • open-passkey-flask, open-passkey-fastapi, open-passkey-django -- framework bindings
  • @open-passkey/sdk (npm) -- browser SDK

License

MIT

Metadata

Release files for open-passkey-server 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-server 0.1.4
File Size Uploaded
open_passkey_server-0.1.4.tar.gz 10.0 kB Details

Built distribution (wheel)

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

Total release size: 18.8 kB

Release files / open_passkey_server-0.1.4.tar.gz

Download URL open_passkey_server-0.1.4.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ea43f164d72aeeaec6fb733da998b27d5e367ab81a06ffad27370f8c2969ae0d
BLAKE2b-256 checksum
How to use checksums
48345a6ce61c1141a8d8c323a57024671bd1eb4f025cbc0103fff5bc4ff6290f
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_server-0.1.4-py3-none-any.whl

Download URL open_passkey_server-0.1.4-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
062a88042f44fd4111f8d85abbcccd86aff25b09ef930ddac420407d1883c66c
BLAKE2b-256 checksum
How to use checksums
a2297c71fe9432a2974bc0914193d1ad2a7c342dda8fc09f8a1dc010bb61c75c
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