Skip to main content

A Python library that provide unique keys for 2FA with given secret.

Project description

authenticatorpy

https://img.shields.io/pypi/v/authenticatorpy.svg https://img.shields.io/pypi/pyversions/authenticatorpy.svg https://readthedocs.org/projects/authenticatorpy/badge/?version=latest https://codecov.io/gh/abdullahselek/authenticatorpy/branch/master/graph/badge.svg

Linux

Windows

https://travis-ci.org/abdullahselek/authenticatorpy.svg?branch=master https://ci.appveyor.com/api/projects/status/vbbhr6naecm16ljv?svg=true

Introduction

A pure Python library which provides one time password like Google Authenticator. It works with Python versions from 2.7+ and Python 3.

Installing

You can install authenticatorpy using:

$ pip install authenticatorpy

Getting the code

The code is hosted at https://github.com/abdullahselek/authenticatorpy

Check out the latest development version anonymously with:

$ git clone git://github.com/abdullahselek/authenticatorpy.git
$ cd authenticatorpy

To install test dependencies, run either:

$ pip install -Ur requirements.testing.txt

Running Tests

The test suite can be run against a single Python version which requires pip install pytest and optionally pip install pytest-cov (these are included if you have installed dependencies from requirements.testing.txt)

To run the unit tests with a single Python version:

$ py.test -v

to also run code coverage:

$ py.test --cov=authenticatorpy

To run the unit tests against a set of Python versions:

$ tox

Sample Usage

Import Authenticator:

from authenticatorpy.authenticator import Authenticator

Initiation:

authenticator = Authenticator('abcd xyzw abcd xyzw abcd xyzw abcd xyzw')
password = authenticator.one_time_password()

And that’s it, you have the unique password.

Command Line Usage

With --secret parameter default 30 seconds regeneration interval:

python authenticator-cli.py --secret 'abcd xyzw abcd xyzw abcd xyzw abcd xyzw'

or additional --time parameter:

python authenticator-cli.py --secret 'abcd xyzw abcd xyzw abcd xyzw abcd xyzw' --time 15

Relevant RFCs

License

MIT License

Copyright (c) 2018 Abdullah Selek

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

authenticatorpy-0.1.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

authenticatorpy-0.1.2-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: authenticatorpy-0.1.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

File hashes

Hashes for authenticatorpy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6b25a0a4af3b6f111ec9637a833059b6a2364bad27a8d13b92147db092cc845e
MD5 701099efa190a8b9bea79993655e4524
BLAKE2b-256 b8e8c561d7afab53796f9ae91f6b822043cfce2241dd4b2dc5fd6a2f75664545

See more details on using hashes here.

File details

Details for the file authenticatorpy-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: authenticatorpy-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

File hashes

Hashes for authenticatorpy-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 732f17219ba0716d5f09383ed6dba3bcc92932d2f533a87f08072cd4091d37dd
MD5 d55a511e6c00132be8621f5b1878951c
BLAKE2b-256 08c470de6898f72d6d430ba8f96968601874b152fc63c6e4f22b26ee9c5d93be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page