@certd/acme-client 1.20.10 → 1.20.13
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 +29 -20
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.13",
|
|
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": "e5989fe02342837056e2943c82d0daad32c54cc3"
|
|
63
63
|
}
|
package/src/auto.js
CHANGED
|
@@ -119,6 +119,7 @@ module.exports = async function(client, userOpts) {
|
|
|
119
119
|
try {
|
|
120
120
|
recordItem = await opts.challengeCreateFn(authz, challenge, keyAuthorization);
|
|
121
121
|
|
|
122
|
+
// throw new Error('测试异常');
|
|
122
123
|
/* Challenge verification */
|
|
123
124
|
if (opts.skipChallengeVerification === true) {
|
|
124
125
|
log(`[auto] [${d}] Skipping challenge verification since skipChallengeVerification=true`);
|
|
@@ -176,21 +177,44 @@ module.exports = async function(client, userOpts) {
|
|
|
176
177
|
await challengeFunc(authz);
|
|
177
178
|
});
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
|
|
181
|
+
function runAllPromise(tasks) {
|
|
182
|
+
let promise = Promise.resolve();
|
|
182
183
|
tasks.forEach((task) => {
|
|
183
184
|
promise = promise.then(task);
|
|
184
185
|
});
|
|
185
186
|
return promise;
|
|
186
187
|
}
|
|
187
188
|
|
|
189
|
+
// function runPromisePa(tasks) {
|
|
190
|
+
// return Promise.all(tasks.map((task) => task()));
|
|
191
|
+
// }
|
|
192
|
+
|
|
188
193
|
|
|
189
194
|
try {
|
|
190
|
-
|
|
195
|
+
log('开始challenge');
|
|
196
|
+
await runAllPromise(challengePromises);
|
|
197
|
+
|
|
198
|
+
log('challenge结束');
|
|
199
|
+
|
|
200
|
+
// log('[auto] Waiting for challenge valid status');
|
|
201
|
+
// await Promise.all(challengePromises);
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Finalize order and download certificate
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
log('[auto] Finalizing order and downloading certificate');
|
|
208
|
+
const finalized = await client.finalizeOrder(order, opts.csr);
|
|
209
|
+
return await client.getCertificate(finalized, opts.preferredChain);
|
|
210
|
+
}
|
|
211
|
+
catch (e) {
|
|
212
|
+
log('证书申请失败');
|
|
213
|
+
throw e;
|
|
191
214
|
}
|
|
192
215
|
finally {
|
|
193
|
-
|
|
216
|
+
log(`清理challenge痕迹,length:${clearTasks.length}`);
|
|
217
|
+
await runAllPromise(clearTasks);
|
|
194
218
|
}
|
|
195
219
|
|
|
196
220
|
// try {
|
|
@@ -200,19 +224,4 @@ module.exports = async function(client, userOpts) {
|
|
|
200
224
|
// log('清理challenge');
|
|
201
225
|
// await Promise.allSettled(clearTasks);
|
|
202
226
|
// }
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
log('challenge结束');
|
|
206
|
-
|
|
207
|
-
// log('[auto] Waiting for challenge valid status');
|
|
208
|
-
// await Promise.all(challengePromises);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Finalize order and download certificate
|
|
213
|
-
*/
|
|
214
|
-
|
|
215
|
-
log('[auto] Finalizing order and downloading certificate');
|
|
216
|
-
const finalized = await client.finalizeOrder(order, opts.csr);
|
|
217
|
-
return client.getCertificate(finalized, opts.preferredChain);
|
|
218
227
|
};
|