'use strict'; /*global Promise*/ var challenge = require('./').create({}); var opts = challenge.getOptions && challenge.getOptions() || challenge.options; 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); }); }); } opts.challenge = { type: 'http-01' , identifier: { type: 'dns', value: 'example.com' } , wildcard: false , expires: '2012-01-01T12:00:00.000Z' , token: 'abc123' , 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: '<>' , 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); });