micro509 0.8.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.
- package/dist/index.d.ts +4 -4
- package/dist/index.js +15 -15
- package/dist/internal/asn1/asn1.js +145 -186
- package/dist/internal/asn1/asn1.js.map +1 -0
- package/dist/internal/asn1/der.js +210 -227
- package/dist/internal/asn1/der.js.map +1 -0
- package/dist/internal/asn1/oids.js +297 -101
- package/dist/internal/asn1/oids.js.map +1 -0
- package/dist/internal/asn1/oids2.js +69 -0
- package/dist/internal/asn1/oids2.js.map +1 -0
- package/dist/internal/crypto/algorithm-names.js +37 -35
- package/dist/internal/crypto/algorithm-names.js.map +1 -0
- package/dist/internal/crypto/ecdsa.js +25 -28
- package/dist/internal/crypto/ecdsa.js.map +1 -0
- package/dist/internal/crypto/hash.js +56 -117
- package/dist/internal/crypto/hash.js.map +1 -0
- package/dist/internal/crypto/pbes2.js +122 -133
- package/dist/internal/crypto/pbes2.js.map +1 -0
- package/dist/internal/crypto/rsa-pss.js +118 -124
- package/dist/internal/crypto/rsa-pss.js.map +1 -0
- package/dist/internal/crypto/sig-verify.js +87 -99
- package/dist/internal/crypto/sig-verify.js.map +1 -0
- package/dist/internal/crypto/signing.d.ts +12 -8
- package/dist/internal/crypto/signing.js +53 -55
- package/dist/internal/crypto/signing.js.map +1 -0
- package/dist/internal/crypto/webcrypto.js +5 -3
- package/dist/internal/crypto/webcrypto.js.map +1 -0
- package/dist/internal/shared/base64.js +10 -9
- package/dist/internal/shared/base64.js.map +1 -0
- package/dist/internal/shared/dn.js +50 -57
- package/dist/internal/shared/dn.js.map +1 -0
- package/dist/internal/shared/ip.js +43 -53
- package/dist/internal/shared/ip.js.map +1 -0
- package/dist/internal/verify/name-constraints-engine.js +211 -239
- package/dist/internal/verify/name-constraints-engine.js.map +1 -0
- package/dist/internal/verify/policy-engine.js +228 -247
- package/dist/internal/verify/policy-engine.js.map +1 -0
- package/dist/internal/verify/verify-path.js +213 -228
- package/dist/internal/verify/verify-path.js.map +1 -0
- package/dist/internal/x509/extension-bits.js +62 -59
- package/dist/internal/x509/extension-bits.js.map +1 -0
- package/dist/internal/x509/extension-registry.js +133 -164
- package/dist/internal/x509/extension-registry.js.map +1 -0
- package/dist/internal/x509/name-fields.js +35 -41
- package/dist/internal/x509/name-fields.js.map +1 -0
- package/dist/keys/keys.d.ts +626 -447
- package/dist/keys/keys.js +652 -404
- package/dist/keys/keys.js.map +1 -0
- package/dist/keys.d.ts +2 -2
- package/dist/keys.js +2 -2
- package/dist/pem/pem.d.ts +46 -46
- package/dist/pem/pem.js +62 -81
- package/dist/pem/pem.js.map +1 -0
- package/dist/pem.js +2 -2
- package/dist/pkcs/pfx.d.ts +96 -80
- package/dist/pkcs/pfx.js +191 -231
- package/dist/pkcs/pfx.js.map +1 -0
- package/dist/pkcs/pkcs12-mac.d.ts +20 -18
- package/dist/pkcs/pkcs12-mac.js +90 -111
- package/dist/pkcs/pkcs12-mac.js.map +1 -0
- package/dist/pkcs/pkcs7.d.ts +118 -69
- package/dist/pkcs/pkcs7.js +401 -443
- package/dist/pkcs/pkcs7.js.map +1 -0
- package/dist/pkcs.d.ts +2 -2
- package/dist/pkcs.js +4 -4
- package/dist/result/result.d.ts +37 -32
- package/dist/result/result.js +46 -44
- package/dist/result/result.js.map +1 -0
- package/dist/result.js +2 -2
- package/dist/revocation/chain.d.ts +138 -119
- package/dist/revocation/chain.js +248 -281
- package/dist/revocation/chain.js.map +1 -0
- package/dist/revocation/crl.d.ts +125 -123
- package/dist/revocation/crl.js +653 -745
- package/dist/revocation/crl.js.map +1 -0
- package/dist/revocation/ocsp.d.ts +183 -177
- package/dist/revocation/ocsp.js +581 -638
- package/dist/revocation/ocsp.js.map +1 -0
- package/dist/revocation/revocation.d.ts +26 -26
- package/dist/revocation/revocation.js +104 -125
- package/dist/revocation/revocation.js.map +1 -0
- package/dist/revocation.js +5 -5
- package/dist/verify/identity.d.ts +42 -42
- package/dist/verify/identity.js +158 -167
- package/dist/verify/identity.js.map +1 -0
- package/dist/verify/name-constraints.d.ts +7 -7
- package/dist/verify/policy.d.ts +10 -10
- package/dist/verify/verify.d.ts +163 -163
- package/dist/verify/verify.js +396 -392
- package/dist/verify/verify.js.map +1 -0
- package/dist/verify.js +3 -3
- package/dist/x509/certificate.d.ts +117 -117
- package/dist/x509/certificate.js +51 -60
- package/dist/x509/certificate.js.map +1 -0
- package/dist/x509/csr.d.ts +25 -25
- package/dist/x509/csr.js +26 -30
- package/dist/x509/csr.js.map +1 -0
- package/dist/x509/extensions.d.ts +228 -184
- package/dist/x509/extensions.js +175 -200
- package/dist/x509/extensions.js.map +1 -0
- package/dist/x509/name.d.ts +94 -93
- package/dist/x509/name.js +30 -29
- package/dist/x509/name.js.map +1 -0
- package/dist/x509/parse.d.ts +185 -185
- package/dist/x509/parse.js +638 -676
- package/dist/x509/parse.js.map +1 -0
- package/dist/x509.js +6 -6
- package/package.json +79 -41
package/dist/verify/verify.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { RevocationPolicy } from "../revocation/chain.js";
|
|
|
6
6
|
import { DnsServiceIdentityInput, IpServiceIdentityInput, MatchServiceIdentityErrorCode, MatchServiceIdentityFailure, MatchServiceIdentityFailureDetails, MatchServiceIdentityFailureResult, MatchServiceIdentityInput, MatchServiceIdentityResult, MatchServiceIdentitySuccess, ServiceIdentityInput, ServiceIdentityType, SrvServiceIdentityInput, UriServiceIdentityInput, matchCertificateServiceIdentity, matchServiceIdentity } from "./identity.js";
|
|
7
7
|
import { InitialNameConstraintsInput } from "./name-constraints.js";
|
|
8
8
|
import { ConstrainedPolicy, PolicyValidationInput, PolicyValidationOutcome } from "./policy.js";
|
|
9
|
-
|
|
10
9
|
//#region src/verify/verify.d.ts
|
|
11
10
|
/** PEM string or DER bytes for a certificate. PEM may contain multiple blocks. */
|
|
12
11
|
type CertificateSource = string | Uint8Array;
|
|
@@ -29,10 +28,10 @@ interface EkuCheckFailure extends Micro509Error<"leaf_eku_missing" | "intermedia
|
|
|
29
28
|
readonly index: number;
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
|
-
* Bare trust anchor — subject identity and public key material without a
|
|
33
|
-
* full certificate. Used when the root CA certificate is unavailable but
|
|
34
|
-
* its key is known. Build from a certificate with {@linkcode trustAnchorFromCertificate}.
|
|
35
|
-
*/
|
|
31
|
+
* Bare trust anchor — subject identity and public key material without a
|
|
32
|
+
* full certificate. Used when the root CA certificate is unavailable but
|
|
33
|
+
* its key is known. Build from a certificate with {@linkcode trustAnchorFromCertificate}.
|
|
34
|
+
*/
|
|
36
35
|
interface TrustAnchor {
|
|
37
36
|
/** Parsed subject distinguished name. Used for semantic issuer matching (RFC 5280 §7.1). */
|
|
38
37
|
readonly subject: ParsedName;
|
|
@@ -46,31 +45,31 @@ interface TrustAnchor {
|
|
|
46
45
|
readonly subjectKeyIdentifier?: string;
|
|
47
46
|
}
|
|
48
47
|
/**
|
|
49
|
-
* Discriminant for every failure a verify operation can produce.
|
|
50
|
-
*
|
|
51
|
-
* - `no_trusted_root` — chain could not be anchored to any root or {@linkcode TrustAnchor}.
|
|
52
|
-
* - `issuer_not_found` — an intermediate's issuer was not in the candidate set.
|
|
53
|
-
* - `signature_invalid` — a certificate's signature failed cryptographic verification.
|
|
54
|
-
* - `certificate_expired` — a certificate's notBefore/notAfter window excludes the validation time.
|
|
55
|
-
* - `ca_required` — an issuer lacks `basicConstraints.ca = true`.
|
|
56
|
-
* - `key_cert_sign_required` — an issuer has keyUsage but omits `keyCertSign`.
|
|
57
|
-
* - `path_length_exceeded` — the number of CA certificates below an issuer exceeds its pathLength.
|
|
58
|
-
* - `authority_key_identifier_mismatch` — a certificate's AKI does not match the issuer's SKI.
|
|
59
|
-
* - `extended_key_usage_invalid` — the leaf certificate lacks the required EKU for the requested purpose.
|
|
60
|
-
* - `subject_alt_name_mismatch` — no SAN entry matches the requested service identity.
|
|
61
|
-
* - `common_name_fallback_suppressed` — CN fallback was attempted but suppressed (SAN present or disabled).
|
|
62
|
-
* - `self_signed_leaf_not_allowed` — the leaf is self-signed and `allowSelfSignedLeaf` was not set.
|
|
63
|
-
* - `unrecognized_critical_extension` — a certificate contains a critical extension the verifier cannot process.
|
|
64
|
-
* - `intermediate_eku_constraint` — an intermediate CA's EKU set does not include the required purpose.
|
|
65
|
-
* - `explicit_policy_required` — `requireExplicitPolicy` was set but no acceptable policy was found.
|
|
66
|
-
* - `initial_policy_set_not_satisfied` — the chain's policies do not intersect `initialPolicySet`.
|
|
67
|
-
* - `unsupported_initial_name_constraints` — caller-supplied initial name constraints use unsupported or malformed forms.
|
|
68
|
-
* - `unsupported_name_constraints` — a certificate's nameConstraints use an unsupported form.
|
|
69
|
-
* - `name_constraints_violated` — a subject name violates a permitted/excluded subtree.
|
|
70
|
-
* - `unsupported_signature_algorithm_parameters` — the signature algorithm uses unrecognized parameters.
|
|
71
|
-
* - `certificate_revoked` — revocation evidence confirms a chain certificate is revoked.
|
|
72
|
-
* - `revocation_indeterminate` — revocation status could not be determined under a hard-fail policy.
|
|
73
|
-
*/
|
|
48
|
+
* Discriminant for every failure a verify operation can produce.
|
|
49
|
+
*
|
|
50
|
+
* - `no_trusted_root` — chain could not be anchored to any root or {@linkcode TrustAnchor}.
|
|
51
|
+
* - `issuer_not_found` — an intermediate's issuer was not in the candidate set.
|
|
52
|
+
* - `signature_invalid` — a certificate's signature failed cryptographic verification.
|
|
53
|
+
* - `certificate_expired` — a certificate's notBefore/notAfter window excludes the validation time.
|
|
54
|
+
* - `ca_required` — an issuer lacks `basicConstraints.ca = true`.
|
|
55
|
+
* - `key_cert_sign_required` — an issuer has keyUsage but omits `keyCertSign`.
|
|
56
|
+
* - `path_length_exceeded` — the number of CA certificates below an issuer exceeds its pathLength.
|
|
57
|
+
* - `authority_key_identifier_mismatch` — a certificate's AKI does not match the issuer's SKI.
|
|
58
|
+
* - `extended_key_usage_invalid` — the leaf certificate lacks the required EKU for the requested purpose.
|
|
59
|
+
* - `subject_alt_name_mismatch` — no SAN entry matches the requested service identity.
|
|
60
|
+
* - `common_name_fallback_suppressed` — CN fallback was attempted but suppressed (SAN present or disabled).
|
|
61
|
+
* - `self_signed_leaf_not_allowed` — the leaf is self-signed and `allowSelfSignedLeaf` was not set.
|
|
62
|
+
* - `unrecognized_critical_extension` — a certificate contains a critical extension the verifier cannot process.
|
|
63
|
+
* - `intermediate_eku_constraint` — an intermediate CA's EKU set does not include the required purpose.
|
|
64
|
+
* - `explicit_policy_required` — `requireExplicitPolicy` was set but no acceptable policy was found.
|
|
65
|
+
* - `initial_policy_set_not_satisfied` — the chain's policies do not intersect `initialPolicySet`.
|
|
66
|
+
* - `unsupported_initial_name_constraints` — caller-supplied initial name constraints use unsupported or malformed forms.
|
|
67
|
+
* - `unsupported_name_constraints` — a certificate's nameConstraints use an unsupported form.
|
|
68
|
+
* - `name_constraints_violated` — a subject name violates a permitted/excluded subtree.
|
|
69
|
+
* - `unsupported_signature_algorithm_parameters` — the signature algorithm uses unrecognized parameters.
|
|
70
|
+
* - `certificate_revoked` — revocation evidence confirms a chain certificate is revoked.
|
|
71
|
+
* - `revocation_indeterminate` — revocation status could not be determined under a hard-fail policy.
|
|
72
|
+
*/
|
|
74
73
|
declare const VERIFY_ERROR_CODES: readonly ["no_trusted_root", "issuer_not_found", "signature_invalid", "certificate_expired", "ca_required", "key_cert_sign_required", "path_length_exceeded", "authority_key_identifier_mismatch", "extended_key_usage_invalid", "subject_alt_name_mismatch", "common_name_fallback_suppressed", "self_signed_leaf_not_allowed", "unrecognized_critical_extension", "intermediate_eku_constraint", "explicit_policy_required", "initial_policy_set_not_satisfied", "unsupported_initial_name_constraints", "unsupported_name_constraints", "name_constraints_violated", "unsupported_signature_algorithm_parameters", "certificate_revoked", "revocation_indeterminate"];
|
|
75
74
|
/** See the doc comment above {@linkcode VERIFY_ERROR_CODES} for the meaning of each code. */
|
|
76
75
|
type VerifyErrorCode = (typeof VERIFY_ERROR_CODES)[number];
|
|
@@ -253,156 +252,157 @@ interface ValidateForCaInput extends BuildCandidatePathInput, PolicyValidationIn
|
|
|
253
252
|
readonly nameConstraints?: InitialNameConstraintsInput;
|
|
254
253
|
}
|
|
255
254
|
/**
|
|
256
|
-
* Builds a signature-verified path from a leaf certificate to a trusted root.
|
|
257
|
-
*
|
|
258
|
-
* Parses the supplied certificates, walks the issuer chain, signature-checks
|
|
259
|
-
* each link, and returns the first valid path. Does not enforce time, constraints,
|
|
260
|
-
* or leaf purpose — call {@linkcode validateCandidatePath} or use the all-in-one
|
|
261
|
-
* {@linkcode verifyCertificateChain} for full validation.
|
|
262
|
-
*
|
|
263
|
-
* @example
|
|
264
|
-
* ```ts
|
|
265
|
-
* import { buildCandidatePath } from 'micro509';
|
|
266
|
-
*
|
|
267
|
-
* const result = await buildCandidatePath({
|
|
268
|
-
* leaf: leafPem,
|
|
269
|
-
* intermediates: [intermediatePem],
|
|
270
|
-
* roots: [rootPem],
|
|
271
|
-
* });
|
|
272
|
-
* if (result.ok) {
|
|
273
|
-
* console.log('path length:', result.value.chain.length);
|
|
274
|
-
* }
|
|
275
|
-
* ```
|
|
276
|
-
*/
|
|
255
|
+
* Builds a signature-verified path from a leaf certificate to a trusted root.
|
|
256
|
+
*
|
|
257
|
+
* Parses the supplied certificates, walks the issuer chain, signature-checks
|
|
258
|
+
* each link, and returns the first valid path. Does not enforce time, constraints,
|
|
259
|
+
* or leaf purpose — call {@linkcode validateCandidatePath} or use the all-in-one
|
|
260
|
+
* {@linkcode verifyCertificateChain} for full validation.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* import { buildCandidatePath } from 'micro509';
|
|
265
|
+
*
|
|
266
|
+
* const result = await buildCandidatePath({
|
|
267
|
+
* leaf: leafPem,
|
|
268
|
+
* intermediates: [intermediatePem],
|
|
269
|
+
* roots: [rootPem],
|
|
270
|
+
* });
|
|
271
|
+
* if (result.ok) {
|
|
272
|
+
* console.log('path length:', result.value.chain.length);
|
|
273
|
+
* }
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
277
276
|
declare function buildCandidatePath(input: BuildCandidatePathInput): Promise<BuildCandidatePathResult>;
|
|
278
277
|
/**
|
|
279
|
-
* Validates a pre-built certificate chain for time, constraints, policy, and
|
|
280
|
-
* optionally leaf purpose. Wrap the result of {@linkcode buildCandidatePath}.
|
|
281
|
-
*/
|
|
278
|
+
* Validates a pre-built certificate chain for time, constraints, policy, and
|
|
279
|
+
* optionally leaf purpose. Wrap the result of {@linkcode buildCandidatePath}.
|
|
280
|
+
*/
|
|
282
281
|
declare function validateCandidatePath(input: ValidateCandidatePathInput): Promise<ValidateCandidatePathResult>;
|
|
283
282
|
/**
|
|
284
|
-
* All-in-one certificate chain verification: builds a candidate path then
|
|
285
|
-
* validates time, constraints, policy, purpose, and optional service identity.
|
|
286
|
-
*
|
|
287
|
-
* Equivalent to calling {@linkcode buildCandidatePath} followed by
|
|
288
|
-
* {@linkcode validateCandidatePath} (plus identity matching when configured).
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* ```ts
|
|
292
|
-
* import { verifyCertificateChain } from 'micro509';
|
|
293
|
-
*
|
|
294
|
-
* const result = await verifyCertificateChain({
|
|
295
|
-
* leaf: serverCertPem,
|
|
296
|
-
* intermediates: [intermediatePem],
|
|
297
|
-
* roots: [rootCaPem],
|
|
298
|
-
* purpose: 'serverAuth',
|
|
299
|
-
* serviceIdentity: { type: 'dns', value: 'example.com' },
|
|
300
|
-
* });
|
|
301
|
-
* if (!result.ok) {
|
|
302
|
-
* console.error(result.error.code, result.error.message);
|
|
303
|
-
* }
|
|
304
|
-
* ```
|
|
305
|
-
*/
|
|
283
|
+
* All-in-one certificate chain verification: builds a candidate path then
|
|
284
|
+
* validates time, constraints, policy, purpose, and optional service identity.
|
|
285
|
+
*
|
|
286
|
+
* Equivalent to calling {@linkcode buildCandidatePath} followed by
|
|
287
|
+
* {@linkcode validateCandidatePath} (plus identity matching when configured).
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* import { verifyCertificateChain } from 'micro509';
|
|
292
|
+
*
|
|
293
|
+
* const result = await verifyCertificateChain({
|
|
294
|
+
* leaf: serverCertPem,
|
|
295
|
+
* intermediates: [intermediatePem],
|
|
296
|
+
* roots: [rootCaPem],
|
|
297
|
+
* purpose: 'serverAuth',
|
|
298
|
+
* serviceIdentity: { type: 'dns', value: 'example.com' },
|
|
299
|
+
* });
|
|
300
|
+
* if (!result.ok) {
|
|
301
|
+
* console.error(result.error.code, result.error.message);
|
|
302
|
+
* }
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
306
305
|
declare function verifyCertificateChain(input: VerifyCertificateChainInput): Promise<VerifyChainResult>;
|
|
307
306
|
/**
|
|
308
|
-
* Verifies the self-signature of a PKCS#10 certificate signing request.
|
|
309
|
-
*
|
|
310
|
-
* Parses the CSR from PEM or DER, then checks that its signature is valid
|
|
311
|
-
* against its own embedded public key.
|
|
312
|
-
*
|
|
313
|
-
* @example
|
|
314
|
-
* ```ts
|
|
315
|
-
* import { verifyCertificateSigningRequest } from 'micro509';
|
|
316
|
-
*
|
|
317
|
-
* const result = await verifyCertificateSigningRequest(csrPem);
|
|
318
|
-
* if (result.ok) {
|
|
319
|
-
* console.log('subject:', result.value.subject.values.commonName);
|
|
320
|
-
* }
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
307
|
+
* Verifies the self-signature of a PKCS#10 certificate signing request.
|
|
308
|
+
*
|
|
309
|
+
* Parses the CSR from PEM or DER, then checks that its signature is valid
|
|
310
|
+
* against its own embedded public key.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* import { verifyCertificateSigningRequest } from 'micro509';
|
|
315
|
+
*
|
|
316
|
+
* const result = await verifyCertificateSigningRequest(csrPem);
|
|
317
|
+
* if (result.ok) {
|
|
318
|
+
* console.log('subject:', result.value.subject.values.commonName);
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
323
322
|
declare function verifyCertificateSigningRequest(input: CsrSource): Promise<VerifyRequestResult>;
|
|
324
323
|
/**
|
|
325
|
-
* Standalone EKU check against a verified certificate chain.
|
|
326
|
-
* Validates that the leaf has the requested purpose and that
|
|
327
|
-
* intermediate CA EKU constraints (if present) permit it.
|
|
328
|
-
*
|
|
329
|
-
* @example
|
|
330
|
-
* ```ts
|
|
331
|
-
* import { checkExtendedKeyUsage } from 'micro509';
|
|
332
|
-
*
|
|
333
|
-
* const result = checkExtendedKeyUsage(chain, 'serverAuth');
|
|
334
|
-
* if (!result.ok) {
|
|
335
|
-
* console.error(result.error.code, result.error.message);
|
|
336
|
-
* }
|
|
337
|
-
* ```
|
|
338
|
-
*/
|
|
324
|
+
* Standalone EKU check against a verified certificate chain.
|
|
325
|
+
* Validates that the leaf has the requested purpose and that
|
|
326
|
+
* intermediate CA EKU constraints (if present) permit it.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* import { checkExtendedKeyUsage } from 'micro509';
|
|
331
|
+
*
|
|
332
|
+
* const result = checkExtendedKeyUsage(chain, 'serverAuth');
|
|
333
|
+
* if (!result.ok) {
|
|
334
|
+
* console.error(result.error.code, result.error.message);
|
|
335
|
+
* }
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
339
338
|
declare function checkExtendedKeyUsage(chain: readonly ParsedCertificate[], purpose: EkuCheckPurpose): EkuCheckResult;
|
|
340
339
|
/** Extracts a {@linkcode TrustAnchor} from a parsed certificate, copying the subject, SPKI, and key identifiers. */
|
|
341
340
|
declare function trustAnchorFromCertificate(certificate: ParsedCertificate): TrustAnchor;
|
|
342
341
|
/**
|
|
343
|
-
* Validates a certificate chain for TLS server use:
|
|
344
|
-
* chain verification + `serverAuth` EKU (leaf + intermediate propagation)
|
|
345
|
-
* + DNS/IP identity matching.
|
|
346
|
-
*
|
|
347
|
-
* @example
|
|
348
|
-
* ```ts
|
|
349
|
-
* import { validateForTlsServer } from 'micro509';
|
|
350
|
-
*
|
|
351
|
-
* const result = await validateForTlsServer({
|
|
352
|
-
* leaf: serverCertPem,
|
|
353
|
-
* roots: [rootCaPem],
|
|
354
|
-
* serviceIdentity: { type: 'dns', value: 'example.com' },
|
|
355
|
-
* });
|
|
356
|
-
* if (result.ok) {
|
|
357
|
-
* console.log('valid for', result.value.leaf.subject.values.commonName);
|
|
358
|
-
* }
|
|
359
|
-
* ```
|
|
360
|
-
*/
|
|
342
|
+
* Validates a certificate chain for TLS server use:
|
|
343
|
+
* chain verification + `serverAuth` EKU (leaf + intermediate propagation)
|
|
344
|
+
* + DNS/IP identity matching.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* import { validateForTlsServer } from 'micro509';
|
|
349
|
+
*
|
|
350
|
+
* const result = await validateForTlsServer({
|
|
351
|
+
* leaf: serverCertPem,
|
|
352
|
+
* roots: [rootCaPem],
|
|
353
|
+
* serviceIdentity: { type: 'dns', value: 'example.com' },
|
|
354
|
+
* });
|
|
355
|
+
* if (result.ok) {
|
|
356
|
+
* console.log('valid for', result.value.leaf.subject.values.commonName);
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
361
360
|
declare function validateForTlsServer(input: ValidateForTlsServerInput): Promise<VerifyChainResult>;
|
|
362
361
|
/**
|
|
363
|
-
* Validates a certificate chain for TLS client use:
|
|
364
|
-
* chain verification + `clientAuth` EKU (leaf + intermediate propagation).
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* ```ts
|
|
368
|
-
* import { validateForTlsClient } from 'micro509';
|
|
369
|
-
*
|
|
370
|
-
* const result = await validateForTlsClient({
|
|
371
|
-
* leaf: clientCertPem,
|
|
372
|
-
* roots: [rootCaPem],
|
|
373
|
-
* });
|
|
374
|
-
* ```
|
|
375
|
-
*/
|
|
362
|
+
* Validates a certificate chain for TLS client use:
|
|
363
|
+
* chain verification + `clientAuth` EKU (leaf + intermediate propagation).
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* import { validateForTlsClient } from 'micro509';
|
|
368
|
+
*
|
|
369
|
+
* const result = await validateForTlsClient({
|
|
370
|
+
* leaf: clientCertPem,
|
|
371
|
+
* roots: [rootCaPem],
|
|
372
|
+
* });
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
376
375
|
declare function validateForTlsClient(input: ValidateForTlsClientInput): Promise<VerifyChainResult>;
|
|
377
376
|
/**
|
|
378
|
-
* Validates a certificate chain for code signing:
|
|
379
|
-
* chain verification + `codeSigning` EKU (leaf + intermediate propagation).
|
|
380
|
-
*
|
|
381
|
-
* @example
|
|
382
|
-
* ```ts
|
|
383
|
-
* import { validateForCodeSigning } from 'micro509';
|
|
384
|
-
*
|
|
385
|
-
* const result = await validateForCodeSigning({
|
|
386
|
-
* leaf: codeSigningCertPem,
|
|
387
|
-
* roots: [rootCaPem],
|
|
388
|
-
* });
|
|
389
|
-
* ```
|
|
390
|
-
*/
|
|
377
|
+
* Validates a certificate chain for code signing:
|
|
378
|
+
* chain verification + `codeSigning` EKU (leaf + intermediate propagation).
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```ts
|
|
382
|
+
* import { validateForCodeSigning } from 'micro509';
|
|
383
|
+
*
|
|
384
|
+
* const result = await validateForCodeSigning({
|
|
385
|
+
* leaf: codeSigningCertPem,
|
|
386
|
+
* roots: [rootCaPem],
|
|
387
|
+
* });
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
391
390
|
declare function validateForCodeSigning(input: ValidateForCodeSigningInput): Promise<VerifyChainResult>;
|
|
392
391
|
/**
|
|
393
|
-
* Validates a certificate chain for CA use:
|
|
394
|
-
* chain verification + `basicConstraints.ca` check on the leaf.
|
|
395
|
-
*
|
|
396
|
-
* @example
|
|
397
|
-
* ```ts
|
|
398
|
-
* import { validateForCa } from 'micro509';
|
|
399
|
-
*
|
|
400
|
-
* const result = await validateForCa({
|
|
401
|
-
* leaf: intermediateCertPem,
|
|
402
|
-
* roots: [rootCaPem],
|
|
403
|
-
* });
|
|
404
|
-
* ```
|
|
405
|
-
*/
|
|
392
|
+
* Validates a certificate chain for CA use:
|
|
393
|
+
* chain verification + `basicConstraints.ca` check on the leaf.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```ts
|
|
397
|
+
* import { validateForCa } from 'micro509';
|
|
398
|
+
*
|
|
399
|
+
* const result = await validateForCa({
|
|
400
|
+
* leaf: intermediateCertPem,
|
|
401
|
+
* roots: [rootCaPem],
|
|
402
|
+
* });
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
406
405
|
declare function validateForCa(input: ValidateForCaInput): Promise<VerifyChainResult>;
|
|
407
406
|
//#endregion
|
|
408
|
-
export { BuildCandidatePathInput, BuildCandidatePathResult, CandidatePath, CertificateSource, ChainRevocationInput, type ConstrainedPolicy, CsrSource, type DnsServiceIdentityInput, EkuCheckFailure, EkuCheckPurpose, EkuCheckResult, type InitialNameConstraintsInput, type IpServiceIdentityInput, type MatchServiceIdentityErrorCode, type MatchServiceIdentityFailure, type MatchServiceIdentityFailureDetails, type MatchServiceIdentityFailureResult, type MatchServiceIdentityInput, type MatchServiceIdentityResult, type MatchServiceIdentitySuccess, type PolicyValidationInput, type PolicyValidationOutcome, type ServiceIdentityInput, type ServiceIdentityType, type SrvServiceIdentityInput, TrustAnchor, type UriServiceIdentityInput, VERIFY_ERROR_CODES, ValidateCandidatePathInput, ValidateCandidatePathResult, ValidateCandidatePathSuccess, ValidateForCaInput, ValidateForCodeSigningInput, ValidateForTlsClientInput, ValidateForTlsServerInput, VerifiedCertificateChain, VerifyCertificateChainInput, VerifyChainFailure, VerifyChainResult, VerifyErrorCode, VerifyFailureDetails, VerifyPurpose, VerifyRequestFailure, VerifyRequestResult, buildCandidatePath, checkExtendedKeyUsage, type matchCertificateServiceIdentity, type matchServiceIdentity, trustAnchorFromCertificate, validateCandidatePath, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, verifyCertificateChain, verifyCertificateSigningRequest };
|
|
407
|
+
export { BuildCandidatePathInput, BuildCandidatePathResult, CandidatePath, CertificateSource, ChainRevocationInput, type ConstrainedPolicy, CsrSource, type DnsServiceIdentityInput, EkuCheckFailure, EkuCheckPurpose, EkuCheckResult, type InitialNameConstraintsInput, type IpServiceIdentityInput, type MatchServiceIdentityErrorCode, type MatchServiceIdentityFailure, type MatchServiceIdentityFailureDetails, type MatchServiceIdentityFailureResult, type MatchServiceIdentityInput, type MatchServiceIdentityResult, type MatchServiceIdentitySuccess, type PolicyValidationInput, type PolicyValidationOutcome, type ServiceIdentityInput, type ServiceIdentityType, type SrvServiceIdentityInput, TrustAnchor, type UriServiceIdentityInput, VERIFY_ERROR_CODES, ValidateCandidatePathInput, ValidateCandidatePathResult, ValidateCandidatePathSuccess, ValidateForCaInput, ValidateForCodeSigningInput, ValidateForTlsClientInput, ValidateForTlsServerInput, VerifiedCertificateChain, VerifyCertificateChainInput, VerifyChainFailure, VerifyChainResult, VerifyErrorCode, VerifyFailureDetails, VerifyPurpose, VerifyRequestFailure, VerifyRequestResult, buildCandidatePath, checkExtendedKeyUsage, type matchCertificateServiceIdentity, type matchServiceIdentity, trustAnchorFromCertificate, validateCandidatePath, validateForCa, validateForCodeSigning, validateForTlsClient, validateForTlsServer, verifyCertificateChain, verifyCertificateSigningRequest };
|
|
408
|
+
//# sourceMappingURL=verify.d.ts.map
|