Package Exports
- passgenerator-js
- passgenerator-js/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (passgenerator-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
PassGenerator
Apple Pass Generator for Node.js
Install
$ npm install passgenerator-jsGet 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:
- Log into your Apple Developer Console.
- In Certificates, Identifiers & Profiles, select Identifiers.
- Under Identifiers, select Pass Type IDs.
- Click the plus (+) button.
- Enter the description and pass type identifier, and click Submit.
- Select the pass type identifier, then click Edit.
- Click the Create Certificate button, then follow the instructions to create a pass signing certificate.
- Download your new certificate. Double click to add this certificate to your Keychain.
- 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.pngconst 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)