@distilled.cloud/acme 1.0.0-rc.13 → 1.0.0-rc.14

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.
Files changed (43) hide show
  1. package/README.md +8 -6
  2. package/lib/credentials.d.ts.map +1 -1
  3. package/lib/credentials.js.map +1 -1
  4. package/lib/errors.d.ts.map +1 -1
  5. package/lib/errors.js +1 -1
  6. package/lib/errors.js.map +1 -1
  7. package/lib/index.d.ts +4 -4
  8. package/lib/index.d.ts.map +1 -1
  9. package/lib/index.js +4 -4
  10. package/lib/index.js.map +1 -1
  11. package/lib/jose.d.ts.map +1 -1
  12. package/lib/jose.js +4 -11
  13. package/lib/jose.js.map +1 -1
  14. package/lib/protocol.d.ts +4 -4
  15. package/lib/protocol.d.ts.map +1 -1
  16. package/lib/protocol.js +12 -18
  17. package/lib/protocol.js.map +1 -1
  18. package/lib/protocol.test.d.ts +2 -0
  19. package/lib/protocol.test.d.ts.map +1 -0
  20. package/lib/protocol.test.js +533 -0
  21. package/lib/protocol.test.js.map +1 -0
  22. package/lib/retry.d.ts +1 -1
  23. package/lib/retry.d.ts.map +1 -1
  24. package/lib/retry.js +1 -1
  25. package/lib/retry.js.map +1 -1
  26. package/lib/services/acme.d.ts +83 -20
  27. package/lib/services/acme.d.ts.map +1 -1
  28. package/lib/services/acme.js +72 -130
  29. package/lib/services/acme.js.map +1 -1
  30. package/package.json +15 -10
  31. package/src/credentials.ts +13 -19
  32. package/src/errors.ts +15 -25
  33. package/src/index.ts +4 -8
  34. package/src/jose.ts +14 -41
  35. package/src/protocol.test.ts +806 -0
  36. package/src/protocol.ts +32 -81
  37. package/src/retry.ts +2 -8
  38. package/src/services/acme.ts +178 -222
  39. package/lib/response-validation.test.d.ts +0 -4
  40. package/lib/response-validation.test.d.ts.map +0 -1
  41. package/lib/response-validation.test.js +0 -51
  42. package/lib/response-validation.test.js.map +0 -1
  43. package/src/response-validation.test.ts +0 -65
@@ -1,232 +1,194 @@
1
- // AUTO-GENERATED by scripts/generate.ts from manual-specs/acme.json (hand-authored Smithy, RFC 8555). Do not edit.
2
- import * as S from "@distilled.cloud/core/schema";
3
1
  import * as API from "@distilled.cloud/core/api";
4
2
  import * as C from "@distilled.cloud/core/category";
5
- import * as T from "../traits.ts";
6
- import {
7
- AcmeProtocol,
8
- type AcmeOpError,
9
- type AcmeOpContext,
10
- } from "../protocol.ts";
3
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs/acme.json (from RFC 8555). Do not edit.
4
+ import * as S from "@distilled.cloud/core/schema";
5
+ import { AcmeProtocol, type AcmeOpError, type AcmeOpContext } from "../protocol.ts";
11
6
  import * as Retry from "../retry.ts";
7
+ import * as T from "../traits.ts";
12
8
 
13
9
  export type { AcmeOpError, AcmeOpContext };
14
10
 
15
- /** onlyReturnExisting was set and no account matches this key. */
11
+ /** The request specified an account that does not exist. */
16
12
  export class AcmeAccountDoesNotExist
17
13
  extends /*@__PURE__*/ T.applyErrorMatchers(
18
- /*@__PURE__*/ S.TaggedError<AcmeAccountDoesNotExist>()(
19
- "AcmeAccountDoesNotExist",
20
- {
21
- code: S.Number,
22
- message: S.String,
23
- type: S.String,
24
- detail: S.String,
25
- },
26
- ),
27
- [
28
- {
29
- message: {
30
- matches: "^urn:ietf:params:acme:error:accountDoesNotExist$",
31
- },
32
- },
33
- ],
14
+ /*@__PURE__*/ S.TaggedError<AcmeAccountDoesNotExist>()("AcmeAccountDoesNotExist", {
15
+ code: S.Number,
16
+ message: S.String,
17
+ type: S.String,
18
+ detail: S.optional(S.String),
19
+ }),
20
+ [{ message: { matches: "^urn:ietf:params:acme:error:accountDoesNotExist$" } }],
34
21
  ) {}
35
22
 
23
+ /** The request specified a certificate to be revoked that has already been revoked. */
36
24
  export class AcmeAlreadyRevoked
37
25
  extends /*@__PURE__*/ T.applyErrorMatchers(
38
26
  /*@__PURE__*/ S.TaggedError<AcmeAlreadyRevoked>()("AcmeAlreadyRevoked", {
39
27
  code: S.Number,
40
28
  message: S.String,
41
29
  type: S.String,
42
- detail: S.String,
30
+ detail: S.optional(S.String),
43
31
  }),
44
32
  [{ message: { matches: "^urn:ietf:params:acme:error:alreadyRevoked$" } }],
45
33
  ) {}
46
34
 
35
+ /** The CSR is unacceptable (e.g., due to a short key). */
47
36
  export class AcmeBadCsr
48
37
  extends /*@__PURE__*/ T.applyErrorMatchers(
49
38
  /*@__PURE__*/ S.TaggedError<AcmeBadCsr>()("AcmeBadCsr", {
50
39
  code: S.Number,
51
40
  message: S.String,
52
41
  type: S.String,
53
- detail: S.String,
42
+ detail: S.optional(S.String),
54
43
  }),
55
44
  [{ message: { matches: "^urn:ietf:params:acme:error:badCSR$" } }],
56
45
  ) {}
57
46
 
58
- /** The anti-replay nonce was rejected. The protocol retries at most twice using the rejection's nonce before surfacing this error. */
47
+ /** The client sent an unacceptable anti-replay nonce. */
59
48
  export class AcmeBadNonce
60
49
  extends /*@__PURE__*/ T.applyErrorMatchers(
61
50
  /*@__PURE__*/ S.TaggedError<AcmeBadNonce>()("AcmeBadNonce", {
62
51
  code: S.Number,
63
52
  message: S.String,
64
53
  type: S.String,
65
- detail: S.String,
54
+ detail: S.optional(S.String),
66
55
  }),
67
56
  [{ message: { matches: "^urn:ietf:params:acme:error:badNonce$" } }],
68
57
  ) {}
69
58
 
59
+ /** The JWS was signed by a public key the server does not support. */
70
60
  export class AcmeBadPublicKey
71
61
  extends /*@__PURE__*/ T.applyErrorMatchers(
72
62
  /*@__PURE__*/ S.TaggedError<AcmeBadPublicKey>()("AcmeBadPublicKey", {
73
63
  code: S.Number,
74
64
  message: S.String,
75
65
  type: S.String,
76
- detail: S.String,
66
+ detail: S.optional(S.String),
77
67
  }),
78
68
  [{ message: { matches: "^urn:ietf:params:acme:error:badPublicKey$" } }],
79
69
  ) {}
80
70
 
71
+ /** The revocation reason provided is not allowed by the server. */
81
72
  export class AcmeBadRevocationReason
82
73
  extends /*@__PURE__*/ T.applyErrorMatchers(
83
- /*@__PURE__*/ S.TaggedError<AcmeBadRevocationReason>()(
84
- "AcmeBadRevocationReason",
85
- {
86
- code: S.Number,
87
- message: S.String,
88
- type: S.String,
89
- detail: S.String,
90
- },
91
- ),
92
- [
93
- {
94
- message: {
95
- matches: "^urn:ietf:params:acme:error:badRevocationReason$",
96
- },
97
- },
98
- ],
74
+ /*@__PURE__*/ S.TaggedError<AcmeBadRevocationReason>()("AcmeBadRevocationReason", {
75
+ code: S.Number,
76
+ message: S.String,
77
+ type: S.String,
78
+ detail: S.optional(S.String),
79
+ }),
80
+ [{ message: { matches: "^urn:ietf:params:acme:error:badRevocationReason$" } }],
99
81
  ) {}
100
82
 
83
+ /** The JWS was signed with an algorithm the server does not support. */
101
84
  export class AcmeBadSignatureAlgorithm
102
85
  extends /*@__PURE__*/ T.applyErrorMatchers(
103
- /*@__PURE__*/ S.TaggedError<AcmeBadSignatureAlgorithm>()(
104
- "AcmeBadSignatureAlgorithm",
105
- {
106
- code: S.Number,
107
- message: S.String,
108
- type: S.String,
109
- detail: S.String,
110
- },
111
- ),
112
- [
113
- {
114
- message: {
115
- matches: "^urn:ietf:params:acme:error:badSignatureAlgorithm$",
116
- },
117
- },
118
- ],
86
+ /*@__PURE__*/ S.TaggedError<AcmeBadSignatureAlgorithm>()("AcmeBadSignatureAlgorithm", {
87
+ code: S.Number,
88
+ message: S.String,
89
+ type: S.String,
90
+ detail: S.optional(S.String),
91
+ }),
92
+ [{ message: { matches: "^urn:ietf:params:acme:error:badSignatureAlgorithm$" } }],
119
93
  ) {}
120
94
 
121
- /** A CAA record forbids this CA from issuing for the identifier. */
95
+ /** Certification Authority Authorization (CAA) records forbid the CA from issuing a certificate. */
122
96
  export class AcmeCaa
123
97
  extends /*@__PURE__*/ T.applyErrorMatchers(
124
98
  /*@__PURE__*/ S.TaggedError<AcmeCaa>()("AcmeCaa", {
125
99
  code: S.Number,
126
100
  message: S.String,
127
101
  type: S.String,
128
- detail: S.String,
102
+ detail: S.optional(S.String),
129
103
  }),
130
104
  [{ message: { matches: "^urn:ietf:params:acme:error:caa$" } }],
131
105
  ) {}
132
106
 
107
+ /** The server could not connect to validation target. */
133
108
  export class AcmeConnection
134
109
  extends /*@__PURE__*/ T.applyErrorMatchers(
135
110
  /*@__PURE__*/ S.TaggedError<AcmeConnection>()("AcmeConnection", {
136
111
  code: S.Number,
137
112
  message: S.String,
138
113
  type: S.String,
139
- detail: S.String,
114
+ detail: S.optional(S.String),
140
115
  }),
141
116
  [{ message: { matches: "^urn:ietf:params:acme:error:connection$" } }],
142
117
  ) {}
143
118
 
144
- /** The CA could not resolve the identifier (DNS-01 record missing or not propagated). */
119
+ /** There was a problem with a DNS query during identifier validation. */
145
120
  export class AcmeDns
146
121
  extends /*@__PURE__*/ T.applyErrorMatchers(
147
122
  /*@__PURE__*/ S.TaggedError<AcmeDns>()("AcmeDns", {
148
123
  code: S.Number,
149
124
  message: S.String,
150
125
  type: S.String,
151
- detail: S.String,
126
+ detail: S.optional(S.String),
152
127
  }),
153
128
  [{ message: { matches: "^urn:ietf:params:acme:error:dns$" } }],
154
129
  ) {}
155
130
 
156
- /** This CA needs an External Account Binding on newAccount (ZeroSSL, Google Trust Services). */
131
+ /** The request must include a value for the "externalAccountBinding" field. */
157
132
  export class AcmeExternalAccountRequired
158
133
  extends /*@__PURE__*/ T.applyErrorMatchers(
159
- /*@__PURE__*/ S.TaggedError<AcmeExternalAccountRequired>()(
160
- "AcmeExternalAccountRequired",
161
- {
162
- code: S.Number,
163
- message: S.String,
164
- type: S.String,
165
- detail: S.String,
166
- },
167
- ),
168
- [
169
- {
170
- message: {
171
- matches: "^urn:ietf:params:acme:error:externalAccountRequired$",
172
- },
173
- },
174
- ],
134
+ /*@__PURE__*/ S.TaggedError<AcmeExternalAccountRequired>()("AcmeExternalAccountRequired", {
135
+ code: S.Number,
136
+ message: S.String,
137
+ type: S.String,
138
+ detail: S.optional(S.String),
139
+ }),
140
+ [{ message: { matches: "^urn:ietf:params:acme:error:externalAccountRequired$" } }],
175
141
  ) {}
176
142
 
143
+ /** Response received didn't match the challenge's requirements. */
177
144
  export class AcmeIncorrectResponse
178
145
  extends /*@__PURE__*/ T.applyErrorMatchers(
179
- /*@__PURE__*/ S.TaggedError<AcmeIncorrectResponse>()(
180
- "AcmeIncorrectResponse",
181
- {
182
- code: S.Number,
183
- message: S.String,
184
- type: S.String,
185
- detail: S.String,
186
- },
187
- ),
188
- [
189
- {
190
- message: { matches: "^urn:ietf:params:acme:error:incorrectResponse$" },
191
- },
192
- ],
146
+ /*@__PURE__*/ S.TaggedError<AcmeIncorrectResponse>()("AcmeIncorrectResponse", {
147
+ code: S.Number,
148
+ message: S.String,
149
+ type: S.String,
150
+ detail: S.optional(S.String),
151
+ }),
152
+ [{ message: { matches: "^urn:ietf:params:acme:error:incorrectResponse$" } }],
193
153
  ) {}
194
154
 
155
+ /** A contact URL for an account was invalid. */
195
156
  export class AcmeInvalidContact
196
157
  extends /*@__PURE__*/ T.applyErrorMatchers(
197
158
  /*@__PURE__*/ S.TaggedError<AcmeInvalidContact>()("AcmeInvalidContact", {
198
159
  code: S.Number,
199
160
  message: S.String,
200
161
  type: S.String,
201
- detail: S.String,
162
+ detail: S.optional(S.String),
202
163
  }),
203
164
  [{ message: { matches: "^urn:ietf:params:acme:error:invalidContact$" } }],
204
165
  ) {}
205
166
 
167
+ /** The request message was malformed. */
206
168
  export class AcmeMalformed
207
169
  extends /*@__PURE__*/ T.applyErrorMatchers(
208
170
  /*@__PURE__*/ S.TaggedError<AcmeMalformed>()("AcmeMalformed", {
209
171
  code: S.Number,
210
172
  message: S.String,
211
173
  type: S.String,
212
- detail: S.String,
174
+ detail: S.optional(S.String),
213
175
  }),
214
176
  [{ message: { matches: "^urn:ietf:params:acme:error:malformed$" } }],
215
177
  ) {}
216
178
 
217
- /** finalize was called before every authorization was valid. */
179
+ /** The request attempted to finalize an order that is not ready to be finalized. */
218
180
  export class AcmeOrderNotReady
219
181
  extends /*@__PURE__*/ T.applyErrorMatchers(
220
182
  /*@__PURE__*/ S.TaggedError<AcmeOrderNotReady>()("AcmeOrderNotReady", {
221
183
  code: S.Number,
222
184
  message: S.String,
223
185
  type: S.String,
224
- detail: S.String,
186
+ detail: S.optional(S.String),
225
187
  }),
226
188
  [{ message: { matches: "^urn:ietf:params:acme:error:orderNotReady$" } }],
227
189
  ) {}
228
190
 
229
- /** The CA's rate limit was hit; `retryAfter` carries its hint when the CA sends one. */
191
+ /** The request exceeds a rate limit. */
230
192
  export class AcmeRateLimited
231
193
  extends /*@__PURE__*/ T.applyErrorMatchers(
232
194
  /*@__PURE__*/ S.TaggedError<AcmeRateLimited>()("AcmeRateLimited", {
@@ -234,118 +196,93 @@ export class AcmeRateLimited
234
196
  code: S.Number,
235
197
  message: S.String,
236
198
  type: S.String,
237
- detail: S.String,
199
+ detail: S.optional(S.String),
238
200
  }).pipe(C.withThrottlingError, C.withRetryableError),
239
201
  [{ message: { matches: "^urn:ietf:params:acme:error:rateLimited$" } }],
240
202
  ) {}
241
203
 
242
- /** The CA will not issue for this identifier (policy, blocklist). */
204
+ /** The server will not issue certificates for the identifier. */
243
205
  export class AcmeRejectedIdentifier
244
206
  extends /*@__PURE__*/ T.applyErrorMatchers(
245
- /*@__PURE__*/ S.TaggedError<AcmeRejectedIdentifier>()(
246
- "AcmeRejectedIdentifier",
247
- {
248
- code: S.Number,
249
- message: S.String,
250
- type: S.String,
251
- detail: S.String,
252
- },
253
- ),
254
- [
255
- {
256
- message: { matches: "^urn:ietf:params:acme:error:rejectedIdentifier$" },
257
- },
258
- ],
207
+ /*@__PURE__*/ S.TaggedError<AcmeRejectedIdentifier>()("AcmeRejectedIdentifier", {
208
+ code: S.Number,
209
+ message: S.String,
210
+ type: S.String,
211
+ detail: S.optional(S.String),
212
+ }),
213
+ [{ message: { matches: "^urn:ietf:params:acme:error:rejectedIdentifier$" } }],
259
214
  ) {}
260
215
 
216
+ /** The server experienced an internal error. */
261
217
  export class AcmeServerInternal
262
218
  extends /*@__PURE__*/ T.applyErrorMatchers(
263
219
  /*@__PURE__*/ S.TaggedError<AcmeServerInternal>()("AcmeServerInternal", {
264
220
  code: S.Number,
265
221
  message: S.String,
266
222
  type: S.String,
267
- detail: S.String,
223
+ detail: S.optional(S.String),
268
224
  }).pipe(C.withRetryableError),
269
225
  [{ message: { matches: "^urn:ietf:params:acme:error:serverInternal$" } }],
270
226
  ) {}
271
227
 
228
+ /** The server received a TLS error during validation. */
272
229
  export class AcmeTls
273
230
  extends /*@__PURE__*/ T.applyErrorMatchers(
274
231
  /*@__PURE__*/ S.TaggedError<AcmeTls>()("AcmeTls", {
275
232
  code: S.Number,
276
233
  message: S.String,
277
234
  type: S.String,
278
- detail: S.String,
235
+ detail: S.optional(S.String),
279
236
  }),
280
237
  [{ message: { matches: "^urn:ietf:params:acme:error:tls$" } }],
281
238
  ) {}
282
239
 
240
+ /** The client lacks sufficient authorization. */
283
241
  export class AcmeUnauthorized
284
242
  extends /*@__PURE__*/ T.applyErrorMatchers(
285
243
  /*@__PURE__*/ S.TaggedError<AcmeUnauthorized>()("AcmeUnauthorized", {
286
244
  code: S.Number,
287
245
  message: S.String,
288
246
  type: S.String,
289
- detail: S.String,
247
+ detail: S.optional(S.String),
290
248
  }),
291
249
  [{ message: { matches: "^urn:ietf:params:acme:error:unauthorized$" } }],
292
250
  ) {}
293
251
 
252
+ /** A contact URL for an account used an unsupported protocol scheme. */
294
253
  export class AcmeUnsupportedContact
295
254
  extends /*@__PURE__*/ T.applyErrorMatchers(
296
- /*@__PURE__*/ S.TaggedError<AcmeUnsupportedContact>()(
297
- "AcmeUnsupportedContact",
298
- {
299
- code: S.Number,
300
- message: S.String,
301
- type: S.String,
302
- detail: S.String,
303
- },
304
- ),
305
- [
306
- {
307
- message: { matches: "^urn:ietf:params:acme:error:unsupportedContact$" },
308
- },
309
- ],
255
+ /*@__PURE__*/ S.TaggedError<AcmeUnsupportedContact>()("AcmeUnsupportedContact", {
256
+ code: S.Number,
257
+ message: S.String,
258
+ type: S.String,
259
+ detail: S.optional(S.String),
260
+ }),
261
+ [{ message: { matches: "^urn:ietf:params:acme:error:unsupportedContact$" } }],
310
262
  ) {}
311
263
 
264
+ /** An identifier is of an unsupported type. */
312
265
  export class AcmeUnsupportedIdentifier
313
266
  extends /*@__PURE__*/ T.applyErrorMatchers(
314
- /*@__PURE__*/ S.TaggedError<AcmeUnsupportedIdentifier>()(
315
- "AcmeUnsupportedIdentifier",
316
- {
317
- code: S.Number,
318
- message: S.String,
319
- type: S.String,
320
- detail: S.String,
321
- },
322
- ),
323
- [
324
- {
325
- message: {
326
- matches: "^urn:ietf:params:acme:error:unsupportedIdentifier$",
327
- },
328
- },
329
- ],
267
+ /*@__PURE__*/ S.TaggedError<AcmeUnsupportedIdentifier>()("AcmeUnsupportedIdentifier", {
268
+ code: S.Number,
269
+ message: S.String,
270
+ type: S.String,
271
+ detail: S.optional(S.String),
272
+ }),
273
+ [{ message: { matches: "^urn:ietf:params:acme:error:unsupportedIdentifier$" } }],
330
274
  ) {}
331
275
 
332
- /** The CA needs a human step (new terms of service, a subscriber agreement); `detail` says what. */
276
+ /** Visit the "instance" URL and take actions specified there. */
333
277
  export class AcmeUserActionRequired
334
278
  extends /*@__PURE__*/ T.applyErrorMatchers(
335
- /*@__PURE__*/ S.TaggedError<AcmeUserActionRequired>()(
336
- "AcmeUserActionRequired",
337
- {
338
- code: S.Number,
339
- message: S.String,
340
- type: S.String,
341
- detail: S.String,
342
- },
343
- ),
344
- [
345
- {
346
- message: { matches: "^urn:ietf:params:acme:error:userActionRequired$" },
347
- },
348
- ],
279
+ /*@__PURE__*/ S.TaggedError<AcmeUserActionRequired>()("AcmeUserActionRequired", {
280
+ code: S.Number,
281
+ message: S.String,
282
+ type: S.String,
283
+ detail: S.optional(S.String),
284
+ }),
285
+ [{ message: { matches: "^urn:ietf:params:acme:error:userActionRequired$" } }],
349
286
  ) {}
350
287
 
351
288
  export interface DeactivateAuthorizationRequest {
@@ -358,16 +295,15 @@ export const DeactivateAuthorizationRequest = /*@__PURE__*/ S.suspend(() =>
358
295
  S.Struct({
359
296
  url: S.String.pipe(T.Label()),
360
297
  status: S.String,
361
- }).pipe(
362
- T.Http({ method: "POST", uri: "/authz/{url}/deactivate", code: 200 }),
363
- ),
298
+ }).pipe(T.Http({ method: "POST", uri: "/authz/{url}/deactivate", code: 200 })),
364
299
  ).annotate({
365
300
  identifier: "DeactivateAuthorizationRequest",
366
301
  }) as any as S.Schema<DeactivateAuthorizationRequest>;
367
302
 
368
303
  export interface Identifier {
369
- /** `dns` (RFC 8555) or `ip` (RFC 8738). */
304
+ /** The type of identifier. This document defines the "dns" identifier type. See the registry defined in Section 9.7.7 for any others. */
370
305
  type: string;
306
+ /** The identifier itself. */
371
307
  value: string;
372
308
  }
373
309
  export const Identifier = /*@__PURE__*/ S.suspend(() =>
@@ -378,8 +314,11 @@ export const Identifier = /*@__PURE__*/ S.suspend(() =>
378
314
  ).annotate({ identifier: "Identifier" }) as any as S.Schema<Identifier>;
379
315
 
380
316
  export interface Subproblem {
317
+ /** The error type URI. */
381
318
  type?: string;
319
+ /** A human-readable explanation. */
382
320
  detail?: string;
321
+ /** The identifier this subproblem is about. */
383
322
  identifier?: Identifier;
384
323
  }
385
324
  export const Subproblem = /*@__PURE__*/ S.suspend(() =>
@@ -397,11 +336,17 @@ export const ProblemSubproblemsList = /*@__PURE__*/ S.Array(
397
336
 
398
337
  /** RFC 7807 problem document (RFC 8555 §6.7). */
399
338
  export interface Problem {
339
+ /** The error type URI, e.g. `urn:ietf:params:acme:error:malformed`. */
400
340
  type?: string;
341
+ /** A human-readable explanation. */
401
342
  detail?: string;
343
+ /** The HTTP status code. */
402
344
  status?: number;
345
+ /** A URI reference identifying this occurrence. */
403
346
  instance?: string;
347
+ /** The identifier the error relates to. */
404
348
  identifier?: Identifier;
349
+ /** Errors for individual identifiers (RFC 8555 §6.7.1). */
405
350
  subproblems?: ProblemSubproblemsList;
406
351
  }
407
352
  export const Problem = /*@__PURE__*/ S.suspend(() =>
@@ -417,13 +362,17 @@ export const Problem = /*@__PURE__*/ S.suspend(() =>
417
362
 
418
363
  /** RFC 8555 §8 */
419
364
  export interface Challenge {
420
- /** dns-01 | http-01 | tls-alpn-01 */
365
+ /** The type of challenge encoded in the object. */
421
366
  type: string;
367
+ /** The URL to which a response can be posted. */
422
368
  url: string;
423
- /** pending | processing | valid | invalid */
369
+ /** The status of this challenge. Possible values are "pending", "processing", "valid", and "invalid" (see Section 7.1.6). */
424
370
  status: string;
371
+ /** The time at which the server validated this challenge, encoded in the format specified in [RFC3339]. This field is REQUIRED if the "status" field is "valid". */
425
372
  validated?: string;
373
+ /** A random value that uniquely identifies the challenge. This value MUST have at least 128 bits of entropy. It MUST NOT contain any characters outside the base64url alphabet and MUST NOT include base64 padding characters ("="). See [RFC4086] for additional information on randomness requirements. */
426
374
  token?: string;
375
+ /** Error that occurred while the server was validating the challenge, if any, structured as a problem document [RFC7807]. Multiple errors can be indicated by using subproblems Section 6.7.1. A challenge object with an error MUST have status equal to "invalid". */
427
376
  error?: Problem;
428
377
  }
429
378
  export const Challenge = /*@__PURE__*/ S.suspend(() =>
@@ -444,11 +393,15 @@ export const AuthorizationChallengesList = /*@__PURE__*/ S.Array(
444
393
 
445
394
  /** RFC 8555 §7.1.4 */
446
395
  export interface Authorization {
396
+ /** The identifier that the account is authorized to represent. */
447
397
  identifier: Identifier;
448
- /** pending | valid | invalid | deactivated | expired | revoked */
398
+ /** The status of this authorization. Possible values are "pending", "valid", "invalid", "deactivated", "expired", and "revoked". See Section 7.1.6. */
449
399
  status: string;
400
+ /** The timestamp after which the server will consider this authorization invalid, encoded in the format specified in [RFC3339]. This field is REQUIRED for objects with "valid" in the "status" field. */
450
401
  expires?: string;
402
+ /** For pending authorizations, the challenges that the client can fulfill in order to prove possession of the identifier. For valid authorizations, the challenge that was validated. For invalid authorizations, the challenge that was attempted and failed. Each array entry is an object with parameters required to validate the challenge. A client should attempt to fulfill one of these challenges, and a server should consider any one of the challenges sufficient to make the authorization valid. */
451
403
  challenges: AuthorizationChallengesList;
404
+ /** This field MUST be present and true for authorizations created as a result of a newOrder request containing a DNS identifier with a value that was a wildcard domain name. For other authorizations, it MUST be absent. Wildcard domain names are described in Section 7.1.3. */
452
405
  wildcard?: boolean;
453
406
  }
454
407
  export const Authorization = /*@__PURE__*/ S.suspend(() =>
@@ -490,14 +443,12 @@ export const CertificateChain = /*@__PURE__*/ S.suspend(() =>
490
443
  chain: S.String,
491
444
  alternates: S.optional(CertificateChainAlternatesList),
492
445
  }),
493
- ).annotate({
494
- identifier: "CertificateChain",
495
- }) as any as S.Schema<CertificateChain>;
446
+ ).annotate({ identifier: "CertificateChain" }) as any as S.Schema<CertificateChain>;
496
447
 
497
448
  export interface FinalizeOrderRequest {
498
449
  /** Absolute URL of the resource, as returned by the CA. */
499
450
  url: string;
500
- /** base64url DER PKCS#10 CSR. */
451
+ /** A CSR encoding the parameters for the certificate being requested [RFC2986]. The CSR is sent in the base64url-encoded version of the DER format. (Note: Because this field uses base64url, and does not include headers, it is different from PEM.) */
501
452
  csr: string;
502
453
  }
503
454
  export const FinalizeOrderRequest = /*@__PURE__*/ S.suspend(() =>
@@ -505,9 +456,7 @@ export const FinalizeOrderRequest = /*@__PURE__*/ S.suspend(() =>
505
456
  url: S.String.pipe(T.Label()),
506
457
  csr: S.String,
507
458
  }).pipe(T.Http({ method: "POST", uri: "/finalize/{url}", code: 200 })),
508
- ).annotate({
509
- identifier: "FinalizeOrderRequest",
510
- }) as any as S.Schema<FinalizeOrderRequest>;
459
+ ).annotate({ identifier: "FinalizeOrderRequest" }) as any as S.Schema<FinalizeOrderRequest>;
511
460
 
512
461
  export type OrderResponseIdentifiersList = Array<Identifier>;
513
462
  export const OrderResponseIdentifiersList = /*@__PURE__*/ S.Array(
@@ -521,15 +470,23 @@ export const OrderResponseAuthorizationsList = /*@__PURE__*/ S.Array(
521
470
 
522
471
  /** RFC 8555 §7.1.3, plus the `Location` header as `location`. */
523
472
  export interface OrderResponse {
524
- /** pending | ready | processing | valid | invalid */
473
+ /** The status of this order. Possible values are "pending", "ready", "processing", "valid", and "invalid". See Section 7.1.6. */
525
474
  status: string;
475
+ /** The timestamp after which the server will consider this order invalid, encoded in the format specified in [RFC3339]. This field is REQUIRED for objects with "pending" or "valid" in the status field. */
526
476
  expires?: string;
477
+ /** An array of identifier objects that the order pertains to. */
527
478
  identifiers: OrderResponseIdentifiersList;
479
+ /** The requested value of the notBefore field in the certificate, in the date format defined in [RFC3339]. */
528
480
  notBefore?: string;
481
+ /** The requested value of the notAfter field in the certificate, in the date format defined in [RFC3339]. */
529
482
  notAfter?: string;
483
+ /** The error that occurred while processing the order, if any. This field is structured as a problem document [RFC7807]. */
530
484
  error?: Problem;
485
+ /** For pending orders, the authorizations that the client needs to complete before the requested certificate can be issued (see Section 7.5), including unexpired authorizations that the client has completed in the past for identifiers specified in the order. The authorizations required are dictated by server policy; there may not be a 1:1 relationship between the order identifiers and the authorizations required. For final orders (in the "valid" or "invalid" state), the authorizations that were completed. Each entry is a URL from which an authorization can be fetched with a POST-as-GET request. */
531
486
  authorizations: OrderResponseAuthorizationsList;
487
+ /** A URL that a CSR must be POSTed to once all of the order's authorizations are satisfied to finalize the order. The result of a successful finalization will be the population of the certificate URL for the order. */
532
488
  finalize: string;
489
+ /** A URL for the certificate that has been issued in response to this order. */
533
490
  certificate?: string;
534
491
  /** The order URL (`Location` header). */
535
492
  location?: string;
@@ -557,16 +514,12 @@ export const GetAuthorizationRequest = /*@__PURE__*/ S.suspend(() =>
557
514
  S.Struct({
558
515
  url: S.String.pipe(T.Label()),
559
516
  }).pipe(T.Http({ method: "POST", uri: "/authz/{url}", code: 200 })),
560
- ).annotate({
561
- identifier: "GetAuthorizationRequest",
562
- }) as any as S.Schema<GetAuthorizationRequest>;
517
+ ).annotate({ identifier: "GetAuthorizationRequest" }) as any as S.Schema<GetAuthorizationRequest>;
563
518
 
564
519
  export interface GetDirectoryRequest {}
565
520
  export const GetDirectoryRequest = /*@__PURE__*/ S.suspend(() =>
566
521
  S.Struct({}).pipe(T.Http({ method: "GET", uri: "/directory", code: 200 })),
567
- ).annotate({
568
- identifier: "GetDirectoryRequest",
569
- }) as any as S.Schema<GetDirectoryRequest>;
522
+ ).annotate({ identifier: "GetDirectoryRequest" }) as any as S.Schema<GetDirectoryRequest>;
570
523
 
571
524
  export type DirectoryMetaCaaIdentitiesList = Array<string>;
572
525
  export const DirectoryMetaCaaIdentitiesList = /*@__PURE__*/ S.Array(
@@ -574,9 +527,13 @@ export const DirectoryMetaCaaIdentitiesList = /*@__PURE__*/ S.Array(
574
527
  ) as any as S.Schema<DirectoryMetaCaaIdentitiesList>;
575
528
 
576
529
  export interface DirectoryMeta {
530
+ /** A URL identifying the current terms of service. */
577
531
  termsOfService?: string;
532
+ /** An HTTP or HTTPS URL locating a website providing more information about the ACME server. */
578
533
  website?: string;
534
+ /** The hostnames that the ACME server recognizes as referring to itself for the purposes of CAA record validation as defined in [RFC6844]. Each string MUST represent the same sequence of ASCII code points that the server will expect to see as the "Issuer Domain Name" in a CAA issue or issuewild property tag. This allows clients to determine the correct issuer domain name to use when configuring CAA records. */
579
535
  caaIdentities?: DirectoryMetaCaaIdentitiesList;
536
+ /** If this field is present and set to "true", then the CA requires that all newAccount requests include an "externalAccountBinding" field associating the new account with an external account. */
580
537
  externalAccountRequired?: boolean;
581
538
  }
582
539
  export const DirectoryMeta = /*@__PURE__*/ S.suspend(() =>
@@ -590,12 +547,19 @@ export const DirectoryMeta = /*@__PURE__*/ S.suspend(() =>
590
547
 
591
548
  /** RFC 8555 §7.1.1 */
592
549
  export interface Directory {
550
+ /** URL of the new nonce resource. */
593
551
  newNonce: string;
552
+ /** URL of the new account resource. */
594
553
  newAccount: string;
554
+ /** URL of the new order resource. */
595
555
  newOrder: string;
556
+ /** URL of the new authorization resource. */
596
557
  newAuthz?: string;
558
+ /** URL of the revoke certificate resource. */
597
559
  revokeCert: string;
560
+ /** URL of the key change resource. */
598
561
  keyChange?: string;
562
+ /** Metadata relating to the service provided by the ACME server. */
599
563
  meta?: DirectoryMeta;
600
564
  }
601
565
  export const Directory = /*@__PURE__*/ S.suspend(() =>
@@ -618,16 +582,14 @@ export const GetOrderRequest = /*@__PURE__*/ S.suspend(() =>
618
582
  S.Struct({
619
583
  url: S.String.pipe(T.Label()),
620
584
  }).pipe(T.Http({ method: "POST", uri: "/order/{url}", code: 200 })),
621
- ).annotate({
622
- identifier: "GetOrderRequest",
623
- }) as any as S.Schema<GetOrderRequest>;
585
+ ).annotate({ identifier: "GetOrderRequest" }) as any as S.Schema<GetOrderRequest>;
624
586
 
625
587
  export type NewAccountRequestContactList = Array<string>;
626
588
  export const NewAccountRequestContactList = /*@__PURE__*/ S.Array(
627
589
  S.String,
628
590
  ) as any as S.Schema<NewAccountRequestContactList>;
629
591
 
630
- /** A JWS binding this account to an existing CA account (RFC 8555 §7.3.4). The protocol builds it from the credentials' EAB key when the CA requires one. */
592
+ /** A JWS binding this account to an existing CA account (RFC 8555 §7.3.4). The protocol builds it from the credentials' EAB key id and HMAC key. */
631
593
  export interface ExternalAccountBinding {
632
594
  protected: string;
633
595
  payload: string;
@@ -639,14 +601,16 @@ export const ExternalAccountBinding = /*@__PURE__*/ S.suspend(() =>
639
601
  payload: S.String,
640
602
  signature: S.String,
641
603
  }),
642
- ).annotate({
643
- identifier: "ExternalAccountBinding",
644
- }) as any as S.Schema<ExternalAccountBinding>;
604
+ ).annotate({ identifier: "ExternalAccountBinding" }) as any as S.Schema<ExternalAccountBinding>;
645
605
 
646
606
  export interface NewAccountRequest {
607
+ /** Same meaning as the corresponding server field defined in Section 7.1.2. */
647
608
  contact?: NewAccountRequestContactList;
609
+ /** Same meaning as the corresponding server field defined in Section 7.1.2. */
648
610
  termsOfServiceAgreed?: boolean;
611
+ /** If this field is present with the value "true", then the server MUST NOT create a new account if one does not already exist. This allows a client to look up an account URL based on an account key (see Section 7.3.1). */
649
612
  onlyReturnExisting?: boolean;
613
+ /** Same meaning as the corresponding server field defined in Section 7.1.2 */
650
614
  externalAccountBinding?: ExternalAccountBinding;
651
615
  }
652
616
  export const NewAccountRequest = /*@__PURE__*/ S.suspend(() =>
@@ -656,9 +620,7 @@ export const NewAccountRequest = /*@__PURE__*/ S.suspend(() =>
656
620
  onlyReturnExisting: S.optional(S.Boolean),
657
621
  externalAccountBinding: S.optional(ExternalAccountBinding),
658
622
  }).pipe(T.Http({ method: "POST", uri: "/newAccount", code: 200 })),
659
- ).annotate({
660
- identifier: "NewAccountRequest",
661
- }) as any as S.Schema<NewAccountRequest>;
623
+ ).annotate({ identifier: "NewAccountRequest" }) as any as S.Schema<NewAccountRequest>;
662
624
 
663
625
  export type AccountResponseContactList = Array<string>;
664
626
  export const AccountResponseContactList = /*@__PURE__*/ S.Array(
@@ -667,9 +629,13 @@ export const AccountResponseContactList = /*@__PURE__*/ S.Array(
667
629
 
668
630
  /** RFC 8555 §7.1.2, plus the `Location` header as `location`. */
669
631
  export interface AccountResponse {
632
+ /** The status of this account. Possible values are "valid", "deactivated", and "revoked". The value "deactivated" should be used to indicate client-initiated deactivation whereas "revoked" should be used to indicate server- initiated deactivation. See Section 7.1.6. */
670
633
  status: string;
634
+ /** An array of URLs that the server can use to contact the client for issues related to this account. For example, the server may wish to notify the client about server-initiated revocation or certificate expiration. For information on supported URL schemes, see Section 7.3. */
671
635
  contact?: AccountResponseContactList;
636
+ /** Including this field in a newAccount request, with a value of true, indicates the client's agreement with the terms of service. This field cannot be updated by the client. */
672
637
  termsOfServiceAgreed?: boolean;
638
+ /** A URL from which a list of orders submitted by this account can be fetched via a POST-as-GET request, as described in Section 7.1.2.1. */
673
639
  orders?: string;
674
640
  /** The account URL (`Location` header); the `kid` for every later request. */
675
641
  location?: string;
@@ -682,16 +648,12 @@ export const AccountResponse = /*@__PURE__*/ S.suspend(() =>
682
648
  orders: S.optional(S.String),
683
649
  location: S.optional(S.String),
684
650
  }),
685
- ).annotate({
686
- identifier: "AccountResponse",
687
- }) as any as S.Schema<AccountResponse>;
651
+ ).annotate({ identifier: "AccountResponse" }) as any as S.Schema<AccountResponse>;
688
652
 
689
653
  export interface NewNonceRequest {}
690
654
  export const NewNonceRequest = /*@__PURE__*/ S.suspend(() =>
691
655
  S.Struct({}).pipe(T.Http({ method: "GET", uri: "/newNonce", code: 200 })),
692
- ).annotate({
693
- identifier: "NewNonceRequest",
694
- }) as any as S.Schema<NewNonceRequest>;
656
+ ).annotate({ identifier: "NewNonceRequest" }) as any as S.Schema<NewNonceRequest>;
695
657
 
696
658
  export interface NonceResponse {
697
659
  /** The `Replay-Nonce` header. */
@@ -709,8 +671,11 @@ export const NewOrderRequestIdentifiersList = /*@__PURE__*/ S.Array(
709
671
  ) as any as S.Schema<NewOrderRequestIdentifiersList>;
710
672
 
711
673
  export interface NewOrderRequest {
674
+ /** An array of identifier objects that the client wishes to submit an order for. */
712
675
  identifiers: NewOrderRequestIdentifiersList;
676
+ /** The requested value of the notBefore field in the certificate, in the date format defined in [RFC3339]. */
713
677
  notBefore?: string;
678
+ /** The requested value of the notAfter field in the certificate, in the date format defined in [RFC3339]. */
714
679
  notAfter?: string;
715
680
  }
716
681
  export const NewOrderRequest = /*@__PURE__*/ S.suspend(() =>
@@ -719,9 +684,7 @@ export const NewOrderRequest = /*@__PURE__*/ S.suspend(() =>
719
684
  notBefore: S.optional(S.String),
720
685
  notAfter: S.optional(S.String),
721
686
  }).pipe(T.Http({ method: "POST", uri: "/newOrder", code: 200 })),
722
- ).annotate({
723
- identifier: "NewOrderRequest",
724
- }) as any as S.Schema<NewOrderRequest>;
687
+ ).annotate({ identifier: "NewOrderRequest" }) as any as S.Schema<NewOrderRequest>;
725
688
 
726
689
  export interface RespondChallengeRequest {
727
690
  /** Absolute URL of the resource, as returned by the CA. */
@@ -731,14 +694,12 @@ export const RespondChallengeRequest = /*@__PURE__*/ S.suspend(() =>
731
694
  S.Struct({
732
695
  url: S.String.pipe(T.Label()),
733
696
  }).pipe(T.Http({ method: "POST", uri: "/challenge/{url}", code: 200 })),
734
- ).annotate({
735
- identifier: "RespondChallengeRequest",
736
- }) as any as S.Schema<RespondChallengeRequest>;
697
+ ).annotate({ identifier: "RespondChallengeRequest" }) as any as S.Schema<RespondChallengeRequest>;
737
698
 
738
699
  export interface RevokeCertificateRequest {
739
- /** base64url DER of the certificate to revoke. */
700
+ /** The certificate to be revoked, in the base64url-encoded version of the DER format. (Note: Because this field uses base64url, and does not include headers, it is different from PEM.) */
740
701
  certificate: string;
741
- /** RFC 5280 CRLReason code. */
702
+ /** One of the revocation reasonCodes defined in Section 5.3.1 of [RFC5280] to be used when generating OCSP responses and CRLs. If this field is not set, the server SHOULD omit the reasonCode CRL entry extension when generating OCSP responses and CRLs. The server MAY disallow a subset of reasonCodes from being used by the user. If a request contains a disallowed reasonCode, then the server MUST reject it with the error type "urn:ietf:params:acme:error:badRevocationReason". The problem document detail SHOULD indicate which reasonCodes are allowed. */
742
703
  reason?: number;
743
704
  }
744
705
  export const RevokeCertificateRequest = /*@__PURE__*/ S.suspend(() =>
@@ -746,14 +707,10 @@ export const RevokeCertificateRequest = /*@__PURE__*/ S.suspend(() =>
746
707
  certificate: S.String,
747
708
  reason: S.optional(S.Number),
748
709
  }).pipe(T.Http({ method: "POST", uri: "/revokeCert", code: 200 })),
749
- ).annotate({
750
- identifier: "RevokeCertificateRequest",
751
- }) as any as S.Schema<RevokeCertificateRequest>;
710
+ ).annotate({ identifier: "RevokeCertificateRequest" }) as any as S.Schema<RevokeCertificateRequest>;
752
711
 
753
712
  export interface RevokeCertificateResponse {}
754
- export const RevokeCertificateResponse = /*@__PURE__*/ S.suspend(() =>
755
- S.Struct({}),
756
- ).annotate({
713
+ export const RevokeCertificateResponse = /*@__PURE__*/ S.suspend(() => S.Struct({})).annotate({
757
714
  identifier: "RevokeCertificateResponse",
758
715
  }) as any as S.Schema<RevokeCertificateResponse>;
759
716
 
@@ -765,8 +722,9 @@ export const UpdateAccountRequestContactList = /*@__PURE__*/ S.Array(
765
722
  export interface UpdateAccountRequest {
766
723
  /** Absolute URL of the resource, as returned by the CA. */
767
724
  url: string;
725
+ /** An array of URLs that the server can use to contact the client for issues related to this account. For example, the server may wish to notify the client about server-initiated revocation or certificate expiration. For information on supported URL schemes, see Section 7.3. */
768
726
  contact?: UpdateAccountRequestContactList;
769
- /** `deactivated` to deactivate the account. */
727
+ /** `deactivated` to deactivate the account (RFC 8555 §7.3.6). */
770
728
  status?: string;
771
729
  }
772
730
  export const UpdateAccountRequest = /*@__PURE__*/ S.suspend(() =>
@@ -775,9 +733,7 @@ export const UpdateAccountRequest = /*@__PURE__*/ S.suspend(() =>
775
733
  contact: S.optional(UpdateAccountRequestContactList),
776
734
  status: S.optional(S.String),
777
735
  }).pipe(T.Http({ method: "POST", uri: "/account/{url}", code: 200 })),
778
- ).annotate({
779
- identifier: "UpdateAccountRequest",
780
- }) as any as S.Schema<UpdateAccountRequest>;
736
+ ).annotate({ identifier: "UpdateAccountRequest" }) as any as S.Schema<UpdateAccountRequest>;
781
737
 
782
738
  export type DeactivateAuthorizationError =
783
739
  | AcmeAccountDoesNotExist