http-01 challenge pre-flight works

This commit is contained in:
AJ ONeal 2019-05-03 00:51:46 -06:00
parent f6d26c8b8e
commit e479d79c15
3 changed files with 47 additions and 25 deletions

29
app.js
View File

@ -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) {

View File

@ -34,27 +34,21 @@
</div>
<div class="js-ec-opts">
<p>EC Options:</p>
<input type="radio" id="-crv2"
name="ec-crv" value="P-256" checked>
<label for="-crv2">P-256</label>
<input type="radio" id="-crv3"
name="ec-crv" value="P-384">
<label for="-crv3">P-384</label>
<!-- input type="radio" id="-crv5"
name="ec-crv" value="P-521">
<label for="-crv5">P-521</label -->
<label for="-crv2"><input type="radio" id="-crv2"
name="ec-crv" value="P-256" checked>P-256</label>
<label for="-crv3"><input type="radio" id="-crv3"
name="ec-crv" value="P-384">P-384</label>
<!-- label for="-crv5"><input type="radio" id="-crv5"
name="ec-crv" value="P-521">P-521</label -->
</div>
<div class="js-rsa-opts" hidden>
<p>RSA Options:</p>
<input type="radio" id="-modlen2"
name="rsa-len" value="2048" checked>
<label for="-modlen2">2048</label>
<input type="radio" id="-modlen3"
name="rsa-len" value="3072">
<label for="-modlen3">3072</label>
<input type="radio" id="-modlen5"
name="rsa-len" value="4096">
<label for="-modlen5">4096</label>
<label for="-modlen2"><input type="radio" id="-modlen2"
name="rsa-len" value="2048" checked>2048</label>
<label for="-modlen3"><input type="radio" id="-modlen3"
name="rsa-len" value="3072">3072</label>
<label for="-modlen5"><input type="radio" id="-modlen5"
name="rsa-len" value="4096">4096</label>
</div>
<button class="js-generate" hidden>Generate</button>
</form>
@ -67,6 +61,11 @@
<label for="-acmeDomains">Domains:</label>
<input class="js-domains" type="text" id="-acmeDomains">
<br>
<label for="-http01"><input type="radio" id="-http01"
name="acme-challenge-type" value="http-01" checked>http-01</label>
<label for="-dns01"><input type="radio" id="-dns01"
name="acme-challenge-type" value="dns-01">dns-01</label>
<br>
<button class="js-create-account" hidden>Create Account</button>
</form>

View File

@ -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 }