A lightweight in-memory OTP generator and verifier with external record support
Project description
GVOTP
A lightweight in-memory OTP (One-Time Password) generator and verifier with external record support.
Installation
pip install gvotp
🚀 Usage
from gvotp import GVOTP
otp_manager = GVOTP()
# Generate an OTP
result = otp_manager.generate_otp("email", "user@example.com")
# Access the raw OTP (to send via email, SMS, etc.)
otp = result["otp"]
# (Optional) Use result["otp_record"] if you prefer storing OTPs externally
otp_doc = result["otp_record"]
# Example structure:
# {
# 'kind': 'email',
# 'receiver': 'user@example.com',
# 'otp_hash': '...',
# 'attempts': 0,
# 'create_time': 1750093088,
# 'ttl': 900
# }
# ✅ In-memory OTP verification
otp_manager.verify_otp("email", "user@example.com", otp)
# ✅ External document verification (if OTP record is stored externally)
otp_manager.verify_otp("email", "user@example.com", otp, document=otp_doc)
📌 Note
-
OTPs expire after the configured TTL (default: 15 minutes).
-
Maximum 5 failed attempts are allowed per OTP.
-
Once an OTP is successfully verified, it is deleted from in-memory store automatically.
-
If using external storage (like a database), you must manage record deletion post-verification.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gvotp-0.1.1.tar.gz.
File metadata
- Download URL: gvotp-0.1.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b47963029a2595e95b85d1fc6c3219f989a92def8e0fd09be43c6b035d755570
|
|
| MD5 |
edd7999b8f0f21ef804ea084dd2b0345
|
|
| BLAKE2b-256 |
6fa37c434516aa8b11a9fc06d6bf5af4cfb213428084db77761b0bfd12bb1d11
|
File details
Details for the file gvotp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gvotp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7322992259d9123d92ab52dd437e8e2df02891ab4e0a48ec09b3ae8c51040485
|
|
| MD5 |
db2734ba11908668137f3f595a67a389
|
|
| BLAKE2b-256 |
ec54302a55b77a73c636ffefcd4e167af805afb7e76d5ada5607cd4717beb611
|