Feature: PKPASS Reader
Purpose
The project must read an Apple Wallet pass: a .pkpass file is a ZIP whose pass.json describes a pass, with manifest.json recording a SHA-1 digest per member and signature carrying a detached PKCS#7 signature over the manifest.
Requirements
PKPASS-READER-R001— The reader must read a.pkpassas a ZIP archive, honouring each member’s own compression method, both stored and deflate.PKPASS-READER-R002— The reader must verify each extracted member against the CRC in the central directory.PKPASS-READER-R003— The reader must report whetherpass.json,manifest.json, andsignatureare present.PKPASS-READER-R004— The reader must fail with a message when the file is not a readable ZIP, or whenpass.jsonis absent or not a JSON object.PKPASS-READER-R005— The reader must readformatVersionand the required top-level keyspassTypeIdentifier,serialNumber,teamIdentifier,organizationName, anddescription.PKPASS-READER-R006— The reader must read the optional top-level keyslogoText,relevantDate,expirationDate,voided,groupingIdentifier,sharingProhibited,webServiceURL,authenticationToken, andnfc.PKPASS-READER-R007— The reader must determine the pass style from exactly one ofgeneric,storeCard,coupon,eventTicket, orboardingPass, and readtransitTypefrom a boarding pass.PKPASS-READER-R008— The reader must read the field groupsheaderFields,primaryFields,secondaryFields,auxiliaryFields, andbackFields, keeping the group each field came from.PKPASS-READER-R009— The reader must read a field’skey,label,value,attributedValue,changeMessage,textAlignment,dateStyle,timeStyle,currencyCode,numberStyle, androw.PKPASS-READER-R010— The reader must read both the legacy singularbarcodeobject and thebarcodesarray, and must prefer the array when both are present.PKPASS-READER-R011— The reader must parse a colour written asrgb(r,g,b)orrgba(r,g,b,a), including the spaces real passes put after the commas, and as#RGB,#RRGGBB, or#AARRGGBBwhere the alpha channel leads the four-channel hex form.PKPASS-READER-R012— The reader must record an unreadable colour as a warning rather than failing the pass.PKPASS-READER-R013— The reader must readlocationsentries (latitude, longitude, and relevantText).PKPASS-READER-R014— The reader must readmanifest.jsoninto member-name and digest pairs.PKPASS-READER-R015— The reader must list the archive’s member names and identify the members that are PNG images.PKPASS-READER-R016— The verifier must check every manifest entry’s SHA-1 digest against the member’s bytes and report missing and mismatched entries separately.PKPASS-READER-R017— The verifier must name a member that is present in the archive but in no manifest entry.PKPASS-READER-R018— The verifier must check the detached PKCS#7 signature overmanifest.jsonwhenopensslis available, and must distinguish the statusesabsent,verified,invalid, andunavailable.PKPASS-READER-R019— The reader must return a pass with warnings rather than refusing a structurally readable pass, so a viewer can still show it.PKPASS-READER-R020— No public interface may throw.
Behavior
- Given the real-world color form
rgb(86, 39, 126), the three channels are read as 86, 39, and 126. - Given a pass that uses the legacy singular
barcode, exactly one barcode is reported. - Given a pass whose members mix stored and deflated entries, every member extracts.
- Given a member whose bytes no longer match its manifest digest, the entry is reported as mismatched and the pass still reads.
- Given a pass with no
signaturemember,hasSignatureis false and the signature status isabsent. - Given a file that is not a ZIP, the reader fails with a message and no partial pass.
Dependencies
- None.