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
SpookyOTP-1.1.3.tar.gz
(7.0 kB
view hashes)
Built Distributions
Close
Hashes for SpookyOTP-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a09c8cdac595ff1f19e0d1e5bbe6808c49e56d4eb99119bb4188a4bd8e03148e |
|
MD5 | ce1fb0083e9491115a41d28776e44fa0 |
|
BLAKE2b-256 | a293a528aedc4e8321ab1f4d0df4463655dad5b15d5f4dae50154882635c0a63 |
Close
Hashes for SpookyOTP-1.1.3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1d130c31fbf2157e0b592550cbb7888aa44dc12ee9d9ca67409cbdb273f3cc5 |
|
MD5 | 4b101b5e315168390b9a699356134553 |
|
BLAKE2b-256 | 1198b8a27480a974e4d565d617cf35f5a5c4be835f4f820726fe3f08dbbaf021 |