@certd/acme-client 1.20.9 → 1.20.12

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 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.9",
6
+ "version": "1.20.12",
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": "adf569eb62540ce74e091b0d7a55706d959a5e0d"
62
+ "gitHead": "eed265faf11b72c19fd71a3084aa4d623693002c"
63
63
  }
package/src/auto.js CHANGED
@@ -59,9 +59,8 @@ module.exports = async function(client, userOpts) {
59
59
  */
60
60
 
61
61
  log('[auto] Parsing domains from Certificate Signing Request');
62
- const csrDomains = readCsrDomains(opts.csr);
63
- const domains = [csrDomains.commonName].concat(csrDomains.altNames);
64
- const uniqueDomains = Array.from(new Set(domains));
62
+ const { commonName, altNames } = readCsrDomains(opts.csr);
63
+ const uniqueDomains = Array.from(new Set([commonName].concat(altNames).filter((d) => d)));
65
64
 
66
65
  log(`[auto] Resolved ${uniqueDomains.length} unique domains from parsing the Certificate Signing Request`);
67
66
 
@@ -120,6 +119,7 @@ module.exports = async function(client, userOpts) {
120
119
  try {
121
120
  recordItem = await opts.challengeCreateFn(authz, challenge, keyAuthorization);
122
121
 
122
+ // throw new Error('测试异常');
123
123
  /* Challenge verification */
124
124
  if (opts.skipChallengeVerification === true) {
125
125
  log(`[auto] [${d}] Skipping challenge verification since skipChallengeVerification=true`);
@@ -177,21 +177,44 @@ module.exports = async function(client, userOpts) {
177
177
  await challengeFunc(authz);
178
178
  });
179
179
 
180
- log('开始challenge');
181
- let promise = Promise.resolve();
182
- function runPromisesSerially(tasks) {
180
+
181
+ function runAllPromise(tasks) {
182
+ let promise = Promise.resolve();
183
183
  tasks.forEach((task) => {
184
184
  promise = promise.then(task);
185
185
  });
186
186
  return promise;
187
187
  }
188
188
 
189
+ // function runPromisePa(tasks) {
190
+ // return Promise.all(tasks.map((task) => task()));
191
+ // }
192
+
189
193
 
190
194
  try {
191
- await runPromisesSerially(challengePromises);
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;
192
214
  }
193
215
  finally {
194
- await runPromisesSerially(clearTasks);
216
+ log(`清理challenge痕迹,length:${clearTasks.length}`);
217
+ await runAllPromise(clearTasks);
195
218
  }
196
219
 
197
220
  // try {
@@ -201,19 +224,4 @@ module.exports = async function(client, userOpts) {
201
224
  // log('清理challenge');
202
225
  // await Promise.allSettled(clearTasks);
203
226
  // }
204
-
205
-
206
- log('challenge结束');
207
-
208
- // log('[auto] Waiting for challenge valid status');
209
- // await Promise.all(challengePromises);
210
-
211
-
212
- /**
213
- * Finalize order and download certificate
214
- */
215
-
216
- log('[auto] Finalizing order and downloading certificate');
217
- const finalized = await client.finalizeOrder(order, opts.csr);
218
- return client.getCertificate(finalized, opts.preferredChain);
219
227
  };
package/src/client.js CHANGED
@@ -261,7 +261,7 @@ class AcmeClient {
261
261
  const accountUrl = this.api.getAccountUrl();
262
262
 
263
263
  /* Create new HTTP and API clients using new key */
264
- const newHttpClient = new HttpClient(this.opts.directoryUrl, newAccountKey);
264
+ const newHttpClient = new HttpClient(this.opts.directoryUrl, newAccountKey, this.opts.externalAccountBinding);
265
265
  const newApiClient = new AcmeApi(newHttpClient, accountUrl);
266
266
 
267
267
  /* Get old JWK */