Ticket generation: QR codes, SVG tickets, and Apple Wallet passes.
- QR codes — SVG-based QR code generation for check-in URLs
- SVG tickets — visual ticket images for email attachments
- Apple Wallet —
.pkpassfile generation with PKCS#7 signing
Build the check-in URL for a single ticket token
Build info lines from ticket data (non-PII event and booking details)
Build a complete .pkpass file as a Uint8Array (ZIP archive)
Create manifest.json mapping filenames to SHA-1 hashes
Whether this event can send QR code scanners directly to checkout. True when no extra contact fields or questions are required.
Extract the inner content of an SVG element (strip the outer <svg> wrapper)
Extract the viewBox from an SVG element to compute its coordinate space
Build the pass.json content from pass data and signing credentials
Generate an SVG string for a QR code encoding the given text. Returns a complete <svg> element suitable for inline embedding.
Generate a standalone SVG ticket with QR code and event/booking details. Returns a complete SVG document string.
Validate that a string is a parseable PEM certificate
Validate that a string is a parseable PEM private key
Pad a serial number to meet Apple's minimum authenticationToken length. Uses "-" (not in uppercase hex charset) so padding is cleanly reversible.
Compute SHA-1 hex digest of a Uint8Array
Sign the manifest with PKCS#7 detached signature
Strip padding added by padAuthToken to recover the original serial number
Data needed to generate a pass — maps to existing ticket/event data
-
attendeeDate: string | null
Selected date for daily/recurring events (null for one-off events)
- backgroundColor: string
-
checkinUrl: string
Full URL encoded in the QR barcode
- currencyCode: string
-
description: string
VoiceOver accessibility description for the pass
-
eventDate: string
ISO 8601 date used for relevantDate and secondary field
-
eventLocation: string
Venue shown in secondary field
-
eventName: string
Event name displayed in the primary field
-
foregroundColor: string
Optional pass colors (CSS rgb() format)
- labelColor: string
-
organizationName: string
Platform/domain name shown on the pass header
- pricePaid: number
-
quantity: number
Ticket quantity and price (in minor units, e.g. pence)
-
serialNumber: string
Unique token identifying this ticket
-
webServiceURL: string
Base URL for Apple Wallet web service (e.g. https://example.com)
| "eventDate"
| "eventLocation"
| "attendeeDate"
| "quantity"
| "checkinUrl"
& { pricePaid: string; currency: string; purchaseOnly?: boolean; }
Non-PII ticket data for SVG rendering (extends shared wallet fields with display-formatted values)
Decoded icon files for inclusion in .pkpass bundles
Usage
import * as mod from "docs/tickets.ts";