Skip to main content

AdmitiQ: signed, expiring, revocable tokens for QR codes and ticket links. By LogicLitz — https://admitiq.logiclitz.org

Project description

AdmitiQ

PyPI npm License: MIT

Signed, expiring, revocable tokens for QR codes and ticket links.

A LogicLitz open-source project · Site: admitiq.logiclitz.org

Website & tutorial https://admitiq.logiclitz.org
Token playground https://admitiq.logiclitz.org/debugger
Organization https://logiclitz.org
Source https://github.com/HyperXfury1873/admitiq
JavaScript twin npm install admitiq

A QR code is just text with better marketing. AdmitiQ puts an HMAC-signed (or ES256) token under the QR or inside a URL so a scan can prove: we issued it, it hasn’t expired, and (optionally) it hasn’t been used yet.

Tokens are cross-language: issue in Python, verify in Node (and the reverse) with the same secret.


Install

pip install admitiq

# optional extras
pip install "admitiq[qr]"     # QR images (qrcode + Pillow)
pip install "admitiq[ec]"     # ES256 / cryptography
pip install "admitiq[redis]"  # Redis single-use / revoke store

Quick start

from admitiq import issue, verify, issue_url, issue_qr
import os

SECRET = os.environ["ADMITIQ_SECRET"]  # keep on the server only

token = issue({"ticket_id": "T-1001", "seat": "A12"}, ttl_seconds=3600, secret=SECRET)
url = issue_url(
    "https://events.example/scan",
    {"ticket_id": "T-1001"},
    ttl_seconds=3600,
    secret=SECRET,
)
# issue_qr(..., output_path="ticket.png")  # needs admitiq[qr]

payload = verify(token, secret=SECRET)
print(payload["data"])  # {"ticket_id": ..., "seat": ...}

FastAPI / Flask helpers

from admitiq.frameworks import fastapi_dependency, flask_require_token

See the Python guide and the Flask attendance example.

Key rotation

from admitiq import verify_with_secrets
payload = verify_with_secrets(token, secrets=[NEW_SECRET, OLD_SECRET])

ES256 (untrusted scanners)

from admitiq.ec import generate_keypair, issue, verify
private_pem, public_pem = generate_keypair()
token = issue({"ticket_id": "T-1001"}, ttl_seconds=3600, private_key_pem=private_pem)
verify(token, public_key_pem=public_pem)  # scanner holds public key only

Docs & guides

Resource URL
Interactive tutorial https://admitiq.logiclitz.org/tutorial
Issue & verify playground https://admitiq.logiclitz.org/debugger
Getting started https://admitiq.logiclitz.org/getting-started
Python guide https://github.com/HyperXfury1873/admitiq/blob/main/docs/python.md
Delivering tokens (QR / URL) https://github.com/HyperXfury1873/admitiq/blob/main/docs/delivering-tokens.md
Key rotation https://github.com/HyperXfury1873/admitiq/blob/main/docs/key-rotation.md
Security model https://github.com/HyperXfury1873/admitiq/blob/main/SECURITY.md
Flask example https://github.com/HyperXfury1873/admitiq/tree/main/examples/flask-attendance
What is AdmitiQ? https://github.com/HyperXfury1873/admitiq/blob/main/docs/what-is-admitiq.md

Project links

These also appear in the PyPI sidebar:

License

MIT © LogicLitz

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

admitiq-0.3.5.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

admitiq-0.3.5-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file admitiq-0.3.5.tar.gz.

File metadata

  • Download URL: admitiq-0.3.5.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for admitiq-0.3.5.tar.gz
Algorithm Hash digest
SHA256 59176590547e0d5380e30a7d85c36408a38e469332316b248b40713922bdf8bc
MD5 d02d7118750da00d7c005db4ee15696f
BLAKE2b-256 bde0fd9144207adb97bada48964bff68554ca58ca80ef34c9399268bbd7c5936

See more details on using hashes here.

File details

Details for the file admitiq-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: admitiq-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for admitiq-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b1dc906e342a411dcbf6288eea9c43a7043dd80367acfc9096a675f4eb618c13
MD5 0a7b0e0a9f23bff60f1a7f97c59b6670
BLAKE2b-256 7bbab2cd050686eda349fd88cfe5ea1fe84f5f1f5238638551309b0021432f74

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