* the other callback

This commit is contained in:
AJ ONeal 2018-07-04 00:36:33 -06:00
parent 97e39aaeb0
commit 125d31b2c4
3 changed files with 12 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.pem
letsencrypt.work letsencrypt.work
letsencrypt.logs letsencrypt.logs
letsencrypt.config letsencrypt.config

18
node.js
View File

@ -416,6 +416,14 @@ ACME._postChallenge = function (me, options, identifier, ch) {
if (1 === options.setChallenge.length) { if (1 === options.setChallenge.length) {
options.setChallenge(auth).then(testChallenge).then(resolve, reject); options.setChallenge(auth).then(testChallenge).then(resolve, reject);
} else if (2 === options.setChallenge.length) { } else if (2 === options.setChallenge.length) {
options.setChallenge(auth, function (err) {
if(err) {
reject(err);
} else {
testChallenge().then(resolve, reject);
}
});
} else {
var challengeCb = function(err) { var challengeCb = function(err) {
if(err) { if(err) {
reject(err); reject(err);
@ -426,15 +434,7 @@ ACME._postChallenge = function (me, options, identifier, ch) {
Object.keys(auth).forEach(function (key) { Object.keys(auth).forEach(function (key) {
challengeCb[key] = auth[key]; challengeCb[key] = auth[key];
}); });
options.setChallenge(auth, challengeCb); options.setChallenge(identifier.value, ch.token, keyAuthorization, challengeCb);
} else {
options.setChallenge(identifier.value, ch.token, keyAuthorization, function(err) {
if(err) {
reject(err);
} else {
testChallenge().then(resolve, reject);
}
});
} }
} catch(e) { } catch(e) {
reject(e); reject(e);

View File

@ -26,7 +26,7 @@ module.exports.run = function (directoryUrl, RSA, web, chType, email, accountKey
console.log("dig TXT " + pathname + " '" + cb.dnsAuthorization + "'"); console.log("dig TXT " + pathname + " '" + cb.dnsAuthorization + "'");
console.log("\nThen hit the 'any' key to continue..."); console.log("\nThen hit the 'any' key to continue...");
} else { } else {
cb(new Error("[acme-v2] unrecognized challenge type")); cb(new Error("[acme-v2] unrecognized challenge type: " + cb.type));
return; return;
} }