From 83819b5901d721a3f1f7b4a3a94fb1e8d95ddf20 Mon Sep 17 00:00:00 2001 From: Matt McKenna Date: Sun, 2 Jun 2019 19:35:51 -0700 Subject: [PATCH] make cert optional in get/set keypair --- lib/certificates/checkKeypair.js | 2 +- lib/certificates/setKeypair.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/certificates/checkKeypair.js b/lib/certificates/checkKeypair.js index 3c2d514..c997d19 100644 --- a/lib/certificates/checkKeypair.js +++ b/lib/certificates/checkKeypair.js @@ -6,7 +6,7 @@ const fileNames = require("../fileNames"); module.exports.checkKeypair = (opts, options) => { console.log("certificates.checkKeypair for", opts.subject); - let id = opts.certificate.kid || opts.certificate.id || opts.subject; + let id = (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject; let pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem); // let jwkKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.jwk); diff --git a/lib/certificates/setKeypair.js b/lib/certificates/setKeypair.js index 8a2273c..97eb08b 100644 --- a/lib/certificates/setKeypair.js +++ b/lib/certificates/setKeypair.js @@ -4,7 +4,7 @@ const pathHelper = require("../pathHelper"); const fileNames = require("../fileNames"); module.exports.setKeypair = (opts, options) => { - let id = opts.certificate.kid || opts.certificate.id || opts.subject; + let id = (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject; console.log("certificates.setKeypair for", id); let pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);