Skip to main content

Implements one time password of HOTP/TOTP

Project description

One time password implementations in Python. HOTP and TOTP.

Documentation: https://otp.authlib.org/ GitHub: https://github.com/authlib/otpauth

Usage

Most of the time, you would use a time based one time password. You can generate and verify the token with HOTP:

import otpauth

totp = otpauth.HOTP(b"user-secret")

# generate a code for now
code: int = totp.generate()

# you may want to convert it to string
str_code: str = totp.string_code(code)

# verify the code
totp.verify(code)  # => True
totp.verify(str_code)  # => True

License

Licensed under BSD. Please see LICENSE for licensing details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otpauth-2.1.1.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

otpauth-2.1.1-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page