sequence auths, more testing

This commit is contained in:
AJ ONeal 2018-04-05 03:37:41 -06:00
parent 1148e82706
commit 1647818326
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
* Apr 5, 2018 - completely match api for acme v1 (le-acme-core.js)
* Apr 5, 2018 - test wildcard
* Apr 5, 2018 - test two subdomains
* Apr 5, 2018 - test subdomains and its wildcard
Todo

27
node.js
View File

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