From fd62408a9a69083933b159c9b749e25bc5c6a566 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 20 Oct 2019 03:27:05 -0600 Subject: [PATCH] working, huzzah! --- certificates.js | 2 ++ greenlock.js | 9 ++++++++- utils.js | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/certificates.js b/certificates.js index cbe1d03..467bad9 100644 --- a/certificates.js +++ b/certificates.js @@ -214,6 +214,7 @@ C._check = function(db, args) { certificate: args.certificate }; return db.check(query).then(function(pems) { + console.log('[debug] has pems? (yes)', pems); if (!pems) { return null; } @@ -234,6 +235,7 @@ C._check = function(db, args) { return U._getKeypair(db, args.subject, query) .then(function(keypair) { + console.log('[debug get keypair]', Object.keys(keypair)); pems.privkey = keypair.privateKeyPem; return pems; }) diff --git a/greenlock.js b/greenlock.js index 6de72c6..2d3ea2f 100644 --- a/greenlock.js +++ b/greenlock.js @@ -310,7 +310,14 @@ G.create = function(gconf) { challenges, account, args - ); + ).then(function(pems) { + if (!pems.privkey) { + throw new Error( + 'missing private key, which is kinda important' + ); + } + return pems; + }); }); }); }); diff --git a/utils.js b/utils.js index 341ce7f..9f09e3f 100644 --- a/utils.js +++ b/utils.js @@ -263,5 +263,7 @@ U._getOrCreateKeypair = function(db, subject, query, keyType, mustExist) { }; U._getKeypair = function(db, subject, query) { - return U._getOrCreateKeypair(db, subject, query, '', true); + return U._getOrCreateKeypair(db, subject, query, '', true).then(function (result) { + return result.keypair; + }); };