@certd/acme-client 1.29.2 → 1.29.4

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.29.2",
6
+ "version": "1.29.4",
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.29.2",
21
+ "@certd/basic": "^1.29.4",
22
22
  "@peculiar/x509": "^1.11.0",
23
23
  "asn1js": "^3.0.5",
24
24
  "axios": "^1.7.2",
@@ -65,5 +65,5 @@
65
65
  "bugs": {
66
66
  "url": "https://github.com/publishlab/node-acme-client/issues"
67
67
  },
68
- "gitHead": "ed5634ff83405ad0eb13a8456f59270ed4218734"
68
+ "gitHead": "94509c64b954e17e4842b02c5c9fa0649bce13d4"
69
69
  }
package/src/auto.js CHANGED
@@ -99,31 +99,14 @@ export default async (client, userOpts) => {
99
99
  return;
100
100
  }
101
101
 
102
- try {
103
- /* Select challenge based on priority */
104
- const challenge = authz.challenges.sort((a, b) => {
105
- const aidx = opts.challengePriority.indexOf(a.type);
106
- const bidx = opts.challengePriority.indexOf(b.type);
107
-
108
- if (aidx === -1) return 1;
109
- if (bidx === -1) return -1;
110
- return aidx - bidx;
111
- }).slice(0, 1)[0];
112
-
113
- if (!challenge) {
114
- throw new Error(`Unable to select challenge for ${d}, no challenge found`);
115
- }
116
-
117
- log(`[auto] [${d}] Found ${authz.challenges.length} challenges, selected type: ${challenge.type}`);
102
+ const keyAuthorizationGetter = async (challenge) => {
103
+ return await client.getChallengeKeyAuthorization(challenge);
104
+ }
118
105
 
119
- /* Trigger challengeCreateFn() */
106
+ try {
120
107
  log(`[auto] [${d}] Trigger challengeCreateFn()`);
121
- const keyAuthorization = await client.getChallengeKeyAuthorization(challenge);
122
-
123
108
  try {
124
- const { recordReq, recordRes, dnsProvider } = await opts.challengeCreateFn(authz, challenge, keyAuthorization);
125
- log(`[auto] [${d}] challengeCreateFn success`);
126
- log(`[auto] [${d}] add challengeRemoveFn()`);
109
+ const { recordReq, recordRes, dnsProvider,challenge ,keyAuthorization} = await opts.challengeCreateFn(authz, keyAuthorizationGetter);
127
110
  clearTasks.push(async () => {
128
111
  /* Trigger challengeRemoveFn(), suppress errors */
129
112
  log(`[auto] [${d}] Trigger challengeRemoveFn()`);
@@ -141,7 +124,7 @@ export default async (client, userOpts) => {
141
124
  await wait(60 * 1000);
142
125
  }
143
126
  else {
144
- log(`[auto] [${d}] Running challenge verification`);
127
+ log(`[auto] [${d}] Running challenge verification, type = ${challenge.type}`);
145
128
  try {
146
129
  await client.verifyChallenge(authz, challenge);
147
130
  }
package/src/error.js CHANGED
@@ -5,3 +5,5 @@ export class CancelError extends Error {
5
5
  }
6
6
  }
7
7
 
8
+
9
+
package/types/index.d.ts CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  import { AxiosInstance } from 'axios';
6
6
  import * as rfc8555 from './rfc8555';
7
+ import {CancelError} from '../src/error.js'
8
+ export * from '../src/error.js'
7
9
 
8
10
  export type PrivateKeyBuffer = Buffer;
9
11
  export type PublicKeyBuffer = Buffer;
@@ -56,7 +58,7 @@ export interface ClientExternalAccountBindingOptions {
56
58
 
57
59
  export interface ClientAutoOptions {
58
60
  csr: CsrBuffer | CsrString;
59
- challengeCreateFn: (authz: Authorization, challenge: rfc8555.Challenge, keyAuthorization: string) => Promise<{recordReq:any,recordRes:any,dnsProvider:any}>;
61
+ challengeCreateFn: (authz: Authorization, keyAuthorization: (challenge:rfc8555.Challenge)=>Promise<string>) => Promise<{recordReq?:any,recordRes?:any,dnsProvider?:any,challenge: rfc8555.Challenge,keyAuthorization:string}>;
60
62
  challengeRemoveFn: (authz: Authorization, challenge: rfc8555.Challenge, keyAuthorization: string,recordReq:any, recordRes:any,dnsProvider:any) => Promise<any>;
61
63
  email?: string;
62
64
  termsOfServiceAgreed?: boolean;
@@ -202,4 +204,4 @@ export function setLogger(fn: (message: any, ...args: any[]) => void): void;
202
204
 
203
205
  export function walkTxtRecord(record: any): Promise<string[]>;
204
206
 
205
- export const CancelError: Error;
207
+ export const CancelError: typeof CancelError;