Skip to main content

allsafe-otp

Project Overview

allsafe-otp is a simple Python package for generating Time-Based One-Time Passwords (TOTP) and QR codes for two-factor authentication (2FA). It allows you to easily create secure OTPs and generate QR codes that can be scanned with Google Authenticator or other 2FA apps.

Features

  • Generate secure TOTP codes using the HMAC-SHA1 algorithm.
  • Create scannable QR codes for Google Authenticator or any 2FA app.
  • Easy to integrate into your Python projects.

Installation

pip install allsafe-otp

Usage

1. Generate a TOTP Code

from allsafe_otp.totp import generate_otp

secret = "JBSWY3DPEHPK3PXP"  # Your base32 secret
otp = generate_otp(secret)
print(f"Generated OTP: {otp}")

2. Generate a QR Code for Google Authenticator

from allsafe_otp.generate_qr import generate_qr_code

otp_url = "otpauth://totp/MyApp:daniel@allsafe.com?secret=JBSWY3DPEHPK3PXP&issuer=MyApp"
generate_qr_code(otp_url)

Testing

To test the package:

  1. Install the package (if not already installed):
pip install allsafe-otp
  1. Create a test script (test.py):
from allsafe_otp.totp import generate_otp
from allsafe_otp.generate_qr import generate_qr_code

secret = "JBSWY3DPEHPK3PXP"
print("Generated OTP from Python:", generate_otp(secret))

otp_url = "otpauth://totp/MyApp:daniel@allsafe.com?secret=JBSWY3DPEHPK3PXP&issuer=MyApp"
generate_qr_code(otp_url)

Project Structure

allsafe-otp/
├── allsafe_otp/
│   ├── __init__.py
│   ├── generate_qr.py
│   └── totp.py
├── setup.py
└── README.md

Contributing

Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Release files for allsafe-otp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for allsafe-otp 0.1.1
File Size Uploaded
allsafe_otp-0.1.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for allsafe-otp 0.1.1
File Interpreter ABI Platform
allsafe_otp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size:6.8 kB

Release files / allsafe_otp-0.1.1.tar.gz

Download URL allsafe_otp-0.1.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2977ac158a0b7c368e63d1c183b60c861719fd0baa6b4de3d9871e02c87ad3a0
BLAKE2b-256 checksum
How to use checksums
b3f3d7e25125df854d7a09f4c5d5d8c5123f4cdb9247ccfc0b206e3f86d533ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / allsafe_otp-0.1.1-py3-none-any.whl

Download URL allsafe_otp-0.1.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4218e86c79278fd27377835c62d825f2204e0c0f2b1b5aabd490986a67a4de9
BLAKE2b-256 checksum
How to use checksums
95cd8f5db6e3615ba7e710f6a3e992819f4da851fa29aaa6dd2baacfaa469b6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page