A lightweight Python 2/3 package for handling HOTP/TOTP (Google Authenticator) authentication.
Project description
SpookyOTP
Lightweight Python package for TOTP/HOTP (Google Authenticator) codes
Description
This is a lightweight package for generating TOTP and HOTP codes used for two-factor authentication. They can be used with Google Authenticator or FreeOTP.
Some features (such as using different hashing algorithms or displaying more than 6 digits) do not work with Google Authenticator.
URIs generated (and QR codes encoding them) follow the Google Authenticator format
Example
from spookyotp import (get_random_secret, TOTP, from_uri)
secret = get_random_secret(n_bytes=10)
totp = TOTP(secret, 'Example', 'user@example.org')
totp.save_qr_code('qr.png')
# you can now load the QR code with your app of choice
code = input("Enter code: ") # or raw_input in Python 2
matches = totp.compare(code)
if matches:
print("Correct!")
else:
print("Incorrect.")
# serialization and deserialization is supported via URI
uri = totp.get_uri()
new_totp = from_uri(uri)
Why Spooky?
I created the git repo on Halloween, and there is already a project called PyOTP.
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
Built Distributions
File details
Details for the file SpookyOTP-1.1.4.tar.gz
.
File metadata
- Download URL: SpookyOTP-1.1.4.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e3495f76293e0e5f5cd1816a9861b4b8bbe17985fe1a1bea885f8fa83883356 |
|
MD5 | 0b474401fb77ae8104443937e19bf0fc |
|
BLAKE2b-256 | 2f3db7c544c5ff54b59c3cfc1cd9f6c5aeda32a4c395818454eaabfedba078da |
File details
Details for the file SpookyOTP-1.1.4-py3.7.egg
.
File metadata
- Download URL: SpookyOTP-1.1.4-py3.7.egg
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a16e98e9fdbfa9165196c34bdb7650ba5e9c9b1ea1199e488d5385215834e4de |
|
MD5 | 82a869e993ecb9555f8ec197c1488089 |
|
BLAKE2b-256 | 574e2963a365d257f0187fe6e3ea2777ed7ea0d248559db83900d640fdc6e583 |
File details
Details for the file SpookyOTP-1.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: SpookyOTP-1.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e49028a2be1be42b16de42183bc301c1d71233f4dcb8e7faed575b4686f5fdf |
|
MD5 | 2bef9a93f5fa7b3a1b8699e24d17bf9e |
|
BLAKE2b-256 | 3c475779e0435eb5ee3c3eb14e18e44a559cbbb869d01cc49c29553b209b345a |