Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/malept/pyoath-toolkit
Python bindings for the OATH Toolkit library (one-time password generation/verification).
https://github.com/malept/pyoath-toolkit
Last synced: 11 days ago
JSON representation
Python bindings for the OATH Toolkit library (one-time password generation/verification).
- Host: GitHub
- URL: https://github.com/malept/pyoath-toolkit
- Owner: malept
- License: apache-2.0
- Created: 2013-06-09T23:31:59.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-13T01:16:48.000Z (over 9 years ago)
- Last Synced: 2024-10-24T16:08:50.664Z (14 days ago)
- Language: Python
- Homepage: https://pyoath-toolkit.readthedocs.org/
- Size: 832 KB
- Stars: 19
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
Python bindings for OATH Toolkit
================================This package is a set of Python bindings for the `OATH Toolkit`_ library.
Please note that it is *OATH* (open authentication, e.g., one-time passwords)
and not *OAuth* (an open standard for authorization)... image:: https://travis-ci.org/malept/pyoath-toolkit.svg?branch=master
:target: https://travis-ci.org/malept/pyoath-toolkit
:alt: [Travis CI].. image:: https://codeclimate.com/github/malept/pyoath-toolkit/badges/gpa.svg
:target: https://codeclimate.com/github/malept/pyoath-toolkit
:alt: [CodeClimate].. image:: https://readthedocs.org/projects/pyoath-toolkit/badge/
:target: https://pyoath-toolkit.readthedocs.org/
:alt: [Read The Docs].. _OATH Toolkit: http://www.nongnu.org/oath-toolkit/
.. contents:: Table of Contents
:local:Features
--------* Runs on a variety of Python versions/implementations
* `QR code`_ generator, compatible with apps like `Google Authenticator`_
* Integration with WTForms_
* Integration with Django via ``django-otp``.. _Google Authenticator: https://en.wikipedia.org/wiki/Google_Authenticator
.. _QR code: https://en.wikipedia.org/wiki/QR_code
.. _WTForms: http://pypi.python.org/pypi/WTFormsQuick Install
-------------.. note:: For a more detailed set of installation instructions, including
optional feature prerequisites and installing from Git, please consult the
`installation docs`_... _installation docs:
https://pyoath-toolkit.readthedocs.org/en/latest/install.html1. Make sure CPython 2.6, 2.7, 3.3, 3.4, or PyPy ≥ 2.0 is installed.
2. Make sure `pip is installed`_.
3. Make sure ``liboath`` from `oath-toolkit is installed
`_.
4. If you're using CPython, it's recommended that a C compiler, Python
development headers/libraries, ``liboath`` development headers/libraries,
and Cython_ are available.
5. Run the following:.. code-block:: shell-session
user@host:~$ pip install pyoath-toolkit
.. _pip is installed: https://pip.pypa.io/en/latest/installing.html
.. _Cython: http://cython.org/Usage
-----To generate a time-based one-time password (TOTP):
.. code-block:: python
from oath_toolkit import TOTP
from time import timedigits = 6
time_step = 30
oath = TOTP(b'secret key', digits, time_step)
one_time_password = oath.generate(time())To validate a HMAC-based one-time password (HOTP):
.. code-block:: python
from oath_toolkit import HOTP
from oath_toolkit.exc import OATHErrordef verify(otp, counter):
digits = 6
oath = HOTP(b'secret key', digits)
try:
return oath.verify(otp, counter)
except OATHError:
return FalseFor an explanation of terms like ``time_step`` and ``counter``, refer to the
`API documentation <#documentation>`_.More complex examples can be found in the ``examples/`` directory, which
includes a port of the command-line app ``oathtool``, a sample Django project,
and a simple Flask app which shows how WTForms integration works.Documentation
-------------The docs_ at `Read the Docs`_ contains information such as:
* Requirements and installation instructions
* API documentation
* Contribution guidelines and a list of contributors.. _docs: https://pyoath-toolkit.readthedocs.org/
.. _Read the Docs: https://readthedocs.org/License
-------Unless otherwise noted in the respective files, the code is licensed under the
Apache License 2.0; see the ``LICENSE`` file for details on the Apache license.
The otherwise-licensed files have the requisite separate license details.
Specifically:* ``oath_toolkit/django_otp/hotp/tests.py`` and
``oath_toolkit/django_otp/totp/tests.py`` are originally licensed under the
two-clause BSD license.
* ``examples/django/example/forms.py`` is originally licensed under the MIT
license.The documentation is licensed under the Creative Commons
Attribution-ShareAlike 4.0 International License; see the ``LICENSE.docs``
file for details.