diff --git a/lib/core.js b/lib/core.js index 3fe2133..969065b 100644 --- a/lib/core.js +++ b/lib/core.js @@ -243,14 +243,15 @@ module.exports.create = function (le) { var copy = utils.merge({ domains: [domain] }, le); utils.tplCopy(copy); - le.challenge.set(copy, domain, key, value, done); + // TODO need to save challengeType + le.challenges[args.challengeType].set(copy, domain, key, value, done); }; certReq.removeChallenge = function (domain, key, done) { log(args.debug, "setChallenge called for '" + domain + "'"); var copy = utils.merge({ domains: [domain] }, le); utils.tplCopy(copy); - le.challenge.remove(copy, domain, key, done); + le.challenges[args.challengeType].remove(copy, domain, key, done); }; log(args.debug, 'calling le.acme.getCertificateAsync', certReq.domains); diff --git a/lib/middleware.js b/lib/middleware.js index b8a3cd1..70e83ab 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -12,7 +12,7 @@ function _log(debug) { } module.exports.create = function (le) { - if (!le.challenge || !le.challenge.get) { + if (!le.challenges['http-01'] || !le.challenges['http-01'].get) { throw new Error("middleware requires challenge plugin with get method"); } var log = le.log || _log; @@ -51,7 +51,8 @@ module.exports.create = function (le) { copy = utils.tplCopy(copy); // TODO tpl copy? - le.challenge.get(copy, hostname, token, function (err, secret) { + // TODO need to restore challengeType + le.challenges['http-01'].get(copy, hostname, token, function (err, secret) { if (err || !token) { res.statusCode = 404; res.setHeader('Content-Type', 'application/json; charset=utf-8');