Passbook: inside a pass

Related posts about Passbook:


After introducing Passbook here, this post will show what is really a passbook pass.

A passbook pass is just a compressed file, a .zip archive, but with a “.pkpass” extension. This compressed pass must be cryptographically signed.

Zip to pass

The .pkpass includes 3 necessary files:

  • manifest.json
    The manifest is a JSON file that lists the archives in the .pkpass, calculate the SHA-1 hash of their content and store the hash in a dictionary. The manifest file itself and the signature file are not included. An example of the manifest file content is:

    {"pass.json":"41ea636799de90475196cdf17f879653aa256e61",
    "icon.png":"7bec35c1b3f926c50df1bbc6a7a62870cdd47aea",
    "icon@2x.png":"a3603d48dfb142efa86577b4143c06c94d77b087"}
  • pass.json
    A JSON dictionary that defines the pass. It describes the type of pass and the content of its fields. The JSON structure is described in detail in the Apple developer library.
  • signature
    This file is a detached PKCS #7 signature of the manifest file. The signature is created using the private key associated with our signing certificate and using the WWDR intermediate certificate. The Worldwide Developer Relations (WWDR) certificate can be downloaded from here.

The zip archive also contains the images of the pass. The images are included inside the pass using standard names as we will see in another post.

To support localization, the structure of the .pkpass archive changes. For each supported location, it is necessary to create a subfolder to separate the files that depend on the location. For example create a subfolder named “es.lproj” and create a strings file named “pass.strings” that contains the Spanish strings. These strings will be referenced from the pass.

The directory structure:
Structure

Share Button

2 Comments

  1. Great post, I made my first pass and works fine, just a doubt, when you internationalize a pass, is it necessary to include the pass.strings files within manifest.json? If so, what is the right way to do it? Thanks!

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.