iOS Apple passbook library

$ npm install passbookster

To create a pass, you first create a pass template which holds information that remains static for each subsequent pass created from the template. Then you can create a Pass by providing the rest of the fields and images.

A Pass can act as a stream, or as a plain-callback async operation. Performance-wise you should use the stream interface, when its possible to pipe the pass to another stream. (eg store to filesystem or Amazon S3)

You'll also need the Apple Worldwide Developer Relations (WWDR) certficate and your pass certificate.

openssl must be installed, and inside the $PATH. It is used internally to calculate the pass signature, since node crypto API does not support PKCS 7. (TODO).

var passbook = require('passbookster')
var template = passbook.createTemplate('coupon', {
  passTypeIdentifier: 'PASS_TYPE_ID',
  teamIdentifier:     'TEAM_ID',
  organizationName:   'Paw Planet'
}, {
  certs: {
    wwdr: '/path/to/wwdr.pem',
    pass: '/path/to/pass_cert'
var pass = template.createPass({
  serialNumber:    'E5982H-I2',
  backgroundColor: 'rgb(206, 140, 53)',
  description:     '20% off premium dog food',
  icon:            fs.createReadStream('/path/to/icon.png')
var template = passbook.createTemplate(style, fields, options)

The style of the pass.

Must be one of: 'boardingPass', 'coupon', 'eventTicker', 'storeCard', 'generic'

Any field that should be included in all passes created from this template. Usually you want these to be passTypeIdentifier, teamIdentifier and organizationName, but it's completely ok to pass any pass field. These will be merely copied to each pass you create.

Object containing extra information about this pass. Only certificates for now.

Object with keys wwdr and pass and values the paths to the apple WWDR certificate and the pass certificate.


An object containing paths to apple wwdr and the pass certificate.

Pass to apple wwdr certificate

Pass to pass certificate

template.createPass(fields, cb)

Rest of the fields you want this pass to have. Fields provided to the template will be included.

Optional callback function. If a callback is provided, then the pass will not act as a stream, and will call this function as cb(err, res) when its done. Result is a buffer of the .pkpass created.

export WWDR_CERT=/path/to/wwdr.cert
export PASS_CERT=/path/to/pass.cert
npm test
  • More and proper tests
  • Add PKCS7 signing to node crypto