How pyauth/pyotp works
PyOTP is a Python library for generating and verifying HOTP and TOTP codes, plus creating and parsing authenticator provisioning URIs. An application uses its public API to create an OTP handler, then generates or verifies codes; provisioning can produce an otpauth URI for an authenticator app. The core OTP class supplies HMAC code generation, while utilities provide URI construction and timing-resistant comparison. The README documents secret-generation helpers and Steam TOTP support. This is a stateless library: applications manage secret storage and replay prevention. Arrows follow shown imports, calls, or README descriptions.
Main entry points: __init__.py Public API and URI Parsing · totp.py TOTP · hotp.py HOTP · steam.py Steam TOTP
Components 10
Public API
- Public API and URI Parsing
src/pyotp/__init__.py - Secret Generation
src/pyotp/__init__.py
OTP Algorithms
- HOTP
src/pyotp/hotp.py - TOTP
src/pyotp/totp.py - Steam TOTP
src/pyotp/contrib/steam.py
Shared Core
- HMAC OTP Core
src/pyotp/otp.py - URI and Comparison
src/pyotp/utils.py - Random Compatibility
src/pyotp/compat.py
Other components
- Application
- Authenticator App
Connections 12
- Application → Public API and URI Parsing: uses
README.rst - Public API and URI Parsing → HOTP: constructs
src/pyotp/__init__.py - Public API and URI Parsing → TOTP: constructs
src/pyotp/__init__.py - Public API and URI Parsing → Steam TOTP: constructs
src/pyotp/__init__.py - Public API and URI Parsing → Secret Generation: provides
src/pyotp/__init__.py - Secret Generation → Random Compatibility: uses
src/pyotp/__init__.py - HOTP → HMAC OTP Core: inherits
src/pyotp/hotp.py - TOTP → HMAC OTP Core: inherits
src/pyotp/totp.py - Steam TOTP → TOTP: inherits
src/pyotp/contrib/steam.py - HOTP → URI and Comparison: uses
src/pyotp/hotp.py - TOTP → URI and Comparison: uses
src/pyotp/totp.py - Authenticator App → Public API and URI Parsing: imports URI
README.rst