passkit-generator
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -0,1 +1,4 @@ | ||
export declare const INIT: { | ||
readonly INVALID_BUFFERS: "Cannot set buffers in constructor: expected object but received %s"; | ||
}; | ||
export declare const CERTIFICATES: { | ||
@@ -2,0 +5,0 @@ readonly INVALID: "Invalid certificate(s) loaded. %s. Please provide valid WWDR certificates and developer signer certificate and key (with passphrase).\nRefer to docs to obtain them"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.format = exports.PACK = exports.FROM = exports.BUNDLE = exports.MODELS = exports.CLOSE = exports.JSON = exports.PERSONALIZE = exports.PASS_SOURCE = exports.BARCODES = exports.LANGUAGES = exports.DATE = exports.FIELDS = exports.FILTER_VALID = exports.TEMPLATE = exports.PASS_TYPE = exports.TRANSIT_TYPE = exports.CERTIFICATES = void 0; | ||
exports.format = exports.PACK = exports.FROM = exports.BUNDLE = exports.MODELS = exports.CLOSE = exports.JSON = exports.PERSONALIZE = exports.PASS_SOURCE = exports.BARCODES = exports.LANGUAGES = exports.DATE = exports.FIELDS = exports.FILTER_VALID = exports.TEMPLATE = exports.PASS_TYPE = exports.TRANSIT_TYPE = exports.CERTIFICATES = exports.INIT = void 0; | ||
exports.INIT = { | ||
INVALID_BUFFERS: "Cannot set buffers in constructor: expected object but received %s", | ||
}; | ||
exports.CERTIFICATES = { | ||
@@ -5,0 +8,0 @@ INVALID: "Invalid certificate(s) loaded. %s. Please provide valid WWDR certificates and developer signer certificate and key (with passphrase).\nRefer to docs to obtain them", |
@@ -39,3 +39,3 @@ /// <reference types="node" /> | ||
static pack(...passes: PKPass[]): Bundle; | ||
constructor(buffers: Schemas.FileBuffers, certificates: Schemas.CertificatesSchema, props?: Schemas.OverridablePassProps); | ||
constructor(buffers?: Schemas.FileBuffers, certificates?: Schemas.CertificatesSchema, props?: Schemas.OverridablePassProps); | ||
/** | ||
@@ -42,0 +42,0 @@ * Allows changing the certificates, if needed. |
@@ -31,7 +31,12 @@ "use strict"; | ||
this[_c] = undefined; | ||
const buffersEntries = Object.entries(buffers); | ||
for (let i = buffersEntries.length, buffer; (buffer = buffersEntries[--i]);) { | ||
const [fileName, contentBuffer] = buffer; | ||
this.addBuffer(fileName, contentBuffer); | ||
if (buffers && typeof buffers === "object") { | ||
const buffersEntries = Object.entries(buffers); | ||
for (let i = buffersEntries.length, buffer; (buffer = buffersEntries[--i]);) { | ||
const [fileName, contentBuffer] = buffer; | ||
this.addBuffer(fileName, contentBuffer); | ||
} | ||
} | ||
else { | ||
console.warn(Messages.format(Messages.INIT.INVALID_BUFFERS, typeof buffers)); | ||
} | ||
if (props) { | ||
@@ -42,3 +47,5 @@ /** Overrides validation and pushing in props */ | ||
} | ||
this.certificates = certificates; | ||
if (certificates) { | ||
this.certificates = certificates; | ||
} | ||
} | ||
@@ -45,0 +52,0 @@ /** |
@@ -81,3 +81,3 @@ /// <reference types="node" /> | ||
model: string; | ||
certificates: CertificatesSchema; | ||
certificates?: CertificatesSchema; | ||
} | ||
@@ -84,0 +84,0 @@ export declare const Template: Joi.ObjectSchema<Template>; |
{ | ||
"name": "passkit-generator", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "The easiest way to generate custom Apple Wallet passes in Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -119,3 +119,3 @@ <div align="center"> | ||
* Use `const { PKPass } = require("passkit-generator");` | ||
* for usage in pure Node.js | ||
* for usage in CommonJS (Node.js) | ||
*/ | ||
@@ -125,9 +125,16 @@ import { PKPass } from "passkit-generator"; | ||
try { | ||
const pass = PKPass.from({ | ||
model: "./passModels/myFirstModel", | ||
/** Each, but last, can be either a string or a Buffer. See API Documentation for more */ | ||
const { wwdr, signerCert, signerKey, signerKeyPassphrase } = getCertificatesContentsSomehow(); | ||
const pass = await PKPass.from({ | ||
/** | ||
* Note: .pass extension is enforced when reading a | ||
* model from FS, even if not specified here below | ||
*/ | ||
model: "./passModels/myFirstModel.pass", | ||
certificates: { | ||
wwdr: "./certs/wwdr.pem", | ||
signerCert: "./certs/signercert.pem", | ||
signerKey: "./certs/signerkey.pem", | ||
signerKeyPassphrase: "123456" | ||
wwdr, | ||
signerCert, | ||
signerKey, | ||
signerKeyPassphrase | ||
}, | ||
@@ -161,3 +168,3 @@ }, { | ||
* Use `const { PKPass } = require("passkit-generator");` | ||
* for usage in pure Node.js | ||
* for usage in CommonJS (Node.js) | ||
*/ | ||
@@ -167,2 +174,5 @@ import { PKPass } from "passkit-generator"; | ||
try { | ||
/** Each, but last, can be either a string or a Buffer. See API Documentation for more */ | ||
const { wwdr, signerCert, signerKey, signerKeyPassphrase } = getCertificatesContentsSomehow(); | ||
const examplePass = new PKPass({ | ||
@@ -175,10 +185,10 @@ "thumbnail": Buffer.from([ ... ]), | ||
{ | ||
wwdr: "./certs/wwdr.pem", | ||
signerCert: "./certs/signercert.pem", | ||
signerKey: "./certs/signerkey.pem", | ||
signerKeyPassphrase: "123456", | ||
wwdr, | ||
signerCert, | ||
signerKey, | ||
signerKeyPassphrase, | ||
}, | ||
{ | ||
// keys to be added or overridden | ||
serialNumber: "AAGH44625236dddaffbda" | ||
serialNumber: "AAGH44625236dddaffbda", | ||
}); | ||
@@ -185,0 +195,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
108512
2533
0
257