How yubico/python-fido2 works
Project type and purpose
• This is a language-library project (python-fido2) that implements the FIDO U2F and FIDO2 (WebAuthn) protocols.
• It provides both low-level device communication (CTAP over USB via HID or PC/SC) and higher-level client/server helper classes for Relying Party integration.
File structure
• Top-level packages:
• fido2/ ← core library modules
• examples/ ← sample applications
• tests/ ← pytest test suite
• Key sub-packages under fido2/:
• client/ ← client-side abstractions (Windows, WinAPI)
• server.py ← server-side WebAuthn helper
• ctap1.py, ctap2/ ← CTAP 1 & 2 protocol implementations
• hid/ ← platform-specific USB HID transports
• pcsc.py ← optional NFC (PC/SC) transport
• attestation/ ← attestation format parsers and verifiers
• cbor.py, cose.py ← CBOR encoding/decoding and COSE signature support
• utils.py, features.py, rpid.py, public_suffix_list.dat
• Configuration, build and CI files: pyproject.toml, GitHub workflows, pre-commit, mypy.ini.
README for additional insights
• Confirms dual focus: low-level device access (CTAP+HID/PCSC) and higher-level WebAuthn (fido2.client, fido2.server).
• Mentions external dependencies: cryptography, pyscard (optional).