@certd/acme-client 1.31.5 → 1.31.7

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.31.5",
6
+ "version": "1.31.7",
7
7
  "type": "module",
8
8
  "module": "scr/index.js",
9
9
  "main": "src/index.js",
@@ -18,7 +18,7 @@
18
18
  "types"
19
19
  ],
20
20
  "dependencies": {
21
- "@certd/basic": "^1.31.5",
21
+ "@certd/basic": "^1.31.7",
22
22
  "@peculiar/x509": "^1.11.0",
23
23
  "asn1js": "^3.0.5",
24
24
  "axios": "^1.7.2",
@@ -67,5 +67,5 @@
67
67
  "bugs": {
68
68
  "url": "https://github.com/publishlab/node-acme-client/issues"
69
69
  },
70
- "gitHead": "92446cb048e1bd7c57f36992d9ba376e9f4e7d3b"
70
+ "gitHead": "0725c663c49d72226c9fb55e2c0c5d134c93ba58"
71
71
  }
package/src/auto.js CHANGED
@@ -53,10 +53,10 @@ export default async (client, userOpts) => {
53
53
 
54
54
  try {
55
55
  client.getAccountUrl();
56
- log('[auto] Account URL already exists, skipping account registration');
56
+ log('[auto] Account URL already exists, skipping account registration( 证书申请账户已存在,跳过注册 )');
57
57
  }
58
58
  catch (e) {
59
- log('[auto] Registering account');
59
+ log('[auto] Registering account (注册证书申请账户)');
60
60
  await client.createAccount(accountPayload);
61
61
  }
62
62
 
@@ -64,7 +64,7 @@ export default async (client, userOpts) => {
64
64
  * Parse domains from CSR
65
65
  */
66
66
 
67
- log('[auto] Parsing domains from Certificate Signing Request');
67
+ log('[auto] Parsing domains from Certificate Signing Request ');
68
68
  const { commonName, altNames } = readCsrDomains(opts.csr);
69
69
  const uniqueDomains = Array.from(new Set([commonName].concat(altNames).filter((d) => d)));
70
70
 
@@ -120,20 +120,20 @@ export default async (client, userOpts) => {
120
120
  // throw new Error('测试异常');
121
121
  /* Challenge verification */
122
122
  if (opts.skipChallengeVerification === true) {
123
- log(`[auto] [${d}] Skipping challenge verification since skipChallengeVerification=true,wait 60s`);
123
+ log(`[auto] [${d}] 跳过本地验证(skipChallengeVerification=true),等待 60s`);
124
124
  await wait(60 * 1000);
125
125
  }
126
126
  else {
127
- log(`[auto] [${d}] Running challenge verification, type = ${challenge.type}`);
127
+ log(`[auto] [${d}] 开始本地验证, type = ${challenge.type}`);
128
128
  try {
129
129
  await client.verifyChallenge(authz, challenge);
130
130
  }
131
131
  catch (e) {
132
- log(`[auto] [${d}] challenge verification threw error: ${e.message}`);
132
+ log(`[auto] [${d}] 本地验证失败,尝试请求ACME提供商获取状态: ${e.message}`);
133
133
  }
134
134
  }
135
135
  /* Complete challenge and wait for valid status */
136
- log(`[auto] [${d}] Completing challenge with ACME provider and waiting for valid status`);
136
+ log(`[auto] [${d}] 请求ACME提供商完成验证,等待返回valid状态`);
137
137
  await client.completeChallenge(challenge);
138
138
  challengeCompleted = true;
139
139
 
package/src/client.js CHANGED
@@ -500,7 +500,7 @@ class AcmeClient {
500
500
  await verify[challenge.type](authz, challenge, keyAuthorization);
501
501
  };
502
502
 
503
- log('Waiting for ACME challenge verification', this.backoffOpts);
503
+ log('Waiting for ACME challenge verification(等待ACME挑战验证)', this.backoffOpts);
504
504
  return util.retry(verifyFn, this.backoffOpts);
505
505
  }
506
506
 
@@ -568,14 +568,14 @@ class AcmeClient {
568
568
  const resp = await this.api.apiRequest(item.url, null, [200]);
569
569
 
570
570
  /* Verify status */
571
- log(`Item has status: ${resp.data.status}`);
571
+ log(`Item has status(挑战状态): ${resp.data.status}`);
572
572
 
573
573
  if (invalidStates.includes(resp.data.status)) {
574
574
  abort();
575
575
  throw new Error(util.formatResponseError(resp));
576
576
  }
577
577
  else if (pendingStates.includes(resp.data.status)) {
578
- throw new Error('Operation is pending or processing');
578
+ throw new Error('Operation is pending or processing(当前仍然在等待状态)');
579
579
  }
580
580
  else if (validStates.includes(resp.data.status)) {
581
581
  return resp.data;
@@ -584,7 +584,7 @@ class AcmeClient {
584
584
  throw new Error(`Unexpected item status: ${resp.data.status}`);
585
585
  };
586
586
 
587
- log(`Waiting for valid status from: ${item.url}`, this.backoffOpts);
587
+ log(`Waiting for valid status (等待valid状态): ${item.url}`, this.backoffOpts);
588
588
  return util.retry(verifyFn, this.backoffOpts);
589
589
  }
590
590
 
package/src/util.js CHANGED
@@ -60,8 +60,9 @@ async function retryPromise(fn, attempts, backoff) {
60
60
  throw e;
61
61
  }
62
62
 
63
+ log(`Promise rejected: ${e.message}`);
63
64
  const duration = backoff.duration();
64
- log(`Promise rejected attempt #${backoff.attempts}, retrying in ${duration}ms: ${e.message}`);
65
+ log(`attempt #${backoff.attempts}, ${duration}ms 后重试: ${e.message}`);
65
66
 
66
67
  await new Promise((resolve) => { setTimeout(resolve, duration); });
67
68
  return retryPromise(fn, attempts, backoff);
@@ -241,7 +242,7 @@ async function resolveDomainBySoaRecord(recordName) {
241
242
  */
242
243
 
243
244
  async function getAuthoritativeDnsResolver(recordName) {
244
- log(`Locating authoritative NS records for name: ${recordName}`);
245
+ log(`Locating authoritative NS records for name: ${recordName} (获取域名的权威NS服务器)`);
245
246
  const resolver = new dns.Resolver();
246
247
 
247
248
  try {
@@ -249,13 +250,14 @@ async function getAuthoritativeDnsResolver(recordName) {
249
250
  const domain = await resolveDomainBySoaRecord(recordName);
250
251
 
251
252
  /* Resolve authoritative NS addresses */
252
- log(`Looking up authoritative NS records for domain: ${domain}`);
253
+ log(`Looking up authoritative NS records for domain(获取域名的权威NS服务器): ${domain}`);
253
254
  const nsRecords = await dns.resolveNs(domain);
255
+ log(`域名权威NS服务器:${nsRecords}`);
254
256
  const nsAddrArray = await Promise.all(nsRecords.map(async (r) => dns.resolve4(r)));
255
257
  const nsAddresses = [].concat(...nsAddrArray).filter((a) => a);
256
258
 
257
259
  if (!nsAddresses.length) {
258
- throw new Error(`Unable to locate any valid authoritative NS addresses for domain: ${domain}`);
260
+ throw new Error(`Unable to locate any valid authoritative NS addresses for domain(获取权威服务器IP失败): ${domain}`);
259
261
  }
260
262
 
261
263
  /* Authoritative NS success */
@@ -263,12 +265,12 @@ async function getAuthoritativeDnsResolver(recordName) {
263
265
  resolver.setServers(nsAddresses);
264
266
  }
265
267
  catch (e) {
266
- log(`Authoritative NS lookup error: ${e.message}`);
268
+ log(`Authoritative NS lookup error(获取权威NS服务器地址失败): ${e.message}`);
267
269
  }
268
270
 
269
271
  /* Return resolver */
270
272
  const addresses = resolver.getServers();
271
- log(`DNS resolver addresses: ${addresses.join(', ')}`);
273
+ log(`DNS resolver addresses(域名的权威NS服务器地址): ${addresses.join(', ')}`);
272
274
 
273
275
  return resolver;
274
276
  }
package/src/verify.js CHANGED
@@ -113,14 +113,14 @@ export async function walkTxtRecord(recordName) {
113
113
 
114
114
  async function verifyDnsChallenge(authz, challenge, keyAuthorization, prefix = '_acme-challenge.') {
115
115
  const recordName = `${prefix}${authz.identifier.value}`;
116
- log(`Resolving DNS TXT from record: ${recordName}`);
116
+ log(`Resolving DNS TXT from record(解析DNS TXT记录): ${recordName}`);
117
117
  const recordValues = await walkTxtRecord(recordName);
118
- log(`DNS query finished successfully, found ${recordValues.length} TXT records`);
118
+ log(`DNS query finished successfully(DNS查询成功), found ${recordValues.length} TXT records`);
119
119
  if (!recordValues.length || !recordValues.includes(keyAuthorization)) {
120
- throw new Error(`Authorization not found in DNS TXT record: ${recordName},need:${keyAuthorization},found:${recordValues}`);
120
+ throw new Error(`Authorization not found in DNS TXT record(没有找到需要的DNS TXT记录): ${recordName},need:${keyAuthorization},found:${recordValues}`);
121
121
  }
122
122
 
123
- log(`Key authorization match for ${challenge.type}/${recordName}, ACME challenge verified`);
123
+ log(`Key authorization match for ${challenge.type}/${recordName}, ACME challenge verified(域名所有权校验成功)`);
124
124
  return true;
125
125
  }
126
126