passlet 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -16
- package/dist/index.cjs +75 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -16
- package/dist/index.d.ts +117 -16
- package/dist/index.js +75 -10
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/providers/apple/signer.ts","../src/providers/apple/utils.ts","../src/providers/apple/index.ts","../src/providers/google/api.ts","../src/providers/google/utils.ts","../src/providers/google/index.ts","../src/types/schemas.ts","../src/pass.ts","../src/wallet.ts"],"names":["imageSet","SignJWT"],"mappings":";;;;;;;AAAO,IAAM,kBAAA,GAAqB;AAAA;AAAA,EAEjC,mBAAA,EAAqB,oBAAA;AAAA,EACrB,qBAAA,EAAuB,sBAAA;AAAA;AAAA,EAGvB,yBAAA,EACC,iEAAA;AAAA,EACD,wBAAA,EACC,gEAAA;AAAA,EACD,kBAAA,EACC,2DAAA;AAAA,EACD,oBAAA,EACC,yDAAA;AAAA,EACD,kBAAA,EAAoB,oDAAA;AAAA,EACpB,gCAAA,EACC,mFAAA;AAAA,EACD,mCAAA,EACC,oDAAA;AAAA;AAAA,EAGD,0BAAA,EACC,yEAAA;AAAA,EACD,qBAAA,EAAuB,sDAAA;AAAA,EACvB,gBAAA,EAAkB,yBAAA;AAAA,EAClB,mBAAA,EACC,6DAAA;AAAA,EACD,kCAAA,EACC,qFAAA;AAAA,EACD,oCAAA,EACC,mDAAA;AAAA;AAAA,EAGD,yBAAA,EAA2B,sCAAA;AAAA,EAC3B,kBAAA,EAAoB;AACrB;AAIO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EAC7B,IAAA;AAAA,EAET,WAAA,CAAY,IAAA,EAAuB,OAAA,EAAkB,OAAA,EAAwB;AAC5E,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AAAA,OAClB;AAAA,IACD;AAAA,EACD;AACD;;;ACvJO,IAAM,SAAN,MAAa;AAAA,EACF,WAAA;AAAA,EAEjB,YAAY,WAAA,EAAgC;AAC3C,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AAAA,EACpB;AAAA,EAEA,QAAQ,MAAA,EAA+C;AACtD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,SAAA,EAAU,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EACjE;AAAA,EAEA,MAAM,MAAA,EAA6C;AAClD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,OAAA,EAAQ,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EAC/D;AAAA,EAEA,OAAO,MAAA,EAA8C;AACpD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,QAAA,EAAS,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EAChE;AAAA,EAEA,OAAO,MAAA,EAA8C;AACpD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,QAAA,EAAS,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EAChE;AAAA,EAEA,SAAS,MAAA,EAAgD;AACxD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,UAAA,EAAW,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EAClE;AAAA,EAEA,QAAQ,MAAA,EAA+C;AACtD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,SAAA,EAAU,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EACjE;AACD","file":"index.js","sourcesContent":["export const WALLET_ERROR_CODES = {\n\t// Config validation — message comes from the schema\n\tPASS_CONFIG_INVALID: \"PassConfig invalid\",\n\tCREATE_CONFIG_INVALID: \"CreateConfig invalid\",\n\n\t// Apple — provider-level constraints the schema cannot enforce\n\tAPPLE_INVALID_SIGNER_CERT:\n\t\t\"Apple signing failed: signerCert is not a valid PEM certificate\",\n\tAPPLE_INVALID_SIGNER_KEY:\n\t\t\"Apple signing failed: signerKey is not a valid PEM private key\",\n\tAPPLE_INVALID_WWDR:\n\t\t\"Apple signing failed: wwdr is not a valid PEM certificate\",\n\tAPPLE_SIGNING_FAILED:\n\t\t\"Apple signing failed: could not create PKCS#7 signature\",\n\tAPPLE_MISSING_ICON: \"Apple Wallet requires an icon image for every pass\",\n\tAPPLE_UNSUPPORTED_BARCODE_FORMAT:\n\t\t\"Apple Wallet does not support this barcode format — use QR, PDF417, or Aztec\",\n\tAPPLE_BOARDING_MISSING_TRANSIT_TYPE:\n\t\t\"Apple Wallet boarding passes require a transitType\",\n\n\t// Google — provider-level constraints the schema cannot enforce\n\tGOOGLE_INVALID_PRIVATE_KEY:\n\t\t\"Google signing failed: privateKey is not a valid PKCS#8 PEM private key\",\n\tGOOGLE_SIGNING_FAILED: \"Google signing failed: could not sign the Wallet JWT\",\n\tGOOGLE_API_ERROR: \"Google Wallet API error\",\n\tGOOGLE_MISSING_LOGO:\n\t\t\"Google Wallet requires a public logo URL for this pass type\",\n\tGOOGLE_FLIGHT_MISSING_CLASS_FIELDS:\n\t\t\"Google Wallet flightClass requires flightHeader and localScheduledDepartureDateTime\",\n\tGOOGLE_FLIGHT_MISSING_PASSENGER_NAME:\n\t\t\"Google Wallet flightObject requires passengerName\",\n\n\t// Images\n\tIMAGE_FETCH_NETWORK_ERROR: \"Failed to fetch image: network error\",\n\tIMAGE_FETCH_FAILED: \"Failed to fetch image: non-2xx response\",\n} as const;\n\nexport type WalletErrorCode = keyof typeof WALLET_ERROR_CODES;\n\nexport class WalletError extends Error {\n\treadonly code: WalletErrorCode;\n\n\tconstructor(code: WalletErrorCode, message?: string, options?: ErrorOptions) {\n\t\tsuper(message ?? WALLET_ERROR_CODES[code], options);\n\t\tthis.name = \"WalletError\";\n\t\tthis.code = code;\n\t}\n}\n","import forge from \"node-forge\";\nimport { WalletError } from \"../../errors\";\n\ninterface SignManifestOptions {\n\tmanifest: Uint8Array;\n\tsignerCert: string; // PEM\n\tsignerKey: string; // PEM\n\twwdr: string; // PEM\n}\n\n// Sign manifest.json with a PKCS#7 detached signature — required by Apple to\n// validate the integrity of a .pkpass file.\nexport function signManifest(options: SignManifestOptions): Uint8Array {\n\tconst { manifest, signerCert, signerKey, wwdr } = options;\n\n\tlet cert: forge.pki.Certificate;\n\tlet key: forge.pki.PrivateKey;\n\tlet wwdrCert: forge.pki.Certificate;\n\n\ttry {\n\t\tcert = forge.pki.certificateFromPem(signerCert);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_INVALID_SIGNER_CERT\", undefined, { cause });\n\t}\n\ttry {\n\t\tkey = forge.pki.privateKeyFromPem(signerKey);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_INVALID_SIGNER_KEY\", undefined, { cause });\n\t}\n\ttry {\n\t\twwdrCert = forge.pki.certificateFromPem(wwdr);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_INVALID_WWDR\", undefined, { cause });\n\t}\n\n\ttry {\n\t\t// forge requires a binary string — decode the Uint8Array as latin1\n\t\t// biome-ignore lint/suspicious/noExplicitAny: \"iso-8859-1\" is valid but not in strict Encoding types\n\t\tconst binaryStr = new TextDecoder(\"iso-8859-1\" as any).decode(manifest);\n\n\t\tconst p7 = forge.pkcs7.createSignedData();\n\t\tp7.content = forge.util.createBuffer(binaryStr);\n\t\tp7.addCertificate(cert);\n\t\tp7.addCertificate(wwdrCert);\n\t\tp7.addSigner({\n\t\t\tkey,\n\t\t\tcertificate: cert,\n\t\t\tdigestAlgorithm: forge.pki.oids.sha1 as string,\n\t\t\tauthenticatedAttributes: [\n\t\t\t\t{\n\t\t\t\t\ttype: forge.pki.oids.contentType as string,\n\t\t\t\t\tvalue: forge.pki.oids.data as string,\n\t\t\t\t},\n\t\t\t\t{ type: forge.pki.oids.messageDigest as string },\n\t\t\t\t{ type: forge.pki.oids.signingTime as string },\n\t\t\t],\n\t\t});\n\n\t\tp7.sign({ detached: true });\n\n\t\tconst der = forge.asn1.toDer(p7.toAsn1()).getBytes();\n\t\treturn Uint8Array.from(der, (c) => c.charCodeAt(0));\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_SIGNING_FAILED\", undefined, { cause });\n\t}\n}\n","import { WalletError } from \"../../errors\";\nimport type { ImageSet } from \"../../types/schemas\";\n\n// Convert a 6-digit hex color to Apple's rgb() format.\n// Apple pass.json requires colors as \"rgb(r, g, b)\" strings.\nexport function hexToRgb(hex: string): string {\n\tconst clean = hex.replace(\"#\", \"\");\n\tconst r = Number.parseInt(clean.slice(0, 2), 16);\n\tconst g = Number.parseInt(clean.slice(2, 4), 16);\n\tconst b = Number.parseInt(clean.slice(4, 6), 16);\n\treturn `rgb(${r}, ${g}, ${b})`;\n}\n\nconst APPLE_BARCODE_FORMAT: Record<string, string> = {\n\tQR: \"PKBarcodeFormatQR\",\n\tPDF417: \"PKBarcodeFormatPDF417\",\n\tAztec: \"PKBarcodeFormatAztec\",\n\tCode128: \"PKBarcodeFormatCode128\",\n};\n\nexport function toAppleBarcodeFormat(format: string): string {\n\treturn APPLE_BARCODE_FORMAT[format] ?? \"PKBarcodeFormatQR\";\n}\n\nasync function fetchAsBytes(url: string): Promise<Uint8Array> {\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(url);\n\t} catch (cause) {\n\t\tthrow new WalletError(\n\t\t\t\"IMAGE_FETCH_NETWORK_ERROR\",\n\t\t\t`Failed to fetch image: ${url} (network error)`,\n\t\t\t{ cause }\n\t\t);\n\t}\n\tif (!response.ok) {\n\t\tthrow new WalletError(\n\t\t\t\"IMAGE_FETCH_FAILED\",\n\t\t\t`Failed to fetch image: ${url} (${response.status})`\n\t\t);\n\t}\n\treturn new Uint8Array(await response.arrayBuffer());\n}\n\nfunction resolveSource(src: string | Uint8Array): Promise<Uint8Array> {\n\treturn src instanceof Uint8Array ? Promise.resolve(src) : fetchAsBytes(src);\n}\n\n// Resolve an ImageSet into named Apple image files (base.png, @2x, @3x).\n// Returns a record of filename → bytes. Optional images that fail to load\n// are skipped and a warning is added.\nexport async function resolveImageSet(\n\tname: string,\n\timageSet: ImageSet | undefined,\n\twarnings: string[]\n): Promise<Record<string, Uint8Array>> {\n\tif (!imageSet) {\n\t\treturn {};\n\t}\n\n\tconst files: Record<string, Uint8Array> = {};\n\n\tconst tryLoad = async (filename: string, src: string | Uint8Array) => {\n\t\ttry {\n\t\t\tfiles[filename] = await resolveSource(src);\n\t\t} catch (e) {\n\t\t\twarnings.push(\n\t\t\t\t`Could not load ${filename}: ${e instanceof Error ? e.message : String(e)}`\n\t\t\t);\n\t\t}\n\t};\n\n\tif (typeof imageSet === \"string\" || imageSet instanceof Uint8Array) {\n\t\tawait tryLoad(`${name}.png`, imageSet);\n\t} else {\n\t\tawait tryLoad(`${name}.png`, imageSet.base);\n\t\tif (imageSet.retina) {\n\t\t\tawait tryLoad(`${name}@2x.png`, imageSet.retina);\n\t\t}\n\t\tif (imageSet.superRetina) {\n\t\t\tawait tryLoad(`${name}@3x.png`, imageSet.superRetina);\n\t\t}\n\t}\n\n\treturn files;\n}\n\n// Same as resolveImageSet but throws instead of warning — for required images.\nexport async function resolveRequiredImageSet(\n\tname: string,\n\timageSet: ImageSet\n): Promise<Record<string, Uint8Array>> {\n\tconst files: Record<string, Uint8Array> = {};\n\n\tif (typeof imageSet === \"string\" || imageSet instanceof Uint8Array) {\n\t\tfiles[`${name}.png`] = await resolveSource(imageSet);\n\t} else {\n\t\tfiles[`${name}.png`] = await resolveSource(imageSet.base);\n\t\tif (imageSet.retina) {\n\t\t\tfiles[`${name}@2x.png`] = await resolveSource(imageSet.retina);\n\t\t}\n\t\tif (imageSet.superRetina) {\n\t\t\tfiles[`${name}@3x.png`] = await resolveSource(imageSet.superRetina);\n\t\t}\n\t}\n\n\treturn files;\n}\n","import { createHash } from \"node:crypto\";\nimport JSZip from \"jszip\";\nimport { WalletError } from \"../../errors\";\nimport type { AppleCredentials } from \"../../types/credentials\";\nimport type { CreateConfig, FieldDef, PassConfig } from \"../../types/schemas\";\nimport { signManifest } from \"./signer\";\nimport {\n\thexToRgb,\n\tresolveImageSet,\n\tresolveRequiredImageSet,\n\ttoAppleBarcodeFormat,\n} from \"./utils\";\n\n// Apple pass type → pass.json key\nconst PASS_TYPE_KEY: Record<string, string> = {\n\tloyalty: \"storeCard\",\n\tcoupon: \"coupon\",\n\tevent: \"eventTicket\",\n\tflight: \"boardingPass\",\n\tgiftCard: \"storeCard\",\n\tgeneric: \"generic\",\n};\n\nconst TRANSIT_TYPE: Record<string, string> = {\n\tair: \"PKTransitTypeAir\",\n\ttrain: \"PKTransitTypeTrain\",\n\tbus: \"PKTransitTypeBus\",\n\tboat: \"PKTransitTypeBoat\",\n};\n\n// Apple field slot → pass.json key\nconst SLOT_KEY: Record<FieldDef[\"slot\"], string> = {\n\theader: \"headerFields\",\n\tprimary: \"primaryFields\",\n\tsecondary: \"secondaryFields\",\n\tauxiliary: \"auxiliaryFields\",\n\tback: \"backFields\",\n};\n\nfunction validateAppleRequirements(pass: PassConfig): void {\n\tif (!pass.apple?.icon) {\n\t\tthrow new WalletError(\"APPLE_MISSING_ICON\");\n\t}\n\tif (pass.type === \"flight\" && !pass.transitType) {\n\t\tthrow new WalletError(\"APPLE_BOARDING_MISSING_TRANSIT_TYPE\");\n\t}\n}\n\nfunction buildSlots(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n): Record<string, unknown[]> {\n\tconst slots: Record<string, unknown[]> = {\n\t\theaderFields: [],\n\t\tprimaryFields: [],\n\t\tsecondaryFields: [],\n\t\tauxiliaryFields: [],\n\t\tbackFields: [],\n\t};\n\n\tfor (const f of fields) {\n\t\tconst value = f.key in values ? values[f.key] : f.value;\n\t\tif (value === null || value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tslots[SLOT_KEY[f.slot]]?.push({\n\t\t\tkey: f.key,\n\t\t\tlabel: f.label,\n\t\t\tvalue,\n\t\t\t...(f.changeMessage && { changeMessage: f.changeMessage }),\n\t\t\t...(f.dateStyle && { dateStyle: f.dateStyle }),\n\t\t\t...(f.timeStyle && { timeStyle: f.timeStyle }),\n\t\t\t...(f.numberStyle && { numberStyle: f.numberStyle }),\n\t\t\t...(f.currencyCode && { currencyCode: f.currencyCode }),\n\t\t\t...(f.textAlignment && { textAlignment: f.textAlignment }),\n\t\t\t...(f.row !== undefined && { row: f.row }),\n\t\t});\n\t}\n\n\treturn slots;\n}\n\nfunction buildPassTypeContent(\n\tpass: PassConfig,\n\tslots: Record<string, unknown[]>\n): Record<string, unknown> {\n\tconst content: Record<string, unknown> = { ...slots };\n\tif (pass.type === \"flight\") {\n\t\tcontent.transitType =\n\t\t\tTRANSIT_TYPE[pass.transitType ?? \"air\"] ?? \"PKTransitTypeAir\";\n\t}\n\treturn content;\n}\n\ntype EventPass = Extract<PassConfig, { type: \"event\" }>;\ntype FlightPass = Extract<PassConfig, { type: \"flight\" }>;\n\nfunction buildEventAppleFields(pass: EventPass): Record<string, unknown> {\n\tconst a = pass.apple;\n\treturn {\n\t\teventLogoText: a?.eventLogoText,\n\t\tfooterBackgroundColor: a?.footerBackgroundColor\n\t\t\t? hexToRgb(a.footerBackgroundColor)\n\t\t\t: undefined,\n\t\tsuppressHeaderDarkening: a?.suppressHeaderDarkening,\n\t\tuseAutomaticColors: a?.useAutomaticColors,\n\t\tpreferredStyleSchemes: a?.preferredStyleSchemes,\n\t\tauxiliaryStoreIdentifiers: a?.auxiliaryStoreIdentifiers,\n\t\taccessibilityURL: a?.accessibilityURL,\n\t\taddOnURL: a?.addOnURL,\n\t\tbagPolicyURL: a?.bagPolicyURL,\n\t\tcontactVenueEmail: a?.contactVenueEmail,\n\t\tcontactVenuePhoneNumber: a?.contactVenuePhoneNumber,\n\t\tcontactVenueWebsite: a?.contactVenueWebsite,\n\t\tdirectionsInformationURL: a?.directionsInformationURL,\n\t\tmerchandiseURL: a?.merchandiseURL,\n\t\torderFoodURL: a?.orderFoodURL,\n\t\tparkingInformationURL: a?.parkingInformationURL,\n\t\tpurchaseParkingURL: a?.purchaseParkingURL,\n\t\tsellURL: a?.sellURL,\n\t\ttransferURL: a?.transferURL,\n\t\ttransitInformationURL: a?.transitInformationURL,\n\t};\n}\n\nfunction buildFlightAppleFields(pass: FlightPass): Record<string, unknown> {\n\tconst a = pass.apple;\n\treturn {\n\t\tchangeSeatURL: a?.changeSeatURL,\n\t\tentertainmentURL: a?.entertainmentURL,\n\t\tmanagementURL: a?.managementURL,\n\t\tpurchaseAdditionalBaggageURL: a?.purchaseAdditionalBaggageURL,\n\t\tpurchaseLoungeAccessURL: a?.purchaseLoungeAccessURL,\n\t\tpurchaseWifiURL: a?.purchaseWifiURL,\n\t\tregisterServiceAnimalURL: a?.registerServiceAnimalURL,\n\t\treportLostBagURL: a?.reportLostBagURL,\n\t\trequestWheelchairURL: a?.requestWheelchairURL,\n\t\ttrackBagsURL: a?.trackBagsURL,\n\t\ttransitProviderEmail: a?.transitProviderEmail,\n\t\ttransitProviderPhoneNumber: a?.transitProviderPhoneNumber,\n\t\ttransitProviderWebsiteURL: a?.transitProviderWebsiteURL,\n\t\tupgradeURL: a?.upgradeURL,\n\t};\n}\n\nfunction buildAppleCommonFields(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig\n): Record<string, unknown> {\n\tconst a = pass.apple;\n\treturn {\n\t\tbackgroundColor: pass.color ? hexToRgb(pass.color) : undefined,\n\t\tforegroundColor: a?.foregroundColor\n\t\t\t? hexToRgb(a.foregroundColor)\n\t\t\t: undefined,\n\t\tlabelColor: a?.labelColor ? hexToRgb(a.labelColor) : undefined,\n\t\texpirationDate: createConfig.expiresAt,\n\t\tvoided: createConfig.apple?.voided,\n\t\t// Barcode — Apple supports up to 10 but we expose one per recipient\n\t\tbarcodes: createConfig.barcode\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: createConfig.barcode.value,\n\t\t\t\t\t\tformat: toAppleBarcodeFormat(createConfig.barcode.format),\n\t\t\t\t\t\tmessageEncoding: \"iso-8859-1\",\n\t\t\t\t\t\taltText: createConfig.barcode.altText ?? createConfig.barcode.value,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: undefined,\n\t\t// Locations — altitude and relevantText are Apple-only\n\t\tlocations: pass.locations?.map(\n\t\t\t({ latitude, longitude, altitude, relevantText }) => ({\n\t\t\t\tlatitude,\n\t\t\t\tlongitude,\n\t\t\t\taltitude,\n\t\t\t\trelevantText,\n\t\t\t})\n\t\t),\n\t\tbeacons: a?.beacons,\n\t\trelevantDate: a?.relevantDate,\n\t\trelevantDates: a?.relevantDates,\n\t\tgroupingIdentifier: a?.groupingIdentifier,\n\t\tsuppressStripShine: a?.suppressStripShine,\n\t\tsharingProhibited: a?.sharingProhibited,\n\t\tmaxDistance: a?.maxDistance,\n\t\tnfc: a?.nfc\n\t\t\t? {\n\t\t\t\t\tmessage: a.nfc.message,\n\t\t\t\t\tencryptionPublicKey: a.nfc.encryptionPublicKey,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tappLaunchURL: a?.appLaunchURL,\n\t\tassociatedStoreIdentifiers: a?.associatedStoreIdentifiers,\n\t\twebServiceURL: a?.webServiceURL,\n\t\tauthenticationToken: a?.webServiceURL ? a.authenticationToken : undefined,\n\t\tuserInfo: a?.userInfo,\n\t};\n}\n\nfunction buildPassJson(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: AppleCredentials\n): Record<string, unknown> {\n\tconst passTypeKey = PASS_TYPE_KEY[pass.type] ?? \"generic\";\n\tconst slots = buildSlots(pass.fields, createConfig.values ?? {});\n\tconst a = pass.apple;\n\n\treturn {\n\t\tformatVersion: 1,\n\t\tpassTypeIdentifier: credentials.passTypeIdentifier,\n\t\tserialNumber: createConfig.serialNumber,\n\t\tteamIdentifier: credentials.teamId,\n\t\torganizationName: pass.name,\n\t\tdescription: a?.description ?? pass.name,\n\t\tlogoText: a?.logoText ?? pass.name,\n\t\t...buildAppleCommonFields(pass, createConfig),\n\t\t...(pass.type === \"event\" && buildEventAppleFields(pass)),\n\t\t...(pass.type === \"flight\" && buildFlightAppleFields(pass)),\n\t\t[passTypeKey]: buildPassTypeContent(pass, slots),\n\t};\n}\n\nasync function collectImages(\n\tpass: PassConfig,\n\twarnings: string[]\n): Promise<Record<string, Uint8Array>> {\n\tconst images: Record<string, Uint8Array> = {};\n\n\t// icon is required — validateAppleRequirements() throws before we reach here if missing\n\tconst icon = pass.apple?.icon;\n\tif (!icon) {\n\t\tthrow new WalletError(\"APPLE_MISSING_ICON\");\n\t}\n\tconst iconFiles = await resolveRequiredImageSet(\"icon\", icon);\n\tObject.assign(images, iconFiles);\n\n\t// All other images are optional — adds warnings on failure\n\tconst optional = await Promise.all([\n\t\tresolveImageSet(\"logo\", pass.logo, warnings),\n\t\tresolveImageSet(\"strip\", pass.banner, warnings), // banner → strip on Apple\n\t\tresolveImageSet(\"background\", pass.apple?.background, warnings),\n\t\tresolveImageSet(\"thumbnail\", pass.apple?.thumbnail, warnings),\n\t\tresolveImageSet(\"footer\", pass.apple?.footer, warnings),\n\t]);\n\tfor (const set of optional) {\n\t\tObject.assign(images, set);\n\t}\n\n\treturn images;\n}\n\nexport async function generateApplePass(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: AppleCredentials\n): Promise<{ pass: Uint8Array; warnings: string[] }> {\n\tconst warnings: string[] = [];\n\n\tvalidateAppleRequirements(pass);\n\n\tconst encoder = new TextEncoder();\n\tconst zip = new JSZip();\n\tconst files: Record<string, Uint8Array> = {};\n\n\t// pass.json\n\tconst passJson = buildPassJson(pass, createConfig, credentials);\n\tfiles[\"pass.json\"] = encoder.encode(JSON.stringify(passJson));\n\n\t// Locale files — {language}.lproj/pass.strings\n\t// Each entry uses Apple's pass.strings format: \"key\" = \"value\";\n\t// Use field keys to translate labels and \"key_value\" to translate static field values.\n\t// The reserved key \"name\" translates the pass title (organizationName / description / logoText).\n\tif (pass.locales) {\n\t\tfor (const [language, translations] of Object.entries(pass.locales)) {\n\t\t\tconst lines = Object.entries(translations).map(\n\t\t\t\t([key, value]) => `\"${key}\" = \"${value.replace(/\"/g, '\\\\\"')}\";`\n\t\t\t);\n\t\t\tfiles[`${language}.lproj/pass.strings`] = encoder.encode(\n\t\t\t\tlines.join(\"\\n\")\n\t\t\t);\n\t\t}\n\t}\n\n\t// Images\n\tconst images = await collectImages(pass, warnings);\n\tfor (const [name, bytes] of Object.entries(images)) {\n\t\tfiles[name] = bytes;\n\t}\n\n\t// manifest.json — SHA1 hash of every file\n\tconst manifest: Record<string, string> = {};\n\tfor (const [name, content] of Object.entries(files)) {\n\t\tmanifest[name] = createHash(\"sha1\").update(content).digest(\"hex\");\n\t}\n\tconst manifestBytes = encoder.encode(JSON.stringify(manifest));\n\n\t// signature — PKCS#7 detached signature of manifest.json\n\tconst signature = signManifest({\n\t\tmanifest: manifestBytes,\n\t\tsignerCert: credentials.signerCert,\n\t\tsignerKey: credentials.signerKey,\n\t\twwdr: credentials.wwdr,\n\t});\n\n\tfor (const [name, content] of Object.entries(files)) {\n\t\tzip.file(name, content);\n\t}\n\tzip.file(\"manifest.json\", manifestBytes);\n\tzip.file(\"signature\", signature);\n\n\treturn { pass: await zip.generateAsync({ type: \"uint8array\" }), warnings };\n}\n","import { importPKCS8, SignJWT } from \"jose\";\nimport { WalletError } from \"../../errors\";\nimport type { GoogleCredentials } from \"../../types/credentials\";\n\nconst WALLET_BASE = \"https://walletobjects.googleapis.com/walletobjects/v1\";\nconst TOKEN_URL = \"https://oauth2.googleapis.com/token\";\nconst WALLET_SCOPE = \"https://www.googleapis.com/auth/wallet_object.issuer\";\n\n// Cache access tokens for 55 minutes (tokens expire in 60).\nconst tokenCache = new Map<string, { token: string; expiresAt: number }>();\n\nexport async function importGoogleKey(\n\tcredentials: GoogleCredentials\n): Promise<CryptoKey> {\n\ttry {\n\t\treturn await importPKCS8(credentials.privateKey, \"RS256\");\n\t} catch (cause) {\n\t\tthrow new WalletError(\"GOOGLE_INVALID_PRIVATE_KEY\", undefined, { cause });\n\t}\n}\n\nasync function getAccessToken(\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<string> {\n\tconst cacheKey = `${credentials.issuerId}:${credentials.clientEmail}`;\n\tconst cached = tokenCache.get(cacheKey);\n\tif (cached && Date.now() < cached.expiresAt) {\n\t\treturn cached.token;\n\t}\n\n\tlet assertion: string;\n\ttry {\n\t\tassertion = await new SignJWT({ scope: WALLET_SCOPE })\n\t\t\t.setProtectedHeader({ alg: \"RS256\" })\n\t\t\t.setIssuedAt()\n\t\t\t.setExpirationTime(\"1h\")\n\t\t\t.setIssuer(credentials.clientEmail)\n\t\t\t.setAudience(TOKEN_URL)\n\t\t\t.sign(privateKey);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"GOOGLE_SIGNING_FAILED\", undefined, { cause });\n\t}\n\n\tconst response = await fetch(TOKEN_URL, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n\t\tbody: new URLSearchParams({\n\t\t\tgrant_type: \"urn:ietf:params:oauth:grant-type:jwt-bearer\",\n\t\t\tassertion,\n\t\t}).toString(),\n\t});\n\n\tif (!response.ok) {\n\t\tconst text = await response.text();\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_API_ERROR\",\n\t\t\t`Failed to obtain access token (${response.status}): ${extractGoogleDetail(text)}`\n\t\t);\n\t}\n\n\tconst data = (await response.json()) as { access_token: string };\n\ttokenCache.set(cacheKey, {\n\t\ttoken: data.access_token,\n\t\texpiresAt: Date.now() + 55 * 60 * 1000,\n\t});\n\treturn data.access_token;\n}\n\nasync function walletRequest(\n\tmethod: string,\n\tpath: string,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey,\n\tbody?: Record<string, unknown>\n): Promise<Response> {\n\tconst accessToken = await getAccessToken(credentials, privateKey);\n\treturn fetch(`${WALLET_BASE}${path}`, {\n\t\tmethod,\n\t\theaders: {\n\t\t\tAuthorization: `Bearer ${accessToken}`,\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t},\n\t\tbody: body === undefined ? undefined : JSON.stringify(body),\n\t});\n}\n\nfunction extractGoogleDetail(text: string): string {\n\ttry {\n\t\tconst body = JSON.parse(text) as { error?: { message?: string } };\n\t\tif (body.error?.message) {\n\t\t\treturn body.error.message;\n\t\t}\n\t} catch {\n\t\t// not JSON — fall through to raw text\n\t}\n\treturn text;\n}\n\nasync function assertOk(response: Response): Promise<void> {\n\tif (!response.ok) {\n\t\tconst text = await response.text();\n\t\tconst detail = extractGoogleDetail(text);\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_API_ERROR\",\n\t\t\t`Google Wallet API error (${response.status}): ${detail}`\n\t\t);\n\t}\n}\n\n// Ensure a Google Wallet class exists. Creates it if not found; no-ops if it already exists.\n// Class updates (template changes) are intentionally out of scope — use patchClass for that.\nexport async function ensureClass(\n\tclassType: string,\n\tclassId: string,\n\tclassBody: Record<string, unknown>,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<void> {\n\tconst existing = await walletRequest(\n\t\t\"GET\",\n\t\t`/${classType}/${classId}`,\n\t\tcredentials,\n\t\tprivateKey\n\t);\n\n\tif (existing.ok) {\n\t\tawait existing.body?.cancel();\n\t\treturn;\n\t}\n\n\tif (existing.status !== 404) {\n\t\tconst text = await existing.text();\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_API_ERROR\",\n\t\t\t`Google Wallet API error (${existing.status}): ${extractGoogleDetail(text)}`\n\t\t);\n\t}\n\n\tawait assertOk(\n\t\tawait walletRequest(\"POST\", `/${classType}`, credentials, privateKey, {\n\t\t\tid: classId,\n\t\t\t...classBody,\n\t\t})\n\t);\n}\n\nexport async function deleteObject(\n\tobjectType: string,\n\tobjectId: string,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<void> {\n\tconst response = await walletRequest(\n\t\t\"DELETE\",\n\t\t`/${objectType}/${objectId}`,\n\t\tcredentials,\n\t\tprivateKey\n\t);\n\t// 404 = already deleted — treat as success (idempotent)\n\tif (response.status === 404) {\n\t\tawait response.body?.cancel();\n\t\treturn;\n\t}\n\tawait assertOk(response);\n\tawait response.body?.cancel();\n}\n\nexport async function patchObject(\n\tobjectType: string,\n\tobjectId: string,\n\tpatch: Record<string, unknown>,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<void> {\n\tconst response = await walletRequest(\n\t\t\"PATCH\",\n\t\t`/${objectType}/${objectId}`,\n\t\tcredentials,\n\t\tprivateKey,\n\t\tpatch\n\t);\n\tawait assertOk(response);\n}\n","const GOOGLE_BARCODE_TYPE: Record<string, string> = {\n\tQR: \"QR_CODE\",\n\tPDF417: \"PDF_417\",\n\tAztec: \"AZTEC\",\n\tCode128: \"CODE_128\",\n};\n\nexport function toGoogleBarcodeType(format: string): string {\n\treturn GOOGLE_BARCODE_TYPE[format] ?? \"QR_CODE\";\n}\n\ninterface TranslatedValue {\n\tlanguage: string;\n\tvalue: string;\n}\n\ninterface LocalizedString {\n\tdefaultValue: TranslatedValue;\n\ttranslatedValues?: TranslatedValue[];\n}\n\n// Build a Google Wallet LocalizedString object.\n// Pass translatedValues to include additional language variants.\nexport function localized(\n\tvalue: string,\n\tlanguage = \"en-US\",\n\ttranslatedValues?: TranslatedValue[]\n): LocalizedString {\n\treturn {\n\t\tdefaultValue: { language, value },\n\t\ttranslatedValues: translatedValues?.length ? translatedValues : undefined,\n\t};\n}\n\n// Build the translatedValues array for a given key by scanning all locales.\n// Used to look up field key translations (labels) and key_value translations (static values).\nexport function translationsFor(\n\tkey: string,\n\tlocales: Record<string, Record<string, string>> | undefined\n): TranslatedValue[] | undefined {\n\tif (!locales) {\n\t\treturn undefined;\n\t}\n\tconst result = Object.entries(locales)\n\t\t.filter(([, t]) => t[key] !== undefined)\n\t\t.map(([lang, t]) => ({ language: lang, value: t[key] as string }));\n\treturn result.length > 0 ? result : undefined;\n}\n\n// Wrap a URL string as a Google Wallet ImageUri object.\nexport function imageUri(url: unknown): Record<string, unknown> | undefined {\n\treturn typeof url === \"string\" ? { sourceUri: { uri: url } } : undefined;\n}\n","import { WalletError } from \"../../errors\";\nimport type { GoogleCredentials } from \"../../types/credentials\";\nimport type { CreateConfig, FieldDef, PassConfig } from \"../../types/schemas\";\nimport { deleteObject, ensureClass, importGoogleKey, patchObject } from \"./api\";\nimport {\n\timageUri,\n\tlocalized,\n\ttoGoogleBarcodeType,\n\ttranslationsFor,\n} from \"./utils\";\n\n// Typed maps — pass.type is always one of these keys so access is always string (not string | undefined)\ntype PassType = PassConfig[\"type\"];\n\n// Google Wallet class type per pass type\nconst CLASS_TYPE: Record<PassType, string> = {\n\tloyalty: \"loyaltyClass\",\n\tevent: \"eventTicketClass\",\n\tflight: \"flightClass\",\n\tcoupon: \"offerClass\",\n\tgiftCard: \"giftCardClass\",\n\tgeneric: \"genericClass\",\n};\n\n// Google Wallet object type per pass type\nconst OBJECT_TYPE: Record<PassType, string> = {\n\tloyalty: \"loyaltyObject\",\n\tevent: \"eventTicketObject\",\n\tflight: \"flightObject\",\n\tcoupon: \"offerObject\",\n\tgiftCard: \"giftCardObject\",\n\tgeneric: \"genericObject\",\n};\n\nfunction validateGoogleRequirements(pass: PassConfig): void {\n\t// Google logo must be a URL (not bytes — Google can't accept binary uploads directly)\n\tif (pass.logo !== undefined && pass.logo instanceof Uint8Array) {\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_MISSING_LOGO\",\n\t\t\t\"Google Wallet logo must be a URL string, not bytes\"\n\t\t);\n\t}\n\tif (pass.type === \"flight\") {\n\t\tconst { carrier, flightNumber, origin, destination } = pass;\n\t\tif (!(carrier && flightNumber && origin && destination)) {\n\t\t\tthrow new WalletError(\n\t\t\t\t\"GOOGLE_FLIGHT_MISSING_CLASS_FIELDS\",\n\t\t\t\t\"Flight passes require carrier, flightNumber, origin, and destination\"\n\t\t\t);\n\t\t}\n\t}\n}\n\n// Build textModulesData from fields not in excluded slots\nfunction buildTextModules(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>,\n\texcludeSlots: FieldDef[\"slot\"][]\n): Array<{ header: string; body: string; id: string }> {\n\tconst modules: Array<{ header: string; body: string; id: string }> = [];\n\tfor (const f of fields) {\n\t\tif (excludeSlots.includes(f.slot)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = f.key in values ? values[f.key] : f.value;\n\t\tif (value === null || value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tmodules.push({ header: f.label, body: value, id: f.key });\n\t}\n\treturn modules;\n}\n\n// Build infoModuleData from back fields\nfunction buildInfoModuleData(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n):\n\t| {\n\t\t\tlabelValueRows: Array<{\n\t\t\t\tcolumns: Array<{ label: string; value: string }>;\n\t\t\t}>;\n\t }\n\t| undefined {\n\tconst rows: Array<{ label: string; value: string }> = [];\n\tfor (const f of fields) {\n\t\tif (f.slot !== \"back\") {\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = f.key in values ? values[f.key] : f.value;\n\t\tif (value === null || value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\trows.push({ label: f.label, value });\n\t}\n\tif (rows.length === 0) {\n\t\treturn undefined;\n\t}\n\treturn { labelValueRows: rows.map((r) => ({ columns: [r] })) };\n}\n\n// Per-type class name fields\nfunction buildClassTypeFields(\n\tpass: PassConfig,\n\tlocales: PassConfig[\"locales\"]\n): Record<string, unknown> {\n\tconst nameTranslations = translationsFor(\"name\", locales);\n\tif (pass.type === \"loyalty\") {\n\t\treturn { programName: pass.name };\n\t}\n\tif (pass.type === \"event\") {\n\t\treturn {\n\t\t\teventName: localized(pass.name, \"en-US\", nameTranslations),\n\t\t\tlocalScheduledStartDateTime: pass.startsAt?.replace(\"Z\", \"\"),\n\t\t\tlocalScheduledEndDateTime: pass.endsAt?.replace(\"Z\", \"\"),\n\t\t};\n\t}\n\tif (pass.type === \"flight\") {\n\t\treturn {\n\t\t\t// flightClass represents a single flight — departure time is class-level\n\t\t\tflightHeader: {\n\t\t\t\tcarrier: { carrierIataCode: pass.carrier },\n\t\t\t\tflightNumber: pass.flightNumber,\n\t\t\t\toperatingCarrier: { carrierIataCode: pass.carrier },\n\t\t\t\toperatingFlightNumber: pass.flightNumber,\n\t\t\t},\n\t\t\tlocalScheduledDepartureDateTime: pass.departure?.replace(\"Z\", \"\"),\n\t\t\torigin: pass.origin ? { airportIataCode: pass.origin } : undefined,\n\t\t\tdestination: pass.destination\n\t\t\t\t? {\n\t\t\t\t\t\tairportIataCode: pass.destination,\n\t\t\t\t\t\tlocalScheduledArrivalDateTime: pass.arrival?.replace(\"Z\", \"\"),\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t};\n\t}\n\tif (pass.type === \"coupon\") {\n\t\treturn {\n\t\t\ttitle: pass.name,\n\t\t\t// provider is required by Google offerClass — defaults to the pass name\n\t\t\tprovider: pass.name,\n\t\t\tredemptionChannel: pass.redemptionChannel.toUpperCase(),\n\t\t};\n\t}\n\t// giftCard + generic\n\treturn { cardTitle: localized(pass.name, \"en-US\", nameTranslations) };\n}\n\n// Build a Google Wallet AppLinkInfo sub-object from our simplified schema shape.\nfunction buildAppLinkInfo(info: {\n\turi: string;\n\ttitle?: string;\n\tdescription?: string;\n\tlogoUrl?: string;\n}): Record<string, unknown> {\n\treturn {\n\t\tappLogoImage: imageUri(info.logoUrl),\n\t\ttitle: info.title ? localized(info.title) : undefined,\n\t\tdescription: info.description ? localized(info.description) : undefined,\n\t\tappTarget: { targetUri: { uri: info.uri } },\n\t};\n}\n\nfunction buildAppLinkData(d: {\n\tandroid?: {\n\t\turi: string;\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tlogoUrl?: string;\n\t};\n\tios?: { uri: string; title?: string; description?: string; logoUrl?: string };\n\tweb?: { uri: string; title?: string; description?: string; logoUrl?: string };\n}): Record<string, unknown> {\n\treturn {\n\t\tandroidAppLinkInfo: d.android ? buildAppLinkInfo(d.android) : undefined,\n\t\tiosAppLinkInfo: d.ios ? buildAppLinkInfo(d.ios) : undefined,\n\t\twebAppLinkInfo: d.web ? buildAppLinkInfo(d.web) : undefined,\n\t};\n}\n\n// Build the class body — defines the pass template (shared across all recipients)\nfunction buildClassBody(pass: PassConfig): Record<string, unknown> {\n\tconst logo = imageUri(pass.logo);\n\tconst wideLogo = imageUri(pass.google?.wideLogo);\n\tconst hero = imageUri(\n\t\ttypeof pass.banner === \"string\" ? pass.banner : undefined\n\t);\n\n\tconst body: Record<string, unknown> = {\n\t\t...buildClassTypeFields(pass, pass.locales),\n\t\thexBackgroundColor: pass.color,\n\t\tissuerName: pass.google?.issuerName ?? pass.name,\n\t};\n\n\t// loyalty uses programLogo; all other types use logo\n\tif (pass.type === \"loyalty\") {\n\t\tif (logo) {\n\t\t\tbody.programLogo = logo;\n\t\t}\n\t} else if (logo) {\n\t\tbody.logo = logo;\n\t}\n\tif (wideLogo) {\n\t\tbody.wideProgramBanner = wideLogo;\n\t}\n\tif (hero) {\n\t\tbody.heroImage = hero;\n\t}\n\t// Required for loyalty, event, flight, coupon, giftCard classes. Ignored by genericClass.\n\tif (pass.type !== \"generic\") {\n\t\tbody.reviewStatus = pass.google?.reviewStatus ?? \"UNDER_REVIEW\";\n\t}\n\tif (pass.google?.enableSmartTap) {\n\t\tbody.enableSmartTap = pass.google.enableSmartTap;\n\t}\n\tif (pass.google?.redemptionIssuers) {\n\t\tbody.redemptionIssuers = pass.google.redemptionIssuers;\n\t}\n\tif (pass.google?.messages) {\n\t\tbody.messages = pass.google.messages;\n\t}\n\tif (pass.google?.appLinkData) {\n\t\tbody.appLinkData = buildAppLinkData(pass.google.appLinkData);\n\t}\n\tif (pass.locations?.length) {\n\t\tbody.locations = pass.locations.map(({ latitude, longitude }) => ({\n\t\t\tlatitude,\n\t\t\tlongitude,\n\t\t}));\n\t}\n\n\treturn body;\n}\n\n// Loyalty: map well-known field keys to structured loyalty fields\nfunction buildLoyaltyObjectFields(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n): Record<string, unknown> {\n\tconst resolve = (key: string) =>\n\t\tvalues[key] ?? fields.find((f) => f.key === key)?.value;\n\tconst points = resolve(\"points\");\n\tconst member = resolve(\"member\");\n\tconst memberId = resolve(\"memberId\");\n\treturn {\n\t\tloyaltyPoints: points == null ? undefined : { balance: { string: points } },\n\t\taccountName: member ?? undefined,\n\t\taccountId: memberId ?? undefined,\n\t};\n}\n\n// Flight: structured boarding data required by Google flightObject\nfunction buildFlightObjectFields(\n\t_pass: Extract<PassConfig, { type: \"flight\" }>,\n\tserialNumber: string,\n\tvalues: Record<string, string | null>,\n\twarnings: string[]\n): Record<string, unknown> {\n\tconst passengerName = values.passengerName;\n\tif (!passengerName) {\n\t\twarnings.push(\n\t\t\t\"Google flight pass: passengerName not set in values — passenger name will be blank\"\n\t\t);\n\t}\n\treturn {\n\t\tpassengerName: passengerName ?? \"\",\n\t\treservationInfo: { confirmationCode: serialNumber },\n\t};\n}\n\n// GiftCard: balance amount with currency\nfunction buildGiftCardObjectFields(\n\tpass: Extract<PassConfig, { type: \"giftCard\" }>,\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n): Record<string, unknown> {\n\tconst raw = values.balance ?? fields.find((f) => f.key === \"balance\")?.value;\n\treturn {\n\t\tbalance:\n\t\t\traw == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tmicros: String(Math.round(Number.parseFloat(raw) * 1_000_000)),\n\t\t\t\t\t\tcurrencyCode: pass.currency ?? \"USD\",\n\t\t\t\t\t},\n\t};\n}\n\n// Display fields: primary → subheader+header, others → textModulesData, back → infoModuleData\nfunction buildDisplayFields(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>,\n\tlocales: PassConfig[\"locales\"]\n): Record<string, unknown> {\n\tconst primaryField = fields.find((f) => f.slot === \"primary\");\n\tconst primaryValue =\n\t\tprimaryField &&\n\t\t(primaryField.key in values\n\t\t\t? values[primaryField.key]\n\t\t\t: primaryField.value);\n\n\tconst textModules = buildTextModules(fields, values, [\"primary\", \"back\"]);\n\n\treturn {\n\t\tsubheader:\n\t\t\tprimaryField && primaryValue != null\n\t\t\t\t? localized(\n\t\t\t\t\t\tprimaryField.label,\n\t\t\t\t\t\t\"en-US\",\n\t\t\t\t\t\ttranslationsFor(primaryField.key, locales)\n\t\t\t\t\t)\n\t\t\t\t: undefined,\n\t\theader:\n\t\t\tprimaryField && primaryValue != null\n\t\t\t\t? localized(\n\t\t\t\t\t\tprimaryValue,\n\t\t\t\t\t\t\"en-US\",\n\t\t\t\t\t\ttranslationsFor(`${primaryField.key}_value`, locales)\n\t\t\t\t\t)\n\t\t\t\t: undefined,\n\t\ttextModulesData: textModules.length > 0 ? textModules : undefined,\n\t\tinfoModuleData: buildInfoModuleData(fields, values),\n\t};\n}\n\n// Build the object body — per-recipient data\nfunction buildObjectBody(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tclassId: string,\n\tobjectId: string,\n\twarnings: string[]\n): Record<string, unknown> {\n\tconst values = createConfig.values ?? {};\n\tconst fields = pass.fields;\n\n\treturn {\n\t\tid: objectId,\n\t\tclassId,\n\t\tstate: \"ACTIVE\",\n\t\tbarcode: createConfig.barcode\n\t\t\t? {\n\t\t\t\t\ttype: toGoogleBarcodeType(createConfig.barcode.format),\n\t\t\t\t\tvalue: createConfig.barcode.value,\n\t\t\t\t\talternateText:\n\t\t\t\t\t\tcreateConfig.barcode.altText ?? createConfig.barcode.value,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tvalidTimeInterval:\n\t\t\tcreateConfig.validFrom || createConfig.expiresAt\n\t\t\t\t? {\n\t\t\t\t\t\tstart: createConfig.validFrom\n\t\t\t\t\t\t\t? { date: createConfig.validFrom }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tend: createConfig.expiresAt\n\t\t\t\t\t\t\t? { date: createConfig.expiresAt }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t// Smart Tap: per-recipient redemption value sent to NFC terminals\n\t\tsmartTapRedemptionValue: createConfig.google?.smartTapRedemptionValue,\n\t\t// Rotating barcode replaces the static barcode when set\n\t\trotatingBarcode: createConfig.google?.rotatingBarcode,\n\t\t// Per-recipient messages\n\t\tmessages: createConfig.google?.messages,\n\t\t...(pass.type === \"loyalty\" && buildLoyaltyObjectFields(fields, values)),\n\t\t...(pass.type === \"flight\" &&\n\t\t\tbuildFlightObjectFields(\n\t\t\t\tpass,\n\t\t\t\tcreateConfig.serialNumber,\n\t\t\t\tvalues,\n\t\t\t\twarnings\n\t\t\t)),\n\t\t...(pass.type === \"giftCard\" &&\n\t\t\tbuildGiftCardObjectFields(pass, fields, values)),\n\t\t// genericObject requires cardTitle in the object body (in addition to the class)\n\t\t...(pass.type === \"generic\" && {\n\t\t\tcardTitle: localized(\n\t\t\t\tpass.name,\n\t\t\t\t\"en-US\",\n\t\t\t\ttranslationsFor(\"name\", pass.locales)\n\t\t\t),\n\t\t}),\n\t\t...buildDisplayFields(fields, values, pass.locales),\n\t};\n}\n\nexport async function generateGooglePass(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: GoogleCredentials\n): Promise<{ pass: string | null; warnings: string[] }> {\n\tconst warnings: string[] = [];\n\n\tvalidateGoogleRequirements(pass);\n\n\tconst privateKey = await importGoogleKey(credentials);\n\n\tconst classType = CLASS_TYPE[pass.type];\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst classId = `${credentials.issuerId}.${pass.id}`;\n\tconst objectId = `${credentials.issuerId}.${createConfig.serialNumber}`;\n\n\tconst classBody = buildClassBody(pass);\n\tawait ensureClass(classType, classId, classBody, credentials, privateKey);\n\n\tconst objectBody = buildObjectBody(\n\t\tpass,\n\t\tcreateConfig,\n\t\tclassId,\n\t\tobjectId,\n\t\twarnings\n\t);\n\n\t// Pluralise the object type key for the JWT payload (e.g. \"loyaltyObject\" → \"loyaltyObjects\")\n\tconst objectsKey = objectType.replace(\"Object\", \"Objects\");\n\n\tconst payload = {\n\t\tiss: credentials.clientEmail,\n\t\taud: \"google\",\n\t\ttyp: \"savetowallet\",\n\t\tiat: Math.floor(Date.now() / 1000),\n\t\tpayload: {\n\t\t\t[objectsKey]: [objectBody],\n\t\t},\n\t};\n\n\t// Sign the \"Add to Google Wallet\" JWT with the service account key\n\tconst { SignJWT } = await import(\"jose\");\n\tconst jwt = await new SignJWT(payload)\n\t\t.setProtectedHeader({ alg: \"RS256\" })\n\t\t.sign(privateKey);\n\n\treturn { pass: jwt, warnings };\n}\n\nexport async function updateGooglePass(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: GoogleCredentials\n): Promise<void> {\n\tconst privateKey = await importGoogleKey(credentials);\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst classId = `${credentials.issuerId}.${pass.id}`;\n\tconst objectId = `${credentials.issuerId}.${createConfig.serialNumber}`;\n\n\tconst patch = buildObjectBody(pass, createConfig, classId, objectId, []);\n\n\tawait patchObject(objectType, objectId, patch, credentials, privateKey);\n}\n\nexport async function deleteGooglePass(\n\tpass: PassConfig,\n\tserialNumber: string,\n\tcredentials: GoogleCredentials\n): Promise<void> {\n\tconst privateKey = await importGoogleKey(credentials);\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst objectId = `${credentials.issuerId}.${serialNumber}`;\n\n\tawait deleteObject(objectType, objectId, credentials, privateKey);\n}\n\nexport async function expireGooglePass(\n\tpass: PassConfig,\n\tserialNumber: string,\n\tcredentials: GoogleCredentials\n): Promise<void> {\n\tconst privateKey = await importGoogleKey(credentials);\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst objectId = `${credentials.issuerId}.${serialNumber}`;\n\n\tawait patchObject(\n\t\tobjectType,\n\t\tobjectId,\n\t\t{ state: \"EXPIRED\" },\n\t\tcredentials,\n\t\tprivateKey\n\t);\n}\n","import { z } from \"zod\";\n\n// Primitives\n\nconst hexColor = z\n\t.string()\n\t.regex(/^#[0-9a-fA-F]{6}$/, 'must be a 6-digit hex color like \"#1a1a1a\"')\n\t.optional();\n\n// BCP 47 language tag: primary subtag (2-3 lowercase letters) followed by optional subtags.\n// Examples: \"en\", \"en-US\", \"zh-Hans\", \"zh-Hans-CN\", \"es-419\"\nconst BCP47_RE = /^[a-z]{2,3}(-[A-Za-z0-9]+)*$/;\nconst localeCodeSchema = z\n\t.string()\n\t.regex(\n\t\tBCP47_RE,\n\t\t'must be a BCP 47 language tag (e.g. \"en-US\", \"es\", \"zh-Hans\")'\n\t);\n\nconst imageValue = z.union([\n\tz.url(),\n\tz.custom<Uint8Array>((v) => v instanceof Uint8Array),\n]);\n\n// An image can be a single source or an object with resolution variants.\n// base is required when using the object form; retina (@2x) and superRetina (@3x) are optional.\nconst imageSet = z\n\t.union([\n\t\timageValue,\n\t\tz.object({\n\t\t\tbase: imageValue,\n\t\t\tretina: imageValue.optional(),\n\t\t\tsuperRetina: imageValue.optional(),\n\t\t}),\n\t])\n\t.optional();\n\n// Field formatting options\n\nexport const dateStyleSchema = z.enum([\n\t\"none\",\n\t\"short\",\n\t\"medium\",\n\t\"long\",\n\t\"full\",\n]);\nexport const numberStyleSchema = z.enum([\n\t\"decimal\",\n\t\"percent\",\n\t\"scientific\",\n\t\"spellOut\",\n]);\nexport const textAlignmentSchema = z.enum([\n\t\"left\",\n\t\"center\",\n\t\"right\",\n\t\"natural\",\n]);\n\n// FieldDef — a single display field on a pass.\n// slot maps to Apple's field areas; Google uses primary → subheader+header, rest → textModulesData.\nexport const fieldDefSchema = z.object({\n\t// Apple: headerFields / primaryFields / secondaryFields / auxiliaryFields / backFields\n\t// Google: primary → subheader (label) + header (value), others → textModulesData\n\tslot: z.enum([\"header\", \"primary\", \"secondary\", \"auxiliary\", \"back\"]),\n\tkey: z.string(),\n\tlabel: z.string(),\n\tvalue: z.string().optional(),\n\tchangeMessage: z.string().optional(),\n\tdateStyle: dateStyleSchema.optional(),\n\ttimeStyle: dateStyleSchema.optional(),\n\tnumberStyle: numberStyleSchema.optional(),\n\tcurrencyCode: z.string().optional(),\n\ttextAlignment: textAlignmentSchema.optional(),\n\trow: z.union([z.literal(0), z.literal(1)]).optional(),\n});\n\n// Barcode\n// Google supports AZTEC, CODE_39, CODE_128, CODABAR, DATA_MATRIX, EAN_8, EAN_13, ITF_14, PDF_417, QR_CODE, UPC_A and TEXT_ONLY barcodes. Apple only supports PKBarcodeFormatQR, PKBarcodeFormatPDF417, PKBarcodeFormatAztec, and PKBarcodeFormatCode128 formats, but we exclude that since it's not widely supported by barcode scanners.\nexport const barcodeFormatSchema = z.enum([\"QR\", \"PDF417\", \"Aztec\", \"Code128\"]);\n\nexport const barcodeSchema = z.object({\n\tformat: barcodeFormatSchema.default(\"QR\"),\n\tvalue: z.string().min(1, \"barcode.value must not be empty\"),\n\taltText: z.string().optional(),\n});\n\n// Apple-specific options — no cross-platform equivalent\n\n// Bluetooth Low Energy beacon — shows the pass on lock screen when nearby\nconst beaconSchema = z.object({\n\t// Required: device UUID of the Bluetooth Low Energy beacon\n\tproximityUUID: z.uuid(),\n\t// 16-bit major value to narrow the region of the beacon\n\tmajor: z.number().int().min(0).max(65_535).optional(),\n\t// 16-bit minor value to further narrow the region of the beacon\n\tminor: z.number().int().min(0).max(65_535).optional(),\n\t// Text shown on lock screen when the pass becomes relevant near this beacon\n\trelevantText: z.string().optional(),\n});\n\n// Date interval for relevantDates (replaces the deprecated relevantDate)\nconst relevantDateSchema = z.object({\n\tstartDate: z.iso.datetime({\n\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T20:00:00Z\"',\n\t}),\n\tendDate: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T23:00:00Z\"',\n\t\t})\n\t\t.optional(),\n});\n\n// Base Apple options — applicable to all pass types\nconst appleOptionsSchema = z.object({\n\t// Required by Apple Wallet — validated at create() time\n\ticon: imageSet,\n\t// Apple-only image slots\n\tbackground: imageSet,\n\tthumbnail: imageSet,\n\tfooter: imageSet,\n\t// Apple: description (shown in Wallet list view, defaults to pass name)\n\tdescription: z.string().optional(),\n\t// Apple: logoText (text shown next to the logo, not for poster event tickets)\n\tlogoText: z.string().optional(),\n\t// Apple: foregroundColor (text color), labelColor (label text color)\n\tforegroundColor: hexColor,\n\tlabelColor: hexColor,\n\t// Deprecated — use relevantDates instead\n\trelevantDate: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T20:00:00Z\"',\n\t\t})\n\t\t.optional(),\n\t// Date intervals during which the pass is relevant (replaces relevantDate)\n\trelevantDates: z.array(relevantDateSchema).optional(),\n\t// Groups passes of the same type into a single stack in Wallet\n\tgroupingIdentifier: z.string().optional(),\n\t// Disables the glossy shine effect rendered over strip images\n\tsuppressStripShine: z.boolean().optional(),\n\t// NFC payload — message is passed to the contactless reader on tap\n\tnfc: z\n\t\t.object({\n\t\t\tmessage: z.string(),\n\t\t\t// Public key used to encrypt the NFC payload (Base64-encoded X.509)\n\t\t\tencryptionPublicKey: z.string().optional(),\n\t\t})\n\t\t.optional(),\n\t// Deep link opened when the user taps \"Open\" on the pass (requires associatedStoreIdentifiers)\n\tappLaunchURL: z.url().optional(),\n\t// App Store app IDs — adds an \"Open\" button that launches your app from Wallet\n\tassociatedStoreIdentifiers: z.array(z.number().int().positive()).optional(),\n\t// Maximum distance in meters from a location at which the pass is shown\n\tmaxDistance: z.number().positive().optional(),\n\t// Removes the Share button from the back of the pass\n\tsharingProhibited: z.boolean().optional(),\n\t// Arbitrary JSON passed to your companion app via NFC or URL — not shown to users\n\tuserInfo: z.record(z.string(), z.unknown()).optional(),\n\t// URL for a web service that receives push update notifications for this pass\n\twebServiceURL: z.url().optional(),\n\t// Authentication token sent with web service requests (required with webServiceURL)\n\tauthenticationToken: z.string().min(16).optional(),\n\t// Bluetooth LE beacons that trigger lock screen relevance\n\tbeacons: z.array(beaconSchema).optional(),\n});\n\n// Event-specific Apple options — includes poster event ticket fields\nconst appleEventOptionsSchema = appleOptionsSchema.extend({\n\t// Text next to the logo on poster event tickets (use logoText for standard event tickets)\n\teventLogoText: z.string().optional(),\n\t// Background color for the footer bar on poster event tickets\n\tfooterBackgroundColor: hexColor,\n\t// Disables the header darkening gradient on poster event tickets\n\tsuppressHeaderDarkening: z.boolean().optional(),\n\t// Derives foreground and label colors from the background image (poster event tickets only)\n\tuseAutomaticColors: z.boolean().optional(),\n\t// Schemes to validate the pass against (falls back to designed type if all fail)\n\tpreferredStyleSchemes: z.array(z.string()).optional(),\n\t// Additional App Store app IDs shown in the event guide (poster event tickets only)\n\tauxiliaryStoreIdentifiers: z.array(z.number().int().positive()).optional(),\n\t// Poster event ticket action URLs\n\taccessibilityURL: z.url().optional(),\n\taddOnURL: z.url().optional(),\n\tbagPolicyURL: z.url().optional(),\n\tcontactVenueEmail: z.email().optional(),\n\tcontactVenuePhoneNumber: z.string().optional(),\n\tcontactVenueWebsite: z.url().optional(),\n\tdirectionsInformationURL: z.url().optional(),\n\tmerchandiseURL: z.url().optional(),\n\torderFoodURL: z.url().optional(),\n\tparkingInformationURL: z.url().optional(),\n\tpurchaseParkingURL: z.url().optional(),\n\tsellURL: z.url().optional(),\n\ttransferURL: z.url().optional(),\n\ttransitInformationURL: z.url().optional(),\n});\n\n// Flight-specific Apple options — boarding pass action URLs\nconst appleFlightOptionsSchema = appleOptionsSchema.extend({\n\tchangeSeatURL: z.url().optional(),\n\tentertainmentURL: z.url().optional(),\n\tmanagementURL: z.url().optional(),\n\tpurchaseAdditionalBaggageURL: z.url().optional(),\n\tpurchaseLoungeAccessURL: z.url().optional(),\n\tpurchaseWifiURL: z.url().optional(),\n\tregisterServiceAnimalURL: z.url().optional(),\n\treportLostBagURL: z.url().optional(),\n\trequestWheelchairURL: z.url().optional(),\n\ttrackBagsURL: z.url().optional(),\n\ttransitProviderEmail: z.email().optional(),\n\ttransitProviderPhoneNumber: z.string().optional(),\n\ttransitProviderWebsiteURL: z.url().optional(),\n\tupgradeURL: z.url().optional(),\n});\n\n// Google-specific sub-schemas\n\n// Info message shown inside the pass view (e.g. alerts, promotions, expiry warnings).\n// Class-level messages appear for all holders; object-level messages are per-recipient.\nconst googleMessageSchema = z.object({\n\theader: z.string(),\n\tbody: z.string(),\n\tid: z.string().optional(),\n\t// TEXT (default), expireNotification, or TEXT_AND_NOTIFY (push + in-app)\n\tmessageType: z\n\t\t.enum([\"TEXT\", \"expireNotification\", \"TEXT_AND_NOTIFY\"])\n\t\t.default(\"TEXT\"),\n\tdisplayInterval: z\n\t\t.object({\n\t\t\tstart: z.object({ date: z.iso.datetime() }).optional(),\n\t\t\tend: z.object({ date: z.iso.datetime() }).optional(),\n\t\t})\n\t\t.optional(),\n});\n\n// TOTP-based rotating barcode — generates a new barcode value every periodMillis ms.\n// valuePattern uses {totp_value_hex} or {totp_value_decimal} as the rotating placeholder.\nconst googleRotatingBarcodeSchema = z.object({\n\ttype: z.enum([\"QR_CODE\", \"PDF_417\", \"AZTEC\", \"CODE_128\"]).default(\"QR_CODE\"),\n\t// Pattern containing the TOTP placeholder, e.g. \"https://example.com/redeem/{totp_value_hex}\"\n\tvaluePattern: z\n\t\t.string()\n\t\t.min(1, \"rotatingBarcode.valuePattern must not be empty\"),\n\ttotpDetails: z.object({\n\t\tperiodMillis: z.string().default(\"30000\"),\n\t\talgorithm: z.literal(\"TOTP_SHA1\").default(\"TOTP_SHA1\"),\n\t\tparameters: z.array(\n\t\t\tz.object({\n\t\t\t\tkey: z.string(),\n\t\t\t\tvalueLength: z.number().int().min(1).max(8),\n\t\t\t})\n\t\t),\n\t}),\n\trenderEncoding: z.literal(\"UTF_8\").optional(),\n});\n\n// App deep link shown on the pass — supports Android, iOS, and web targets.\nconst googleAppLinkInfoSchema = z.object({\n\t// Deep link URI (e.g. intent:// for Android, https:// scheme for iOS universal links)\n\turi: z.url(),\n\ttitle: z.string().optional(),\n\tdescription: z.string().optional(),\n\tlogoUrl: z.url().optional(),\n});\n\nconst googleAppLinkDataSchema = z.object({\n\tandroid: googleAppLinkInfoSchema.optional(),\n\tios: googleAppLinkInfoSchema.optional(),\n\tweb: googleAppLinkInfoSchema.optional(),\n});\n\n// Google-specific options — no cross-platform equivalent\n\nconst googleOptionsSchema = z.object({\n\t// Google: wideLogo — wider variant of the logo shown on some pass layouts\n\twideLogo: z.url().optional(),\n\t// Google: issuerName — displayed as the pass issuer\n\tissuerName: z.string().optional(),\n\t// Required by Google for loyalty, event, flight, coupon, and giftCard classes.\n\t// \"UNDER_REVIEW\" is the default for new classes; set to \"APPROVED\" once approved in the console.\n\treviewStatus: z\n\t\t.enum([\"UNDER_REVIEW\", \"APPROVED\", \"REJECTED\", \"DRAFT\"])\n\t\t.default(\"UNDER_REVIEW\"),\n\t// Smart Tap NFC — enable tap-to-redeem at supported terminals\n\tenableSmartTap: z.boolean().optional(),\n\t// Smart Tap issuer IDs allowed to redeem this pass (required when enableSmartTap is true)\n\tredemptionIssuers: z.array(z.string()).optional(),\n\t// Class-level info messages shown inside the pass view for all holders\n\tmessages: z.array(googleMessageSchema).optional(),\n\t// App link shown on the pass to open a companion app\n\tappLinkData: googleAppLinkDataSchema.optional(),\n});\n\n// Location — geo-relevance for lock screen suggestions.\n// Apple: locations[] with longitude, latitude, altitude?, relevantText?\n// Google: locations[] with latitude, longitude (altitude and relevantText ignored)\nexport const locationSchema = z.object({\n\tlatitude: z.number(),\n\tlongitude: z.number(),\n\t// Apple: altitude in meters above sea level (optional)\n\taltitude: z.number().optional(),\n\t// Apple: text shown on lock screen when the pass becomes relevant near this location\n\t// Google: no equivalent — ignored\n\trelevantText: z.string().optional(),\n});\n\n// Base pass config — shared across all pass types\n\nconst basePassSchema = z.object({\n\t// Apple: description (pass name shown in Wallet list)\n\t// Google: cardTitle\n\tid: z.string().min(1, \"PassConfig missing: id\"),\n\tname: z.string().min(1, \"PassConfig missing: name\"),\n\n\t// Apple: backgroundColor\n\t// Google: hexBackgroundColor\n\tcolor: hexColor,\n\n\t// Shared logo image.\n\t// Apple: logo (accepts bytes or URL)\n\t// Google: logo (URL only — validated at create() time)\n\tlogo: imageSet,\n\n\t// Shared banner image — same visual purpose, different placement per platform.\n\t// Apple: strip (shown behind the fields, top of pass)\n\t// Google: hero (shown at the bottom of the pass)\n\tbanner: imageSet,\n\n\t// Geo-relevance — show pass on lock screen when near these coordinates.\n\t// Apple: locations[] — up to 10 entries\n\t// Google: locations[] — up to 20 entries\n\tlocations: z.array(locationSchema).optional(),\n\n\t// Display fields — use field.primary(), field.secondary(), etc.\n\t// Apple: maps to headerFields / primaryFields / secondaryFields / auxiliaryFields / backFields\n\t// Google: primary → subheader + header, all others → textModulesData\n\tfields: z.array(fieldDefSchema).default([]),\n\n\t// Translations for field labels and pass-level strings.\n\t// Keys are field keys (matching field.key) or the reserved key \"name\" for the pass title.\n\t// Use \"fieldKey_value\" to translate a field's static default value.\n\t// Apple: generates {language}.lproj/pass.strings files in the .pkpass zip.\n\t// Google: adds translatedValues to LocalizedString objects.\n\tlocales: z\n\t\t.record(localeCodeSchema, z.record(z.string(), z.string()))\n\t\t.optional(),\n\n\tapple: appleOptionsSchema.optional(),\n\tgoogle: googleOptionsSchema.optional(),\n});\n\n// Per-type pass configs\n// Each type adds structured properties that providers need beyond display fields.\n\nexport const loyaltyPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"loyalty\"),\n\t// No extra structured props — Google maps field keys by convention:\n\t// \"points\" → loyaltyPoints, \"member\" → accountName, \"memberId\" → accountId\n});\n\nexport const eventPassSchema = basePassSchema\n\t.extend({\n\t\ttype: z.literal(\"event\"),\n\t\t// Apple: relevant date for lock screen suggestion\n\t\t// Google: localScheduledStartDateTime (required for eventTicketClass)\n\t\tstartsAt: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T20:00:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t\tendsAt: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T23:00:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t})\n\t.extend({ apple: appleEventOptionsSchema.optional() });\n\n// Flight covers air, train, bus, and boat boarding passes.\nexport const flightPassSchema = basePassSchema\n\t.extend({\n\t\ttype: z.literal(\"flight\"),\n\t\t// Apple: transitType (required for boardingPass layout, defaults to \"air\")\n\t\t// Google: inferred from flightHeader\n\t\ttransitType: z.enum([\"air\", \"train\", \"bus\", \"boat\"]).optional(),\n\t\t// Required by Google flightClass — IATA codes and datetimes\n\t\t// Apple: shown as display fields; provider maps these to the correct slots\n\t\tcarrier: z\n\t\t\t.string()\n\t\t\t.regex(\n\t\t\t\t/^[A-Z0-9]{2}$/,\n\t\t\t\t'must be a 2-character IATA carrier code e.g. \"AA\"'\n\t\t\t)\n\t\t\t.optional(),\n\t\tflightNumber: z\n\t\t\t.string()\n\t\t\t.regex(/^\\d{1,4}[A-Z]?$/, 'must be a flight number e.g. \"100\" or \"1234A\"')\n\t\t\t.optional(),\n\t\torigin: z\n\t\t\t.string()\n\t\t\t.regex(/^[A-Z]{3}$/, 'must be a 3-letter IATA airport code e.g. \"JFK\"')\n\t\t\t.optional(),\n\t\tdestination: z\n\t\t\t.string()\n\t\t\t.regex(/^[A-Z]{3}$/, 'must be a 3-letter IATA airport code e.g. \"LAX\"')\n\t\t\t.optional(),\n\t\tdeparture: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T08:00:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t\tarrival: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T11:30:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t\t// passengerName is per-recipient — pass in values at create() time\n\t})\n\t.extend({ apple: appleFlightOptionsSchema.optional() });\n\nexport const couponPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"coupon\"),\n\t// Google: redemptionChannel (required for offerClass)\n\t// Apple: no equivalent — ignored\n\t// Defaults to \"both\" — Google requires this field for offerClass\n\tredemptionChannel: z.enum([\"online\", \"instore\", \"both\"]).default(\"both\"),\n});\n\nexport const giftCardPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"giftCard\"),\n\t// Google: balance.currencyCode (needed to format the balance amount)\n\t// Apple: use currencyCode on the balance field definition instead\n\tcurrency: z\n\t\t.string()\n\t\t.regex(/^[A-Z]{3}$/, 'must be a 3-letter ISO 4217 currency code e.g. \"USD\"')\n\t\t.optional(),\n});\n\nexport const genericPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"generic\"),\n\t// No extra structured props — full control via fields\n});\n\n// Discriminated union — the full PassConfig type\n\nexport const passConfigSchema = z.discriminatedUnion(\"type\", [\n\tloyaltyPassSchema,\n\teventPassSchema,\n\tflightPassSchema,\n\tcouponPassSchema,\n\tgiftCardPassSchema,\n\tgenericPassSchema,\n]);\n\n// Create config — per-recipient values supplied at issue time\n\nexport const createConfigSchema = z.object({\n\tserialNumber: z.string().min(1, \"CreateConfig missing: serialNumber\"),\n\tbarcode: barcodeSchema.optional(),\n\t// Apple: no equivalent — ignored\n\t// Google: validTimeInterval.start\n\tvalidFrom: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-01-01T00:00:00Z\"',\n\t\t})\n\t\t.optional(),\n\texpiresAt: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2025-01-01T00:00:00Z\"',\n\t\t})\n\t\t.optional(),\n\t// Per-recipient field values. null hides the field for this recipient.\n\tvalues: z.record(z.string(), z.string().nullable()).optional(),\n\t// Apple-specific per-recipient options.\n\tapple: z\n\t\t.object({\n\t\t\t// Mark this issued pass as void. Displays a \"Void\" banner on the pass.\n\t\t\t// For Google, use pass.expire() instead — it transitions state via the API.\n\t\t\tvoided: z.boolean().optional(),\n\t\t})\n\t\t.optional(),\n\t// Google-specific per-recipient options.\n\tgoogle: z\n\t\t.object({\n\t\t\t// Smart Tap NFC value for this specific pass holder (required when enableSmartTap is true)\n\t\t\tsmartTapRedemptionValue: z.string().optional(),\n\t\t\t// TOTP rotating barcode — replaces the static barcode for this pass holder\n\t\t\trotatingBarcode: googleRotatingBarcodeSchema.optional(),\n\t\t\t// Per-recipient info messages shown inside the pass view\n\t\t\tmessages: z.array(googleMessageSchema).optional(),\n\t\t})\n\t\t.optional(),\n});\n\n// Inferred types\n\n// Common BCP 47 language tags — autocomplete hints while still accepting any valid string.\ntype CommonLocaleCode =\n\t| \"en\"\n\t| \"en-US\"\n\t| \"en-GB\"\n\t| \"en-CA\"\n\t| \"en-AU\"\n\t| \"es\"\n\t| \"es-ES\"\n\t| \"es-MX\"\n\t| \"es-419\"\n\t| \"fr\"\n\t| \"fr-FR\"\n\t| \"fr-CA\"\n\t| \"de\"\n\t| \"de-DE\"\n\t| \"de-AT\"\n\t| \"it\"\n\t| \"it-IT\"\n\t| \"pt\"\n\t| \"pt-BR\"\n\t| \"pt-PT\"\n\t| \"ja\"\n\t| \"ja-JP\"\n\t| \"ko\"\n\t| \"ko-KR\"\n\t| \"zh\"\n\t| \"zh-CN\"\n\t| \"zh-TW\"\n\t| \"zh-Hans\"\n\t| \"zh-Hant\"\n\t| \"ar\"\n\t| \"nl\"\n\t| \"ru\"\n\t| \"sv\"\n\t| \"da\"\n\t| \"nb\"\n\t| \"fi\"\n\t| \"pl\"\n\t| \"tr\"\n\t| \"hi\"\n\t| \"id\"\n\t| \"th\"\n\t| (string & {});\n\n// A BCP 47 language tag. Common values are suggested by autocomplete; any valid tag is accepted.\nexport type LocaleCode = CommonLocaleCode;\n\n// Keys are field keys, \"name\" for the pass title, or \"fieldKey_value\" for static field values.\nexport type TranslationMap = Record<string, string>;\n\nexport type Locales = Record<LocaleCode, TranslationMap>;\nexport type Location = z.infer<typeof locationSchema>;\nexport type ImageSource = string | Uint8Array;\nexport type ImageSet =\n\t| ImageSource\n\t| { base: ImageSource; retina?: ImageSource; superRetina?: ImageSource };\nexport type BarcodeFormat = z.infer<typeof barcodeFormatSchema>;\nexport type Barcode = z.infer<typeof barcodeSchema>;\nexport type DateStyle = z.infer<typeof dateStyleSchema>;\nexport type NumberStyle = z.infer<typeof numberStyleSchema>;\nexport type TextAlignment = z.infer<typeof textAlignmentSchema>;\nexport type FieldDef = z.infer<typeof fieldDefSchema>;\n\n// Per-type field keys — TypeScript suggests these in autocomplete while still accepting any string.\n// The `string & {}` trick preserves suggestions without restricting the type.\ntype FieldDefWith<K extends string> = Omit<FieldDef, \"key\"> & { key: K };\n\ntype LoyaltyFieldKey =\n\t| \"points\"\n\t| \"tier\"\n\t| \"member\"\n\t| \"memberId\"\n\t| (string & {});\ntype EventFieldKey =\n\t| \"date\"\n\t| \"venue\"\n\t| \"seat\"\n\t| \"row\"\n\t| \"section\"\n\t| \"gate\"\n\t| (string & {});\ntype FlightFieldKey =\n\t| \"gate\"\n\t| \"seat\"\n\t| \"boardingClass\"\n\t| \"boardingZone\"\n\t| (string & {});\ntype CouponFieldKey =\n\t| \"offer\"\n\t| \"discount\"\n\t| \"code\"\n\t| \"expires\"\n\t| \"terms\"\n\t| (string & {});\ntype GiftCardFieldKey = \"balance\" | \"pin\" | \"initialValue\" | (string & {});\n\nexport type LoyaltyPassConfig = Omit<\n\tz.infer<typeof loyaltyPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<LoyaltyFieldKey>[] };\nexport type EventPassConfig = Omit<\n\tz.infer<typeof eventPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<EventFieldKey>[] };\nexport type FlightPassConfig = Omit<\n\tz.infer<typeof flightPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<FlightFieldKey>[] };\nexport type CouponPassConfig = Omit<\n\tz.infer<typeof couponPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<CouponFieldKey>[] };\nexport type GiftCardPassConfig = Omit<\n\tz.infer<typeof giftCardPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<GiftCardFieldKey>[] };\nexport type GenericPassConfig = z.infer<typeof genericPassSchema>;\nexport type PassConfig = z.infer<typeof passConfigSchema>;\nexport type CreateConfig = z.infer<typeof createConfigSchema>;\nexport type GooglePassMessage = z.infer<typeof googleMessageSchema>;\nexport type RotatingBarcode = z.infer<typeof googleRotatingBarcodeSchema>;\nexport type AppLinkData = z.infer<typeof googleAppLinkDataSchema>;\n","import { WalletError } from \"./errors\";\nimport { generateApplePass } from \"./providers/apple/index\";\nimport {\n\tdeleteGooglePass,\n\texpireGooglePass,\n\tgenerateGooglePass,\n\tupdateGooglePass,\n} from \"./providers/google/index\";\nimport type { IssuedPass, WalletCredentials } from \"./types/credentials\";\nimport type { CreateConfig, FieldDef, PassConfig } from \"./types/schemas\";\nimport { createConfigSchema, passConfigSchema } from \"./types/schemas\";\n\n// Field builder — use these to define display fields on any pass type.\n\ntype FieldOptions = Omit<FieldDef, \"slot\" | \"key\" | \"label\">;\n\n// A string shorthand sets value directly; an object passes all options through.\ntype FieldArg = string | FieldOptions;\n\nfunction resolveOptions(arg: FieldArg | undefined): FieldOptions | undefined {\n\tif (arg === undefined) {\n\t\treturn undefined;\n\t}\n\treturn typeof arg === \"string\" ? { value: arg } : arg;\n}\n\nexport const field = {\n\t/** Top-right of the pass. Compact — typically one field. */\n\theader: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"header\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/** Large, prominent area. Apple: primaryFields. Google: subheader (label) + header (value). */\n\tprimary: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"primary\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/** Below primary. Apple: secondaryFields. Google: textModulesData. */\n\tsecondary: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"secondary\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/** Below secondary. Supports two rows via { row: 0 | 1 }. Apple: auxiliaryFields. Google: textModulesData. */\n\tauxiliary: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"auxiliary\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/** Back of the pass — hidden by default. Apple: backFields. Google: infoModuleData. */\n\tback: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"back\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n};\n\n// Validation\n\nfunction validatePassConfig(config: PassConfig): void {\n\tconst result = passConfigSchema.safeParse(config);\n\tif (!result.success) {\n\t\tthrow new WalletError(\n\t\t\t\"PASS_CONFIG_INVALID\",\n\t\t\tresult.error.issues[0]?.message\n\t\t);\n\t}\n}\n\nfunction validateCreateConfig(config: CreateConfig): void {\n\tconst result = createConfigSchema.safeParse(config);\n\tif (!result.success) {\n\t\tthrow new WalletError(\n\t\t\t\"CREATE_CONFIG_INVALID\",\n\t\t\tresult.error.issues[0]?.message\n\t\t);\n\t}\n}\n\n// Pass\n\nexport class Pass {\n\tprivate readonly config: PassConfig;\n\tprivate readonly credentials: WalletCredentials;\n\n\tconstructor(config: PassConfig, credentials: WalletCredentials) {\n\t\t// Validate immediately so misconfiguration is surfaced at construction time,\n\t\t// not deferred until the first create().\n\t\tvalidatePassConfig(config);\n\t\tthis.config = config;\n\t\tthis.credentials = credentials;\n\t}\n\n\tasync create(createConfig: CreateConfig): Promise<IssuedPass> {\n\t\tvalidateCreateConfig(createConfig);\n\n\t\t// Both providers run independently — a Google API failure won't block the Apple pass.\n\t\tconst [appleResult, googleResult] = await Promise.allSettled([\n\t\t\tthis.credentials.apple\n\t\t\t\t? generateApplePass(this.config, createConfig, this.credentials.apple)\n\t\t\t\t: Promise.resolve({ pass: null, warnings: [] as string[] }),\n\t\t\tthis.credentials.google\n\t\t\t\t? generateGooglePass(this.config, createConfig, this.credentials.google)\n\t\t\t\t: Promise.resolve({ pass: null, warnings: [] as string[] }),\n\t\t]);\n\n\t\tif (appleResult.status === \"rejected\") {\n\t\t\tthrow appleResult.reason;\n\t\t}\n\t\tif (googleResult.status === \"rejected\") {\n\t\t\tthrow googleResult.reason;\n\t\t}\n\n\t\treturn {\n\t\t\tapple: appleResult.value.pass,\n\t\t\tgoogle: googleResult.value.pass,\n\t\t\twarnings: [...appleResult.value.warnings, ...googleResult.value.warnings],\n\t\t};\n\t}\n\n\t// Update an existing pass. For Google: PATCHes the object via the Wallet REST API.\n\tasync update(createConfig: CreateConfig): Promise<void> {\n\t\tvalidateCreateConfig(createConfig);\n\t\tif (this.credentials.google) {\n\t\t\tawait updateGooglePass(\n\t\t\t\tthis.config,\n\t\t\t\tcreateConfig,\n\t\t\t\tthis.credentials.google\n\t\t\t);\n\t\t}\n\t}\n\n\t// Delete a pass. For Google: permanently removes the object via the Wallet REST API.\n\t// Apple passes cannot be remotely deleted — use expire() to invalidate them instead.\n\tasync delete(serialNumber: string): Promise<void> {\n\t\tif (this.credentials.google) {\n\t\t\tawait deleteGooglePass(\n\t\t\t\tthis.config,\n\t\t\t\tserialNumber,\n\t\t\t\tthis.credentials.google\n\t\t\t);\n\t\t}\n\t}\n\n\t// Expire a pass. For Google: sets object state to EXPIRED via the Wallet REST API.\n\t// Apple passes expire automatically when expiresAt is reached.\n\tasync expire(serialNumber: string): Promise<void> {\n\t\tif (this.credentials.google) {\n\t\t\tawait expireGooglePass(\n\t\t\t\tthis.config,\n\t\t\t\tserialNumber,\n\t\t\t\tthis.credentials.google\n\t\t\t);\n\t\t}\n\t}\n}\n","import { Pass } from \"./pass\";\nimport type { WalletCredentials } from \"./types/credentials\";\nimport type {\n\tCouponPassConfig,\n\tEventPassConfig,\n\tFlightPassConfig,\n\tGenericPassConfig,\n\tGiftCardPassConfig,\n\tLoyaltyPassConfig,\n} from \"./types/schemas\";\n\nexport class Wallet {\n\tprivate readonly credentials: WalletCredentials;\n\n\tconstructor(credentials: WalletCredentials) {\n\t\tthis.credentials = credentials;\n\t}\n\n\tloyalty(config: Omit<LoyaltyPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"loyalty\" }, this.credentials);\n\t}\n\n\tevent(config: Omit<EventPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"event\" }, this.credentials);\n\t}\n\n\tflight(config: Omit<FlightPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"flight\" }, this.credentials);\n\t}\n\n\tcoupon(config: Omit<CouponPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"coupon\" }, this.credentials);\n\t}\n\n\tgiftCard(config: Omit<GiftCardPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"giftCard\" }, this.credentials);\n\t}\n\n\tgeneric(config: Omit<GenericPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"generic\" }, this.credentials);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/providers/apple/signer.ts","../src/providers/apple/utils.ts","../src/providers/apple/index.ts","../src/providers/google/api.ts","../src/providers/google/utils.ts","../src/providers/google/index.ts","../src/types/schemas.ts","../src/pass.ts","../src/wallet.ts"],"names":["imageSet","SignJWT"],"mappings":";;;;;;;AAAO,IAAM,kBAAA,GAAqB;AAAA;AAAA,EAEjC,mBAAA,EAAqB,oBAAA;AAAA,EACrB,qBAAA,EAAuB,sBAAA;AAAA;AAAA,EAGvB,yBAAA,EACC,iEAAA;AAAA,EACD,wBAAA,EACC,gEAAA;AAAA,EACD,kBAAA,EACC,2DAAA;AAAA,EACD,oBAAA,EACC,yDAAA;AAAA,EACD,kBAAA,EAAoB,oDAAA;AAAA,EACpB,gCAAA,EACC,mFAAA;AAAA,EACD,mCAAA,EACC,oDAAA;AAAA;AAAA,EAGD,0BAAA,EACC,yEAAA;AAAA,EACD,qBAAA,EAAuB,sDAAA;AAAA,EACvB,gBAAA,EAAkB,y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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,MAAA,EAA8C;AACpD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,QAAA,EAAS,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EAChE;AAAA;AAAA,EAGA,OAAO,MAAA,EAA8C;AACpD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,QAAA,EAAS,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EAChE;AAAA;AAAA,EAGA,SAAS,MAAA,EAAgD;AACxD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,UAAA,EAAW,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EAClE;AAAA;AAAA,EAGA,QAAQ,MAAA,EAA+C;AACtD,IAAA,OAAO,IAAI,KAAK,EAAE,GAAG,QAAQ,IAAA,EAAM,SAAA,EAAU,EAAG,IAAA,CAAK,WAAW,CAAA;AAAA,EACjE;AACD","file":"index.js","sourcesContent":["export const WALLET_ERROR_CODES = {\n\t// Config validation — message comes from the schema\n\tPASS_CONFIG_INVALID: \"PassConfig invalid\",\n\tCREATE_CONFIG_INVALID: \"CreateConfig invalid\",\n\n\t// Apple — provider-level constraints the schema cannot enforce\n\tAPPLE_INVALID_SIGNER_CERT:\n\t\t\"Apple signing failed: signerCert is not a valid PEM certificate\",\n\tAPPLE_INVALID_SIGNER_KEY:\n\t\t\"Apple signing failed: signerKey is not a valid PEM private key\",\n\tAPPLE_INVALID_WWDR:\n\t\t\"Apple signing failed: wwdr is not a valid PEM certificate\",\n\tAPPLE_SIGNING_FAILED:\n\t\t\"Apple signing failed: could not create PKCS#7 signature\",\n\tAPPLE_MISSING_ICON: \"Apple Wallet requires an icon image for every pass\",\n\tAPPLE_UNSUPPORTED_BARCODE_FORMAT:\n\t\t\"Apple Wallet does not support this barcode format — use QR, PDF417, or Aztec\",\n\tAPPLE_BOARDING_MISSING_TRANSIT_TYPE:\n\t\t\"Apple Wallet boarding passes require a transitType\",\n\n\t// Google — provider-level constraints the schema cannot enforce\n\tGOOGLE_INVALID_PRIVATE_KEY:\n\t\t\"Google signing failed: privateKey is not a valid PKCS#8 PEM private key\",\n\tGOOGLE_SIGNING_FAILED: \"Google signing failed: could not sign the Wallet JWT\",\n\tGOOGLE_API_ERROR: \"Google Wallet API error\",\n\tGOOGLE_MISSING_LOGO:\n\t\t\"Google Wallet requires a public logo URL for this pass type\",\n\tGOOGLE_FLIGHT_MISSING_CLASS_FIELDS:\n\t\t\"Google Wallet flightClass requires flightHeader and localScheduledDepartureDateTime\",\n\tGOOGLE_FLIGHT_MISSING_PASSENGER_NAME:\n\t\t\"Google Wallet flightObject requires passengerName\",\n\n\t// Images\n\tIMAGE_FETCH_NETWORK_ERROR: \"Failed to fetch image: network error\",\n\tIMAGE_FETCH_FAILED: \"Failed to fetch image: non-2xx response\",\n} as const;\n\nexport type WalletErrorCode = keyof typeof WALLET_ERROR_CODES;\n\nexport class WalletError extends Error {\n\treadonly code: WalletErrorCode;\n\n\tconstructor(code: WalletErrorCode, message?: string, options?: ErrorOptions) {\n\t\tsuper(message ?? WALLET_ERROR_CODES[code], options);\n\t\tthis.name = \"WalletError\";\n\t\tthis.code = code;\n\t}\n}\n","import forge from \"node-forge\";\nimport { WalletError } from \"../../errors\";\n\ninterface SignManifestOptions {\n\tmanifest: Uint8Array;\n\tsignerCert: string; // PEM\n\tsignerKey: string; // PEM\n\twwdr: string; // PEM\n}\n\n// Sign manifest.json with a PKCS#7 detached signature — required by Apple to\n// validate the integrity of a .pkpass file.\nexport function signManifest(options: SignManifestOptions): Uint8Array {\n\tconst { manifest, signerCert, signerKey, wwdr } = options;\n\n\tlet cert: forge.pki.Certificate;\n\tlet key: forge.pki.PrivateKey;\n\tlet wwdrCert: forge.pki.Certificate;\n\n\ttry {\n\t\tcert = forge.pki.certificateFromPem(signerCert);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_INVALID_SIGNER_CERT\", undefined, { cause });\n\t}\n\ttry {\n\t\tkey = forge.pki.privateKeyFromPem(signerKey);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_INVALID_SIGNER_KEY\", undefined, { cause });\n\t}\n\ttry {\n\t\twwdrCert = forge.pki.certificateFromPem(wwdr);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_INVALID_WWDR\", undefined, { cause });\n\t}\n\n\ttry {\n\t\t// forge requires a binary string — decode the Uint8Array as latin1\n\t\t// biome-ignore lint/suspicious/noExplicitAny: \"iso-8859-1\" is valid but not in strict Encoding types\n\t\tconst binaryStr = new TextDecoder(\"iso-8859-1\" as any).decode(manifest);\n\n\t\tconst p7 = forge.pkcs7.createSignedData();\n\t\tp7.content = forge.util.createBuffer(binaryStr);\n\t\tp7.addCertificate(cert);\n\t\tp7.addCertificate(wwdrCert);\n\t\tp7.addSigner({\n\t\t\tkey,\n\t\t\tcertificate: cert,\n\t\t\tdigestAlgorithm: forge.pki.oids.sha1 as string,\n\t\t\tauthenticatedAttributes: [\n\t\t\t\t{\n\t\t\t\t\ttype: forge.pki.oids.contentType as string,\n\t\t\t\t\tvalue: forge.pki.oids.data as string,\n\t\t\t\t},\n\t\t\t\t{ type: forge.pki.oids.messageDigest as string },\n\t\t\t\t{ type: forge.pki.oids.signingTime as string },\n\t\t\t],\n\t\t});\n\n\t\tp7.sign({ detached: true });\n\n\t\tconst der = forge.asn1.toDer(p7.toAsn1()).getBytes();\n\t\treturn Uint8Array.from(der, (c) => c.charCodeAt(0));\n\t} catch (cause) {\n\t\tthrow new WalletError(\"APPLE_SIGNING_FAILED\", undefined, { cause });\n\t}\n}\n","import { WalletError } from \"../../errors\";\nimport type { ImageSet } from \"../../types/schemas\";\n\n// Convert a 6-digit hex color to Apple's rgb() format.\n// Apple pass.json requires colors as \"rgb(r, g, b)\" strings.\nexport function hexToRgb(hex: string): string {\n\tconst clean = hex.replace(\"#\", \"\");\n\tconst r = Number.parseInt(clean.slice(0, 2), 16);\n\tconst g = Number.parseInt(clean.slice(2, 4), 16);\n\tconst b = Number.parseInt(clean.slice(4, 6), 16);\n\treturn `rgb(${r}, ${g}, ${b})`;\n}\n\nconst APPLE_BARCODE_FORMAT: Record<string, string> = {\n\tQR: \"PKBarcodeFormatQR\",\n\tPDF417: \"PKBarcodeFormatPDF417\",\n\tAztec: \"PKBarcodeFormatAztec\",\n\tCode128: \"PKBarcodeFormatCode128\",\n};\n\nexport function toAppleBarcodeFormat(format: string): string {\n\treturn APPLE_BARCODE_FORMAT[format] ?? \"PKBarcodeFormatQR\";\n}\n\nasync function fetchAsBytes(url: string): Promise<Uint8Array> {\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(url);\n\t} catch (cause) {\n\t\tthrow new WalletError(\n\t\t\t\"IMAGE_FETCH_NETWORK_ERROR\",\n\t\t\t`Failed to fetch image: ${url} (network error)`,\n\t\t\t{ cause }\n\t\t);\n\t}\n\tif (!response.ok) {\n\t\tthrow new WalletError(\n\t\t\t\"IMAGE_FETCH_FAILED\",\n\t\t\t`Failed to fetch image: ${url} (${response.status})`\n\t\t);\n\t}\n\treturn new Uint8Array(await response.arrayBuffer());\n}\n\nfunction resolveSource(src: string | Uint8Array): Promise<Uint8Array> {\n\treturn src instanceof Uint8Array ? Promise.resolve(src) : fetchAsBytes(src);\n}\n\n// Resolve an ImageSet into named Apple image files (base.png, @2x, @3x).\n// Returns a record of filename → bytes. Optional images that fail to load\n// are skipped and a warning is added.\nexport async function resolveImageSet(\n\tname: string,\n\timageSet: ImageSet | undefined,\n\twarnings: string[]\n): Promise<Record<string, Uint8Array>> {\n\tif (!imageSet) {\n\t\treturn {};\n\t}\n\n\tconst files: Record<string, Uint8Array> = {};\n\n\tconst tryLoad = async (filename: string, src: string | Uint8Array) => {\n\t\ttry {\n\t\t\tfiles[filename] = await resolveSource(src);\n\t\t} catch (e) {\n\t\t\twarnings.push(\n\t\t\t\t`Could not load ${filename}: ${e instanceof Error ? e.message : String(e)}`\n\t\t\t);\n\t\t}\n\t};\n\n\tif (typeof imageSet === \"string\" || imageSet instanceof Uint8Array) {\n\t\tawait tryLoad(`${name}.png`, imageSet);\n\t} else {\n\t\tawait tryLoad(`${name}.png`, imageSet.base);\n\t\tif (imageSet.retina) {\n\t\t\tawait tryLoad(`${name}@2x.png`, imageSet.retina);\n\t\t}\n\t\tif (imageSet.superRetina) {\n\t\t\tawait tryLoad(`${name}@3x.png`, imageSet.superRetina);\n\t\t}\n\t}\n\n\treturn files;\n}\n\n// Same as resolveImageSet but throws instead of warning — for required images.\nexport async function resolveRequiredImageSet(\n\tname: string,\n\timageSet: ImageSet\n): Promise<Record<string, Uint8Array>> {\n\tconst files: Record<string, Uint8Array> = {};\n\n\tif (typeof imageSet === \"string\" || imageSet instanceof Uint8Array) {\n\t\tfiles[`${name}.png`] = await resolveSource(imageSet);\n\t} else {\n\t\tfiles[`${name}.png`] = await resolveSource(imageSet.base);\n\t\tif (imageSet.retina) {\n\t\t\tfiles[`${name}@2x.png`] = await resolveSource(imageSet.retina);\n\t\t}\n\t\tif (imageSet.superRetina) {\n\t\t\tfiles[`${name}@3x.png`] = await resolveSource(imageSet.superRetina);\n\t\t}\n\t}\n\n\treturn files;\n}\n","import { createHash } from \"node:crypto\";\nimport JSZip from \"jszip\";\nimport { WalletError } from \"../../errors\";\nimport type { AppleCredentials } from \"../../types/credentials\";\nimport type { CreateConfig, FieldDef, PassConfig } from \"../../types/schemas\";\nimport { signManifest } from \"./signer\";\nimport {\n\thexToRgb,\n\tresolveImageSet,\n\tresolveRequiredImageSet,\n\ttoAppleBarcodeFormat,\n} from \"./utils\";\n\n// Apple pass type → pass.json key\nconst PASS_TYPE_KEY: Record<string, string> = {\n\tloyalty: \"storeCard\",\n\tcoupon: \"coupon\",\n\tevent: \"eventTicket\",\n\tflight: \"boardingPass\",\n\tgiftCard: \"storeCard\",\n\tgeneric: \"generic\",\n};\n\nconst TRANSIT_TYPE: Record<string, string> = {\n\tair: \"PKTransitTypeAir\",\n\ttrain: \"PKTransitTypeTrain\",\n\tbus: \"PKTransitTypeBus\",\n\tboat: \"PKTransitTypeBoat\",\n};\n\n// Apple field slot → pass.json key\nconst SLOT_KEY: Record<FieldDef[\"slot\"], string> = {\n\theader: \"headerFields\",\n\tprimary: \"primaryFields\",\n\tsecondary: \"secondaryFields\",\n\tauxiliary: \"auxiliaryFields\",\n\tback: \"backFields\",\n};\n\nfunction validateAppleRequirements(pass: PassConfig): void {\n\tif (!pass.apple?.icon) {\n\t\tthrow new WalletError(\"APPLE_MISSING_ICON\");\n\t}\n\tif (pass.type === \"flight\" && !pass.transitType) {\n\t\tthrow new WalletError(\"APPLE_BOARDING_MISSING_TRANSIT_TYPE\");\n\t}\n}\n\nfunction buildSlots(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n): Record<string, unknown[]> {\n\tconst slots: Record<string, unknown[]> = {\n\t\theaderFields: [],\n\t\tprimaryFields: [],\n\t\tsecondaryFields: [],\n\t\tauxiliaryFields: [],\n\t\tbackFields: [],\n\t};\n\n\tfor (const f of fields) {\n\t\tconst value = f.key in values ? values[f.key] : f.value;\n\t\tif (value === null || value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tslots[SLOT_KEY[f.slot]]?.push({\n\t\t\tkey: f.key,\n\t\t\tlabel: f.label,\n\t\t\tvalue,\n\t\t\t...(f.changeMessage && { changeMessage: f.changeMessage }),\n\t\t\t...(f.dateStyle && { dateStyle: f.dateStyle }),\n\t\t\t...(f.timeStyle && { timeStyle: f.timeStyle }),\n\t\t\t...(f.numberStyle && { numberStyle: f.numberStyle }),\n\t\t\t...(f.currencyCode && { currencyCode: f.currencyCode }),\n\t\t\t...(f.textAlignment && { textAlignment: f.textAlignment }),\n\t\t\t...(f.row !== undefined && { row: f.row }),\n\t\t});\n\t}\n\n\treturn slots;\n}\n\nfunction buildPassTypeContent(\n\tpass: PassConfig,\n\tslots: Record<string, unknown[]>\n): Record<string, unknown> {\n\tconst content: Record<string, unknown> = { ...slots };\n\tif (pass.type === \"flight\") {\n\t\tcontent.transitType =\n\t\t\tTRANSIT_TYPE[pass.transitType ?? \"air\"] ?? \"PKTransitTypeAir\";\n\t}\n\treturn content;\n}\n\ntype EventPass = Extract<PassConfig, { type: \"event\" }>;\ntype FlightPass = Extract<PassConfig, { type: \"flight\" }>;\n\nfunction buildEventAppleFields(pass: EventPass): Record<string, unknown> {\n\tconst a = pass.apple;\n\treturn {\n\t\teventLogoText: a?.eventLogoText,\n\t\tfooterBackgroundColor: a?.footerBackgroundColor\n\t\t\t? hexToRgb(a.footerBackgroundColor)\n\t\t\t: undefined,\n\t\tsuppressHeaderDarkening: a?.suppressHeaderDarkening,\n\t\tuseAutomaticColors: a?.useAutomaticColors,\n\t\tpreferredStyleSchemes: a?.preferredStyleSchemes,\n\t\tauxiliaryStoreIdentifiers: a?.auxiliaryStoreIdentifiers,\n\t\taccessibilityURL: a?.accessibilityURL,\n\t\taddOnURL: a?.addOnURL,\n\t\tbagPolicyURL: a?.bagPolicyURL,\n\t\tcontactVenueEmail: a?.contactVenueEmail,\n\t\tcontactVenuePhoneNumber: a?.contactVenuePhoneNumber,\n\t\tcontactVenueWebsite: a?.contactVenueWebsite,\n\t\tdirectionsInformationURL: a?.directionsInformationURL,\n\t\tmerchandiseURL: a?.merchandiseURL,\n\t\torderFoodURL: a?.orderFoodURL,\n\t\tparkingInformationURL: a?.parkingInformationURL,\n\t\tpurchaseParkingURL: a?.purchaseParkingURL,\n\t\tsellURL: a?.sellURL,\n\t\ttransferURL: a?.transferURL,\n\t\ttransitInformationURL: a?.transitInformationURL,\n\t};\n}\n\nfunction buildFlightAppleFields(pass: FlightPass): Record<string, unknown> {\n\tconst a = pass.apple;\n\treturn {\n\t\tchangeSeatURL: a?.changeSeatURL,\n\t\tentertainmentURL: a?.entertainmentURL,\n\t\tmanagementURL: a?.managementURL,\n\t\tpurchaseAdditionalBaggageURL: a?.purchaseAdditionalBaggageURL,\n\t\tpurchaseLoungeAccessURL: a?.purchaseLoungeAccessURL,\n\t\tpurchaseWifiURL: a?.purchaseWifiURL,\n\t\tregisterServiceAnimalURL: a?.registerServiceAnimalURL,\n\t\treportLostBagURL: a?.reportLostBagURL,\n\t\trequestWheelchairURL: a?.requestWheelchairURL,\n\t\ttrackBagsURL: a?.trackBagsURL,\n\t\ttransitProviderEmail: a?.transitProviderEmail,\n\t\ttransitProviderPhoneNumber: a?.transitProviderPhoneNumber,\n\t\ttransitProviderWebsiteURL: a?.transitProviderWebsiteURL,\n\t\tupgradeURL: a?.upgradeURL,\n\t};\n}\n\nfunction buildAppleCommonFields(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig\n): Record<string, unknown> {\n\tconst a = pass.apple;\n\treturn {\n\t\tbackgroundColor: pass.color ? hexToRgb(pass.color) : undefined,\n\t\tforegroundColor: a?.foregroundColor\n\t\t\t? hexToRgb(a.foregroundColor)\n\t\t\t: undefined,\n\t\tlabelColor: a?.labelColor ? hexToRgb(a.labelColor) : undefined,\n\t\texpirationDate: createConfig.expiresAt,\n\t\tvoided: createConfig.apple?.voided,\n\t\t// Barcode — Apple supports up to 10 but we expose one per recipient\n\t\tbarcodes: createConfig.barcode\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: createConfig.barcode.value,\n\t\t\t\t\t\tformat: toAppleBarcodeFormat(createConfig.barcode.format),\n\t\t\t\t\t\tmessageEncoding: \"iso-8859-1\",\n\t\t\t\t\t\taltText: createConfig.barcode.altText ?? createConfig.barcode.value,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: undefined,\n\t\t// Locations — altitude and relevantText are Apple-only\n\t\tlocations: pass.locations?.map(\n\t\t\t({ latitude, longitude, altitude, relevantText }) => ({\n\t\t\t\tlatitude,\n\t\t\t\tlongitude,\n\t\t\t\taltitude,\n\t\t\t\trelevantText,\n\t\t\t})\n\t\t),\n\t\tbeacons: a?.beacons,\n\t\trelevantDate: a?.relevantDate,\n\t\trelevantDates: a?.relevantDates,\n\t\tgroupingIdentifier: a?.groupingIdentifier,\n\t\tsuppressStripShine: a?.suppressStripShine,\n\t\tsharingProhibited: a?.sharingProhibited,\n\t\tmaxDistance: a?.maxDistance,\n\t\tnfc: a?.nfc\n\t\t\t? {\n\t\t\t\t\tmessage: a.nfc.message,\n\t\t\t\t\tencryptionPublicKey: a.nfc.encryptionPublicKey,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tappLaunchURL: a?.appLaunchURL,\n\t\tassociatedStoreIdentifiers: a?.associatedStoreIdentifiers,\n\t\twebServiceURL: a?.webServiceURL,\n\t\tauthenticationToken: a?.webServiceURL ? a.authenticationToken : undefined,\n\t\tuserInfo: a?.userInfo,\n\t};\n}\n\nfunction buildPassJson(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: AppleCredentials\n): Record<string, unknown> {\n\tconst passTypeKey = PASS_TYPE_KEY[pass.type] ?? \"generic\";\n\tconst slots = buildSlots(pass.fields, createConfig.values ?? {});\n\tconst a = pass.apple;\n\n\treturn {\n\t\tformatVersion: 1,\n\t\tpassTypeIdentifier: credentials.passTypeIdentifier,\n\t\tserialNumber: createConfig.serialNumber,\n\t\tteamIdentifier: credentials.teamId,\n\t\torganizationName: pass.name,\n\t\tdescription: a?.description ?? pass.name,\n\t\tlogoText: a?.logoText ?? pass.name,\n\t\t...buildAppleCommonFields(pass, createConfig),\n\t\t...(pass.type === \"event\" && buildEventAppleFields(pass)),\n\t\t...(pass.type === \"flight\" && buildFlightAppleFields(pass)),\n\t\t[passTypeKey]: buildPassTypeContent(pass, slots),\n\t};\n}\n\nasync function collectImages(\n\tpass: PassConfig,\n\twarnings: string[]\n): Promise<Record<string, Uint8Array>> {\n\tconst images: Record<string, Uint8Array> = {};\n\n\t// icon is required — validateAppleRequirements() throws before we reach here if missing\n\tconst icon = pass.apple?.icon;\n\tif (!icon) {\n\t\tthrow new WalletError(\"APPLE_MISSING_ICON\");\n\t}\n\tconst iconFiles = await resolveRequiredImageSet(\"icon\", icon);\n\tObject.assign(images, iconFiles);\n\n\t// All other images are optional — adds warnings on failure\n\tconst optional = await Promise.all([\n\t\tresolveImageSet(\"logo\", pass.logo, warnings),\n\t\tresolveImageSet(\"strip\", pass.banner, warnings), // banner → strip on Apple\n\t\tresolveImageSet(\"background\", pass.apple?.background, warnings),\n\t\tresolveImageSet(\"thumbnail\", pass.apple?.thumbnail, warnings),\n\t\tresolveImageSet(\"footer\", pass.apple?.footer, warnings),\n\t]);\n\tfor (const set of optional) {\n\t\tObject.assign(images, set);\n\t}\n\n\treturn images;\n}\n\nexport async function generateApplePass(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: AppleCredentials\n): Promise<{ pass: Uint8Array; warnings: string[] }> {\n\tconst warnings: string[] = [];\n\n\tvalidateAppleRequirements(pass);\n\n\tconst encoder = new TextEncoder();\n\tconst zip = new JSZip();\n\tconst files: Record<string, Uint8Array> = {};\n\n\t// pass.json\n\tconst passJson = buildPassJson(pass, createConfig, credentials);\n\tfiles[\"pass.json\"] = encoder.encode(JSON.stringify(passJson));\n\n\t// Locale files — {language}.lproj/pass.strings\n\t// Each entry uses Apple's pass.strings format: \"key\" = \"value\";\n\t// Use field keys to translate labels and \"key_value\" to translate static field values.\n\t// The reserved key \"name\" translates the pass title (organizationName / description / logoText).\n\tif (pass.locales) {\n\t\tfor (const [language, translations] of Object.entries(pass.locales)) {\n\t\t\tconst lines = Object.entries(translations).map(\n\t\t\t\t([key, value]) => `\"${key}\" = \"${value.replace(/\"/g, '\\\\\"')}\";`\n\t\t\t);\n\t\t\tfiles[`${language}.lproj/pass.strings`] = encoder.encode(\n\t\t\t\tlines.join(\"\\n\")\n\t\t\t);\n\t\t}\n\t}\n\n\t// Images\n\tconst images = await collectImages(pass, warnings);\n\tfor (const [name, bytes] of Object.entries(images)) {\n\t\tfiles[name] = bytes;\n\t}\n\n\t// manifest.json — SHA1 hash of every file\n\tconst manifest: Record<string, string> = {};\n\tfor (const [name, content] of Object.entries(files)) {\n\t\tmanifest[name] = createHash(\"sha1\").update(content).digest(\"hex\");\n\t}\n\tconst manifestBytes = encoder.encode(JSON.stringify(manifest));\n\n\t// signature — PKCS#7 detached signature of manifest.json\n\tconst signature = signManifest({\n\t\tmanifest: manifestBytes,\n\t\tsignerCert: credentials.signerCert,\n\t\tsignerKey: credentials.signerKey,\n\t\twwdr: credentials.wwdr,\n\t});\n\n\tfor (const [name, content] of Object.entries(files)) {\n\t\tzip.file(name, content);\n\t}\n\tzip.file(\"manifest.json\", manifestBytes);\n\tzip.file(\"signature\", signature);\n\n\treturn { pass: await zip.generateAsync({ type: \"uint8array\" }), warnings };\n}\n","import { importPKCS8, SignJWT } from \"jose\";\nimport { WalletError } from \"../../errors\";\nimport type { GoogleCredentials } from \"../../types/credentials\";\n\nconst WALLET_BASE = \"https://walletobjects.googleapis.com/walletobjects/v1\";\nconst TOKEN_URL = \"https://oauth2.googleapis.com/token\";\nconst WALLET_SCOPE = \"https://www.googleapis.com/auth/wallet_object.issuer\";\n\n// Cache access tokens for 55 minutes (tokens expire in 60).\nconst tokenCache = new Map<string, { token: string; expiresAt: number }>();\n\nexport async function importGoogleKey(\n\tcredentials: GoogleCredentials\n): Promise<CryptoKey> {\n\ttry {\n\t\treturn await importPKCS8(credentials.privateKey, \"RS256\");\n\t} catch (cause) {\n\t\tthrow new WalletError(\"GOOGLE_INVALID_PRIVATE_KEY\", undefined, { cause });\n\t}\n}\n\nasync function getAccessToken(\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<string> {\n\tconst cacheKey = `${credentials.issuerId}:${credentials.clientEmail}`;\n\tconst cached = tokenCache.get(cacheKey);\n\tif (cached && Date.now() < cached.expiresAt) {\n\t\treturn cached.token;\n\t}\n\n\tlet assertion: string;\n\ttry {\n\t\tassertion = await new SignJWT({ scope: WALLET_SCOPE })\n\t\t\t.setProtectedHeader({ alg: \"RS256\" })\n\t\t\t.setIssuedAt()\n\t\t\t.setExpirationTime(\"1h\")\n\t\t\t.setIssuer(credentials.clientEmail)\n\t\t\t.setAudience(TOKEN_URL)\n\t\t\t.sign(privateKey);\n\t} catch (cause) {\n\t\tthrow new WalletError(\"GOOGLE_SIGNING_FAILED\", undefined, { cause });\n\t}\n\n\tconst response = await fetch(TOKEN_URL, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n\t\tbody: new URLSearchParams({\n\t\t\tgrant_type: \"urn:ietf:params:oauth:grant-type:jwt-bearer\",\n\t\t\tassertion,\n\t\t}).toString(),\n\t});\n\n\tif (!response.ok) {\n\t\tconst text = await response.text();\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_API_ERROR\",\n\t\t\t`Failed to obtain access token (${response.status}): ${extractGoogleDetail(text)}`\n\t\t);\n\t}\n\n\tconst data = (await response.json()) as { access_token: string };\n\ttokenCache.set(cacheKey, {\n\t\ttoken: data.access_token,\n\t\texpiresAt: Date.now() + 55 * 60 * 1000,\n\t});\n\treturn data.access_token;\n}\n\nasync function walletRequest(\n\tmethod: string,\n\tpath: string,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey,\n\tbody?: Record<string, unknown>\n): Promise<Response> {\n\tconst accessToken = await getAccessToken(credentials, privateKey);\n\treturn fetch(`${WALLET_BASE}${path}`, {\n\t\tmethod,\n\t\theaders: {\n\t\t\tAuthorization: `Bearer ${accessToken}`,\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t},\n\t\tbody: body === undefined ? undefined : JSON.stringify(body),\n\t});\n}\n\nfunction extractGoogleDetail(text: string): string {\n\ttry {\n\t\tconst body = JSON.parse(text) as { error?: { message?: string } };\n\t\tif (body.error?.message) {\n\t\t\treturn body.error.message;\n\t\t}\n\t} catch {\n\t\t// not JSON — fall through to raw text\n\t}\n\treturn text;\n}\n\nasync function assertOk(response: Response): Promise<void> {\n\tif (!response.ok) {\n\t\tconst text = await response.text();\n\t\tconst detail = extractGoogleDetail(text);\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_API_ERROR\",\n\t\t\t`Google Wallet API error (${response.status}): ${detail}`\n\t\t);\n\t}\n}\n\n// Ensure a Google Wallet class exists. Creates it if not found; no-ops if it already exists.\n// Class updates (template changes) are intentionally out of scope — use patchClass for that.\nexport async function ensureClass(\n\tclassType: string,\n\tclassId: string,\n\tclassBody: Record<string, unknown>,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<void> {\n\tconst existing = await walletRequest(\n\t\t\"GET\",\n\t\t`/${classType}/${classId}`,\n\t\tcredentials,\n\t\tprivateKey\n\t);\n\n\tif (existing.ok) {\n\t\tawait existing.body?.cancel();\n\t\treturn;\n\t}\n\n\tif (existing.status !== 404) {\n\t\tconst text = await existing.text();\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_API_ERROR\",\n\t\t\t`Google Wallet API error (${existing.status}): ${extractGoogleDetail(text)}`\n\t\t);\n\t}\n\n\tawait assertOk(\n\t\tawait walletRequest(\"POST\", `/${classType}`, credentials, privateKey, {\n\t\t\tid: classId,\n\t\t\t...classBody,\n\t\t})\n\t);\n}\n\nexport async function deleteObject(\n\tobjectType: string,\n\tobjectId: string,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<void> {\n\tconst response = await walletRequest(\n\t\t\"DELETE\",\n\t\t`/${objectType}/${objectId}`,\n\t\tcredentials,\n\t\tprivateKey\n\t);\n\t// 404 = already deleted — treat as success (idempotent)\n\tif (response.status === 404) {\n\t\tawait response.body?.cancel();\n\t\treturn;\n\t}\n\tawait assertOk(response);\n\tawait response.body?.cancel();\n}\n\nexport async function patchObject(\n\tobjectType: string,\n\tobjectId: string,\n\tpatch: Record<string, unknown>,\n\tcredentials: GoogleCredentials,\n\tprivateKey: CryptoKey\n): Promise<void> {\n\tconst response = await walletRequest(\n\t\t\"PATCH\",\n\t\t`/${objectType}/${objectId}`,\n\t\tcredentials,\n\t\tprivateKey,\n\t\tpatch\n\t);\n\tawait assertOk(response);\n}\n","const GOOGLE_BARCODE_TYPE: Record<string, string> = {\n\tQR: \"QR_CODE\",\n\tPDF417: \"PDF_417\",\n\tAztec: \"AZTEC\",\n\tCode128: \"CODE_128\",\n};\n\nexport function toGoogleBarcodeType(format: string): string {\n\treturn GOOGLE_BARCODE_TYPE[format] ?? \"QR_CODE\";\n}\n\ninterface TranslatedValue {\n\tlanguage: string;\n\tvalue: string;\n}\n\ninterface LocalizedString {\n\tdefaultValue: TranslatedValue;\n\ttranslatedValues?: TranslatedValue[];\n}\n\n// Build a Google Wallet LocalizedString object.\n// Pass translatedValues to include additional language variants.\nexport function localized(\n\tvalue: string,\n\tlanguage = \"en-US\",\n\ttranslatedValues?: TranslatedValue[]\n): LocalizedString {\n\treturn {\n\t\tdefaultValue: { language, value },\n\t\ttranslatedValues: translatedValues?.length ? translatedValues : undefined,\n\t};\n}\n\n// Build the translatedValues array for a given key by scanning all locales.\n// Used to look up field key translations (labels) and key_value translations (static values).\nexport function translationsFor(\n\tkey: string,\n\tlocales: Record<string, Record<string, string>> | undefined\n): TranslatedValue[] | undefined {\n\tif (!locales) {\n\t\treturn undefined;\n\t}\n\tconst result = Object.entries(locales)\n\t\t.filter(([, t]) => t[key] !== undefined)\n\t\t.map(([lang, t]) => ({ language: lang, value: t[key] as string }));\n\treturn result.length > 0 ? result : undefined;\n}\n\n// Wrap a URL string as a Google Wallet ImageUri object.\nexport function imageUri(url: unknown): Record<string, unknown> | undefined {\n\treturn typeof url === \"string\" ? { sourceUri: { uri: url } } : undefined;\n}\n","import { WalletError } from \"../../errors\";\nimport type { GoogleCredentials } from \"../../types/credentials\";\nimport type { CreateConfig, FieldDef, PassConfig } from \"../../types/schemas\";\nimport { deleteObject, ensureClass, importGoogleKey, patchObject } from \"./api\";\nimport {\n\timageUri,\n\tlocalized,\n\ttoGoogleBarcodeType,\n\ttranslationsFor,\n} from \"./utils\";\n\n// Typed maps — pass.type is always one of these keys so access is always string (not string | undefined)\ntype PassType = PassConfig[\"type\"];\n\n// Google Wallet class type per pass type\nconst CLASS_TYPE: Record<PassType, string> = {\n\tloyalty: \"loyaltyClass\",\n\tevent: \"eventTicketClass\",\n\tflight: \"flightClass\",\n\tcoupon: \"offerClass\",\n\tgiftCard: \"giftCardClass\",\n\tgeneric: \"genericClass\",\n};\n\n// Google Wallet object type per pass type\nconst OBJECT_TYPE: Record<PassType, string> = {\n\tloyalty: \"loyaltyObject\",\n\tevent: \"eventTicketObject\",\n\tflight: \"flightObject\",\n\tcoupon: \"offerObject\",\n\tgiftCard: \"giftCardObject\",\n\tgeneric: \"genericObject\",\n};\n\nfunction validateGoogleRequirements(pass: PassConfig): void {\n\t// Google logo must be a URL (not bytes — Google can't accept binary uploads directly)\n\tif (pass.logo !== undefined && pass.logo instanceof Uint8Array) {\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_MISSING_LOGO\",\n\t\t\t\"Google Wallet logo must be a URL string, not bytes\"\n\t\t);\n\t}\n\t// Google loyalty classes require a programLogo URL — the API returns 400 without it\n\tif (pass.type === \"loyalty\" && !pass.logo) {\n\t\tthrow new WalletError(\n\t\t\t\"GOOGLE_MISSING_LOGO\",\n\t\t\t\"Google Wallet loyalty passes require a logo URL (programLogo)\"\n\t\t);\n\t}\n\tif (pass.type === \"flight\") {\n\t\tconst { carrier, flightNumber, origin, destination } = pass;\n\t\tif (!(carrier && flightNumber && origin && destination)) {\n\t\t\tthrow new WalletError(\n\t\t\t\t\"GOOGLE_FLIGHT_MISSING_CLASS_FIELDS\",\n\t\t\t\t\"Flight passes require carrier, flightNumber, origin, and destination\"\n\t\t\t);\n\t\t}\n\t}\n}\n\n// Build textModulesData from fields not in excluded slots\nfunction buildTextModules(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>,\n\texcludeSlots: FieldDef[\"slot\"][]\n): Array<{ header: string; body: string; id: string }> {\n\tconst modules: Array<{ header: string; body: string; id: string }> = [];\n\tfor (const f of fields) {\n\t\tif (excludeSlots.includes(f.slot)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = f.key in values ? values[f.key] : f.value;\n\t\tif (value === null || value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tmodules.push({ header: f.label, body: value, id: f.key });\n\t}\n\treturn modules;\n}\n\n// Build infoModuleData from back fields\nfunction buildInfoModuleData(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n):\n\t| {\n\t\t\tlabelValueRows: Array<{\n\t\t\t\tcolumns: Array<{ label: string; value: string }>;\n\t\t\t}>;\n\t }\n\t| undefined {\n\tconst rows: Array<{ label: string; value: string }> = [];\n\tfor (const f of fields) {\n\t\tif (f.slot !== \"back\") {\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = f.key in values ? values[f.key] : f.value;\n\t\tif (value === null || value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\trows.push({ label: f.label, value });\n\t}\n\tif (rows.length === 0) {\n\t\treturn undefined;\n\t}\n\treturn { labelValueRows: rows.map((r) => ({ columns: [r] })) };\n}\n\n// Per-type class name fields\nfunction buildClassTypeFields(\n\tpass: PassConfig,\n\tlocales: PassConfig[\"locales\"]\n): Record<string, unknown> {\n\tconst nameTranslations = translationsFor(\"name\", locales);\n\tif (pass.type === \"loyalty\") {\n\t\treturn { programName: pass.name };\n\t}\n\tif (pass.type === \"event\") {\n\t\treturn {\n\t\t\teventName: localized(pass.name, \"en-US\", nameTranslations),\n\t\t\tlocalScheduledStartDateTime: pass.startsAt?.replace(\"Z\", \"\"),\n\t\t\tlocalScheduledEndDateTime: pass.endsAt?.replace(\"Z\", \"\"),\n\t\t};\n\t}\n\tif (pass.type === \"flight\") {\n\t\treturn {\n\t\t\t// flightClass represents a single flight — departure time is class-level\n\t\t\tflightHeader: {\n\t\t\t\tcarrier: { carrierIataCode: pass.carrier },\n\t\t\t\tflightNumber: pass.flightNumber,\n\t\t\t\toperatingCarrier: { carrierIataCode: pass.carrier },\n\t\t\t\toperatingFlightNumber: pass.flightNumber,\n\t\t\t},\n\t\t\tlocalScheduledDepartureDateTime: pass.departure?.replace(\"Z\", \"\"),\n\t\t\torigin: pass.origin ? { airportIataCode: pass.origin } : undefined,\n\t\t\tdestination: pass.destination\n\t\t\t\t? {\n\t\t\t\t\t\tairportIataCode: pass.destination,\n\t\t\t\t\t\tlocalScheduledArrivalDateTime: pass.arrival?.replace(\"Z\", \"\"),\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t};\n\t}\n\tif (pass.type === \"coupon\") {\n\t\treturn {\n\t\t\ttitle: pass.name,\n\t\t\t// provider is required by Google offerClass — defaults to the pass name\n\t\t\tprovider: pass.name,\n\t\t\tredemptionChannel: pass.redemptionChannel.toUpperCase(),\n\t\t};\n\t}\n\t// giftCard + generic\n\treturn { cardTitle: localized(pass.name, \"en-US\", nameTranslations) };\n}\n\n// Build a Google Wallet AppLinkInfo sub-object from our simplified schema shape.\nfunction buildAppLinkInfo(info: {\n\turi: string;\n\ttitle?: string;\n\tdescription?: string;\n\tlogoUrl?: string;\n}): Record<string, unknown> {\n\treturn {\n\t\tappLogoImage: imageUri(info.logoUrl),\n\t\ttitle: info.title ? localized(info.title) : undefined,\n\t\tdescription: info.description ? localized(info.description) : undefined,\n\t\tappTarget: { targetUri: { uri: info.uri } },\n\t};\n}\n\nfunction buildAppLinkData(d: {\n\tandroid?: {\n\t\turi: string;\n\t\ttitle?: string;\n\t\tdescription?: string;\n\t\tlogoUrl?: string;\n\t};\n\tios?: { uri: string; title?: string; description?: string; logoUrl?: string };\n\tweb?: { uri: string; title?: string; description?: string; logoUrl?: string };\n}): Record<string, unknown> {\n\treturn {\n\t\tandroidAppLinkInfo: d.android ? buildAppLinkInfo(d.android) : undefined,\n\t\tiosAppLinkInfo: d.ios ? buildAppLinkInfo(d.ios) : undefined,\n\t\twebAppLinkInfo: d.web ? buildAppLinkInfo(d.web) : undefined,\n\t};\n}\n\n// Build the class body — defines the pass template (shared across all recipients)\nfunction buildClassBody(pass: PassConfig): Record<string, unknown> {\n\tconst logo = imageUri(pass.logo);\n\tconst wideLogo = imageUri(pass.google?.wideLogo);\n\tconst hero = imageUri(\n\t\ttypeof pass.banner === \"string\" ? pass.banner : undefined\n\t);\n\n\tconst body: Record<string, unknown> = {\n\t\t...buildClassTypeFields(pass, pass.locales),\n\t\thexBackgroundColor: pass.color,\n\t\tissuerName: pass.google?.issuerName ?? pass.name,\n\t};\n\n\t// loyalty uses programLogo; all other types use logo\n\tif (pass.type === \"loyalty\") {\n\t\tif (logo) {\n\t\t\tbody.programLogo = logo;\n\t\t}\n\t} else if (logo) {\n\t\tbody.logo = logo;\n\t}\n\tif (wideLogo) {\n\t\tbody.wideProgramBanner = wideLogo;\n\t}\n\tif (hero) {\n\t\tbody.heroImage = hero;\n\t}\n\t// Required for loyalty, event, flight, coupon, giftCard classes. Ignored by genericClass.\n\tif (pass.type !== \"generic\") {\n\t\tbody.reviewStatus = pass.google?.reviewStatus ?? \"UNDER_REVIEW\";\n\t}\n\tif (pass.google?.enableSmartTap) {\n\t\tbody.enableSmartTap = pass.google.enableSmartTap;\n\t}\n\tif (pass.google?.redemptionIssuers) {\n\t\tbody.redemptionIssuers = pass.google.redemptionIssuers;\n\t}\n\tif (pass.google?.messages) {\n\t\tbody.messages = pass.google.messages;\n\t}\n\tif (pass.google?.appLinkData) {\n\t\tbody.appLinkData = buildAppLinkData(pass.google.appLinkData);\n\t}\n\tif (pass.locations?.length) {\n\t\tbody.locations = pass.locations.map(({ latitude, longitude }) => ({\n\t\t\tlatitude,\n\t\t\tlongitude,\n\t\t}));\n\t}\n\n\treturn body;\n}\n\n// Loyalty: map well-known field keys to structured loyalty fields\nfunction buildLoyaltyObjectFields(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n): Record<string, unknown> {\n\tconst resolve = (key: string) =>\n\t\tvalues[key] ?? fields.find((f) => f.key === key)?.value;\n\tconst points = resolve(\"points\");\n\tconst member = resolve(\"member\");\n\tconst memberId = resolve(\"memberId\");\n\treturn {\n\t\tloyaltyPoints: points == null ? undefined : { balance: { string: points } },\n\t\taccountName: member ?? undefined,\n\t\taccountId: memberId ?? undefined,\n\t};\n}\n\n// Flight: structured boarding data required by Google flightObject\nfunction buildFlightObjectFields(\n\t_pass: Extract<PassConfig, { type: \"flight\" }>,\n\tserialNumber: string,\n\tvalues: Record<string, string | null>,\n\twarnings: string[]\n): Record<string, unknown> {\n\tconst passengerName = values.passengerName;\n\tif (!passengerName) {\n\t\twarnings.push(\n\t\t\t\"Google flight pass: passengerName not set in values — passenger name will be blank\"\n\t\t);\n\t}\n\treturn {\n\t\tpassengerName: passengerName ?? \"\",\n\t\treservationInfo: { confirmationCode: serialNumber },\n\t};\n}\n\n// GiftCard: balance amount with currency\nfunction buildGiftCardObjectFields(\n\tpass: Extract<PassConfig, { type: \"giftCard\" }>,\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>\n): Record<string, unknown> {\n\tconst raw = values.balance ?? fields.find((f) => f.key === \"balance\")?.value;\n\treturn {\n\t\tbalance:\n\t\t\traw == null\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tmicros: String(Math.round(Number.parseFloat(raw) * 1_000_000)),\n\t\t\t\t\t\tcurrencyCode: pass.currency ?? \"USD\",\n\t\t\t\t\t},\n\t};\n}\n\n// Display fields: primary → subheader+header, others → textModulesData, back → infoModuleData\nfunction buildDisplayFields(\n\tfields: FieldDef[],\n\tvalues: Record<string, string | null>,\n\tlocales: PassConfig[\"locales\"]\n): Record<string, unknown> {\n\tconst primaryField = fields.find((f) => f.slot === \"primary\");\n\tconst primaryValue =\n\t\tprimaryField &&\n\t\t(primaryField.key in values\n\t\t\t? values[primaryField.key]\n\t\t\t: primaryField.value);\n\n\tconst textModules = buildTextModules(fields, values, [\"primary\", \"back\"]);\n\n\treturn {\n\t\tsubheader:\n\t\t\tprimaryField && primaryValue != null\n\t\t\t\t? localized(\n\t\t\t\t\t\tprimaryField.label,\n\t\t\t\t\t\t\"en-US\",\n\t\t\t\t\t\ttranslationsFor(primaryField.key, locales)\n\t\t\t\t\t)\n\t\t\t\t: undefined,\n\t\theader:\n\t\t\tprimaryField && primaryValue != null\n\t\t\t\t? localized(\n\t\t\t\t\t\tprimaryValue,\n\t\t\t\t\t\t\"en-US\",\n\t\t\t\t\t\ttranslationsFor(`${primaryField.key}_value`, locales)\n\t\t\t\t\t)\n\t\t\t\t: undefined,\n\t\ttextModulesData: textModules.length > 0 ? textModules : undefined,\n\t\tinfoModuleData: buildInfoModuleData(fields, values),\n\t};\n}\n\n// Build the object body — per-recipient data\nfunction buildObjectBody(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tclassId: string,\n\tobjectId: string,\n\twarnings: string[]\n): Record<string, unknown> {\n\tconst values = createConfig.values ?? {};\n\tconst fields = pass.fields;\n\n\treturn {\n\t\tid: objectId,\n\t\tclassId,\n\t\tstate: \"ACTIVE\",\n\t\tbarcode: createConfig.barcode\n\t\t\t? {\n\t\t\t\t\ttype: toGoogleBarcodeType(createConfig.barcode.format),\n\t\t\t\t\tvalue: createConfig.barcode.value,\n\t\t\t\t\talternateText:\n\t\t\t\t\t\tcreateConfig.barcode.altText ?? createConfig.barcode.value,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tvalidTimeInterval:\n\t\t\tcreateConfig.validFrom || createConfig.expiresAt\n\t\t\t\t? {\n\t\t\t\t\t\tstart: createConfig.validFrom\n\t\t\t\t\t\t\t? { date: createConfig.validFrom }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tend: createConfig.expiresAt\n\t\t\t\t\t\t\t? { date: createConfig.expiresAt }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t// Smart Tap: per-recipient redemption value sent to NFC terminals\n\t\tsmartTapRedemptionValue: createConfig.google?.smartTapRedemptionValue,\n\t\t// Rotating barcode replaces the static barcode when set\n\t\trotatingBarcode: createConfig.google?.rotatingBarcode,\n\t\t// Per-recipient messages\n\t\tmessages: createConfig.google?.messages,\n\t\t...(pass.type === \"loyalty\" && buildLoyaltyObjectFields(fields, values)),\n\t\t...(pass.type === \"flight\" &&\n\t\t\tbuildFlightObjectFields(\n\t\t\t\tpass,\n\t\t\t\tcreateConfig.serialNumber,\n\t\t\t\tvalues,\n\t\t\t\twarnings\n\t\t\t)),\n\t\t...(pass.type === \"giftCard\" &&\n\t\t\tbuildGiftCardObjectFields(pass, fields, values)),\n\t\t// genericObject requires cardTitle in the object body (in addition to the class)\n\t\t...(pass.type === \"generic\" && {\n\t\t\tcardTitle: localized(\n\t\t\t\tpass.name,\n\t\t\t\t\"en-US\",\n\t\t\t\ttranslationsFor(\"name\", pass.locales)\n\t\t\t),\n\t\t}),\n\t\t...buildDisplayFields(fields, values, pass.locales),\n\t};\n}\n\nexport async function generateGooglePass(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: GoogleCredentials\n): Promise<{ pass: string | null; warnings: string[] }> {\n\tconst warnings: string[] = [];\n\n\tvalidateGoogleRequirements(pass);\n\n\tconst privateKey = await importGoogleKey(credentials);\n\n\tconst classType = CLASS_TYPE[pass.type];\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst classId = `${credentials.issuerId}.${pass.id}`;\n\tconst objectId = `${credentials.issuerId}.${createConfig.serialNumber}`;\n\n\tconst classBody = buildClassBody(pass);\n\tawait ensureClass(classType, classId, classBody, credentials, privateKey);\n\n\tconst objectBody = buildObjectBody(\n\t\tpass,\n\t\tcreateConfig,\n\t\tclassId,\n\t\tobjectId,\n\t\twarnings\n\t);\n\n\t// Pluralise the object type key for the JWT payload (e.g. \"loyaltyObject\" → \"loyaltyObjects\")\n\tconst objectsKey = objectType.replace(\"Object\", \"Objects\");\n\n\tconst payload = {\n\t\tiss: credentials.clientEmail,\n\t\taud: \"google\",\n\t\ttyp: \"savetowallet\",\n\t\tiat: Math.floor(Date.now() / 1000),\n\t\tpayload: {\n\t\t\t[objectsKey]: [objectBody],\n\t\t},\n\t};\n\n\t// Sign the \"Add to Google Wallet\" JWT with the service account key\n\tconst { SignJWT } = await import(\"jose\");\n\tconst jwt = await new SignJWT(payload)\n\t\t.setProtectedHeader({ alg: \"RS256\" })\n\t\t.sign(privateKey);\n\n\treturn { pass: jwt, warnings };\n}\n\nexport async function updateGooglePass(\n\tpass: PassConfig,\n\tcreateConfig: CreateConfig,\n\tcredentials: GoogleCredentials\n): Promise<void> {\n\tconst privateKey = await importGoogleKey(credentials);\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst classId = `${credentials.issuerId}.${pass.id}`;\n\tconst objectId = `${credentials.issuerId}.${createConfig.serialNumber}`;\n\n\tconst patch = buildObjectBody(pass, createConfig, classId, objectId, []);\n\n\tawait patchObject(objectType, objectId, patch, credentials, privateKey);\n}\n\nexport async function deleteGooglePass(\n\tpass: PassConfig,\n\tserialNumber: string,\n\tcredentials: GoogleCredentials\n): Promise<void> {\n\tconst privateKey = await importGoogleKey(credentials);\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst objectId = `${credentials.issuerId}.${serialNumber}`;\n\n\tawait deleteObject(objectType, objectId, credentials, privateKey);\n}\n\nexport async function expireGooglePass(\n\tpass: PassConfig,\n\tserialNumber: string,\n\tcredentials: GoogleCredentials\n): Promise<void> {\n\tconst privateKey = await importGoogleKey(credentials);\n\tconst objectType = OBJECT_TYPE[pass.type];\n\tconst objectId = `${credentials.issuerId}.${serialNumber}`;\n\n\tawait patchObject(\n\t\tobjectType,\n\t\tobjectId,\n\t\t{ state: \"EXPIRED\" },\n\t\tcredentials,\n\t\tprivateKey\n\t);\n}\n","import { z } from \"zod\";\n\n// Primitives\n\nconst hexColor = z\n\t.string()\n\t.regex(/^#[0-9a-fA-F]{6}$/, 'must be a 6-digit hex color like \"#1a1a1a\"')\n\t.optional();\n\n// BCP 47 language tag: primary subtag (2-3 lowercase letters) followed by optional subtags.\n// Examples: \"en\", \"en-US\", \"zh-Hans\", \"zh-Hans-CN\", \"es-419\"\nconst BCP47_RE = /^[a-z]{2,3}(-[A-Za-z0-9]+)*$/;\nconst localeCodeSchema = z\n\t.string()\n\t.regex(\n\t\tBCP47_RE,\n\t\t'must be a BCP 47 language tag (e.g. \"en-US\", \"es\", \"zh-Hans\")'\n\t);\n\nconst imageValue = z.union([\n\tz.url(),\n\tz.custom<Uint8Array>((v) => v instanceof Uint8Array),\n]);\n\n// An image can be a single source or an object with resolution variants.\n// base is required when using the object form; retina (@2x) and superRetina (@3x) are optional.\nconst imageSet = z\n\t.union([\n\t\timageValue,\n\t\tz.object({\n\t\t\tbase: imageValue,\n\t\t\tretina: imageValue.optional(),\n\t\t\tsuperRetina: imageValue.optional(),\n\t\t}),\n\t])\n\t.optional();\n\n// Field formatting options\n\nexport const dateStyleSchema = z.enum([\n\t\"none\",\n\t\"short\",\n\t\"medium\",\n\t\"long\",\n\t\"full\",\n]);\nexport const numberStyleSchema = z.enum([\n\t\"decimal\",\n\t\"percent\",\n\t\"scientific\",\n\t\"spellOut\",\n]);\nexport const textAlignmentSchema = z.enum([\n\t\"left\",\n\t\"center\",\n\t\"right\",\n\t\"natural\",\n]);\n\n// FieldDef — a single display field on a pass.\n// slot maps to Apple's field areas; Google uses primary → subheader+header, rest → textModulesData.\nexport const fieldDefSchema = z.object({\n\t// Apple: headerFields / primaryFields / secondaryFields / auxiliaryFields / backFields\n\t// Google: primary → subheader (label) + header (value), others → textModulesData\n\tslot: z.enum([\"header\", \"primary\", \"secondary\", \"auxiliary\", \"back\"]),\n\tkey: z.string(),\n\tlabel: z.string(),\n\tvalue: z.string().optional(),\n\tchangeMessage: z.string().optional(),\n\tdateStyle: dateStyleSchema.optional(),\n\ttimeStyle: dateStyleSchema.optional(),\n\tnumberStyle: numberStyleSchema.optional(),\n\tcurrencyCode: z.string().optional(),\n\ttextAlignment: textAlignmentSchema.optional(),\n\trow: z.union([z.literal(0), z.literal(1)]).optional(),\n});\n\n// Barcode\n// Google supports AZTEC, CODE_39, CODE_128, CODABAR, DATA_MATRIX, EAN_8, EAN_13, ITF_14, PDF_417, QR_CODE, UPC_A and TEXT_ONLY barcodes. Apple only supports PKBarcodeFormatQR, PKBarcodeFormatPDF417, PKBarcodeFormatAztec, and PKBarcodeFormatCode128 formats, but we exclude that since it's not widely supported by barcode scanners.\nexport const barcodeFormatSchema = z.enum([\"QR\", \"PDF417\", \"Aztec\", \"Code128\"]);\n\nexport const barcodeSchema = z.object({\n\tformat: barcodeFormatSchema.default(\"QR\"),\n\tvalue: z.string().min(1, \"barcode.value must not be empty\"),\n\taltText: z.string().optional(),\n});\n\n// Apple-specific options — no cross-platform equivalent\n\n// Bluetooth Low Energy beacon — shows the pass on lock screen when nearby\nconst beaconSchema = z.object({\n\t// Required: device UUID of the Bluetooth Low Energy beacon\n\tproximityUUID: z.uuid(),\n\t// 16-bit major value to narrow the region of the beacon\n\tmajor: z.number().int().min(0).max(65_535).optional(),\n\t// 16-bit minor value to further narrow the region of the beacon\n\tminor: z.number().int().min(0).max(65_535).optional(),\n\t// Text shown on lock screen when the pass becomes relevant near this beacon\n\trelevantText: z.string().optional(),\n});\n\n// Date interval for relevantDates (replaces the deprecated relevantDate)\nconst relevantDateSchema = z.object({\n\tstartDate: z.iso.datetime({\n\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T20:00:00Z\"',\n\t}),\n\tendDate: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T23:00:00Z\"',\n\t\t})\n\t\t.optional(),\n});\n\n// Base Apple options — applicable to all pass types\nconst appleOptionsSchema = z.object({\n\t// Required by Apple Wallet — validated at create() time\n\ticon: imageSet,\n\t// Apple-only image slots\n\tbackground: imageSet,\n\tthumbnail: imageSet,\n\tfooter: imageSet,\n\t// Apple: description (shown in Wallet list view, defaults to pass name)\n\tdescription: z.string().optional(),\n\t// Apple: logoText (text shown next to the logo, not for poster event tickets)\n\tlogoText: z.string().optional(),\n\t// Apple: foregroundColor (text color), labelColor (label text color)\n\tforegroundColor: hexColor,\n\tlabelColor: hexColor,\n\t// Deprecated — use relevantDates instead\n\trelevantDate: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T20:00:00Z\"',\n\t\t})\n\t\t.optional(),\n\t// Date intervals during which the pass is relevant (replaces relevantDate)\n\trelevantDates: z.array(relevantDateSchema).optional(),\n\t// Groups passes of the same type into a single stack in Wallet\n\tgroupingIdentifier: z.string().optional(),\n\t// Disables the glossy shine effect rendered over strip images\n\tsuppressStripShine: z.boolean().optional(),\n\t// NFC payload — message is passed to the contactless reader on tap\n\tnfc: z\n\t\t.object({\n\t\t\tmessage: z.string(),\n\t\t\t// Public key used to encrypt the NFC payload (Base64-encoded X.509)\n\t\t\tencryptionPublicKey: z.string().optional(),\n\t\t})\n\t\t.optional(),\n\t// Deep link opened when the user taps \"Open\" on the pass (requires associatedStoreIdentifiers)\n\tappLaunchURL: z.url().optional(),\n\t// App Store app IDs — adds an \"Open\" button that launches your app from Wallet\n\tassociatedStoreIdentifiers: z.array(z.number().int().positive()).optional(),\n\t// Maximum distance in meters from a location at which the pass is shown\n\tmaxDistance: z.number().positive().optional(),\n\t// Removes the Share button from the back of the pass\n\tsharingProhibited: z.boolean().optional(),\n\t// Arbitrary JSON passed to your companion app via NFC or URL — not shown to users\n\tuserInfo: z.record(z.string(), z.unknown()).optional(),\n\t// URL for a web service that receives push update notifications for this pass\n\twebServiceURL: z.url().optional(),\n\t// Authentication token sent with web service requests (required with webServiceURL)\n\tauthenticationToken: z.string().min(16).optional(),\n\t// Bluetooth LE beacons that trigger lock screen relevance\n\tbeacons: z.array(beaconSchema).optional(),\n});\n\n// Event-specific Apple options — includes poster event ticket fields\nconst appleEventOptionsSchema = appleOptionsSchema.extend({\n\t// Text next to the logo on poster event tickets (use logoText for standard event tickets)\n\teventLogoText: z.string().optional(),\n\t// Background color for the footer bar on poster event tickets\n\tfooterBackgroundColor: hexColor,\n\t// Disables the header darkening gradient on poster event tickets\n\tsuppressHeaderDarkening: z.boolean().optional(),\n\t// Derives foreground and label colors from the background image (poster event tickets only)\n\tuseAutomaticColors: z.boolean().optional(),\n\t// Schemes to validate the pass against (falls back to designed type if all fail)\n\tpreferredStyleSchemes: z.array(z.string()).optional(),\n\t// Additional App Store app IDs shown in the event guide (poster event tickets only)\n\tauxiliaryStoreIdentifiers: z.array(z.number().int().positive()).optional(),\n\t// Poster event ticket action URLs\n\taccessibilityURL: z.url().optional(),\n\taddOnURL: z.url().optional(),\n\tbagPolicyURL: z.url().optional(),\n\tcontactVenueEmail: z.email().optional(),\n\tcontactVenuePhoneNumber: z.string().optional(),\n\tcontactVenueWebsite: z.url().optional(),\n\tdirectionsInformationURL: z.url().optional(),\n\tmerchandiseURL: z.url().optional(),\n\torderFoodURL: z.url().optional(),\n\tparkingInformationURL: z.url().optional(),\n\tpurchaseParkingURL: z.url().optional(),\n\tsellURL: z.url().optional(),\n\ttransferURL: z.url().optional(),\n\ttransitInformationURL: z.url().optional(),\n});\n\n// Flight-specific Apple options — boarding pass action URLs\nconst appleFlightOptionsSchema = appleOptionsSchema.extend({\n\tchangeSeatURL: z.url().optional(),\n\tentertainmentURL: z.url().optional(),\n\tmanagementURL: z.url().optional(),\n\tpurchaseAdditionalBaggageURL: z.url().optional(),\n\tpurchaseLoungeAccessURL: z.url().optional(),\n\tpurchaseWifiURL: z.url().optional(),\n\tregisterServiceAnimalURL: z.url().optional(),\n\treportLostBagURL: z.url().optional(),\n\trequestWheelchairURL: z.url().optional(),\n\ttrackBagsURL: z.url().optional(),\n\ttransitProviderEmail: z.email().optional(),\n\ttransitProviderPhoneNumber: z.string().optional(),\n\ttransitProviderWebsiteURL: z.url().optional(),\n\tupgradeURL: z.url().optional(),\n});\n\n// Google-specific sub-schemas\n\n// Info message shown inside the pass view (e.g. alerts, promotions, expiry warnings).\n// Class-level messages appear for all holders; object-level messages are per-recipient.\nconst googleMessageSchema = z.object({\n\theader: z.string(),\n\tbody: z.string(),\n\tid: z.string().optional(),\n\t// TEXT (default), expireNotification, or TEXT_AND_NOTIFY (push + in-app)\n\tmessageType: z\n\t\t.enum([\"TEXT\", \"expireNotification\", \"TEXT_AND_NOTIFY\"])\n\t\t.default(\"TEXT\"),\n\tdisplayInterval: z\n\t\t.object({\n\t\t\tstart: z.object({ date: z.iso.datetime() }).optional(),\n\t\t\tend: z.object({ date: z.iso.datetime() }).optional(),\n\t\t})\n\t\t.optional(),\n});\n\n// TOTP-based rotating barcode — generates a new barcode value every periodMillis ms.\n// valuePattern uses {totp_value_hex} or {totp_value_decimal} as the rotating placeholder.\nconst googleRotatingBarcodeSchema = z.object({\n\ttype: z.enum([\"QR_CODE\", \"PDF_417\", \"AZTEC\", \"CODE_128\"]).default(\"QR_CODE\"),\n\t// Pattern containing the TOTP placeholder, e.g. \"https://example.com/redeem/{totp_value_hex}\"\n\tvaluePattern: z\n\t\t.string()\n\t\t.min(1, \"rotatingBarcode.valuePattern must not be empty\"),\n\ttotpDetails: z.object({\n\t\tperiodMillis: z.string().default(\"30000\"),\n\t\talgorithm: z.literal(\"TOTP_SHA1\").default(\"TOTP_SHA1\"),\n\t\tparameters: z.array(\n\t\t\tz.object({\n\t\t\t\tkey: z.string(),\n\t\t\t\tvalueLength: z.number().int().min(1).max(8),\n\t\t\t})\n\t\t),\n\t}),\n\trenderEncoding: z.literal(\"UTF_8\").optional(),\n});\n\n// App deep link shown on the pass — supports Android, iOS, and web targets.\nconst googleAppLinkInfoSchema = z.object({\n\t// Deep link URI (e.g. intent:// for Android, https:// scheme for iOS universal links)\n\turi: z.url(),\n\ttitle: z.string().optional(),\n\tdescription: z.string().optional(),\n\tlogoUrl: z.url().optional(),\n});\n\nconst googleAppLinkDataSchema = z.object({\n\tandroid: googleAppLinkInfoSchema.optional(),\n\tios: googleAppLinkInfoSchema.optional(),\n\tweb: googleAppLinkInfoSchema.optional(),\n});\n\n// Google-specific options — no cross-platform equivalent\n\nconst googleOptionsSchema = z.object({\n\t// Google: wideLogo — wider variant of the logo shown on some pass layouts\n\twideLogo: z.url().optional(),\n\t// Google: issuerName — displayed as the pass issuer\n\tissuerName: z.string().optional(),\n\t// Required by Google for loyalty, event, flight, coupon, and giftCard classes.\n\t// \"UNDER_REVIEW\" is the default for new classes; set to \"APPROVED\" once approved in the console.\n\treviewStatus: z\n\t\t.enum([\"UNDER_REVIEW\", \"APPROVED\", \"REJECTED\", \"DRAFT\"])\n\t\t.default(\"UNDER_REVIEW\"),\n\t// Smart Tap NFC — enable tap-to-redeem at supported terminals\n\tenableSmartTap: z.boolean().optional(),\n\t// Smart Tap issuer IDs allowed to redeem this pass (required when enableSmartTap is true)\n\tredemptionIssuers: z.array(z.string()).optional(),\n\t// Class-level info messages shown inside the pass view for all holders\n\tmessages: z.array(googleMessageSchema).optional(),\n\t// App link shown on the pass to open a companion app\n\tappLinkData: googleAppLinkDataSchema.optional(),\n});\n\n// Location — geo-relevance for lock screen suggestions.\n// Apple: locations[] with longitude, latitude, altitude?, relevantText?\n// Google: locations[] with latitude, longitude (altitude and relevantText ignored)\nexport const locationSchema = z.object({\n\tlatitude: z.number(),\n\tlongitude: z.number(),\n\t// Apple: altitude in meters above sea level (optional)\n\taltitude: z.number().optional(),\n\t// Apple: text shown on lock screen when the pass becomes relevant near this location\n\t// Google: no equivalent — ignored\n\trelevantText: z.string().optional(),\n});\n\n// Base pass config — shared across all pass types\n\nconst basePassSchema = z.object({\n\t// Apple: description (pass name shown in Wallet list)\n\t// Google: cardTitle\n\tid: z.string().min(1, \"PassConfig missing: id\"),\n\tname: z.string().min(1, \"PassConfig missing: name\"),\n\n\t// Apple: backgroundColor\n\t// Google: hexBackgroundColor\n\tcolor: hexColor,\n\n\t// Shared logo image.\n\t// Apple: logo (accepts bytes or URL)\n\t// Google: logo (URL only — validated at create() time)\n\tlogo: imageSet,\n\n\t// Shared banner image — same visual purpose, different placement per platform.\n\t// Apple: strip (shown behind the fields, top of pass)\n\t// Google: hero (shown at the bottom of the pass)\n\tbanner: imageSet,\n\n\t// Geo-relevance — show pass on lock screen when near these coordinates.\n\t// Apple: locations[] — up to 10 entries\n\t// Google: locations[] — up to 20 entries\n\tlocations: z.array(locationSchema).optional(),\n\n\t// Display fields — use field.primary(), field.secondary(), etc.\n\t// Apple: maps to headerFields / primaryFields / secondaryFields / auxiliaryFields / backFields\n\t// Google: primary → subheader + header, all others → textModulesData\n\tfields: z.array(fieldDefSchema).default([]),\n\n\t// Translations for field labels and pass-level strings.\n\t// Keys are field keys (matching field.key) or the reserved key \"name\" for the pass title.\n\t// Use \"fieldKey_value\" to translate a field's static default value.\n\t// Apple: generates {language}.lproj/pass.strings files in the .pkpass zip.\n\t// Google: adds translatedValues to LocalizedString objects.\n\tlocales: z\n\t\t.record(localeCodeSchema, z.record(z.string(), z.string()))\n\t\t.optional(),\n\n\tapple: appleOptionsSchema.optional(),\n\tgoogle: googleOptionsSchema.optional(),\n});\n\n// Per-type pass configs\n// Each type adds structured properties that providers need beyond display fields.\n\nexport const loyaltyPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"loyalty\"),\n\t// No extra structured props — Google maps field keys by convention:\n\t// \"points\" → loyaltyPoints, \"member\" → accountName, \"memberId\" → accountId\n});\n\nexport const eventPassSchema = basePassSchema\n\t.extend({\n\t\ttype: z.literal(\"event\"),\n\t\t// Apple: relevant date for lock screen suggestion\n\t\t// Google: localScheduledStartDateTime (required for eventTicketClass)\n\t\tstartsAt: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T20:00:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t\tendsAt: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T23:00:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t})\n\t.extend({ apple: appleEventOptionsSchema.optional() });\n\n// Flight covers air, train, bus, and boat boarding passes.\nexport const flightPassSchema = basePassSchema\n\t.extend({\n\t\ttype: z.literal(\"flight\"),\n\t\t// Apple: transitType (required for boardingPass layout, defaults to \"air\")\n\t\t// Google: inferred from flightHeader\n\t\ttransitType: z.enum([\"air\", \"train\", \"bus\", \"boat\"]).optional(),\n\t\t// Required by Google flightClass — IATA codes and datetimes\n\t\t// Apple: shown as display fields; provider maps these to the correct slots\n\t\tcarrier: z\n\t\t\t.string()\n\t\t\t.regex(\n\t\t\t\t/^[A-Z0-9]{2}$/,\n\t\t\t\t'must be a 2-character IATA carrier code e.g. \"AA\"'\n\t\t\t)\n\t\t\t.optional(),\n\t\tflightNumber: z\n\t\t\t.string()\n\t\t\t.regex(/^\\d{1,4}[A-Z]?$/, 'must be a flight number e.g. \"100\" or \"1234A\"')\n\t\t\t.optional(),\n\t\torigin: z\n\t\t\t.string()\n\t\t\t.regex(/^[A-Z]{3}$/, 'must be a 3-letter IATA airport code e.g. \"JFK\"')\n\t\t\t.optional(),\n\t\tdestination: z\n\t\t\t.string()\n\t\t\t.regex(/^[A-Z]{3}$/, 'must be a 3-letter IATA airport code e.g. \"LAX\"')\n\t\t\t.optional(),\n\t\tdeparture: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T08:00:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t\tarrival: z.iso\n\t\t\t.datetime({\n\t\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-06-01T11:30:00Z\"',\n\t\t\t})\n\t\t\t.optional(),\n\t\t// passengerName is per-recipient — pass in values at create() time\n\t})\n\t.extend({ apple: appleFlightOptionsSchema.optional() });\n\nexport const couponPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"coupon\"),\n\t// Google: redemptionChannel (required for offerClass)\n\t// Apple: no equivalent — ignored\n\t// Defaults to \"both\" — Google requires this field for offerClass\n\tredemptionChannel: z.enum([\"online\", \"instore\", \"both\"]).default(\"both\"),\n});\n\nexport const giftCardPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"giftCard\"),\n\t// Google: balance.currencyCode (needed to format the balance amount)\n\t// Apple: use currencyCode on the balance field definition instead\n\tcurrency: z\n\t\t.string()\n\t\t.regex(/^[A-Z]{3}$/, 'must be a 3-letter ISO 4217 currency code e.g. \"USD\"')\n\t\t.optional(),\n});\n\nexport const genericPassSchema = basePassSchema.extend({\n\ttype: z.literal(\"generic\"),\n\t// No extra structured props — full control via fields\n});\n\n// Discriminated union — the full PassConfig type\n\nexport const passConfigSchema = z.discriminatedUnion(\"type\", [\n\tloyaltyPassSchema,\n\teventPassSchema,\n\tflightPassSchema,\n\tcouponPassSchema,\n\tgiftCardPassSchema,\n\tgenericPassSchema,\n]);\n\n// Create config — per-recipient values supplied at issue time\n\nexport const createConfigSchema = z.object({\n\tserialNumber: z.string().min(1, \"CreateConfig missing: serialNumber\"),\n\tbarcode: barcodeSchema.optional(),\n\t// Apple: no equivalent — ignored\n\t// Google: validTimeInterval.start\n\tvalidFrom: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2024-01-01T00:00:00Z\"',\n\t\t})\n\t\t.optional(),\n\texpiresAt: z.iso\n\t\t.datetime({\n\t\t\tmessage: 'must be an ISO datetime e.g. \"2025-01-01T00:00:00Z\"',\n\t\t})\n\t\t.optional(),\n\t// Per-recipient field values. null hides the field for this recipient.\n\tvalues: z.record(z.string(), z.string().nullable()).optional(),\n\t// Apple-specific per-recipient options.\n\tapple: z\n\t\t.object({\n\t\t\t// Mark this issued pass as void. Displays a \"Void\" banner on the pass.\n\t\t\t// For Google, use pass.expire() instead — it transitions state via the API.\n\t\t\tvoided: z.boolean().optional(),\n\t\t})\n\t\t.optional(),\n\t// Google-specific per-recipient options.\n\tgoogle: z\n\t\t.object({\n\t\t\t// Smart Tap NFC value for this specific pass holder (required when enableSmartTap is true)\n\t\t\tsmartTapRedemptionValue: z.string().optional(),\n\t\t\t// TOTP rotating barcode — replaces the static barcode for this pass holder\n\t\t\trotatingBarcode: googleRotatingBarcodeSchema.optional(),\n\t\t\t// Per-recipient info messages shown inside the pass view\n\t\t\tmessages: z.array(googleMessageSchema).optional(),\n\t\t})\n\t\t.optional(),\n});\n\n// Inferred types\n\n// Common BCP 47 language tags — autocomplete hints while still accepting any valid string.\ntype CommonLocaleCode =\n\t| \"en\"\n\t| \"en-US\"\n\t| \"en-GB\"\n\t| \"en-CA\"\n\t| \"en-AU\"\n\t| \"es\"\n\t| \"es-ES\"\n\t| \"es-MX\"\n\t| \"es-419\"\n\t| \"fr\"\n\t| \"fr-FR\"\n\t| \"fr-CA\"\n\t| \"de\"\n\t| \"de-DE\"\n\t| \"de-AT\"\n\t| \"it\"\n\t| \"it-IT\"\n\t| \"pt\"\n\t| \"pt-BR\"\n\t| \"pt-PT\"\n\t| \"ja\"\n\t| \"ja-JP\"\n\t| \"ko\"\n\t| \"ko-KR\"\n\t| \"zh\"\n\t| \"zh-CN\"\n\t| \"zh-TW\"\n\t| \"zh-Hans\"\n\t| \"zh-Hant\"\n\t| \"ar\"\n\t| \"nl\"\n\t| \"ru\"\n\t| \"sv\"\n\t| \"da\"\n\t| \"nb\"\n\t| \"fi\"\n\t| \"pl\"\n\t| \"tr\"\n\t| \"hi\"\n\t| \"id\"\n\t| \"th\"\n\t| (string & {});\n\n// A BCP 47 language tag. Common values are suggested by autocomplete; any valid tag is accepted.\nexport type LocaleCode = CommonLocaleCode;\n\n// Keys are field keys, \"name\" for the pass title, or \"fieldKey_value\" for static field values.\nexport type TranslationMap = Record<string, string>;\n\nexport type Locales = Record<LocaleCode, TranslationMap>;\nexport type Location = z.infer<typeof locationSchema>;\nexport type ImageSource = string | Uint8Array;\nexport type ImageSet =\n\t| ImageSource\n\t| { base: ImageSource; retina?: ImageSource; superRetina?: ImageSource };\nexport type BarcodeFormat = z.infer<typeof barcodeFormatSchema>;\nexport type Barcode = z.infer<typeof barcodeSchema>;\nexport type DateStyle = z.infer<typeof dateStyleSchema>;\nexport type NumberStyle = z.infer<typeof numberStyleSchema>;\nexport type TextAlignment = z.infer<typeof textAlignmentSchema>;\nexport type FieldDef = z.infer<typeof fieldDefSchema>;\n\n// Per-type field keys — TypeScript suggests these in autocomplete while still accepting any string.\n// The `string & {}` trick preserves suggestions without restricting the type.\ntype FieldDefWith<K extends string> = Omit<FieldDef, \"key\"> & { key: K };\n\ntype LoyaltyFieldKey =\n\t| \"points\"\n\t| \"tier\"\n\t| \"member\"\n\t| \"memberId\"\n\t| (string & {});\ntype EventFieldKey =\n\t| \"date\"\n\t| \"venue\"\n\t| \"seat\"\n\t| \"row\"\n\t| \"section\"\n\t| \"gate\"\n\t| (string & {});\ntype FlightFieldKey =\n\t| \"gate\"\n\t| \"seat\"\n\t| \"boardingClass\"\n\t| \"boardingZone\"\n\t| (string & {});\ntype CouponFieldKey =\n\t| \"offer\"\n\t| \"discount\"\n\t| \"code\"\n\t| \"expires\"\n\t| \"terms\"\n\t| (string & {});\ntype GiftCardFieldKey = \"balance\" | \"pin\" | \"initialValue\" | (string & {});\n\nexport type LoyaltyPassConfig = Omit<\n\tz.infer<typeof loyaltyPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<LoyaltyFieldKey>[] };\nexport type EventPassConfig = Omit<\n\tz.infer<typeof eventPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<EventFieldKey>[] };\nexport type FlightPassConfig = Omit<\n\tz.infer<typeof flightPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<FlightFieldKey>[] };\nexport type CouponPassConfig = Omit<\n\tz.infer<typeof couponPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<CouponFieldKey>[] };\nexport type GiftCardPassConfig = Omit<\n\tz.infer<typeof giftCardPassSchema>,\n\t\"fields\"\n> & { fields: FieldDefWith<GiftCardFieldKey>[] };\nexport type GenericPassConfig = z.infer<typeof genericPassSchema>;\nexport type PassConfig = z.infer<typeof passConfigSchema>;\nexport type CreateConfig = z.infer<typeof createConfigSchema>;\nexport type GooglePassMessage = z.infer<typeof googleMessageSchema>;\nexport type RotatingBarcode = z.infer<typeof googleRotatingBarcodeSchema>;\nexport type AppLinkData = z.infer<typeof googleAppLinkDataSchema>;\n","import { WalletError } from \"./errors\";\nimport { generateApplePass } from \"./providers/apple/index\";\nimport {\n\tdeleteGooglePass,\n\texpireGooglePass,\n\tgenerateGooglePass,\n\tupdateGooglePass,\n} from \"./providers/google/index\";\nimport type { IssuedPass, WalletCredentials } from \"./types/credentials\";\nimport type { CreateConfig, FieldDef, PassConfig } from \"./types/schemas\";\nimport { createConfigSchema, passConfigSchema } from \"./types/schemas\";\n\n// Field builder — use these to define display fields on any pass type.\n\ntype FieldOptions = Omit<FieldDef, \"slot\" | \"key\" | \"label\">;\n\n// A string shorthand sets value directly; an object passes all options through.\ntype FieldArg = string | FieldOptions;\n\nfunction resolveOptions(arg: FieldArg | undefined): FieldOptions | undefined {\n\tif (arg === undefined) {\n\t\treturn undefined;\n\t}\n\treturn typeof arg === \"string\" ? { value: arg } : arg;\n}\n\n/**\n * Builders for pass display fields. Pass the result into the `fields` array\n * of any pass config.\n *\n * The third argument is either a string (shorthand for `value`) or a full\n * {@link FieldDef} options object for formatting, alignment, and more.\n *\n * @example\n * fields: [\n * field.primary(\"points\", \"Points\", \"1 250\"),\n * field.secondary(\"tier\", \"Tier\", \"Gold\"),\n * field.back(\"terms\", \"Terms\", { value: \"No refunds.\" }),\n * ]\n */\nexport const field = {\n\t/**\n\t * Top-right corner of the pass. Space is limited — use at most one field.\n\t *\n\t * Apple → `headerFields`. Google → `textModulesData`.\n\t */\n\theader: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"header\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/**\n\t * Large, prominent area below the logo.\n\t *\n\t * Apple → `primaryFields`. Google → `subheader` (label) + `header` (value).\n\t * On boarding passes, Apple renders a transit icon between the two primary fields,\n\t * so place departure on the left and arrival on the right.\n\t */\n\tprimary: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"primary\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/**\n\t * Row below the primary area.\n\t *\n\t * Apple → `secondaryFields`. Google → `textModulesData`.\n\t */\n\tsecondary: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"secondary\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/**\n\t * Row below secondary. Supports two rows — pass `{ row: 0 }` or `{ row: 1 }` to assign.\n\t *\n\t * Apple → `auxiliaryFields`. Google → `textModulesData`.\n\t */\n\tauxiliary: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"auxiliary\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n\t/**\n\t * Back of the pass — visible only when the user flips it over.\n\t * Good for terms, redemption instructions, or contact info.\n\t *\n\t * Apple → `backFields`. Google → `infoModuleData`.\n\t */\n\tback: (key: string, label: string, arg?: FieldArg): FieldDef => ({\n\t\tslot: \"back\",\n\t\tkey,\n\t\tlabel,\n\t\t...resolveOptions(arg),\n\t}),\n};\n\n// Validation\n\nfunction validatePassConfig(config: PassConfig): void {\n\tconst result = passConfigSchema.safeParse(config);\n\tif (!result.success) {\n\t\tthrow new WalletError(\n\t\t\t\"PASS_CONFIG_INVALID\",\n\t\t\tresult.error.issues[0]?.message\n\t\t);\n\t}\n}\n\nfunction validateCreateConfig(config: CreateConfig): void {\n\tconst result = createConfigSchema.safeParse(config);\n\tif (!result.success) {\n\t\tthrow new WalletError(\n\t\t\t\"CREATE_CONFIG_INVALID\",\n\t\t\tresult.error.issues[0]?.message\n\t\t);\n\t}\n}\n\n// Pass\n\n/**\n * A configured pass template. Obtain one from {@link Wallet} rather than\n * constructing directly.\n *\n * Config is validated at construction time — a {@link WalletError} with code\n * `PASS_CONFIG_INVALID` is thrown immediately if anything is wrong.\n */\nexport class Pass {\n\tprivate readonly config: PassConfig;\n\tprivate readonly credentials: WalletCredentials;\n\n\tconstructor(config: PassConfig, credentials: WalletCredentials) {\n\t\t// Validate immediately so misconfiguration is surfaced at construction time,\n\t\t// not deferred until the first create().\n\t\tvalidatePassConfig(config);\n\t\tthis.config = config;\n\t\tthis.credentials = credentials;\n\t}\n\n\t/**\n\t * Issue a pass to a recipient. Runs both providers in parallel.\n\t *\n\t * Returns an {@link IssuedPass} with:\n\t * - `apple` — a `.pkpass` `Uint8Array` ready to serve, or `null` if Apple credentials were omitted.\n\t * - `google` — a signed JWT for the Google Wallet save link, or `null` if Google credentials were omitted.\n\t * - `warnings` — non-fatal notices (e.g. a missing optional image).\n\t *\n\t * @throws {WalletError} `CREATE_CONFIG_INVALID` if `createConfig` fails validation.\n\t */\n\tasync create(createConfig: CreateConfig): Promise<IssuedPass> {\n\t\tvalidateCreateConfig(createConfig);\n\n\t\t// Both providers run independently — a Google API failure won't block the Apple pass.\n\t\tconst [appleResult, googleResult] = await Promise.allSettled([\n\t\t\tthis.credentials.apple\n\t\t\t\t? generateApplePass(this.config, createConfig, this.credentials.apple)\n\t\t\t\t: Promise.resolve({ pass: null, warnings: [] as string[] }),\n\t\t\tthis.credentials.google\n\t\t\t\t? generateGooglePass(this.config, createConfig, this.credentials.google)\n\t\t\t\t: Promise.resolve({ pass: null, warnings: [] as string[] }),\n\t\t]);\n\n\t\tif (appleResult.status === \"rejected\") {\n\t\t\tthrow appleResult.reason;\n\t\t}\n\t\tif (googleResult.status === \"rejected\") {\n\t\t\tthrow googleResult.reason;\n\t\t}\n\n\t\treturn {\n\t\t\tapple: appleResult.value.pass,\n\t\t\tgoogle: googleResult.value.pass,\n\t\t\twarnings: [...appleResult.value.warnings, ...googleResult.value.warnings],\n\t\t};\n\t}\n\n\t/**\n\t * Push updated field values to an already-issued pass.\n\t *\n\t * Google: PATCHes the object via the Wallet REST API (the pass must have been\n\t * saved to a wallet first). Apple: no-op — Apple passes update when the holder\n\t * re-downloads the pass via your web service.\n\t */\n\tasync update(createConfig: CreateConfig): Promise<void> {\n\t\tvalidateCreateConfig(createConfig);\n\t\tif (this.credentials.google) {\n\t\t\tawait updateGooglePass(\n\t\t\t\tthis.config,\n\t\t\t\tcreateConfig,\n\t\t\t\tthis.credentials.google\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Permanently delete a pass.\n\t *\n\t * Google: removes the object via the Wallet REST API.\n\t * Apple: no-op — Apple passes cannot be remotely deleted; use {@link expire} to invalidate them.\n\t */\n\tasync delete(serialNumber: string): Promise<void> {\n\t\tif (this.credentials.google) {\n\t\t\tawait deleteGooglePass(\n\t\t\t\tthis.config,\n\t\t\t\tserialNumber,\n\t\t\t\tthis.credentials.google\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Mark a pass as expired / invalid.\n\t *\n\t * Google: transitions the object state to `EXPIRED` via the Wallet REST API.\n\t * Apple: no-op — Apple passes expire automatically when `expiresAt` is reached,\n\t * or you can set `apple.voided: true` at issue time via {@link create}.\n\t */\n\tasync expire(serialNumber: string): Promise<void> {\n\t\tif (this.credentials.google) {\n\t\t\tawait expireGooglePass(\n\t\t\t\tthis.config,\n\t\t\t\tserialNumber,\n\t\t\t\tthis.credentials.google\n\t\t\t);\n\t\t}\n\t}\n}\n","import { Pass } from \"./pass\";\nimport type { WalletCredentials } from \"./types/credentials\";\nimport type {\n\tCouponPassConfig,\n\tEventPassConfig,\n\tFlightPassConfig,\n\tGenericPassConfig,\n\tGiftCardPassConfig,\n\tLoyaltyPassConfig,\n} from \"./types/schemas\";\n\n/**\n * Entry point for building passes. Construct once with your credentials,\n * then call the pass-type methods to get a {@link Pass} you can issue.\n *\n * Omit a provider's credentials to skip that platform entirely —\n * `apple` and `google` are both optional.\n *\n * @example\n * const wallet = new Wallet({ apple: appleCredentials, google: googleCredentials });\n * const result = await wallet.loyalty({ id: \"rewards\", name: \"Rewards Card\", fields: [] })\n * .create({ serialNumber: \"user-123\" });\n */\nexport class Wallet {\n\tprivate readonly credentials: WalletCredentials;\n\n\tconstructor(credentials: WalletCredentials) {\n\t\tthis.credentials = credentials;\n\t}\n\n\t/** Create a loyalty / rewards card pass. */\n\tloyalty(config: Omit<LoyaltyPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"loyalty\" }, this.credentials);\n\t}\n\n\t/** Create an event ticket pass. */\n\tevent(config: Omit<EventPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"event\" }, this.credentials);\n\t}\n\n\t/**\n\t * Create a boarding pass. Covers air, train, bus, and boat transit.\n\t *\n\t * Apple boarding passes render a transit icon between the two `primary` fields,\n\t * so use `field.primary()` for the departure and arrival locations.\n\t */\n\tflight(config: Omit<FlightPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"flight\" }, this.credentials);\n\t}\n\n\t/** Create a coupon / offer pass. */\n\tcoupon(config: Omit<CouponPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"coupon\" }, this.credentials);\n\t}\n\n\t/** Create a gift card pass. */\n\tgiftCard(config: Omit<GiftCardPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"giftCard\" }, this.credentials);\n\t}\n\n\t/** Create a generic pass for anything that doesn't fit the other types. */\n\tgeneric(config: Omit<GenericPassConfig, \"type\">): Pass {\n\t\treturn new Pass({ ...config, type: \"generic\" }, this.credentials);\n\t}\n}\n"]}
|