mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 21:25:26 +00:00
Changed the way in which certificates are valid; Removed async parallel execution after handlers removal; Changed model extension adding condition
This commit is contained in:
48
index.js
48
index.js
@@ -415,41 +415,31 @@ class Pass {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.model = path.resolve(options.model) + (!path.extname(options.model) ? ".pass" : "");
|
this.model = path.resolve(options.model) + (!!options.model && !path.extname(options.model) ? ".pass" : "");
|
||||||
|
|
||||||
let certPaths = Object.keys(options.certificates)
|
let certPaths = Object.keys(options.certificates)
|
||||||
.filter(v => v !== "dir")
|
.filter(v => v !== "dir")
|
||||||
.map((val) =>
|
.map((val) => path.resolve(typeof options.certificates[val] !== "object" ? options.certificates[val] : options.certificates[val]["keyFile"]));
|
||||||
path.resolve(
|
|
||||||
typeof options.certificates[val] !== "object" ? options.certificates[val] : options.certificates[val]["keyFile"]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
async.parallel([
|
async.concat(certPaths, fs.readFile, (err, contents) => {
|
||||||
certsParseCallback => {
|
if (err) {
|
||||||
async.concat(certPaths, fs.readFile, (err, contents) => {
|
return reject(err);
|
||||||
if (err) {
|
}
|
||||||
return reject(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
contents.forEach(file => {
|
contents.forEach(file => {
|
||||||
let pem = this.__parsePEM(file, options.certificates.signerKey.passphrase);
|
let pem = this.__parsePEM(file, options.certificates.signerKey.passphrase);
|
||||||
if (!pem.key || !pem.value) {
|
if (!pem) {
|
||||||
return reject({
|
return reject({
|
||||||
status: false,
|
status: false,
|
||||||
error: {
|
error: {
|
||||||
message: "Invalid certificates got loaded. Please provide WWDR certificates and developer signer certificate and key (with passphrase).",
|
message: "Invalid certificates got loaded. Please provide WWDR certificates and developer signer certificate and key (with passphrase).",
|
||||||
ecode: 418
|
ecode: 418
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.Certificates[pem.key] = pem.value;
|
this.Certificates[pem.key] = pem.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
return certsParseCallback();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
return success();
|
return success();
|
||||||
});
|
});
|
||||||
@@ -469,7 +459,7 @@ class Pass {
|
|||||||
value: forge.pki.certificateFromPem(element)
|
value: forge.pki.certificateFromPem(element)
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return { key: null, value: null };
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user