open-passkey
Core WebAuthn/FIDO2 protocol verification for Python. No HTTP, no sessions, no framework dependencies -- pure cryptographic verification of registration and authentication ceremonies.
Install
pip install open-passkey
For post-quantum algorithm support (ML-DSA-65, ML-DSA-65-ES256 composite):
pip install open-passkey[pq]
This installs liboqs-python, which requires the liboqs C library on your system.
Usage
from open_passkey import verify_registration, verify_authentication
# Registration ceremony
result = verify_registration(
rp_id="example.com",
expected_challenge="<base64url>",
expected_origin="https://example.com",
client_data_json="<base64url>",
attestation_object="<base64url>",
)
print(result.credential_id, result.public_key_cose)
# Authentication ceremony
result = verify_authentication(
rp_id="example.com",
expected_challenge="<base64url>",
expected_origin="https://example.com",
stored_public_key_cose="<base64url>",
stored_sign_count=0,
client_data_json="<base64url>",
authenticator_data="<base64url>",
signature="<base64url>",
)
print(result.sign_count)
All binary inputs and outputs are base64url-encoded strings (no padding).
API
Functions
verify_registration(rp_id, expected_challenge, expected_origin, client_data_json, attestation_object, require_user_verification=False) -> RegistrationResultverify_authentication(rp_id, expected_challenge, expected_origin, stored_public_key_cose, stored_sign_count, client_data_json, authenticator_data, signature, require_user_verification=False) -> AuthenticationResult
Dataclasses
RegistrationResult--credential_id,public_key_cose,sign_count,rp_id_hash,flags,backup_eligible,backup_state,attestation_formatAuthenticationResult--sign_count,flags,backup_eligible,backup_state
Errors (all subclass WebAuthnError)
ChallengeMismatchError, OriginMismatchError, RPIDMismatchError, SignatureInvalidError, UnsupportedAlgorithmError, UnsupportedAttestationFormatError, InvalidAttestationStatementError, SignCountRollbackError, UserPresenceRequiredError, UserVerificationRequiredError, InvalidBackupStateError
Algorithms
| Algorithm | COSE alg | Notes |
|---|---|---|
| ES256 (ECDSA P-256) | -7 | Classical, all browsers |
| ML-DSA-65 | -49 | Post-quantum (FIPS 204), requires liboqs |
| ML-DSA-65-ES256 composite | -52 | Hybrid PQ, requires liboqs |
Attestation
Supports none and packed (self-attestation and full x5c chain).
Dependencies
cryptography>=41.0cbor2>=5.4- Optional:
liboqs-python>=0.14(for ML-DSA-65; requiresliboqsC library)
Testing
pytest tests/
Related Packages
open-passkey-server-- framework-agnostic server logic built on this libraryopen-passkey-flask,open-passkey-fastapi,open-passkey-django-- framework bindings@open-passkey/sdk(npm) -- browser SDK
License
MIT
Metadata
Release files for open-passkey 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| open_passkey-0.1.4.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| open_passkey-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / open_passkey-0.1.4.tar.gz
| Download URL | open_passkey-0.1.4.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15a703e782d032836ce8d6eec91d3f40f3831b040aa88f248f224e991f849942
|
|
BLAKE2b-256 checksum How to use checksums |
00e5af1af002e1b890426aabe0b59327c64462cf300d18daa556940eb448bc55
|
| 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-0.1.4-py3-none-any.whl
| Download URL | open_passkey-0.1.4-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d76a008d6314a3baa2a6116cdb0af1eca848ceb4cbe552193ba0ae897d9e8127
|
|
BLAKE2b-256 checksum How to use checksums |
6f33936f5ce23c5184af9a232eaff6af759396cbec4076d6aac681b3fbbc429e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|