passkit-generator
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -5,3 +5,3 @@ # Non-macOS-steps | ||
I have to use these steps to work under WSL (Windows Subsystem for Linux), or Bash on Windows. I've not tested them under OpenSSL for Windows, but they might work in the same way. The only thing you'll still need over the certificates, are an Wallet-ready iOS App (and so an iPhone) or a way to pass it. | ||
I have to use these steps to work under WSL (Windows Subsystem for Linux), or Bash on Windows. The only thing you'll still need over the certificates, are an Wallet-ready iOS App (and so an iPhone) or a way to pass it. | ||
To test it, I use my [Passkit-sample-client](https://github.com/alexandercerutti/passkit-sample-client), an really basic iOS App which requires just few informations and will show you the generated pass. Or you can use like Telegram, save your generated pass in your "Saved Messages" and then open it from the iPhone. Your choice. | ||
@@ -36,2 +36,12 @@ | ||
> **Please note that to generate a Certificate Signing Request under OpenSSL for Windows, you'll need a configuration file or you'll fall into error.** | ||
> | ||
> You can load it by adding to the command above the flag `-config <path/to/.cnf>` | ||
> | ||
> Other functions might need configuration file. | ||
<br> | ||
<br> | ||
<hr> | ||
You will be prompted to insert some informations. You'll have to insert Apple CA's informations, like below (**bold ones**). If none, press Enter to skip. After the email address, you won't need any further informations. So press Enter until you won't finish. | ||
@@ -60,3 +70,3 @@ | ||
```sh | ||
# Optional, just for curious people | ||
# Optional, just for curious people, like George, even if it's a monkey. | ||
$ openssl asn1parse -i -in csr.certSigningRequest | ||
@@ -63,0 +73,0 @@ ``` |
{ | ||
"name": "passkit-generator", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "The easiest way to generate custom Apple Wallet passes in Node.js", | ||
@@ -20,6 +20,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"archiver": "^2.1.1", | ||
"debug": "^3.1.0", | ||
"got": "^9.3.1", | ||
"joi": "^13.6.0", | ||
"archiver": "^3.0.0", | ||
"debug": "^3.2.6", | ||
"got": "^9.3.2", | ||
"joi": "^13.7.0", | ||
"moment": "^2.22.2", | ||
@@ -32,4 +32,4 @@ "node-forge": "^0.7.6" | ||
"devDependencies": { | ||
"jasmine": "^3.2.0" | ||
"jasmine": "^3.3.0" | ||
} | ||
} |
@@ -1,5 +0,11 @@ | ||
# Node PassKit Generator | ||
<div align="center"> | ||
<br> | ||
<br> | ||
<img width="600" src="assets/logo.svg" alt="Node Passkit Generator logo"> | ||
<br> | ||
<br> | ||
<p align="center">Simple Node.js interface to generate customized <a href="https://developer.apple.com/wallet/">Apple Wallet Passes</a> for iOS.</p> | ||
</div> | ||
<br> | ||
Simple Node.js interface to generate customized [Apple Wallet Passes](https://developer.apple.com/wallet/) for iOS. | ||
### Architecture | ||
@@ -11,3 +17,3 @@ | ||
Pass template will be read and pushed as is in the resulting .zip file, while dynamic objects will be patched against `pass.json` or generated in runtime (`manifest.json`, `signature` and translation files). | ||
Pass template will be read and pushed as is in the resulting .zip file along with web-fetched medias, while dynamic objects will be patched against `pass.json` or generated in runtime (`manifest.json`, `signature` and translation files). | ||
@@ -31,2 +37,3 @@ This package comes with an [API documentation](./API.md), that makes available a series of methods to customize passes. | ||
The first thing you'll have to do, is to start creating a model. A model is a folder in your project directory, with inside the basic pass infos, like the thumbnails, the icon, and the background and **pass.json** containing all the static infos about the pass, like Team identifier, Pass type identifier, colors, etc. | ||
___ | ||
@@ -36,4 +43,7 @@ > Using the .pass extension is a best practice, showing that the directory is a pass package. | ||
Following to this suggestion, each model is required to have a **.pass** extension. | ||
Following to this best practice, the package is set to require each model to have a **_.pass_** extension. | ||
If the extension is not specified in the configuration (as in [Usage Example](#usage_example), at "model" key), it will be added forcefully. | ||
___ | ||
```bash | ||
@@ -65,5 +75,6 @@ $ cd yourProjectDir; | ||
##### Certificates | ||
> Requirements: OpenSSL, | ||
The third step is about the developer and WWDR certificates. I suggest you to create a certificate-dedicated folder inside your working directory (e.g. `./certs`) to contain everything concerning the certificates. This is a standard procedure: you would have to do it also without using this library. | ||
The third step is about the developer and WWDR certificates. I suggest you to create a certificate-dedicated folder inside your working directory (e.g. `./certs`) to contain everything concerning the certificates. | ||
This is a standard procedure: you would have to do it also without using this library. We'll use OpenSSL to complete our work (or to do it entirely, if only on terminal), so be sure to have it installed. | ||
You'll need the following three elements: | ||
@@ -75,3 +86,3 @@ | ||
While WWDR can be obtained from [Apple PKI Portal](https://www.apple.com/certificateauthority/), to get the `signer key` and the `certificate`, you'll have to get first a `Certificate Signing Request` (`.certSigningRequest` file) from your Apple Developers Portal page, at [Pass Types Identifiers](https://developer.apple.com/account/ios/identifier/passTypeId) (open it, it worth the pain). | ||
While WWDR can be obtained from [Apple PKI Portal](https://www.apple.com/certificateauthority/), to get the `signer key` and the `certificate`, you'll have to get first a `Certificate Signing Request` (`.certSigningRequest` file) and upload it to Apple Developers Portal, at [Pass Types Identifiers](https://developer.apple.com/account/ios/identifier/passTypeId) (open it, it's worth it 😜). | ||
@@ -87,9 +98,11 @@ <br> | ||
2. Confirm and register the new identifier. | ||
3. Go back to the pass type identifiers, click on your new pass id and Edit it. | ||
4. Click "Create Certificate" button and follow the instructions until you won't download a certificate like `pass.cer`. | ||
3. Go back to the pass type identifiers, click on your new pass id and edit it. | ||
4. Click "Create Certificate" button and follow the instructions until you won't download a certificate like `pass.cer`. (here you'll generate the `.certSigningRequest` file to be uploaded). | ||
5. Open the downloaded certificate. Go in "Certificates" on left in macOS Keychain access and `right-click > Export "\<certname\>"`. Choose a password (and write it down) and you will get a PKCS#12 file (`.p12`). | ||
6. Open terminal, place where you want to save the files and insert the following commands changing the contents between angular brackets. You'll have to choose a secret passphrase (and write it down) that you'll use also in the application. | ||
6. Open terminal, place where you want to save the files and insert the following OpenSSL commands changing the contents between angular brackets. You'll have to choose a secret passphrase (and write it down) that you'll use also in the application. | ||
```sh | ||
# Creating and changing dir | ||
$ mkdir "certs" && cd $_ | ||
# Extracting key and cert from pkcs12 | ||
$ openssl pkcs12 -in <cert-name>.p12 -clcerts -nokeys -out signerCert.pem -passin pass:<your-password> | ||
@@ -102,8 +115,10 @@ $ openssl pkcs12 -in <cert-name>.p12 -nocerts -out signerKey.pem -passin pass:<your-password> -passout pass:<secret-passphrase> | ||
<a name="usage_example"></a> | ||
## Usage example | ||
```javascript | ||
const Passkit = require("passkit-generator"); | ||
const { Pass } = require("passkit-generator"); | ||
let pass = new Passkit.Pass({ | ||
let examplePass = new Pass({ | ||
model: "./passModels/myFirstModel", | ||
@@ -129,3 +144,3 @@ certificates: { | ||
pass.localize("en", { ... }); | ||
pass.barcode("12345"); | ||
pass.barcode("36478105430"); // Random value | ||
@@ -146,9 +161,9 @@ // Generate the stream, which gets returned through a Promise | ||
If you developed any public projects using this library, open a topic in issues and link it inside if open to all or just tell it. 😊 You'll make me feel like my time hasn't been wasted (it had not anyway, I learnt a lot of things by doing this). | ||
Be sure to not include the certificates if you publish your project open to everybody. | ||
If you used this package in any of your projects, feel free to open a topic in issues to tell me and include a project description or link (for companies). 😊 You'll make me feel like my time hasn't been wasted, even if it had not anyway because I learnt a lot of things by creating this. | ||
Any contribution is welcome. ❤️ | ||
The idea to develop this package, was born during the Apple Developer Academy 17/18, in Naples, Italy, driven by the need to create an iOS app component regarding passes generation for events. | ||
A big thanks to all the people and friends in the Apple Developer Academy (and not) that pushed me and helped me into realizing something like this and a big thanks to the ones that helped me to make technical choices. | ||
Any contribution, is welcome. | ||
Made with ❤️ in Italy. |
@@ -106,4 +106,3 @@ const fs = require("fs"); | ||
if (!noDynList.length || !noDynList.some(f => f.toLowerCase().includes("icon")) | ||
|| !remoteFilesList.some(f => f.toLowerCase().includes("icon"))) { | ||
if (!noDynList.length || ![...noDynList, ...remoteFilesList].some(f => f.toLowerCase().includes("icon"))) { | ||
let eMessage = formatError("MODEL_UNINITIALIZED", path.parse(this.model).name); | ||
@@ -110,0 +109,0 @@ throw new Error(eMessage); |
623779
40
161
1747
+ Addedarchiver@3.1.1(transitive)
+ Addedarchiver-utils@2.1.0(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedcompress-commons@2.1.1(transitive)
+ Addedcrc32-stream@3.0.1(transitive)
+ Addedlodash.defaults@4.2.0(transitive)
+ Addedlodash.difference@4.5.0(transitive)
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedlodash.isplainobject@4.0.6(transitive)
+ Addedlodash.union@4.6.0(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedtar-stream@2.2.0(transitive)
+ Addedzip-stream@2.1.3(transitive)
- Removedarchiver@2.1.1(transitive)
- Removedarchiver-utils@1.3.0(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedcompress-commons@1.2.2(transitive)
- Removedcrc32-stream@2.0.0(transitive)
- Removednormalize-path@2.1.1(transitive)
- Removedremove-trailing-separator@1.1.0(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedxtend@4.0.2(transitive)
- Removedzip-stream@1.2.0(transitive)
Updatedarchiver@^3.0.0
Updateddebug@^3.2.6
Updatedgot@^9.3.2
Updatedjoi@^13.7.0