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