2016-08-10 03:20:19 +00:00
|
|
|
'use strict';
|
2019-04-06 05:11:00 +00:00
|
|
|
/*global Promise*/
|
2016-08-10 03:20:19 +00:00
|
|
|
|
|
|
|
var challenge = require('./').create({});
|
|
|
|
|
2019-04-06 05:11:00 +00:00
|
|
|
var opts = challenge.getOptions && challenge.getOptions() || challenge.options;
|
2016-08-10 03:20:19 +00:00
|
|
|
|
2019-04-06 05:11:00 +00:00
|
|
|
function run() {
|
|
|
|
// this will cause the prompt to appear
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
challenge.set(opts, function () {
|
|
|
|
// this will cause the final completion message to appear
|
|
|
|
return Promise.resolve(challenge.remove(opts)).then(resolve).catch(reject);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2016-08-10 03:20:19 +00:00
|
|
|
|
2019-04-06 05:11:00 +00:00
|
|
|
opts.challenge = {
|
|
|
|
type: 'http-01'
|
|
|
|
, identifier: { type: 'dns', value: 'example.com' }
|
|
|
|
, wildcard: false
|
|
|
|
, expires: '2012-01-01T12:00:00.000Z'
|
|
|
|
, token: 'abc123'
|
|
|
|
, thumbprint: '<<account key thumbprint>>'
|
|
|
|
, keyAuthorization: 'abc123.xxxx'
|
|
|
|
, dnsHost: '_acme-challenge.example.com'
|
|
|
|
, dnsAuthorization: 'yyyy'
|
|
|
|
, altname: 'example.com'
|
|
|
|
};
|
|
|
|
run(opts).then(function () {
|
|
|
|
opts.challenge = {
|
|
|
|
type: 'dns-01'
|
|
|
|
, identifier: { type: 'dns', value: 'example.com' }
|
|
|
|
, wildcard: true
|
|
|
|
, expires: '2012-01-01T12:00:00.000Z'
|
|
|
|
, token: 'abc123'
|
|
|
|
, thumbprint: '<<account key thumbprint>>'
|
|
|
|
, keyAuthorization: 'abc123.xxxx'
|
|
|
|
, dnsHost: '_acme-challenge.example.com'
|
|
|
|
, dnsAuthorization: 'yyyy'
|
|
|
|
, altname: '*.example.com'
|
|
|
|
};
|
|
|
|
return run(opts);
|
|
|
|
}).then(function () {
|
|
|
|
console.info("PASS");
|
|
|
|
}).catch(function (err) {
|
|
|
|
console.error("FAIL");
|
|
|
|
console.error(err);
|
|
|
|
process.exit(17);
|
2016-08-10 03:20:19 +00:00
|
|
|
});
|