From e479d79c158a480bc0b032d068b67cb58c76e9b1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 3 May 2019 00:51:46 -0600 Subject: [PATCH] http-01 challenge pre-flight works --- app.js | 29 ++++++++++++++++++++++++++--- index.html | 35 +++++++++++++++++------------------ lib/acme.js | 8 ++++---- 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/app.js b/app.js index 43eb90c..28c9e63 100644 --- a/app.js +++ b/app.js @@ -141,8 +141,9 @@ , challenges: { 'dns-01': { set: function (opts) { - console.log('dns-01 set challenge:'); - console.log(JSON.stringify(opts, null, 2)); + console.info('dns-01 set challenge:'); + console.info('TXT', opts.dnsHost); + console.info(opts.dnsAuthorization); return new Promise(function (resolve) { while (!window.confirm("Did you set the challenge?")) {} resolve(); @@ -150,7 +151,28 @@ } , remove: function (opts) { console.log('dns-01 remove challenge:'); - console.log(JSON.stringify(opts, null, 2)); + console.info('TXT', opts.dnsHost); + console.info(opts.dnsAuthorization); + return new Promise(function (resolve) { + while (!window.confirm("Did you delete the challenge?")) {} + resolve(); + }); + } + } + , 'http-01': { + set: function (opts) { + console.info('http-01 set challenge:'); + console.info(opts.challengeUrl); + console.info(opts.keyAuthorization); + return new Promise(function (resolve) { + while (!window.confirm("Did you set the challenge?")) {} + resolve(); + }); + } + , remove: function (opts) { + console.log('http-01 remove challenge:'); + console.info(opts.challengeUrl); + console.info(opts.keyAuthorization); return new Promise(function (resolve) { while (!window.confirm("Did you delete the challenge?")) {} resolve(); @@ -158,6 +180,7 @@ } } } + , challengeTypes: [$('input[name="acme-challenge-type"]:checked').value] }); }); }).catch(function (err) { diff --git a/index.html b/index.html index b4d91c8..f984d04 100644 --- a/index.html +++ b/index.html @@ -34,27 +34,21 @@

EC Options:

- - - - - + + +
@@ -67,6 +61,11 @@
+ + +
diff --git a/lib/acme.js b/lib/acme.js index 467e53c..8bfba66 100644 --- a/lib/acme.js +++ b/lib/acme.js @@ -433,7 +433,7 @@ ACME._postChallenge = function (me, options, auth) { */ function deactivate() { if (me.debug) { console.debug('[acme-v2.js] deactivate:'); } - return ACME._jwsRequest({ + return ACME._jwsRequest(me, { options: options , url: auth.url , protected: { kid: options._kid } @@ -508,7 +508,7 @@ ACME._postChallenge = function (me, options, auth) { function respondToChallenge() { if (me.debug) { console.debug('[acme-v2.js] responding to accept challenge:'); } - return ACME._jwsRequest({ + return ACME._jwsRequest(me, { options: options , url: auth.url , protected: { kid: options._kid } @@ -569,7 +569,7 @@ ACME._finalizeOrder = function (me, options, validatedDomains) { function pollCert() { if (me.debug) { console.debug('[acme-v2.js] pollCert:'); } - return ACME._jwsRequest({ + return ACME._jwsRequest(me, { options: options , url: options._finalize , protected: { kid: options._kid } @@ -710,7 +710,7 @@ ACME._getCertificate = function (me, options) { var payload = JSON.stringify(body); if (me.debug) { console.debug('\n[DEBUG] newOrder\n'); } - return ACME._jwsRequest({ + return ACME._jwsRequest(me, { options: options , url: me._directoryUrls.newOrder , protected: { kid: options._kid }