Skip to main content

Implements two-step verification of HOTP/TOTP

Project description

otpauth is One Time Password Authentication, which is usually called as two steps verification. You may have heard it from Google, Dropbox and etc.

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

Installation

Installing otpauth is simple with pip:

$ pip install otpauth

or, with easy_install:

$ easy_install otpauth

Usage

Generate and validate an otp code is very simple:

>>> from otpauth import OtpAuth
>>> auth = OtpAuth('secret')  # a secret string
>>> auth.hotp()  # generate a count based code, default count is 4
330810
>>> auth.valid_hotp(330810)
4
>>> auth.hotp(2)  # generate a count based code, count is 2
720111
>>> auth.valid_hotp(720111)
2
>>> auth.totp()  # generate a time based code
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.2.tar.gz (4.2 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for otpauth-0.1.2.tar.gz
Algorithm Hash digest
SHA256 777ee5c6ddc6922dc02a0762dd014a7135959cb88f8238deb6492c1fab38ade7
MD5 feef76d08102bd95243d595eff163b8c
BLAKE2b-256 bca9e26a436460292ebd1233fb7f41fd4fc77c7d6bc5e255fdc69721db2a2edc

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