chore: npx -p prettier@3 -- prettier -w ./index.js
This commit is contained in:
parent
b8e51c2308
commit
005b496054
38
index.js
38
index.js
|
@ -347,9 +347,7 @@ ACME._wait = function wait(ms) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ACME._testChallengeOptions = function () {
|
ACME._testChallengeOptions = function () {
|
||||||
var chToken = require('crypto')
|
var chToken = require('crypto').randomBytes(16).toString('hex');
|
||||||
.randomBytes(16)
|
|
||||||
.toString('hex');
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'http-01',
|
type: 'http-01',
|
||||||
|
@ -560,10 +558,7 @@ ACME._challengeToAuth = function(me, options, request, challenge, dryrun) {
|
||||||
if (dryrun) {
|
if (dryrun) {
|
||||||
dnsPrefix = dnsPrefix.replace(
|
dnsPrefix = dnsPrefix.replace(
|
||||||
'acme-challenge',
|
'acme-challenge',
|
||||||
'greenlock-dryrun-' +
|
'greenlock-dryrun-' + Math.random().toString().slice(2, 6)
|
||||||
Math.random()
|
|
||||||
.toString()
|
|
||||||
.slice(2, 6)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +739,10 @@ ACME._postChallenge = function(me, options, auth) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (1 === options.removeChallenge.length) {
|
if (1 === options.removeChallenge.length) {
|
||||||
options.removeChallenge(auth).then(function() {}, function() {});
|
options.removeChallenge(auth).then(
|
||||||
|
function () {},
|
||||||
|
function () {}
|
||||||
|
);
|
||||||
} else if (2 === options.removeChallenge.length) {
|
} else if (2 === options.removeChallenge.length) {
|
||||||
options.removeChallenge(auth, function (err) {
|
options.removeChallenge(auth, function (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -846,10 +844,7 @@ ACME._setChallenge = function(me, options, auth) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
try {
|
try {
|
||||||
if (1 === options.setChallenge.length) {
|
if (1 === options.setChallenge.length) {
|
||||||
options
|
options.setChallenge(auth).then(resolve).catch(reject);
|
||||||
.setChallenge(auth)
|
|
||||||
.then(resolve)
|
|
||||||
.catch(reject);
|
|
||||||
} else if (2 === options.setChallenge.length) {
|
} else if (2 === options.setChallenge.length) {
|
||||||
options.setChallenge(auth, function (err) {
|
options.setChallenge(auth, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1101,11 +1096,7 @@ ACME._getCertificate = function(me, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var dnsHosts = options.domains.map(function (d) {
|
var dnsHosts = options.domains.map(function (d) {
|
||||||
return (
|
return require('crypto').randomBytes(2).toString('hex') + d;
|
||||||
require('crypto')
|
|
||||||
.randomBytes(2)
|
|
||||||
.toString('hex') + d
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
return ACME._depInit(me, options, dnsHosts).then(function (nada) {
|
return ACME._depInit(me, options, dnsHosts).then(function (nada) {
|
||||||
if (nada) {
|
if (nada) {
|
||||||
|
@ -1209,9 +1200,8 @@ ACME._getCertificate = function(me, options) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ACME._getChallenges(me, options, authUrl).then(function(
|
return ACME._getChallenges(me, options, authUrl).then(
|
||||||
results
|
function (results) {
|
||||||
) {
|
|
||||||
// var domain = options.domains[i]; // results.identifier.value
|
// var domain = options.domains[i]; // results.identifier.value
|
||||||
|
|
||||||
// If it's already valid, we're golden it regardless
|
// If it's already valid, we're golden it regardless
|
||||||
|
@ -1243,7 +1233,8 @@ ACME._getCertificate = function(me, options) {
|
||||||
);
|
);
|
||||||
auths.push(auth);
|
auths.push(auth);
|
||||||
return ACME._setChallenge(me, options, auth).then(setNext);
|
return ACME._setChallenge(me, options, auth).then(setNext);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function challengeNext() {
|
function challengeNext() {
|
||||||
|
@ -1413,8 +1404,5 @@ ACME.create = function create(me) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ACME._toWebsafeBase64 = function (b64) {
|
ACME._toWebsafeBase64 = function (b64) {
|
||||||
return b64
|
return b64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
||||||
.replace(/\+/g, '-')
|
|
||||||
.replace(/\//g, '_')
|
|
||||||
.replace(/=/g, '');
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue