A library for generating and validating QR-coded event tickets
Project description
QR Ticket Manager
A Python library for generating and validating QR-coded event tickets with HMAC-SHA256 cryptographic signing.
Features
- Ticket Generation: HMAC-SHA256 signed ticket IDs with tamper-proof payloads
- QR Code Creation: High error-correction QR code images (PNG, base64)
- Ticket Validation: Two-layer validation — cryptographic signature check + status verification
- Structured Logging: CloudWatch-compatible JSON logging
- Custom Exceptions: Detailed error hierarchy for precise error handling
Installation
pip install qr_ticket_manager
Quick Start
from qr_ticket_manager import TicketGenerator, QRCodeCreator, TicketValidator
# Generate a ticket
generator = TicketGenerator(secret_key="your-secret-key")
ticket = generator.generate_ticket(
event_id="evt-001",
registration_id="reg-001",
user_id="usr-001",
event_name="Tech Conference 2026"
)
# Create QR code
qr_creator = QRCodeCreator()
qr_payload = generator.create_qr_payload(ticket)
qr_bytes = qr_creator.generate_qr_image(qr_payload)
# Validate ticket
validator = TicketValidator(secret_key="your-secret-key")
result = validator.validate_ticket(qr_payload)
print(result) # {'valid': True, 'ticket_id': '...', ...}
Classes
TicketGenerator
Generates HMAC-SHA256 signed tickets with unique IDs.
QRCodeCreator
Creates QR code images in PNG bytes, base64, or saves to file.
TicketValidator
Two-layer validation: signature verification + status checking.
TicketLogger
CloudWatch-compatible structured JSON logger.
License
MIT
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 qr_ticket_manager-1.0.0.tar.gz.
File metadata
- Download URL: qr_ticket_manager-1.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd14d4b9cf04d04ad126a07b7e6474bb13a9d78c5143c84d0a5dce7b69cbc52a
|
|
| MD5 |
6ebab514a6eab95ac876e8e96ef95c24
|
|
| BLAKE2b-256 |
5e7a01bc0ccea2fde028765040cb86f897307b470d5bf9ea5cf073f84c6eaa77
|
File details
Details for the file qr_ticket_manager-1.0.0-py3-none-any.whl.
File metadata
- Download URL: qr_ticket_manager-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad8350f6548422cf1fdcc0d661c1697006979cd9d16814814bd5d5e523b19017
|
|
| MD5 |
1dd084a569a98310c78a4b3f38e5601c
|
|
| BLAKE2b-256 |
49a532f0a1633727658e4a7a2f6200e62f24185686a5c8a86726a5c5952fb1d1
|