Skip to content

ihiroshi27/passgenerator-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apple Wallet Logo

PassGenerator

NPM Version NPM Downloads

Apple Pass Generator for Node.js

Install

$ npm install passgenerator-js

Get Started

Follow the Apple Wallet Developer Guide to download and edit a sample pass.

Apple's WWDR Certificate

Apple’s World Wide Developer Relations (WWDR) certificate is available from Apple at http://developer.apple.com/certificationauthority/AppleWWDRCA.cer.

Pass Signing Certificate

To download your pass signing certificate, do the following:

  1. Log into your Apple Developer Console.
  2. In Certificates, Identifiers & Profiles, select Identifiers.
  3. Under Identifiers, select Pass Type IDs.
  4. Click the plus (+) button.
  5. Enter the description and pass type identifier, and click Submit.
  6. Select the pass type identifier, then click Edit.
  7. Click the Create Certificate button, then follow the instructions to create a pass signing certificate.
  8. Download your new certificate. Double click to add this certificate to your Keychain.
  9. Right-click on your certificate, then click Export.

Options

Constructor

Name Type Required Description
appleWWDRCA Buffer | String Required Buffer or Path of Apple's WWDR Certificate.
signCert Buffer | String Required Buffer or Path of Pass Signing Certificate.
password String Optional The Password of the Pass Signing Certificate.

Method: add

Name Type Required Description
filename String Required Filename with extension.
data Buffer | String Required File path as string or file content as buffer.
language String Optional Language Code (ISO 639-1).

Usage

Directory structure of a sample pass.

.
└── Sample.pass/
    ├── icon.png
    ├── icon@2x.png
    ├── pass.json
    ├── en.lproj/
    │   ├── logo.png
    │   └── logo@2x.png
    └── th.lproj/
        ├── logo.png
        └── logo@2x.png
const fs = require('fs')

const PassGenerator = require('passgenerator-js')

const passGenerator = new PassGenerator({
  appleWWDRCA: './AppleWWDRCA.cer',
  signCert: './Certificates.p12'
})

const pass = passGenerator.createPass()

pass.add('icon.png', './Sample.pass/icon.png')
pass.add('icon@2x.png', './Sample.pass/icon@2x.png')

pass.add('pass.json', './Sample.pass/pass.json')

pass.add('logo.png', './Sample.pass/en.lproj/logo.png', 'en')
pass.add('logo@2x.png', './Sample.pass/en.lproj/logo@2x.png', 'en')

pass.add('logo.png', './Sample.pass/th.lproj/logo.png', 'th')
pass.add('logo@2x.png', './Sample.pass/th.lproj/logo@2x.png', 'th')

const pkpass = pass.generate()

fs.writeFileSync('Sample.pkpass', pkpass)

License

MIT