Skip to main content

Implements two-step verification of HOTP/TOTP

Project description

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)

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

Uploaded Source

Built Distribution

otpauth-1.0.1-py2.py3-none-any.whl (5.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for otpauth-1.0.1.tar.gz
Algorithm Hash digest
SHA256 dd0813cb5c0ac1c98d888f9a96e587254829a61e856550ebf334187f601ff9fc
MD5 cdda7d3be8ac113e4510beea68468299
BLAKE2b-256 bbee9ac4c6032ac76a1f739ac488809337fb55bad8e6ba4325bfc415f1b59aa1

See more details on using hashes here.

File details

Details for the file otpauth-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for otpauth-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 35bcf1a08caf91e4356505744fcd7e3ce646e8491905e2bd335ef9f340e4db4b
MD5 26cce65db440d3b52793fdacf652e3d6
BLAKE2b-256 aee3dbb3b26358f9ff9701dd905cc9bf919ea31ec8822dbfd9e34451707901dd

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