Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qr_ticket_manager-1.0.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qr_ticket_manager-1.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

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

Hashes for qr_ticket_manager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fd14d4b9cf04d04ad126a07b7e6474bb13a9d78c5143c84d0a5dce7b69cbc52a
MD5 6ebab514a6eab95ac876e8e96ef95c24
BLAKE2b-256 5e7a01bc0ccea2fde028765040cb86f897307b470d5bf9ea5cf073f84c6eaa77

See more details on using hashes here.

File details

Details for the file qr_ticket_manager-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for qr_ticket_manager-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad8350f6548422cf1fdcc0d661c1697006979cd9d16814814bd5d5e523b19017
MD5 1dd084a569a98310c78a4b3f38e5601c
BLAKE2b-256 49a532f0a1633727658e4a7a2f6200e62f24185686a5c8a86726a5c5952fb1d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page