Implements two-step verification of HOTP/TOTP. Also known as one time password.
Python Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs Update documentation Jan 25, 2015
.gitignore init commits Jun 9, 2013
.travis.yml Travis for Python 3.4 May 7, 2014
CHANGES.rst Version bump 1.0.1 May 26, 2015
LICENSE Update license copyright year Jan 25, 2015
MANIFEST.in
Makefile
README.rst Document on cryptography May 26, 2015
appveyor.yml Add appveyor CI Jan 25, 2015
otpauth.py
setup.cfg Add setup.cfg Dec 18, 2014
setup.py Version bump 1.0 stable now Jan 25, 2015
test_otpauth.py Fix test case May 26, 2015

README.rst

otpauth

cryptography has built-in two factor support now.

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

Wheel Status Latest Version Travis CI Status Coverage Status App Veyor CI Status

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

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_uri('totp', 'Example:foo@bar.baz', 'Foo')
>>> import qrcode
>>> img = qrcode.make(s)