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.pkpass file generation with PKCS#7 signing

Functions

f
buildInfoLines(data: SvgTicketData): string[]

Build info lines from ticket data (non-PII event and booking details)

f
buildPkpass(
data: PassData,
creds: SigningCredentials
): Uint8Array

Build a complete .pkpass file as a Uint8Array (ZIP archive)

f
createManifest(files: Record<string, Uint8Array>): string

Create manifest.json mapping filenames to SHA-1 hashes

f
extractSvgContent(svg: string): string

Extract the inner content of an SVG element (strip the outer <svg> wrapper)

f
extractViewBox(svg: string): { width: number; height: number; }

Extract the viewBox from an SVG element to compute its coordinate space

f
generatePassJson(
data: PassData,
creds: SigningCredentials
): Record<string, unknown>

Build the pass.json content from pass data and signing credentials

f
generateQrSvg(text: string): Promise<string>

Generate an SVG string for a QR code encoding the given text. Returns a complete <svg> element suitable for inline embedding.

f
generateSvgTicket(data: SvgTicketData): Promise<string>

Generate a standalone SVG ticket with QR code and event/booking details. Returns a complete SVG document string.

f
isValidPemCertificate(pem: string): boolean

Validate that a string is a parseable PEM certificate

f
isValidPemPrivateKey(pem: string): boolean

Validate that a string is a parseable PEM private key

f
padAuthToken(serial: string): string

Pad a serial number to meet Apple's minimum authenticationToken length. Uses "-" (not in uppercase hex charset) so padding is cleanly reversible.

f
sha1Hex(data: Uint8Array): string

Compute SHA-1 hex digest of a Uint8Array

f
trimAuthToken(authToken: string): string

Strip padding added by padAuthToken to recover the original serial number

Type Aliases

T
PassData = { serialNumber: string; organizationName: string; description: string; eventName: string; eventDate: string; eventLocation: string; attendeeDate: string | null; quantity: number; pricePaid: number; currencyCode: string; checkinUrl: string; webServiceURL: string; foregroundColor?: string; backgroundColor?: string; labelColor?: string; }

Data needed to generate a pass — maps to existing ticket/event data

Variables

v
WALLET_ICONS: Record<string, Uint8Array>

Decoded icon files for inclusion in .pkpass bundles