sequence auths, more testing

This commit is contained in:
AJ ONeal 2018-04-05 03:37:41 -06:00
parent 38cefafe33
commit 2e747bada2
2 changed files with 26 additions and 3 deletions

View File

@ -25,6 +25,8 @@ In progress
* Mar 21, 2018 - *mostly* matches le-acme-core.js API * Mar 21, 2018 - *mostly* matches le-acme-core.js API
* Apr 5, 2018 - completely match api for acme v1 (le-acme-core.js) * Apr 5, 2018 - completely match api for acme v1 (le-acme-core.js)
* Apr 5, 2018 - test wildcard * Apr 5, 2018 - test wildcard
* Apr 5, 2018 - test two subdomains
* Apr 5, 2018 - test subdomains and its wildcard
Todo Todo

27
node.js
View File

@ -218,15 +218,27 @@ ACME._postChallenge = function (me, options, identifier, ch) {
if (1 === options.removeChallenge.length) { if (1 === options.removeChallenge.length) {
options.removeChallenge( options.removeChallenge(
{ identifier: identifier { identifier: identifier
, hostname: identifier.value
, type: ch.type , type: ch.type
, token: ch.token , token: ch.token
, thumbprint: thumbprint
, keyAuthorization: keyAuthorization
, dnsAuthorization: me.RSA.utils.toWebsafeBase64(
require('crypto').createHash('sha256').update(keyAuthorization).digest('base64')
)
} }
).then(function () {}, function () {}); ).then(function () {}, function () {});
} else if (2 === options.removeChallenge.length) { } else if (2 === options.removeChallenge.length) {
options.removeChallenge( options.removeChallenge(
{ identifier: identifier { identifier: identifier
, hostname: identifier.value
, type: ch.type , type: ch.type
, token: ch.token , token: ch.token
, thumbprint: thumbprint
, keyAuthorization: keyAuthorization
, dnsAuthorization: me.RSA.utils.toWebsafeBase64(
require('crypto').createHash('sha256').update(keyAuthorization).digest('base64')
)
} }
, function (err) { return err; } , function (err) { return err; }
); );
@ -403,6 +415,7 @@ ACME._getCertificate = function (me, options) {
}).then(function (resp) { }).then(function (resp) {
me._nonce = resp.toJSON().headers['replay-nonce']; me._nonce = resp.toJSON().headers['replay-nonce'];
var location = resp.toJSON().headers.location; var location = resp.toJSON().headers.location;
var auths;
if (me.debug) { if (me.debug) {
console.log(location); // the account id url console.log(location); // the account id url
console.log(resp.toJSON()); console.log(resp.toJSON());
@ -418,8 +431,12 @@ ACME._getCertificate = function (me, options) {
if (me.debug) { console.log("47 &#&#&#&#&#&#&&##&#&#&#&#&#&#&#&"); } if (me.debug) { console.log("47 &#&#&#&#&#&#&&##&#&#&#&#&#&#&#&"); }
//return resp.body; //return resp.body;
return Promise.all(me._authorizations.map(function (authUrl, i) { auths = me._authorizations.slice(0);
if (me.debug) { console.log("Authorizations map #" + i); }
function next() {
var authUrl = auths.shift();
if (!authUrl) { return; }
return ACME._getChallenges(me, options, authUrl).then(function (results) { return ACME._getChallenges(me, options, authUrl).then(function (results) {
// var domain = options.domains[i]; // results.identifier.value // var domain = options.domains[i]; // results.identifier.value
var chType = options.challengeTypes.filter(function (chType) { var chType = options.challengeTypes.filter(function (chType) {
@ -439,8 +456,12 @@ ACME._getCertificate = function (me, options) {
} }
return ACME._postChallenge(me, options, results.identifier, challenge); return ACME._postChallenge(me, options, results.identifier, challenge);
}).then(function () {
return next();
}); });
})).then(function () { }
return next().then(function () {
if (me.debug) { console.log("37 &#&#&#&#&#&#&&##&#&#&#&#&#&#&#&"); } if (me.debug) { console.log("37 &#&#&#&#&#&#&&##&#&#&#&#&#&#&#&"); }
var validatedDomains = body.identifiers.map(function (ident) { var validatedDomains = body.identifiers.map(function (ident) {
return ident.value; return ident.value;