micro509 0.9.0 → 0.10.0

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 (107) hide show
  1. package/dist/index.d.ts +3 -3
  2. package/dist/index.js +15 -15
  3. package/dist/internal/asn1/asn1.js +145 -186
  4. package/dist/internal/asn1/asn1.js.map +1 -0
  5. package/dist/internal/asn1/der.js +210 -227
  6. package/dist/internal/asn1/der.js.map +1 -0
  7. package/dist/internal/asn1/oids.js +297 -101
  8. package/dist/internal/asn1/oids.js.map +1 -0
  9. package/dist/internal/asn1/oids2.js +69 -0
  10. package/dist/internal/asn1/oids2.js.map +1 -0
  11. package/dist/internal/crypto/algorithm-names.js +37 -35
  12. package/dist/internal/crypto/algorithm-names.js.map +1 -0
  13. package/dist/internal/crypto/ecdsa.js +25 -28
  14. package/dist/internal/crypto/ecdsa.js.map +1 -0
  15. package/dist/internal/crypto/hash.js +56 -117
  16. package/dist/internal/crypto/hash.js.map +1 -0
  17. package/dist/internal/crypto/pbes2.js +122 -133
  18. package/dist/internal/crypto/pbes2.js.map +1 -0
  19. package/dist/internal/crypto/rsa-pss.js +118 -124
  20. package/dist/internal/crypto/rsa-pss.js.map +1 -0
  21. package/dist/internal/crypto/sig-verify.js +87 -99
  22. package/dist/internal/crypto/sig-verify.js.map +1 -0
  23. package/dist/internal/crypto/signing.d.ts +12 -8
  24. package/dist/internal/crypto/signing.js +53 -55
  25. package/dist/internal/crypto/signing.js.map +1 -0
  26. package/dist/internal/crypto/webcrypto.js +5 -3
  27. package/dist/internal/crypto/webcrypto.js.map +1 -0
  28. package/dist/internal/shared/base64.js +10 -9
  29. package/dist/internal/shared/base64.js.map +1 -0
  30. package/dist/internal/shared/dn.js +50 -57
  31. package/dist/internal/shared/dn.js.map +1 -0
  32. package/dist/internal/shared/ip.js +43 -53
  33. package/dist/internal/shared/ip.js.map +1 -0
  34. package/dist/internal/verify/name-constraints-engine.js +211 -239
  35. package/dist/internal/verify/name-constraints-engine.js.map +1 -0
  36. package/dist/internal/verify/policy-engine.js +228 -247
  37. package/dist/internal/verify/policy-engine.js.map +1 -0
  38. package/dist/internal/verify/verify-path.js +213 -228
  39. package/dist/internal/verify/verify-path.js.map +1 -0
  40. package/dist/internal/x509/extension-bits.js +62 -59
  41. package/dist/internal/x509/extension-bits.js.map +1 -0
  42. package/dist/internal/x509/extension-registry.js +133 -164
  43. package/dist/internal/x509/extension-registry.js.map +1 -0
  44. package/dist/internal/x509/name-fields.js +35 -41
  45. package/dist/internal/x509/name-fields.js.map +1 -0
  46. package/dist/keys/keys.d.ts +583 -547
  47. package/dist/keys/keys.js +519 -431
  48. package/dist/keys/keys.js.map +1 -0
  49. package/dist/keys.js +2 -2
  50. package/dist/pem/pem.d.ts +46 -46
  51. package/dist/pem/pem.js +62 -81
  52. package/dist/pem/pem.js.map +1 -0
  53. package/dist/pem.js +2 -2
  54. package/dist/pkcs/pfx.d.ts +96 -80
  55. package/dist/pkcs/pfx.js +191 -231
  56. package/dist/pkcs/pfx.js.map +1 -0
  57. package/dist/pkcs/pkcs12-mac.d.ts +20 -18
  58. package/dist/pkcs/pkcs12-mac.js +90 -111
  59. package/dist/pkcs/pkcs12-mac.js.map +1 -0
  60. package/dist/pkcs/pkcs7.d.ts +118 -69
  61. package/dist/pkcs/pkcs7.js +401 -443
  62. package/dist/pkcs/pkcs7.js.map +1 -0
  63. package/dist/pkcs.d.ts +2 -2
  64. package/dist/pkcs.js +4 -4
  65. package/dist/result/result.d.ts +37 -32
  66. package/dist/result/result.js +46 -44
  67. package/dist/result/result.js.map +1 -0
  68. package/dist/result.js +2 -2
  69. package/dist/revocation/chain.d.ts +138 -119
  70. package/dist/revocation/chain.js +248 -281
  71. package/dist/revocation/chain.js.map +1 -0
  72. package/dist/revocation/crl.d.ts +125 -123
  73. package/dist/revocation/crl.js +653 -745
  74. package/dist/revocation/crl.js.map +1 -0
  75. package/dist/revocation/ocsp.d.ts +183 -177
  76. package/dist/revocation/ocsp.js +579 -636
  77. package/dist/revocation/ocsp.js.map +1 -0
  78. package/dist/revocation/revocation.d.ts +26 -26
  79. package/dist/revocation/revocation.js +104 -125
  80. package/dist/revocation/revocation.js.map +1 -0
  81. package/dist/revocation.js +5 -5
  82. package/dist/verify/identity.d.ts +42 -42
  83. package/dist/verify/identity.js +158 -167
  84. package/dist/verify/identity.js.map +1 -0
  85. package/dist/verify/name-constraints.d.ts +7 -7
  86. package/dist/verify/policy.d.ts +10 -10
  87. package/dist/verify/verify.d.ts +163 -163
  88. package/dist/verify/verify.js +396 -392
  89. package/dist/verify/verify.js.map +1 -0
  90. package/dist/verify.js +3 -3
  91. package/dist/x509/certificate.d.ts +117 -117
  92. package/dist/x509/certificate.js +51 -60
  93. package/dist/x509/certificate.js.map +1 -0
  94. package/dist/x509/csr.d.ts +25 -25
  95. package/dist/x509/csr.js +26 -30
  96. package/dist/x509/csr.js.map +1 -0
  97. package/dist/x509/extensions.d.ts +228 -184
  98. package/dist/x509/extensions.js +175 -200
  99. package/dist/x509/extensions.js.map +1 -0
  100. package/dist/x509/name.d.ts +94 -93
  101. package/dist/x509/name.js +30 -29
  102. package/dist/x509/name.js.map +1 -0
  103. package/dist/x509/parse.d.ts +185 -185
  104. package/dist/x509/parse.js +638 -676
  105. package/dist/x509/parse.js.map +1 -0
  106. package/dist/x509.js +6 -6
  107. package/package.json +79 -41
@@ -1,9 +1,9 @@
1
- import { parseCertificateDerOrThrow, parseCertificateFromSource } from "../x509/parse.js";
2
- import { checkCertificateRevocationAgainstCrl } from "./crl.js";
3
- import { validateOcspResponse } from "./ocsp.js";
1
+ import { parseCertificateDerOrThrow as e, parseCertificateFromSource as t } from "../x509/parse.js";
2
+ import { checkCertificateRevocationAgainstCrl as n } from "./crl.js";
3
+ import { validateOcspResponse as r } from "./ocsp.js";
4
4
  //#region src/revocation/revocation.ts
5
5
  /** Every {@linkcode RevocationIndeterminateReasonCode}, as a runtime array. */
6
- const REVOCATION_INDETERMINATE_REASON_CODES = [
6
+ const i = [
7
7
  "certificate_status_missing",
8
8
  "certificate_status_unknown",
9
9
  "crl_sign_not_permitted",
@@ -22,51 +22,38 @@ const REVOCATION_INDETERMINATE_REASON_CODES = [
22
22
  "stale_response"
23
23
  ];
24
24
  /** Extracts OCSP responder URIs from the certificate's Authority Information Access extension. */
25
- function getCertificateOcspResponderUris(certificate) {
26
- let parsedCertificate;
25
+ function getCertificateOcspResponderUris(e) {
26
+ let t;
27
27
  try {
28
- parsedCertificate = normalizeCertificate(certificate);
28
+ t = normalizeCertificate(e);
29
29
  } catch {
30
30
  return [];
31
31
  }
32
- const uris = [];
33
- const seen = /* @__PURE__ */ new Set();
34
- for (const accessDescription of parsedCertificate.authorityInfoAccess ?? []) {
35
- if (accessDescription.method !== "ocsp" || seen.has(accessDescription.uri)) continue;
36
- seen.add(accessDescription.uri);
37
- uris.push(accessDescription.uri);
38
- }
39
- return uris;
32
+ let n = [], r = /* @__PURE__ */ new Set();
33
+ for (let e of t.authorityInfoAccess ?? []) e.method !== "ocsp" || r.has(e.uri) || (r.add(e.uri), n.push(e.uri));
34
+ return n;
40
35
  }
41
36
  /**
42
37
  * Merges configured OCSP responders with those discovered from the certificate's
43
38
  * AIA extension. Configured responders take priority; duplicates are deduplicated by URI.
44
39
  */
45
- function resolveOcspResponderCandidates(input) {
46
- const candidates = [];
47
- const configuredByUri = /* @__PURE__ */ new Map();
48
- for (const configuredResponder of input.configuredResponders ?? []) {
49
- const existing = configuredByUri.get(configuredResponder.uri);
50
- if (existing === void 0 || existing.responderCertificate === void 0 && configuredResponder.responderCertificate !== void 0) configuredByUri.set(configuredResponder.uri, configuredResponder);
51
- }
52
- const seen = /* @__PURE__ */ new Set();
53
- for (const configuredResponder of configuredByUri.values()) {
54
- seen.add(configuredResponder.uri);
55
- candidates.push({
56
- source: "configured",
57
- uri: configuredResponder.uri,
58
- ...configuredResponder.responderCertificate === void 0 ? {} : { responderCertificate: configuredResponder.responderCertificate }
59
- });
40
+ function resolveOcspResponderCandidates(e) {
41
+ let t = [], n = /* @__PURE__ */ new Map();
42
+ for (let t of e.configuredResponders ?? []) {
43
+ let e = n.get(t.uri);
44
+ (e === void 0 || e.responderCertificate === void 0 && t.responderCertificate !== void 0) && n.set(t.uri, t);
60
45
  }
61
- for (const uri of getCertificateOcspResponderUris(input.certificate)) {
62
- if (seen.has(uri)) continue;
63
- seen.add(uri);
64
- candidates.push({
65
- source: "authorityInfoAccess",
66
- uri
67
- });
68
- }
69
- return candidates;
46
+ let r = /* @__PURE__ */ new Set();
47
+ for (let e of n.values()) r.add(e.uri), t.push({
48
+ source: "configured",
49
+ uri: e.uri,
50
+ ...e.responderCertificate === void 0 ? {} : { responderCertificate: e.responderCertificate }
51
+ });
52
+ for (let n of getCertificateOcspResponderUris(e.certificate)) r.has(n) || (r.add(n), t.push({
53
+ source: "authorityInfoAccess",
54
+ uri: n
55
+ }));
56
+ return t;
70
57
  }
71
58
  /**
72
59
  * Evaluates all provided CRL and OCSP evidence to determine the certificate's
@@ -87,150 +74,140 @@ function resolveOcspResponderCandidates(input) {
87
74
  * }
88
75
  * ```
89
76
  */
90
- async function checkCertificateRevocation(input) {
91
- const evidence = input.evidence ?? [];
92
- const checkedSources = evidence.map((entry) => entry.kind);
93
- if (evidence.length === 0) return revocationSuccess({
77
+ async function checkCertificateRevocation(e) {
78
+ let t = e.evidence ?? [], n = t.map((e) => e.kind);
79
+ if (t.length === 0) return revocationSuccess({
94
80
  status: "indeterminate",
95
81
  code: "revocation_evidence_missing",
96
82
  message: "No CRL or OCSP evidence provided",
97
83
  details: {
98
- checkedSources,
84
+ checkedSources: n,
99
85
  indeterminateEvidence: []
100
86
  }
101
87
  });
102
- let normalizedCertificate;
88
+ let r;
103
89
  try {
104
- normalizedCertificate = normalizeCertificate(input.certificate);
90
+ r = normalizeCertificate(e.certificate);
105
91
  } catch {
106
92
  return revocationSuccess({
107
93
  status: "indeterminate",
108
94
  code: "revocation_status_indeterminate",
109
95
  message: "Certificate input is malformed",
110
96
  details: {
111
- checkedSources,
97
+ checkedSources: n,
112
98
  indeterminateEvidence: []
113
99
  }
114
100
  });
115
101
  }
116
- let goodResult;
117
- const indeterminateEvidence = [];
118
- for (const entry of evidence) {
119
- let result;
102
+ let i, a = [];
103
+ for (let n of t) {
104
+ let t;
120
105
  try {
121
- result = entry.kind === "crl" ? await checkCertificateRevocationWithCrl(input, entry, normalizedCertificate) : await checkCertificateRevocationWithOcsp(input, entry, normalizedCertificate);
106
+ t = n.kind === "crl" ? await checkCertificateRevocationWithCrl(e, n, r) : await checkCertificateRevocationWithOcsp(e, n, r);
122
107
  } catch {
123
- indeterminateEvidence.push({
124
- kind: entry.kind,
108
+ a.push({
109
+ kind: n.kind,
125
110
  code: "signature_invalid",
126
- message: `${entry.kind.toUpperCase()} evidence input is malformed`
111
+ message: `${n.kind.toUpperCase()} evidence input is malformed`
127
112
  });
128
113
  continue;
129
114
  }
130
- if (result.status === "revoked") return revocationSuccess(result.result);
131
- if (result.status === "good") {
132
- goodResult ??= result.result;
115
+ if (t.status === "revoked") return revocationSuccess(t.result);
116
+ if (t.status === "good") {
117
+ i ??= t.result;
133
118
  continue;
134
119
  }
135
- indeterminateEvidence.push(result.detail);
120
+ a.push(t.detail);
136
121
  }
137
- if (goodResult !== void 0) return revocationSuccess(goodResult);
138
- return revocationSuccess({
122
+ return revocationSuccess(i === void 0 ? {
139
123
  status: "indeterminate",
140
124
  code: "revocation_status_indeterminate",
141
125
  message: "No revocation evidence established certificate status",
142
126
  details: {
143
- checkedSources,
144
- indeterminateEvidence
127
+ checkedSources: n,
128
+ indeterminateEvidence: a
145
129
  }
146
- });
130
+ } : i);
147
131
  }
148
132
  /** Evaluates a single CRL evidence entry via {@linkcode checkCertificateRevocationAgainstCrl}. */
149
- async function checkCertificateRevocationWithCrl(input, evidence, certificate) {
150
- const result = await checkCertificateRevocationAgainstCrl({
151
- certificate,
152
- issuerCertificate: input.issuerCertificate,
153
- crl: evidence.crl,
154
- ...evidence.deltaCrl === void 0 ? {} : { deltaCrl: evidence.deltaCrl },
155
- ...input.at === void 0 ? {} : { at: input.at },
156
- ...input.clockSkewMs === void 0 ? {} : { clockSkewMs: input.clockSkewMs }
133
+ async function checkCertificateRevocationWithCrl(e, t, r) {
134
+ let i = await n({
135
+ certificate: r,
136
+ issuerCertificate: e.issuerCertificate,
137
+ crl: t.crl,
138
+ ...t.deltaCrl === void 0 ? {} : { deltaCrl: t.deltaCrl },
139
+ ...e.at === void 0 ? {} : { at: e.at },
140
+ ...e.clockSkewMs === void 0 ? {} : { clockSkewMs: e.clockSkewMs }
157
141
  });
158
- if (result.ok) {
159
- if (result.value.status === "revoked") return {
142
+ return i.ok ? i.value.status === "revoked" ? {
143
+ status: "revoked",
144
+ result: {
160
145
  status: "revoked",
161
- result: {
162
- status: "revoked",
163
- kind: "crl",
164
- message: "Certificate is revoked according to CRL evidence",
165
- revokedAt: result.value.revocationDate,
166
- ...result.value.reasonCode === void 0 ? {} : { revocationReason: result.value.reasonCode }
167
- }
168
- };
169
- return {
146
+ kind: "crl",
147
+ message: "Certificate is revoked according to CRL evidence",
148
+ revokedAt: i.value.revocationDate,
149
+ ...i.value.reasonCode === void 0 ? {} : { revocationReason: i.value.reasonCode }
150
+ }
151
+ } : {
152
+ status: "good",
153
+ result: {
170
154
  status: "good",
171
- result: {
172
- status: "good",
173
- kind: "crl",
174
- message: "Certificate is not revoked according to CRL evidence"
175
- }
176
- };
177
- }
178
- return {
155
+ kind: "crl",
156
+ message: "Certificate is not revoked according to CRL evidence"
157
+ }
158
+ } : {
179
159
  status: "indeterminate",
180
160
  detail: {
181
161
  kind: "crl",
182
- code: result.code,
183
- message: result.message,
184
- ...result.details?.reason === void 0 ? {} : { reason: result.details.reason }
162
+ code: i.code,
163
+ message: i.message,
164
+ ...i.details?.reason === void 0 ? {} : { reason: i.details.reason }
185
165
  }
186
166
  };
187
167
  }
188
168
  /** Evaluates a single OCSP evidence entry via {@linkcode validateOcspResponse}. */
189
- async function checkCertificateRevocationWithOcsp(input, evidence, certificate) {
190
- const response = await validateOcspResponse({
191
- response: evidence.response,
192
- issuerCertificate: input.issuerCertificate,
193
- ...evidence.request === void 0 ? {} : { request: evidence.request },
194
- ...evidence.responderCertificate === void 0 ? {} : { responderCertificate: evidence.responderCertificate },
195
- ...input.at === void 0 ? {} : { at: input.at },
196
- ...input.clockSkewMs === void 0 ? {} : { clockSkewMs: input.clockSkewMs }
169
+ async function checkCertificateRevocationWithOcsp(e, t, n) {
170
+ let i = await r({
171
+ response: t.response,
172
+ issuerCertificate: e.issuerCertificate,
173
+ ...t.request === void 0 ? {} : { request: t.request },
174
+ ...t.responderCertificate === void 0 ? {} : { responderCertificate: t.responderCertificate },
175
+ ...e.at === void 0 ? {} : { at: e.at },
176
+ ...e.clockSkewMs === void 0 ? {} : { clockSkewMs: e.clockSkewMs }
197
177
  });
198
- if (!response.ok) return {
178
+ if (!i.ok) return {
199
179
  status: "indeterminate",
200
180
  detail: {
201
181
  kind: "ocsp",
202
- code: response.code,
203
- message: response.message
182
+ code: i.code,
183
+ message: i.message
204
184
  }
205
185
  };
206
- const matchedResponse = response.value.responses?.find((entry) => normalizeHex(entry.certId.serialNumberHex) === normalizeHex(certificate.serialNumberHex));
207
- if (matchedResponse === void 0) return {
186
+ let a = i.value.responses?.find((e) => normalizeHex(e.certId.serialNumberHex) === normalizeHex(n.serialNumberHex));
187
+ return a === void 0 ? {
208
188
  status: "indeterminate",
209
189
  detail: {
210
190
  kind: "ocsp",
211
191
  code: "certificate_status_missing",
212
192
  message: "OCSP response does not include certificate status for the target certificate"
213
193
  }
214
- };
215
- if (matchedResponse.certStatus === "revoked") return {
194
+ } : a.certStatus === "revoked" ? {
216
195
  status: "revoked",
217
196
  result: {
218
197
  status: "revoked",
219
198
  kind: "ocsp",
220
199
  message: "Certificate is revoked according to OCSP evidence",
221
- ...matchedResponse.revokedAt === void 0 ? {} : { revokedAt: matchedResponse.revokedAt },
222
- ...matchedResponse.revocationReasonCode === void 0 ? {} : { revocationReasonCode: matchedResponse.revocationReasonCode }
200
+ ...a.revokedAt === void 0 ? {} : { revokedAt: a.revokedAt },
201
+ ...a.revocationReasonCode === void 0 ? {} : { revocationReasonCode: a.revocationReasonCode }
223
202
  }
224
- };
225
- if (matchedResponse.certStatus === "good") return {
203
+ } : a.certStatus === "good" ? {
226
204
  status: "good",
227
205
  result: {
228
206
  status: "good",
229
207
  kind: "ocsp",
230
208
  message: "Certificate is not revoked according to OCSP evidence"
231
209
  }
232
- };
233
- return {
210
+ } : {
234
211
  status: "indeterminate",
235
212
  detail: {
236
213
  kind: "ocsp",
@@ -240,22 +217,24 @@ async function checkCertificateRevocationWithOcsp(input, evidence, certificate)
240
217
  };
241
218
  }
242
219
  /** Accepts PEM, DER, or already-parsed certificate and returns a parsed certificate. */
243
- function normalizeCertificate(certificate) {
244
- return hasParsedCertificateShape(certificate) ? parseCertificateDerOrThrow(new Uint8Array(certificate.der)) : parseCertificateFromSource(certificate);
220
+ function normalizeCertificate(n) {
221
+ return hasParsedCertificateShape(n) ? e(new Uint8Array(n.der)) : t(n);
245
222
  }
246
- function hasParsedCertificateShape(value) {
247
- return typeof value !== "string" && "subjectPublicKeyInfoDer" in value;
223
+ function hasParsedCertificateShape(e) {
224
+ return typeof e != "string" && "subjectPublicKeyInfoDer" in e;
248
225
  }
249
226
  /** Lowercases a hex string for bytewise serial-number comparison. */
250
- function normalizeHex(value) {
251
- return value.toLowerCase();
227
+ function normalizeHex(e) {
228
+ return e.toLowerCase();
252
229
  }
253
230
  /** Wraps a value into a successful `CheckCertificateRevocationResult`. */
254
- function revocationSuccess(value) {
231
+ function revocationSuccess(e) {
255
232
  return {
256
- ok: true,
257
- value
233
+ ok: !0,
234
+ value: e
258
235
  };
259
236
  }
260
237
  //#endregion
261
- export { REVOCATION_INDETERMINATE_REASON_CODES, checkCertificateRevocation, getCertificateOcspResponderUris, resolveOcspResponderCandidates };
238
+ export { i as REVOCATION_INDETERMINATE_REASON_CODES, checkCertificateRevocation, getCertificateOcspResponderUris, resolveOcspResponderCandidates };
239
+
240
+ //# sourceMappingURL=revocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revocation.js","names":[],"sources":["../../src/revocation/revocation.ts"],"sourcesContent":["/**\n * Revocation orchestration: evaluates CRL and OCSP evidence to produce a\n * unified `good`/`revoked`/`indeterminate` status for a certificate.\n *\n * @module\n */\n\nimport type { Result } from '#micro509/result/result';\nimport type {\n\tCrlApplicabilityFailureReason,\n\tCrlSource,\n\tRevocationReason,\n} from '#micro509/revocation/crl';\nimport { checkCertificateRevocationAgainstCrl } from '#micro509/revocation/crl';\nimport type {\n\tOcspCertificateSource,\n\tOcspRequestSource,\n\tParsedOcspResponse,\n} from '#micro509/revocation/ocsp';\nimport { validateOcspResponse } from '#micro509/revocation/ocsp';\nimport type { ParsedCertificate } from '#micro509/x509/parse';\nimport { parseCertificateDerOrThrow, parseCertificateFromSource } from '#micro509/x509/parse';\n\nexport type * from '#micro509/revocation/crl';\nexport type * from '#micro509/revocation/ocsp';\n\n/** Unified revocation outcome across CRL and OCSP evidence. */\nexport type RevocationStatus = 'good' | 'revoked' | 'indeterminate';\n\n/** Which revocation mechanism produced the evidence. */\nexport type RevocationEvidenceKind = 'crl' | 'ocsp';\n/** PEM string, DER bytes, or already-parsed certificate. */\nexport type RevocationCertificateSource = string | Uint8Array | ParsedCertificate;\n/** Where the OCSP responder URI came from. */\nexport type OcspResponderSource = 'configured' | 'authorityInfoAccess';\n/** PEM or DER bytes of a pre-configured OCSP responder certificate. */\nexport type ConfiguredOcspResponderCertificate = string | Uint8Array;\n\n/** A manually-configured OCSP responder endpoint. */\nexport interface ConfiguredOcspResponder {\n\t/** OCSP responder URI (typically `http://...`). */\n\treadonly uri: string;\n\t/** Known responder certificate — skips embedded-certificate discovery. */\n\treadonly responderCertificate?: ConfiguredOcspResponderCertificate;\n}\n\n/** One candidate OCSP responder resolved by {@linkcode resolveOcspResponderCandidates}. */\nexport interface OcspResponderCandidate {\n\t/** Whether this candidate came from configuration or the certificate's AIA extension. */\n\treadonly source: OcspResponderSource;\n\t/** OCSP responder URI. */\n\treadonly uri: string;\n\t/** Pre-known responder certificate, if available. */\n\treadonly responderCertificate?: ConfiguredOcspResponderCertificate;\n}\n\n/** Input for {@linkcode resolveOcspResponderCandidates}. */\nexport interface ResolveOcspResponderCandidatesInput {\n\t/** Certificate whose AIA extension will be inspected for OCSP URIs. */\n\treadonly certificate: RevocationCertificateSource;\n\t/** Manually-configured responders — checked before AIA-derived ones. */\n\treadonly configuredResponders?: readonly ConfiguredOcspResponder[];\n}\n\n/** CRL-based revocation evidence for {@linkcode CheckCertificateRevocationInput.evidence}. */\nexport interface RevocationCrlEvidenceInput {\n\t/** Discriminator for the CRL evidence variant. */\n\treadonly kind: 'crl';\n\t/** Complete (base) CRL. */\n\treadonly crl: CrlSource;\n\t/** Optional delta CRL for more recent revocation information. */\n\treadonly deltaCrl?: CrlSource;\n}\n\n/** OCSP-based revocation evidence for {@linkcode CheckCertificateRevocationInput.evidence}. */\nexport interface RevocationOcspEvidenceInput {\n\t/** Discriminator for the OCSP evidence variant. */\n\treadonly kind: 'ocsp';\n\t/** OCSP response to validate. */\n\treadonly response: string | Uint8Array | ParsedOcspResponse;\n\t/** Original OCSP request — enables nonce and coverage checks. */\n\treadonly request?: OcspRequestSource;\n\t/** Explicit responder certificate — overrides embedded certificate discovery. */\n\treadonly responderCertificate?: OcspCertificateSource;\n}\n\n/** Discriminated union of CRL and OCSP evidence inputs. */\nexport type RevocationEvidenceInput = RevocationCrlEvidenceInput | RevocationOcspEvidenceInput;\n\n/** Input for {@linkcode checkCertificateRevocation}. */\nexport interface CheckCertificateRevocationInput {\n\t/** Certificate whose revocation status to determine. */\n\treadonly certificate: RevocationCertificateSource;\n\t/** Issuer of `certificate`. */\n\treadonly issuerCertificate: RevocationCertificateSource;\n\t/** CRL and/or OCSP evidence to evaluate. Returns `indeterminate` if empty. */\n\treadonly evidence?: readonly RevocationEvidenceInput[];\n\t/** Evaluation time. Defaults to `new Date()`. */\n\treadonly at?: Date;\n\t/** Clock-skew tolerance in milliseconds. */\n\treadonly clockSkewMs?: number;\n}\n\n/** Error codes that {@linkcode checkCertificateRevocation} may surface inside an `indeterminate` result. */\nexport type CheckCertificateRevocationErrorCode =\n\t| 'revocation_evidence_missing'\n\t| 'revocation_status_indeterminate';\n\n/** Every {@linkcode RevocationIndeterminateReasonCode}, as a runtime array. */\nexport const REVOCATION_INDETERMINATE_REASON_CODES = [\n\t'certificate_status_missing',\n\t'certificate_status_unknown',\n\t'crl_sign_not_permitted',\n\t'issuer_mismatch',\n\t'non_applicable',\n\t'nonce_mismatch',\n\t'ocsp_signing_missing',\n\t'request_mismatch',\n\t'responder_id_mismatch',\n\t'responder_chain_invalid',\n\t'responder_revoked',\n\t'responder_revocation_unknown',\n\t'response_status_invalid',\n\t'signature_invalid',\n\t'stale_crl',\n\t'stale_response',\n] as const;\n\n/** Why a particular piece of evidence could not produce a definitive `good`/`revoked` answer. */\nexport type RevocationIndeterminateReasonCode =\n\t(typeof REVOCATION_INDETERMINATE_REASON_CODES)[number];\n\n/** One piece of evidence that failed to produce a definitive revocation answer. */\nexport interface RevocationIndeterminateEvidence {\n\t/** Whether this evidence was CRL or OCSP. */\n\treadonly kind: RevocationEvidenceKind;\n\t/** Machine-readable reason code. */\n\treadonly code: RevocationIndeterminateReasonCode;\n\t/** Human-readable explanation. */\n\treadonly message: string;\n\t/** CRL-specific applicability failure reason, when `kind` is `'crl'`. */\n\treadonly reason?: CrlApplicabilityFailureReason;\n}\n\n/** Diagnostic details attached to an `indeterminate` revocation result. */\nexport interface CheckCertificateRevocationFailureDetails {\n\t/** Which evidence kinds were attempted (`'crl'`, `'ocsp'`, or both). */\n\treadonly checkedSources: readonly RevocationEvidenceKind[];\n\t/** Per-evidence explanations of why no definitive answer was reached. */\n\treadonly indeterminateEvidence: readonly RevocationIndeterminateEvidence[];\n}\n\n/** Revocation status could not be determined from the provided evidence. */\nexport interface RevocationCheckIndeterminateValue {\n\t/** Status is indeterminate. */\n\treadonly status: Extract<RevocationStatus, 'indeterminate'>;\n\t/** Why revocation status is indeterminate. */\n\treadonly code: CheckCertificateRevocationErrorCode;\n\t/** Human-readable diagnostic message. */\n\treadonly message: string;\n\t/** What evidence was attempted and why each failed. */\n\treadonly details: CheckCertificateRevocationFailureDetails;\n}\n\n/** Certificate is not revoked according to the checked evidence. */\nexport interface RevocationCheckGoodValue {\n\t/** Certificate is not revoked. */\n\treadonly status: Extract<RevocationStatus, 'good'>;\n\t/** Which evidence kind confirmed the good status. */\n\treadonly kind: RevocationEvidenceKind;\n\t/** Human-readable diagnostic message. */\n\treadonly message: string;\n}\n\n/** Certificate is revoked according to the checked evidence. */\nexport interface RevocationCheckRevokedValue {\n\t/** Certificate is revoked. */\n\treadonly status: Extract<RevocationStatus, 'revoked'>;\n\t/** Which evidence kind reported the revocation. */\n\treadonly kind: RevocationEvidenceKind;\n\t/** Human-readable diagnostic message. */\n\treadonly message: string;\n\t/** When the certificate was revoked (from CRL entry or OCSP response). */\n\treadonly revokedAt?: Date;\n\t/** CRL reason string (from CRL evidence). */\n\treadonly revocationReason?: RevocationReason;\n\t/** CRL reason integer code (from OCSP evidence). */\n\treadonly revocationReasonCode?: number;\n}\n\n/** Discriminated union of `good`, `revoked`, and `indeterminate` revocation outcomes. */\nexport type CheckCertificateRevocationValue =\n\t| RevocationCheckGoodValue\n\t| RevocationCheckRevokedValue\n\t| RevocationCheckIndeterminateValue;\n\n/**\n * Result of {@linkcode checkCertificateRevocation}. Always succeeds (`ok: true`) —\n * the `value.status` discriminator carries the actual outcome.\n */\nexport type CheckCertificateRevocationResult = Result<CheckCertificateRevocationValue, never>;\n\n/** Internal intermediate result from evaluating a single piece of revocation evidence. */\ntype RevocationEvidenceCheck =\n\t| { readonly status: 'good'; readonly result: RevocationCheckGoodValue }\n\t| { readonly status: 'revoked'; readonly result: RevocationCheckRevokedValue }\n\t| { readonly status: 'indeterminate'; readonly detail: RevocationIndeterminateEvidence };\n\n/** Extracts OCSP responder URIs from the certificate's Authority Information Access extension. */\nexport function getCertificateOcspResponderUris(\n\tcertificate: RevocationCertificateSource,\n): readonly string[] {\n\tlet parsedCertificate: ParsedCertificate;\n\ttry {\n\t\tparsedCertificate = normalizeCertificate(certificate);\n\t} catch {\n\t\treturn [];\n\t}\n\tconst uris: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const accessDescription of parsedCertificate.authorityInfoAccess ?? []) {\n\t\tif (accessDescription.method !== 'ocsp' || seen.has(accessDescription.uri)) {\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(accessDescription.uri);\n\t\turis.push(accessDescription.uri);\n\t}\n\treturn uris;\n}\n\n/**\n * Merges configured OCSP responders with those discovered from the certificate's\n * AIA extension. Configured responders take priority; duplicates are deduplicated by URI.\n */\nexport function resolveOcspResponderCandidates(\n\tinput: ResolveOcspResponderCandidatesInput,\n): readonly OcspResponderCandidate[] {\n\tconst candidates: OcspResponderCandidate[] = [];\n\tconst configuredByUri = new Map<string, ConfiguredOcspResponder>();\n\tfor (const configuredResponder of input.configuredResponders ?? []) {\n\t\tconst existing = configuredByUri.get(configuredResponder.uri);\n\t\tif (\n\t\t\texisting === undefined ||\n\t\t\t(existing.responderCertificate === undefined &&\n\t\t\t\tconfiguredResponder.responderCertificate !== undefined)\n\t\t) {\n\t\t\tconfiguredByUri.set(configuredResponder.uri, configuredResponder);\n\t\t}\n\t}\n\tconst seen = new Set<string>();\n\tfor (const configuredResponder of configuredByUri.values()) {\n\t\tseen.add(configuredResponder.uri);\n\t\tcandidates.push({\n\t\t\tsource: 'configured',\n\t\t\turi: configuredResponder.uri,\n\t\t\t...(configuredResponder.responderCertificate === undefined\n\t\t\t\t? {}\n\t\t\t\t: { responderCertificate: configuredResponder.responderCertificate }),\n\t\t});\n\t}\n\tfor (const uri of getCertificateOcspResponderUris(input.certificate)) {\n\t\tif (seen.has(uri)) {\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(uri);\n\t\tcandidates.push({\n\t\t\tsource: 'authorityInfoAccess',\n\t\t\turi,\n\t\t});\n\t}\n\treturn candidates;\n}\n\n/**\n * Evaluates all provided CRL and OCSP evidence to determine the certificate's\n * revocation status. Returns the first `revoked` if any, else the first `good`,\n * else `indeterminate` with diagnostic details about each indeterminate evidence.\n *\n * @example\n * ```ts\n * import { checkCertificateRevocation } from 'micro509';\n *\n * const result = await checkCertificateRevocation({\n * certificate: leafPem,\n * issuerCertificate: caPem,\n * evidence: [{ kind: 'crl', crl: crlPem }],\n * });\n * if (result.ok && result.value.status === 'revoked') {\n * console.log('revoked at', result.value.revokedAt);\n * }\n * ```\n */\nexport async function checkCertificateRevocation(\n\tinput: CheckCertificateRevocationInput,\n): Promise<CheckCertificateRevocationResult> {\n\tconst evidence = input.evidence ?? [];\n\tconst checkedSources = evidence.map((entry) => entry.kind);\n\tif (evidence.length === 0) {\n\t\treturn revocationSuccess({\n\t\t\tstatus: 'indeterminate',\n\t\t\tcode: 'revocation_evidence_missing',\n\t\t\tmessage: 'No CRL or OCSP evidence provided',\n\t\t\tdetails: {\n\t\t\t\tcheckedSources,\n\t\t\t\tindeterminateEvidence: [],\n\t\t\t},\n\t\t});\n\t}\n\tlet normalizedCertificate: ParsedCertificate;\n\ttry {\n\t\tnormalizedCertificate = normalizeCertificate(input.certificate);\n\t} catch {\n\t\treturn revocationSuccess({\n\t\t\tstatus: 'indeterminate',\n\t\t\tcode: 'revocation_status_indeterminate',\n\t\t\tmessage: 'Certificate input is malformed',\n\t\t\tdetails: {\n\t\t\t\tcheckedSources,\n\t\t\t\tindeterminateEvidence: [],\n\t\t\t},\n\t\t});\n\t}\n\tlet goodResult: RevocationCheckGoodValue | undefined;\n\tconst indeterminateEvidence: RevocationIndeterminateEvidence[] = [];\n\tfor (const entry of evidence) {\n\t\tlet result: RevocationEvidenceCheck;\n\t\ttry {\n\t\t\tresult =\n\t\t\t\tentry.kind === 'crl'\n\t\t\t\t\t? await checkCertificateRevocationWithCrl(input, entry, normalizedCertificate)\n\t\t\t\t\t: await checkCertificateRevocationWithOcsp(input, entry, normalizedCertificate);\n\t\t} catch {\n\t\t\tindeterminateEvidence.push({\n\t\t\t\tkind: entry.kind,\n\t\t\t\tcode: 'signature_invalid',\n\t\t\t\tmessage: `${entry.kind.toUpperCase()} evidence input is malformed`,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (result.status === 'revoked') {\n\t\t\treturn revocationSuccess(result.result);\n\t\t}\n\t\tif (result.status === 'good') {\n\t\t\tgoodResult ??= result.result;\n\t\t\tcontinue;\n\t\t}\n\t\tindeterminateEvidence.push(result.detail);\n\t}\n\tif (goodResult !== undefined) {\n\t\treturn revocationSuccess(goodResult);\n\t}\n\treturn revocationSuccess({\n\t\tstatus: 'indeterminate',\n\t\tcode: 'revocation_status_indeterminate',\n\t\tmessage: 'No revocation evidence established certificate status',\n\t\tdetails: {\n\t\t\tcheckedSources,\n\t\t\tindeterminateEvidence,\n\t\t},\n\t});\n}\n\n/** Evaluates a single CRL evidence entry via {@linkcode checkCertificateRevocationAgainstCrl}. */\nasync function checkCertificateRevocationWithCrl(\n\tinput: CheckCertificateRevocationInput,\n\tevidence: RevocationCrlEvidenceInput,\n\tcertificate: ParsedCertificate,\n): Promise<RevocationEvidenceCheck> {\n\tconst result = await checkCertificateRevocationAgainstCrl({\n\t\tcertificate,\n\t\tissuerCertificate: input.issuerCertificate,\n\t\tcrl: evidence.crl,\n\t\t...(evidence.deltaCrl === undefined ? {} : { deltaCrl: evidence.deltaCrl }),\n\t\t...(input.at === undefined ? {} : { at: input.at }),\n\t\t...(input.clockSkewMs === undefined ? {} : { clockSkewMs: input.clockSkewMs }),\n\t});\n\tif (result.ok) {\n\t\tif (result.value.status === 'revoked') {\n\t\t\treturn {\n\t\t\t\tstatus: 'revoked',\n\t\t\t\tresult: {\n\t\t\t\t\tstatus: 'revoked',\n\t\t\t\t\tkind: 'crl',\n\t\t\t\t\tmessage: 'Certificate is revoked according to CRL evidence',\n\t\t\t\t\trevokedAt: result.value.revocationDate,\n\t\t\t\t\t...(result.value.reasonCode === undefined\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { revocationReason: result.value.reasonCode }),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tstatus: 'good',\n\t\t\tresult: {\n\t\t\t\tstatus: 'good',\n\t\t\t\tkind: 'crl',\n\t\t\t\tmessage: 'Certificate is not revoked according to CRL evidence',\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\tstatus: 'indeterminate',\n\t\tdetail: {\n\t\t\tkind: 'crl',\n\t\t\tcode: result.code,\n\t\t\tmessage: result.message,\n\t\t\t...(result.details?.reason === undefined ? {} : { reason: result.details.reason }),\n\t\t},\n\t};\n}\n\n/** Evaluates a single OCSP evidence entry via {@linkcode validateOcspResponse}. */\nasync function checkCertificateRevocationWithOcsp(\n\tinput: CheckCertificateRevocationInput,\n\tevidence: RevocationOcspEvidenceInput,\n\tcertificate: ParsedCertificate,\n): Promise<RevocationEvidenceCheck> {\n\tconst response = await validateOcspResponse({\n\t\tresponse: evidence.response,\n\t\tissuerCertificate: input.issuerCertificate,\n\t\t...(evidence.request === undefined ? {} : { request: evidence.request }),\n\t\t...(evidence.responderCertificate === undefined\n\t\t\t? {}\n\t\t\t: { responderCertificate: evidence.responderCertificate }),\n\t\t...(input.at === undefined ? {} : { at: input.at }),\n\t\t...(input.clockSkewMs === undefined ? {} : { clockSkewMs: input.clockSkewMs }),\n\t});\n\tif (!response.ok) {\n\t\treturn {\n\t\t\tstatus: 'indeterminate',\n\t\t\tdetail: {\n\t\t\t\tkind: 'ocsp',\n\t\t\t\tcode: response.code,\n\t\t\t\tmessage: response.message,\n\t\t\t},\n\t\t};\n\t}\n\tconst matchedResponse = response.value.responses?.find(\n\t\t(entry) =>\n\t\t\tnormalizeHex(entry.certId.serialNumberHex) === normalizeHex(certificate.serialNumberHex),\n\t);\n\tif (matchedResponse === undefined) {\n\t\treturn {\n\t\t\tstatus: 'indeterminate',\n\t\t\tdetail: {\n\t\t\t\tkind: 'ocsp',\n\t\t\t\tcode: 'certificate_status_missing',\n\t\t\t\tmessage: 'OCSP response does not include certificate status for the target certificate',\n\t\t\t},\n\t\t};\n\t}\n\tif (matchedResponse.certStatus === 'revoked') {\n\t\treturn {\n\t\t\tstatus: 'revoked',\n\t\t\tresult: {\n\t\t\t\tstatus: 'revoked',\n\t\t\t\tkind: 'ocsp',\n\t\t\t\tmessage: 'Certificate is revoked according to OCSP evidence',\n\t\t\t\t...(matchedResponse.revokedAt === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: { revokedAt: matchedResponse.revokedAt }),\n\t\t\t\t...(matchedResponse.revocationReasonCode === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: { revocationReasonCode: matchedResponse.revocationReasonCode }),\n\t\t\t},\n\t\t};\n\t}\n\tif (matchedResponse.certStatus === 'good') {\n\t\treturn {\n\t\t\tstatus: 'good',\n\t\t\tresult: {\n\t\t\t\tstatus: 'good',\n\t\t\t\tkind: 'ocsp',\n\t\t\t\tmessage: 'Certificate is not revoked according to OCSP evidence',\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\tstatus: 'indeterminate',\n\t\tdetail: {\n\t\t\tkind: 'ocsp',\n\t\t\tcode: 'certificate_status_unknown',\n\t\t\tmessage: 'OCSP responder returned certificate status unknown',\n\t\t},\n\t};\n}\n\n/** Accepts PEM, DER, or already-parsed certificate and returns a parsed certificate. */\nfunction normalizeCertificate(certificate: RevocationCertificateSource): ParsedCertificate {\n\treturn hasParsedCertificateShape(certificate)\n\t\t? parseCertificateDerOrThrow(new Uint8Array(certificate.der))\n\t\t: parseCertificateFromSource(certificate);\n}\n\nfunction hasParsedCertificateShape(value: RevocationCertificateSource): value is ParsedCertificate {\n\treturn typeof value !== 'string' && 'subjectPublicKeyInfoDer' in value;\n}\n\n/** Lowercases a hex string for bytewise serial-number comparison. */\nfunction normalizeHex(value: string): string {\n\treturn value.toLowerCase();\n}\n\n/** Wraps a value into a successful `CheckCertificateRevocationResult`. */\nfunction revocationSuccess(\n\tvalue: CheckCertificateRevocationValue,\n): CheckCertificateRevocationResult {\n\treturn { ok: true, value };\n}\n"],"mappings":"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"}
@@ -1,5 +1,5 @@
1
- import { checkCertificateRevocationAgainstCrl, createCertificateRevocationList, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, validateCertificateRevocationList, verifyCertificateRevocationListSignature } from "./revocation/crl.js";
2
- import { REVOCATION_INDETERMINATE_REASONS, checkChainRevocation } from "./revocation/chain.js";
3
- import { createOcspRequest, createOcspResponse, hasOcspNoCheckExtension, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, validateOcspResponse, verifyOcspResponseSignature } from "./revocation/ocsp.js";
4
- import { REVOCATION_INDETERMINATE_REASON_CODES, checkCertificateRevocation, getCertificateOcspResponderUris, resolveOcspResponderCandidates } from "./revocation/revocation.js";
5
- export { REVOCATION_INDETERMINATE_REASONS, REVOCATION_INDETERMINATE_REASON_CODES, checkCertificateRevocation, checkCertificateRevocationAgainstCrl, checkChainRevocation, createCertificateRevocationList, createOcspRequest, createOcspResponse, getCertificateOcspResponderUris, hasOcspNoCheckExtension, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, resolveOcspResponderCandidates, validateCertificateRevocationList, validateOcspResponse, verifyCertificateRevocationListSignature, verifyOcspResponseSignature };
1
+ import { checkCertificateRevocationAgainstCrl as e, createCertificateRevocationList as t, isCertificateRevoked as n, parseCertificateRevocationListDer as r, parseCertificateRevocationListDerOrThrow as i, parseCertificateRevocationListPem as a, parseCertificateRevocationListPemOrThrow as o, validateCertificateRevocationList as s, verifyCertificateRevocationListSignature as c } from "./revocation/crl.js";
2
+ import { createOcspRequest as l, createOcspResponse as u, hasOcspNoCheckExtension as d, parseOcspRequestDer as f, parseOcspRequestDerOrThrow as p, parseOcspRequestPem as m, parseOcspRequestPemOrThrow as h, parseOcspResponseDer as g, parseOcspResponseDerOrThrow as _, parseOcspResponsePem as v, parseOcspResponsePemOrThrow as y, validateOcspResponse as b, verifyOcspResponseSignature as x } from "./revocation/ocsp.js";
3
+ import { REVOCATION_INDETERMINATE_REASONS as S, checkChainRevocation as C } from "./revocation/chain.js";
4
+ import { REVOCATION_INDETERMINATE_REASON_CODES as w, checkCertificateRevocation as T, getCertificateOcspResponderUris as E, resolveOcspResponderCandidates as D } from "./revocation/revocation.js";
5
+ export { S as REVOCATION_INDETERMINATE_REASONS, w as REVOCATION_INDETERMINATE_REASON_CODES, T as checkCertificateRevocation, e as checkCertificateRevocationAgainstCrl, C as checkChainRevocation, t as createCertificateRevocationList, l as createOcspRequest, u as createOcspResponse, E as getCertificateOcspResponderUris, d as hasOcspNoCheckExtension, n as isCertificateRevoked, r as parseCertificateRevocationListDer, i as parseCertificateRevocationListDerOrThrow, a as parseCertificateRevocationListPem, o as parseCertificateRevocationListPemOrThrow, f as parseOcspRequestDer, p as parseOcspRequestDerOrThrow, m as parseOcspRequestPem, h as parseOcspRequestPemOrThrow, g as parseOcspResponseDer, _ as parseOcspResponseDerOrThrow, v as parseOcspResponsePem, y as parseOcspResponsePemOrThrow, D as resolveOcspResponderCandidates, s as validateCertificateRevocationList, b as validateOcspResponse, c as verifyCertificateRevocationListSignature, x as verifyOcspResponseSignature };
@@ -1,6 +1,5 @@
1
1
  import { ErrorResult, Micro509Error } from "../result/result.js";
2
2
  import { ParsedCertificate } from "../x509/parse.js";
3
-
4
3
  //#region src/verify/identity.d.ts
5
4
  /** DNS hostname reference identifier. */
6
5
  interface DnsServiceIdentityInput {
@@ -9,10 +8,10 @@ interface DnsServiceIdentityInput {
9
8
  /** The hostname to match (e.g. `"mail.example.com"`). Wildcard labels in the certificate are handled internally. */
10
9
  readonly value: string;
11
10
  /**
12
- * When `true`, falls back to the subject CN if the SAN extension has no
13
- * dns/uri/srv entries. Suppressed when any supported SAN type is present.
14
- * @default false
15
- */
11
+ * When `true`, falls back to the subject CN if the SAN extension has no
12
+ * dns/uri/srv entries. Suppressed when any supported SAN type is present.
13
+ * @default false
14
+ */
16
15
  readonly allowCommonNameFallback?: boolean;
17
16
  }
18
17
  /** IP address reference identifier. */
@@ -79,44 +78,45 @@ interface MatchServiceIdentityInput {
79
78
  readonly serviceIdentity: ServiceIdentityInput;
80
79
  }
81
80
  /**
82
- * Checks whether a certificate covers the requested service identity.
83
- *
84
- * Delegates to {@linkcode matchCertificateServiceIdentity} — this overload
85
- * accepts a single options object.
86
- *
87
- * @example
88
- * ```ts
89
- * const result = matchServiceIdentity({
90
- * certificate: parsed,
91
- * serviceIdentity: { type: 'dns', value: 'example.com' },
92
- * });
93
- * if (!result.ok) console.error(result.error.message);
94
- * ```
95
- */
81
+ * Checks whether a certificate covers the requested service identity.
82
+ *
83
+ * Delegates to {@linkcode matchCertificateServiceIdentity} — this overload
84
+ * accepts a single options object.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const result = matchServiceIdentity({
89
+ * certificate: parsed,
90
+ * serviceIdentity: { type: 'dns', value: 'example.com' },
91
+ * });
92
+ * if (!result.ok) console.error(result.error.message);
93
+ * ```
94
+ */
96
95
  declare function matchServiceIdentity(input: MatchServiceIdentityInput): MatchServiceIdentityResult;
97
96
  /**
98
- * Compares a reference identifier against a certificate's SAN entries.
99
- *
100
- * Supports DNS (with wildcard matching), IP, URI-ID, and SRV-ID.
101
- * For DNS, optionally falls back to subject CN when no SAN of a supported type is present.
102
- *
103
- * @example
104
- * ```ts
105
- * const result = matchCertificateServiceIdentity(parsed, {
106
- * type: 'ip',
107
- * value: '192.168.1.1',
108
- * });
109
- * ```
110
- *
111
- * @example
112
- * ```ts
113
- * const result = matchCertificateServiceIdentity(parsed, {
114
- * type: 'dns',
115
- * value: 'mail.example.com',
116
- * allowCommonNameFallback: true,
117
- * });
118
- * ```
119
- */
97
+ * Compares a reference identifier against a certificate's SAN entries.
98
+ *
99
+ * Supports DNS (with wildcard matching), IP, URI-ID, and SRV-ID.
100
+ * For DNS, optionally falls back to subject CN when no SAN of a supported type is present.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const result = matchCertificateServiceIdentity(parsed, {
105
+ * type: 'ip',
106
+ * value: '192.168.1.1',
107
+ * });
108
+ * ```
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const result = matchCertificateServiceIdentity(parsed, {
113
+ * type: 'dns',
114
+ * value: 'mail.example.com',
115
+ * allowCommonNameFallback: true,
116
+ * });
117
+ * ```
118
+ */
120
119
  declare function matchCertificateServiceIdentity(rawCertificate: ParsedCertificate, serviceIdentity: ServiceIdentityInput): MatchServiceIdentityResult;
121
120
  //#endregion
122
- export { DnsServiceIdentityInput, IpServiceIdentityInput, MatchServiceIdentityErrorCode, MatchServiceIdentityFailure, MatchServiceIdentityFailureDetails, MatchServiceIdentityFailureResult, MatchServiceIdentityInput, MatchServiceIdentityResult, MatchServiceIdentitySuccess, ServiceIdentityInput, ServiceIdentityType, SrvServiceIdentityInput, UriServiceIdentityInput, matchCertificateServiceIdentity, matchServiceIdentity };
121
+ export { DnsServiceIdentityInput, IpServiceIdentityInput, MatchServiceIdentityErrorCode, MatchServiceIdentityFailure, MatchServiceIdentityFailureDetails, MatchServiceIdentityFailureResult, MatchServiceIdentityInput, MatchServiceIdentityResult, MatchServiceIdentitySuccess, ServiceIdentityInput, ServiceIdentityType, SrvServiceIdentityInput, UriServiceIdentityInput, matchCertificateServiceIdentity, matchServiceIdentity };
122
+ //# sourceMappingURL=identity.d.ts.map