37 lines
954 B
JavaScript
Raw Normal View History

2016-10-17 15:44:49 -06:00
'use strict';
/*global Promise*/
2016-10-17 15:44:49 -06:00
var challenge = require('./').create({});
2016-10-17 15:44:49 -06:00
var opts = challenge.getOptions && challenge.getOptions() || challenge.options;
2018-05-12 19:17:26 -06: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);
2018-05-12 19:17:26 -06: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'
2018-05-12 19:17:26 -06:00
};
run(opts).then(function () {
console.info("PASS");
}).catch(function (err) {
console.error("FAIL");
console.error(err);
process.exit(18);
});