forked from root/acme.js
WIP properly fails dry challenge
This commit is contained in:
parent
7f0a5fb28a
commit
0ce04b7466
1
app.js
1
app.js
|
@ -163,6 +163,7 @@
|
|||
}).catch(function (err) {
|
||||
console.error("A bad thing happened:");
|
||||
console.error(err);
|
||||
window.alert(err.message || JSON.stringify(err, null, 2));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
18
lib/acme.js
18
lib/acme.js
|
@ -823,17 +823,15 @@ ACME.create = function create(me) {
|
|||
if (!me.dig) {
|
||||
me.dig = function (query) {
|
||||
// TODO use digd.js
|
||||
return new Promise(function (resolve, reject) {
|
||||
var dns = require('dns');
|
||||
dns.resolveTxt(query.name, function (err, records) {
|
||||
if (err) { reject(err); return; }
|
||||
|
||||
resolve({
|
||||
answer: records.map(function (rr) {
|
||||
return { data: rr };
|
||||
return new me.request({ url: "/api/dns/" + query.name + "?type=" + query.type }).then(function (resp) {
|
||||
if (!resp.body || !Array.isArray(resp.body.answer)) {
|
||||
throw new Error("failed to get DNS response");
|
||||
}
|
||||
return {
|
||||
answer: resp.body.answer.map(function (ans) {
|
||||
return { data: ans.data, ttl: ans.ttl };
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue