GithubHelp home page GithubHelp logo

uberclerk / otpauth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from authlib/otpauth

0.0 1.0 0.0 243 KB

Implements two-step verification of HOTP/TOTP. Also known as one time password.

Home Page: https://pythonhosted.org/otpauth/

License: BSD 3-Clause "New" or "Revised" License

Makefile 6.51% Python 93.49%

otpauth's Introduction

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:[email protected]', 'Foo')
>>> import qrcode
>>> img = qrcode.make(s)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.