@certd/acme-client 1.20.13 → 1.20.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/auto.js +24 -18
- package/src/wait.js +9 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Simple and unopinionated ACME client",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "nmorsman",
|
|
6
|
-
"version": "1.20.
|
|
6
|
+
"version": "1.20.15",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"types": "types/index.d.ts",
|
|
9
9
|
"license": "MIT",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"bugs": {
|
|
60
60
|
"url": "https://github.com/publishlab/node-acme-client/issues"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "19a6b9468033be609e9e574ae5f1cf05a07a7592"
|
|
63
63
|
}
|
package/src/auto.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
const { readCsrDomains } = require('./crypto');
|
|
6
6
|
const { log } = require('./logger');
|
|
7
|
+
const { wait } = require('./wait');
|
|
7
8
|
|
|
8
9
|
const defaultOpts = {
|
|
9
10
|
csr: null,
|
|
@@ -118,7 +119,18 @@ module.exports = async function(client, userOpts) {
|
|
|
118
119
|
let recordItem = null;
|
|
119
120
|
try {
|
|
120
121
|
recordItem = await opts.challengeCreateFn(authz, challenge, keyAuthorization);
|
|
121
|
-
|
|
122
|
+
log(`[auto] [${d}] challengeCreateFn success`);
|
|
123
|
+
log(`[auto] [${d}] add challengeRemoveFn()`);
|
|
124
|
+
clearTasks.push(async () => {
|
|
125
|
+
/* Trigger challengeRemoveFn(), suppress errors */
|
|
126
|
+
log(`[auto] [${d}] Trigger challengeRemoveFn()`);
|
|
127
|
+
try {
|
|
128
|
+
await opts.challengeRemoveFn(authz, challenge, keyAuthorization, recordItem);
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
log(`[auto] [${d}] challengeRemoveFn threw error: ${e.message}`);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
122
134
|
// throw new Error('测试异常');
|
|
123
135
|
/* Challenge verification */
|
|
124
136
|
if (opts.skipChallengeVerification === true) {
|
|
@@ -140,19 +152,6 @@ module.exports = async function(client, userOpts) {
|
|
|
140
152
|
log(`[auto] [${d}] challengeCreateFn threw error: ${e.message}`);
|
|
141
153
|
throw e;
|
|
142
154
|
}
|
|
143
|
-
finally {
|
|
144
|
-
log(`[auto] [${d}] add challengeRemoveFn()`);
|
|
145
|
-
clearTasks.push(async () => {
|
|
146
|
-
/* Trigger challengeRemoveFn(), suppress errors */
|
|
147
|
-
log(`[auto] [${d}] Trigger challengeRemoveFn()`);
|
|
148
|
-
try {
|
|
149
|
-
await opts.challengeRemoveFn(authz, challenge, keyAuthorization, recordItem);
|
|
150
|
-
}
|
|
151
|
-
catch (e) {
|
|
152
|
-
log(`[auto] [${d}] challengeRemoveFn threw error: ${e.message}`);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
155
|
}
|
|
157
156
|
catch (e) {
|
|
158
157
|
/* Deactivate pending authz when unable to complete challenge */
|
|
@@ -186,14 +185,21 @@ module.exports = async function(client, userOpts) {
|
|
|
186
185
|
return promise;
|
|
187
186
|
}
|
|
188
187
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
async function runPromisePa(tasks) {
|
|
189
|
+
const results = [];
|
|
190
|
+
// eslint-disable-next-line no-await-in-loop,no-restricted-syntax
|
|
191
|
+
for (const task of tasks) {
|
|
192
|
+
results.push(task());
|
|
193
|
+
// eslint-disable-next-line no-await-in-loop
|
|
194
|
+
await wait(10000);
|
|
195
|
+
}
|
|
196
|
+
return Promise.all(results);
|
|
197
|
+
}
|
|
192
198
|
|
|
193
199
|
|
|
194
200
|
try {
|
|
195
201
|
log('开始challenge');
|
|
196
|
-
await
|
|
202
|
+
await runPromisePa(challengePromises);
|
|
197
203
|
|
|
198
204
|
log('challenge结束');
|
|
199
205
|
|