pyu2f
U2F host library for interacting with a U2F device over USB.
What it is and what it does
pyu2f is a Python library for communicating with U2F (Universal 2nd Factor) security keys over USB. It uses ctypes to call system USB HID APIs directly, avoiding the need for platform-specific compiled libraries. The library implements a U2F stack for signing authentication challenges and supports pluggable authenticators via the SK_SIGNING_PLUGIN environment variable.
The package is no longer maintained; its repository is archived and the authors explicitly recommend migrating to python-fido2, which supports the newer FIDO2 standard and provides backward-compatible U2F support. U2F itself is considered an outdated FIDO specification. If you are starting a new project, this library should not be your first choice.
Use it for:
- Authenticate users with legacy U2F security keys in existing Python applications on Windows, macOS, or Linux.
- Integrate U2F device support into a Python authentication system without requiring compiled platform-specific libraries.
- Offload U2F signing operations to an external command-line tool via the SK_SIGNING_PLUGIN mechanism.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyu2f provides U2F (Universal 2nd Factor) device authentication over USB on Linux, Windows, and macOS using ctypes-based system calls without compiled dependencies.
No. The package is abandoned, its repository archived, and the maintainers explicitly recommend python-fido2 instead. U2F is an outdated FIDO spec. Install only if you must maintain legacy code already using pyu2f; for new projects, use python-fido2.
Install
pyu2f on PyPI
pip
pip install pyu2fuv
uv add pyu2fpoetry
poetry add pyu2fInstalling pyu2f
Before you install
High install friction due to source distribution only. Maintenance is abandoned as of 2020-10-30; the repository is archived and the maintainers recommend migrating to python-fido2 for FIDO2 support and ongoing security updates.
License in practice
Apache 2.0 is permissive; you may use, modify, and distribute this code freely provided you retain license notices and do not hold the authors liable.
Quickstart
from pyu2f import model
from pyu2f.convenience import authenticator
registered_key = model.RegisteredKey(b64_encoded_key)
challenge_data = [{'key': registered_key, 'challenge': raw_challenge_data}]
api = authenticator.CreateCompositeAuthenticator(origin)
response = api.Authenticate(app_id, challenge_data)
Requires a U2F-compatible USB device connected to the system; SK_SIGNING_PLUGIN environment variable can optionally redirect signing to an external tool.
Verify before relying
- Whether the ctypes-based USB HID calls work reliably on modern versions of Windows, macOS, and Linux kernels.
- Current compatibility with modern U2F devices and whether deprecated U2F protocol support poses a security risk in production use.
Package facts
| License | Apache 2.0 (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,114 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 442,599/month — #6,634 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyu2f-0.1.5.tar.gz
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
fido2Implements FIDO2 and WebAuthn protocols for…
unclear · top 5,000 on PyPI
PyOTPPyOTP generates and verifies one-time passwords…
permissive · top 1,000 on PyPI
yubico-clientVerifies Yubico One Time Passwords (OTPs) using…
permissive · top 15,000 on PyPI
authyPython client for the Twilio Authy two-factor…
permissive · top 15,000 on PyPI
django-allauth-2faAdds two-factor authentication to…
permissive · top 15,000 on PyPI
pyusbPyUSB provides Python access to USB devices on…
permissive · top 5,000 on PyPI
hidapiProvides a Python interface to HIDAPI, enabling…
unclear · top 5,000 on PyPI
django-otpAdds one-time password (OTP) support to Django…
permissive · top 5,000 on PyPI
soft-webauthnEmulates a WebAuthn authenticator in Python for…
permissive · top 15,000 on PyPI
pycdlibPyCdlib is a pure Python library for parsing,…
copyleft · top 5,000 on PyPI