Skip to main content

Implements two-step verification of HOTP/TOTP

Project description

https://travis-ci.org/lepture/otpauth.png?branch=master https://coveralls.io/repos/lepture/otpauth/badge.png?branch=master

Installation

To install otpauth, simply:

$ pip install otpauth

Usage

Generate and validate an otp code is very simple:

>>> from otpauth import OtpAuth
>>> auth = OtpAuth('secret')  # a secret string
>>> auth.hotp()
330810
>>> auth.valid_hotp(330810)
4
>>> auth.hotp(2)
720111
>>> auth.valid_hotp(720111)
2
>>> auth.totp()  # a time based string
828657
>>> auth.valid_totp(828657)
True

Google Authenticator

You can create a QR code for Google Authenticator to scan:

>>> from otpauth import OtpAuth
>>> auth = OtpAuth('secret')  # a secret string
>>> s = auth.to_google('totp', 'Example:foo@bar.baz', 'Foo')
>>> import qrcode
>>> img = qrcode.make(s)

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-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file otpauth-0.1.1.tar.gz.

File metadata

  • Download URL: otpauth-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for otpauth-0.1.1.tar.gz
Algorithm Hash digest
SHA256 abb79d8383575ccd3dfeea348f173d021e1dfb494659f4196e0753a9ca7369b7
MD5 5769775cbcffbe5092dd2e6d55f286fd
BLAKE2b-256 249de7607f7a8c7df5a45ec7e2adac40994fe95b31bd24458b008df7e02b1e3a

See more details on using hashes here.

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