@certd/acme-client 0.3.0 → 0.3.1

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
@@ -2,7 +2,7 @@
2
2
  "name": "@certd/acme-client",
3
3
  "description": "Simple and unopinionated ACME client",
4
4
  "author": "nmorsman",
5
- "version": "0.3.0",
5
+ "version": "0.3.1",
6
6
  "main": "src/index.js",
7
7
  "types": "types",
8
8
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "jsdoc-to-markdown": "^7.1.1",
32
32
  "mocha": "^10.0.0",
33
33
  "nock": "^13.2.4",
34
- "typescript": "^4.6.2",
34
+ "typescript": "^4.8.4",
35
35
  "uuid": "^8.3.2"
36
36
  },
37
37
  "scripts": {
package/src/auto.js CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  const { readCsrDomains } = require('./crypto');
6
6
  const { log } = require('./logger');
7
+
7
8
  const defaultOpts = {
8
9
  csr: null,
9
10
  email: null,
@@ -83,7 +84,7 @@ module.exports = async function(client, userOpts) {
83
84
 
84
85
  log('[auto] Resolving and satisfying authorization challenges');
85
86
 
86
- const challengePromises = authorizations.map(async (authz) => {
87
+ const challengeFunc = async (authz) => {
87
88
  const d = authz.identifier.value;
88
89
  let challengeCompleted = false;
89
90
 
@@ -162,16 +163,26 @@ module.exports = async function(client, userOpts) {
162
163
 
163
164
  throw e;
164
165
  }
166
+ };
167
+
168
+ const challengePromises = authorizations.map((authz) => async () => {
169
+ await challengeFunc(authz);
165
170
  });
166
171
 
167
172
  log('[auto] Waiting for challenge valid status');
168
173
  // await Promise.all(challengePromises);
169
174
 
170
- log("开始challenge")
171
- for (let challenge of challengePromises) {
172
- await challenge
175
+ log('开始challenge');
176
+ let promise = Promise.resolve();
177
+ function runPromisesSerially(tasks) {
178
+ tasks.forEach((task) => {
179
+ promise = promise.then(task);
180
+ });
181
+ return promise;
173
182
  }
174
- log("challenge结束")
183
+
184
+ await runPromisesSerially(challengePromises);
185
+ log('challenge结束');
175
186
  /**
176
187
  * Finalize order and download certificate
177
188
  */
package/types/index.d.ts CHANGED
@@ -51,7 +51,7 @@ export interface ClientExternalAccountBindingOptions {
51
51
  export interface ClientAutoOptions {
52
52
  csr: CsrBuffer | CsrString;
53
53
  challengeCreateFn: (authz: Authorization, challenge: rfc8555.Challenge, keyAuthorization: string) => Promise<any>;
54
- challengeRemoveFn: (authz: Authorization, challenge: rfc8555.Challenge, keyAuthorization: string) => Promise<any>;
54
+ challengeRemoveFn: (authz: Authorization, challenge: rfc8555.Challenge, keyAuthorization: string, recordRes:any) => Promise<any>;
55
55
  email?: string;
56
56
  termsOfServiceAgreed?: boolean;
57
57
  skipChallengeVerification?: boolean;