Time-based passwords
Generate and verify RFC 6238 TOTP codes with configurable periods, digits, and supported hash algorithms.
HOTP and TOTP
Generate and verify one-time passwords with a small, typed Python API.
OTP Auth implements the HOTP and TOTP standards without pulling in a broader authentication framework. Use it for counter-based tokens, authenticator-app codes, and provisioning URIs while keeping the secret and verification flow under your control.
pip install otpauthWhat it covers
A focused package for generating and verifying HMAC-based and time-based one-time passwords.
Generate and verify RFC 6238 TOTP codes with configurable periods, digits, and supported hash algorithms.
Implement RFC 4226 HOTP flows with explicit counters and constant-time code verification.
Work with Base32 secrets and create otpauth provisioning URIs understood by common authenticator applications.
Coverage
Quickstart
Install otpauth, try this focused path, then move into the project documentation for configuration, security notes, and production guidance.
import otpauth
totp = otpauth.TOTP(b"user-secret")
code = totp.generate()
print(totp.string_code(code))
assert totp.verify(code)Project family
Sustainability
Sponsorship supports protocol review, releases, compatibility, documentation, and the maintainer time behind the project family.
View sponsorship options