skillfed

pyu2f

U2F host library for interacting with a U2F device over USB.

pyu2f v0.1.5 442.6K downloads/30d#6,634 on PyPI84
Permissive license Apache 2.0 Abandoned released

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 pyu2f

uv

uv add pyu2f

poetry

poetry add pyu2f

Installing 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

License :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.6Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

U2F authentication libraryUSB security key supporttwo-factor authentication deviceFIDO U2F host libraryhardware security token python
deprecatedu2fsecurity-key

More Libraries packages