Updated examples

This commit is contained in:
Alexander Cerutti
2021-10-20 00:28:49 +02:00
parent 1735a3824a
commit 158ee4221a
8 changed files with 190 additions and 143 deletions

View File

@@ -7,7 +7,7 @@
* have to wait two minutes.
*/
import app from "./webserver";
import app, { getCertificates } from "./webserver";
import path from "path";
import { PKPass } from "passkit-generator";
@@ -19,6 +19,8 @@ app.all(async function manageRequest(request, response) {
return;
}
const certificates = await getCertificates();
const passName =
request.params.modelName +
"_" +
@@ -32,19 +34,10 @@ app.all(async function manageRequest(request, response) {
`../models/${request.params.modelName}`,
),
certificates: {
wwdr: path.resolve(
__dirname,
"../../certificates/WWDR.pem",
),
signerCert: path.resolve(
__dirname,
"../../certificates/signerCert.pem",
),
signerKey: path.resolve(
__dirname,
"../../certificates/signerKey.pem",
),
signerKeyPassphrase: "123456",
wwdr: certificates.wwdr,
signerCert: certificates.signerCert,
signerKey: certificates.signerKey,
signerKeyPassphrase: certificates.signerKeyPassphrase,
},
},
Object.assign(
@@ -62,6 +55,10 @@ app.all(async function manageRequest(request, response) {
// setting the expiration
pass.setExpirationDate(d);
console.log(
"EXPIRATION DATE EXPECTED:",
pass.props["expirationDate"],
);
}
const stream = pass.getAsStream();