48 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-07-22 23:31:48 -06:00
'use strict';
var request;
2019-07-31 16:33:12 -06:00
var defaults = {
wait: 15 * 1000
};
2019-07-22 23:31:48 -06:00
module.exports.create = function(config) {
2019-07-31 16:33:12 -06:00
var wait = config.wait || defaults.wait;
2019-07-22 23:31:48 -06:00
return {
init: function(opts) {
request = opts.request;
return null;
},
zones: function(data) {
//console.info('List Zones', data);
throw Error('listing zones not implemented');
},
set: function(data) {
2019-07-31 16:33:12 -06:00
// console.info('Add TXT', data);
2019-07-23 22:47:36 -06:00
var ch = data.challenge;
if (!ch.dnsZone) {
// zones() is not implemented for http-01 challenges,
2019-07-31 16:33:12 -06:00
// but it is almost always implemented for dns-01 challenges.
// Any plugin that implements zones() should expect ch.dnsZone here
2019-07-23 22:47:36 -06:00
throw new Error('No matching zone for ' + ch.dnsHost);
}
2019-07-31 16:33:12 -06:00
2019-07-22 23:31:48 -06:00
throw Error('setting TXT not implemented');
2019-07-31 16:33:12 -06:00
// many APIs return a valid response quite a bit
// before they actually set the record, and checking
// too quickly will self-poison the response cache.
return new Promise(function(resolve) {
setTimeout(resolve, wait, null);
});
2019-07-22 23:31:48 -06:00
},
remove: function(data) {
// console.info('Remove TXT', data);
throw Error('removing TXT not implemented');
},
get: function(data) {
// console.info('List TXT', data);
throw Error('listing TXTs not implemented');
}
};
};