micro509 0.17.1 → 0.19.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/CHANGELOG.md +165 -6
- package/dist/crypto/crypto.d.ts +12 -4
- package/dist/crypto/crypto.js +30 -17
- package/dist/crypto/crypto.js.map +1 -1
- package/dist/crypto.d.ts +8 -2
- package/dist/der/der.d.ts +14 -4
- package/dist/der/der.js +19 -19
- package/dist/der/der.js.map +1 -1
- package/dist/der.d.ts +26 -2
- package/dist/der.js +4 -4
- package/dist/index.d.ts +84 -16
- package/dist/index.js +19 -19
- package/dist/internal/asn1/asn1.d.ts +1 -2
- package/dist/internal/asn1/asn1.js +10 -2
- package/dist/internal/asn1/asn1.js.map +1 -1
- package/dist/internal/asn1/ber.js.map +1 -1
- package/dist/internal/asn1/decode-refusal.js.map +1 -1
- package/dist/internal/asn1/der.d.ts +1 -2
- package/dist/internal/asn1/der.js.map +1 -1
- package/dist/internal/asn1/oids.js +71 -353
- package/dist/internal/asn1/oids.js.map +1 -1
- package/dist/internal/asn1/oids.json.js +357 -0
- package/dist/internal/asn1/oids.json.js.map +1 -0
- package/dist/internal/crypto/algorithm-names.js +1 -1
- package/dist/internal/crypto/algorithm-names.js.map +1 -1
- package/dist/internal/crypto/ecdsa.js.map +1 -1
- package/dist/internal/crypto/hash.js.map +1 -1
- package/dist/internal/crypto/pbes2.d.ts +1 -2
- package/dist/internal/crypto/pbes2.js +70 -70
- package/dist/internal/crypto/pbes2.js.map +1 -1
- package/dist/internal/crypto/prime-ec.js +37 -0
- package/dist/internal/crypto/prime-ec.js.map +1 -0
- package/dist/internal/crypto/rsa-pss.js +50 -50
- package/dist/internal/crypto/rsa-pss.js.map +1 -1
- package/dist/internal/crypto/sig-verify.d.ts +41 -2
- package/dist/internal/crypto/sig-verify.js +125 -38
- package/dist/internal/crypto/sig-verify.js.map +1 -1
- package/dist/internal/crypto/signing.d.ts +1 -2
- package/dist/internal/crypto/signing.js +26 -26
- package/dist/internal/crypto/signing.js.map +1 -1
- package/dist/internal/jose/base64url.js.map +1 -1
- package/dist/internal/jose/json-data.js +108 -0
- package/dist/internal/jose/json-data.js.map +1 -0
- package/dist/internal/jose/strict-json.d.ts +1 -2
- package/dist/internal/jose/strict-json.js.map +1 -1
- package/dist/internal/shared/base64.js.map +1 -1
- package/dist/internal/shared/dn.d.ts +1 -2
- package/dist/internal/shared/dn.js +1 -1
- package/dist/internal/shared/dn.js.map +1 -1
- package/dist/internal/shared/idna.js.map +1 -1
- package/dist/internal/shared/ip.d.ts +1 -2
- package/dist/internal/shared/ip.js.map +1 -1
- package/dist/internal/shared/mailbox.js.map +1 -1
- package/dist/internal/shared/punycode.js.map +1 -1
- package/dist/internal/shared/uri-host.js.map +1 -1
- package/dist/internal/verify/name-constraints-engine.js +64 -64
- package/dist/internal/verify/name-constraints-engine.js.map +1 -1
- package/dist/internal/verify/policy-engine.js +1 -1
- package/dist/internal/verify/policy-engine.js.map +1 -1
- package/dist/internal/verify/spki-distrust.js.map +1 -1
- package/dist/internal/verify/verify-path.d.ts +1 -2
- package/dist/internal/verify/verify-path.js +234 -128
- package/dist/internal/verify/verify-path.js.map +1 -1
- package/dist/internal/x509/directory-name.js +10 -10
- package/dist/internal/x509/directory-name.js.map +1 -1
- package/dist/internal/x509/extension-bits.js.map +1 -1
- package/dist/internal/x509/extension-errors.d.ts +1 -2
- package/dist/internal/x509/extension-errors.js.map +1 -1
- package/dist/internal/x509/extension-registry.js +18 -18
- package/dist/internal/x509/extension-registry.js.map +1 -1
- package/dist/internal/x509/general-name-profile.js +9 -9
- package/dist/internal/x509/general-name-profile.js.map +1 -1
- package/dist/internal/x509/general-name.js +32 -32
- package/dist/internal/x509/general-name.js.map +1 -1
- package/dist/internal/x509/name-fields.js +1 -1
- package/dist/internal/x509/name-fields.js.map +1 -1
- package/dist/internal/x509/or-address.js.map +1 -1
- package/dist/jose/base64url.d.ts +4 -0
- package/dist/jose/base64url.js +14 -0
- package/dist/jose/base64url.js.map +1 -0
- package/dist/jose/errors.d.ts +9 -3
- package/dist/jose/errors.js.map +1 -1
- package/dist/jose/jwe.d.ts +64 -0
- package/dist/jose/jwe.js +188 -0
- package/dist/jose/jwe.js.map +1 -0
- package/dist/jose/jwks.d.ts +38 -10
- package/dist/jose/jwks.js +156 -96
- package/dist/jose/jwks.js.map +1 -1
- package/dist/jose/jws.d.ts +8 -6
- package/dist/jose/jws.js +216 -170
- package/dist/jose/jws.js.map +1 -1
- package/dist/jose/jwt.d.ts +8 -2
- package/dist/jose/jwt.js +98 -98
- package/dist/jose/jwt.js.map +1 -1
- package/dist/jose/remote-jwks.d.ts +1 -2
- package/dist/jose/remote-jwks.js +106 -108
- package/dist/jose/remote-jwks.js.map +1 -1
- package/dist/jose.d.ts +15 -4
- package/dist/jose.js +7 -5
- package/dist/kdf/argon2-arithmetic.js.map +1 -1
- package/dist/kdf/argon2-core.js.map +1 -1
- package/dist/kdf/argon2-memory.js.map +1 -1
- package/dist/kdf/argon2-portable.js.map +1 -1
- package/dist/kdf/argon2.d.ts +7 -2
- package/dist/kdf/argon2.js.map +1 -1
- package/dist/kdf.d.ts +6 -0
- package/dist/keys/keys.d.ts +31 -6
- package/dist/keys/keys.js +315 -233
- package/dist/keys/keys.js.map +1 -1
- package/dist/keys.d.ts +11 -2
- package/dist/keys.js +2 -2
- package/dist/pem/pem.d.ts +1 -2
- package/dist/pem/pem.js +40 -25
- package/dist/pem/pem.js.map +1 -1
- package/dist/pem.d.ts +6 -0
- package/dist/pkcs/pfx.d.ts +2 -3
- package/dist/pkcs/pfx.js +142 -142
- package/dist/pkcs/pfx.js.map +1 -1
- package/dist/pkcs/pkcs12-mac.d.ts +1 -2
- package/dist/pkcs/pkcs12-mac.js +122 -122
- package/dist/pkcs/pkcs12-mac.js.map +1 -1
- package/dist/pkcs/pkcs7.d.ts +24 -3
- package/dist/pkcs/pkcs7.js +294 -256
- package/dist/pkcs/pkcs7.js.map +1 -1
- package/dist/pkcs.d.ts +10 -1
- package/dist/pkcs.js +4 -4
- package/dist/result/result.d.ts +1 -2
- package/dist/result/result.js.map +1 -1
- package/dist/result.d.ts +6 -0
- package/dist/revocation/chain.d.ts +69 -16
- package/dist/revocation/chain.js +431 -303
- package/dist/revocation/chain.js.map +1 -1
- package/dist/revocation/crl.d.ts +67 -14
- package/dist/revocation/crl.js +656 -366
- package/dist/revocation/crl.js.map +1 -1
- package/dist/revocation/ocsp.d.ts +78 -24
- package/dist/revocation/ocsp.js +622 -436
- package/dist/revocation/ocsp.js.map +1 -1
- package/dist/revocation/revocation.d.ts +68 -14
- package/dist/revocation/revocation.js +195 -74
- package/dist/revocation/revocation.js.map +1 -1
- package/dist/revocation.d.ts +14 -5
- package/dist/revocation.js +4 -4
- package/dist/ssh/ssh.d.ts +2 -3
- package/dist/ssh/ssh.js +165 -170
- package/dist/ssh/ssh.js.map +1 -1
- package/dist/ssh/wire.d.ts +1 -2
- package/dist/ssh/wire.js +10 -10
- package/dist/ssh/wire.js.map +1 -1
- package/dist/ssh.d.ts +8 -0
- package/dist/verify/identity.d.ts +3 -4
- package/dist/verify/identity.js +33 -33
- package/dist/verify/identity.js.map +1 -1
- package/dist/verify/name-constraints.d.ts +9 -2
- package/dist/verify/policy.d.ts +9 -2
- package/dist/verify/verify.d.ts +85 -34
- package/dist/verify/verify.js +276 -226
- package/dist/verify/verify.js.map +1 -1
- package/dist/verify.d.ts +12 -2
- package/dist/x509/certificate.d.ts +4 -5
- package/dist/x509/certificate.js +40 -40
- package/dist/x509/certificate.js.map +1 -1
- package/dist/x509/csr.d.ts +3 -4
- package/dist/x509/csr.js +15 -15
- package/dist/x509/csr.js.map +1 -1
- package/dist/x509/extensions.d.ts +1 -2
- package/dist/x509/extensions.js +165 -165
- package/dist/x509/extensions.js.map +1 -1
- package/dist/x509/fingerprint.d.ts +1 -2
- package/dist/x509/fingerprint.js.map +1 -1
- package/dist/x509/name-text.d.ts +1 -2
- package/dist/x509/name-text.js.map +1 -1
- package/dist/x509/name.d.ts +1 -2
- package/dist/x509/name.js +15 -15
- package/dist/x509/name.js.map +1 -1
- package/dist/x509/parse.d.ts +9 -6
- package/dist/x509/parse.js +394 -394
- package/dist/x509/parse.js.map +1 -1
- package/dist/x509.d.ts +17 -4
- package/dist/x509.js +8 -8
- package/package.json +32 -33
- package/dist/internal/asn1/oids2.js +0 -75
- package/dist/internal/asn1/oids2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation.js","names":["REVOCATION_INDETERMINATE_REASON_CODES","parsedCertificate","certificate","uris","seen","accessDescription","uri","candidates","configuredByUri","configuredResponder","input","existing","evidence","checkedSources","entry","normalizedCertificate","error","ocspGoodResult","crlGoodResult","crlCoveredReasons","indeterminateEvidence","result","reason","unrecognizedReason","coversAllDistributionPointReasons","refusal","decodeRefusalOf","DECODE_REFUSAL_CODES","checkCertificateRevocationAgainstCrl","response","validateOcspResponse","matchedResponse","revocationReasonFromCode","parseCertificateDerOrThrow","parseCertificateFromSource","value"],"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 { DECODE_REFUSAL_CODES, decodeRefusalOf } from '#micro509/internal/asn1/decode-refusal';\nimport type { DecodeRefusalCode, Result } from '#micro509/result/result';\nimport { rethrowIfInvariant } from '#micro509/result/result';\nimport type {\n\tCrlApplicabilityFailureReason,\n\tCrlSource,\n\tParsedRevocationReason,\n\tUnrecognizedReasonCodePolicy,\n} from '#micro509/revocation/crl';\nimport {\n\tassertCrlMaxAge,\n\tcheckCertificateRevocationAgainstCrl,\n\tcoversAllDistributionPointReasons,\n\trevocationReasonFromCode,\n} from '#micro509/revocation/crl';\nimport type {\n\tOcspCertificateSource,\n\tOcspRequestSource,\n\tParsedOcspResponse,\n\tValidateOcspResponseInput,\n} from '#micro509/revocation/ocsp';\nimport { validateOcspResponse } from '#micro509/revocation/ocsp';\nimport type { DistributionPointReason } from '#micro509/x509/extensions';\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. It also widens `crlMaxAgeMs`. */\n\treadonly clockSkewMs?: number;\n\t/** Maximum age of each CRL's `thisUpdate` in milliseconds. Unbounded by default. See {@linkcode ValidateCertificateRevocationListInput.maxAgeMs}. */\n\treadonly crlMaxAgeMs?: number;\n\t/**\n\t * OCSP client profile for every OCSP evidence entry. See\n\t * {@linkcode ValidateOcspResponseInput.profile}. Defaults to `'rfc6960'`.\n\t */\n\treadonly ocspProfile?: ValidateOcspResponseInput['profile'];\n\t/**\n\t * Treatment of CRL or OCSP evidence whose CRLReason is unrecognized. See\n\t * {@linkcode UnrecognizedReasonCodePolicy}. `'reject'` turns that evidence\n\t * into `reason_code_unrecognized`, which also keeps other evidence from\n\t * settling the status as `good`. Defaults to `'revoked'`.\n\t */\n\treadonly unrecognizedReasonCode?: UnrecognizedReasonCodePolicy;\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\t| DecodeRefusalCode;\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'next_update_missing',\n\t'non_applicable',\n\t'nonce_mismatch',\n\t'ocsp_signing_missing',\n\t'reason_code_unrecognized',\n\t'reason_coverage_incomplete',\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\t'unsupported',\n\t'limit_exceeded',\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 (from CRL evidence). */\n\treadonly revocationReason?: ParsedRevocationReason;\n\t/** CRL reason code (from OCSP evidence). */\n\treadonly revocationReasonCode?: bigint;\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| {\n\t\t\treadonly status: 'good';\n\t\t\treadonly result: RevocationCheckGoodValue;\n\t\t\t/** RFC 5280 §6.3.3(d) reasons this CRL covered; absent for OCSP (which is definitive). */\n\t\t\treadonly coveredReasons?: readonly DistributionPointReason[];\n\t }\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' || accessDescription.location.type !== 'uri') {\n\t\t\tcontinue;\n\t\t}\n\t\tconst uri = accessDescription.location.value;\n\t\tif (seen.has(uri)) {\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(uri);\n\t\turis.push(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\tassertCrlMaxAge(input.crlMaxAgeMs);\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 (error) {\n\t\treturn undecodableCertificateResult(error, checkedSources);\n\t}\n\tlet ocspGoodResult: RevocationCheckGoodValue | undefined;\n\tlet crlGoodResult: RevocationCheckGoodValue | undefined;\n\tconst crlCoveredReasons = new Set<string>();\n\tconst indeterminateEvidence: RevocationIndeterminateEvidence[] = [];\n\tfor (const entry of evidence) {\n\t\tconst result = await checkRevocationEvidenceEntry(input, entry, normalizedCertificate);\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\tif (result.coveredReasons === undefined) {\n\t\t\t\tocspGoodResult ??= result.result;\n\t\t\t} else {\n\t\t\t\tcrlGoodResult ??= result.result;\n\t\t\t\tfor (const reason of result.coveredReasons) {\n\t\t\t\t\tcrlCoveredReasons.add(reason);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tindeterminateEvidence.push(result.detail);\n\t}\n\treturn settleRevocationEvidence(\n\t\tocspGoodResult,\n\t\tcrlGoodResult,\n\t\tcrlCoveredReasons,\n\t\tindeterminateEvidence,\n\t\tcheckedSources,\n\t);\n}\n\n/** The result once no evidence revoked the certificate outright. */\nfunction settleRevocationEvidence(\n\tocspGoodResult: RevocationCheckGoodValue | undefined,\n\tcrlGoodResult: RevocationCheckGoodValue | undefined,\n\tcrlCoveredReasons: Set<string>,\n\tindeterminateEvidence: RevocationIndeterminateEvidence[],\n\tcheckedSources: readonly RevocationEvidenceKind[],\n): CheckCertificateRevocationResult {\n\tconst unrecognizedReason = indeterminateEvidence.some(\n\t\t(entry) => entry.code === 'reason_code_unrecognized',\n\t);\n\t// An OCSP good is per-certificate and definitive. A CRL good is definitive\n\t// only once the applicable CRLs together cover every revocation reason.\n\tif (ocspGoodResult !== undefined && !unrecognizedReason) {\n\t\treturn revocationSuccess(ocspGoodResult);\n\t}\n\tif (\n\t\tcrlGoodResult !== undefined &&\n\t\t!unrecognizedReason &&\n\t\tcoversAllDistributionPointReasons(crlCoveredReasons)\n\t) {\n\t\treturn revocationSuccess(crlGoodResult);\n\t}\n\tif (crlGoodResult !== undefined && !coversAllDistributionPointReasons(crlCoveredReasons)) {\n\t\tindeterminateEvidence.push({\n\t\t\tkind: 'crl',\n\t\t\tcode: 'reason_coverage_incomplete',\n\t\t\tmessage: 'CRL evidence covers only some revocation reasons',\n\t\t});\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\nfunction undecodableCertificateResult(\n\terror: unknown,\n\tcheckedSources: readonly RevocationEvidenceKind[],\n): CheckCertificateRevocationResult {\n\tconst refusal = decodeRefusalOf(error, DECODE_REFUSAL_CODES);\n\treturn revocationSuccess({\n\t\tstatus: 'indeterminate',\n\t\tcode: refusal?.code ?? 'revocation_status_indeterminate',\n\t\tmessage: refusal?.message ?? 'Certificate input is malformed',\n\t\tdetails: {\n\t\t\tcheckedSources,\n\t\t\tindeterminateEvidence: [],\n\t\t},\n\t});\n}\n\nasync function checkRevocationEvidenceEntry(\n\tinput: CheckCertificateRevocationInput,\n\tevidence: RevocationEvidenceInput,\n\tcertificate: ParsedCertificate,\n): Promise<RevocationEvidenceCheck> {\n\ttry {\n\t\treturn evidence.kind === 'crl'\n\t\t\t? await checkCertificateRevocationWithCrl(input, evidence, certificate)\n\t\t\t: await checkCertificateRevocationWithOcsp(input, evidence, certificate);\n\t} catch (error) {\n\t\trethrowIfInvariant(error);\n\t\tconst refusal = decodeRefusalOf(error, DECODE_REFUSAL_CODES);\n\t\treturn {\n\t\t\tstatus: 'indeterminate',\n\t\t\tdetail: {\n\t\t\t\tkind: evidence.kind,\n\t\t\t\tcode: refusal?.code ?? 'signature_invalid',\n\t\t\t\tmessage: refusal?.message ?? `${evidence.kind.toUpperCase()} evidence input is malformed`,\n\t\t\t},\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\t...(input.crlMaxAgeMs === undefined ? {} : { maxAgeMs: input.crlMaxAgeMs }),\n\t\t...(input.unrecognizedReasonCode === undefined\n\t\t\t? {}\n\t\t\t: { unrecognizedReasonCode: input.unrecognizedReasonCode }),\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\tcoveredReasons: result.value.coveredReasons,\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\t...(input.ocspProfile === undefined ? {} : { profile: input.ocspProfile }),\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\tif (\n\t\t\tinput.unrecognizedReasonCode === 'reject' &&\n\t\t\ttypeof revocationReasonFromCode(matchedResponse.revocationReasonCode) === 'object'\n\t\t) {\n\t\t\treturn {\n\t\t\t\tstatus: 'indeterminate',\n\t\t\t\tdetail: {\n\t\t\t\t\tkind: 'ocsp',\n\t\t\t\t\tcode: 'reason_code_unrecognized',\n\t\t\t\t\tmessage: `OCSP response carries unrecognized reason code ${String(matchedResponse.revocationReasonCode)}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\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): CheckC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"file":"revocation.js","names":["decodeRefusalOf","callerVerification","resolveSignatureVerifiers","DECODE_REFUSAL_CODES","rethrowIfInvariant","assertClockSkew","assertCrlMaxAge","checkCertificateRevocationAgainstCrlsBy","coversAllDistributionPointReasons","distinctSignedCrls","normalizeCrl","revocationReasonFromCode","signedCrlKey","validateOcspResponseWith","parseCertificateDerOrThrow","parseCertificateFromSource","REVOCATION_INDETERMINATE_REASON_CODES","certificate","parsedCertificate","uris","seen","accessDescription","uri","input","candidates","configuredByUri","configuredResponder","existing","callerInput","evidence","checkedSources","entry","normalizedCertificate","error","ocspGoodResult","crlGoodResult","crlCoveredReasons","indeterminateEvidence","result","reason","unrecognizedReason","refusal","parsed","deltaCrls","crl","budget","checkedCompleteCrls","checks","index","entryChecks","completeCrl","check","checked","key","kind","source","outcome","response","matchedResponse","value"],"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 { DECODE_REFUSAL_CODES, decodeRefusalOf } from '#micro509/internal/asn1/decode-refusal';\nimport type { SignatureVerifiers } from '#micro509/internal/crypto/sig-verify';\nimport {\n\tcallerVerification,\n\tresolveSignatureVerifiers,\n} from '#micro509/internal/crypto/sig-verify';\nimport type { DecodeFailureCode, Result } from '#micro509/result/result';\nimport { rethrowIfInvariant } from '#micro509/result/result';\nimport type {\n\tCheckCertificateRevocationAgainstCrlResult,\n\tCrlApplicabilityFailureReason,\n\tCrlSource,\n\tDeltaCrlBudget,\n\tParsedCertificateRevocationList,\n\tParsedRevocationReason,\n\tSupersededDeltaCrlPolicy,\n\tUnrecognizedReasonCodePolicy,\n} from '#micro509/revocation/crl';\nimport {\n\tassertClockSkew,\n\tassertCrlMaxAge,\n\tcheckCertificateRevocationAgainstCrlsBy,\n\tcoversAllDistributionPointReasons,\n\tDELTA_CRL_ATTEMPTS_PER_CALL,\n\tdistinctSignedCrls,\n\tnormalizeCrl,\n\trevocationReasonFromCode,\n\tsignedCrlKey,\n} from '#micro509/revocation/crl';\nimport type {\n\tOcspCertificateSource,\n\tOcspRequestSource,\n\tOcspResponderRevocationPolicy,\n\tParsedOcspResponse,\n\tRevocationSkipReason,\n\tValidateOcspResponseInput,\n} from '#micro509/revocation/ocsp';\nimport { validateOcspResponseWith } from '#micro509/revocation/ocsp';\nimport type { DistributionPointReason } from '#micro509/x509/extensions';\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' | 'skipped';\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/**\n\t * Clock-skew tolerance in milliseconds. It also widens `crlMaxAgeMs`.\n\t * Throws `RangeError` when negative or not finite.\n\t */\n\treadonly clockSkewMs?: number;\n\t/** Maximum age of each CRL's `thisUpdate` in milliseconds. Unbounded by default. See {@linkcode ValidateCertificateRevocationListInput.maxAgeMs}. */\n\treadonly crlMaxAgeMs?: number;\n\t/**\n\t * OCSP client profile for every OCSP evidence entry. See\n\t * {@linkcode ValidateOcspResponseInput.profile}. Defaults to `'rfc6960'`.\n\t */\n\treadonly ocspProfile?: ValidateOcspResponseInput['profile'];\n\t/**\n\t * Revocation policy for delegated OCSP responders. The CRLs in `evidence`,\n\t * delta CRLs included, serve as their revocation evidence. See\n\t * {@linkcode OcspResponderRevocationPolicy}. Defaults to\n\t * `'nocheck-or-evidence'`.\n\t */\n\treadonly ocspResponderRevocation?: OcspResponderRevocationPolicy;\n\t/**\n\t * Treatment of CRL or OCSP evidence whose CRLReason is unrecognized. See\n\t * {@linkcode UnrecognizedReasonCodePolicy}. `'reject'` turns that evidence\n\t * into `reason_code_unrecognized`, which also keeps other evidence from\n\t * settling the status as `good`. Defaults to `'revoked'`.\n\t */\n\treadonly unrecognizedReasonCode?: UnrecognizedReasonCodePolicy;\n\t/**\n\t * Treatment of delta CRLs in `evidence` that the attempt limits leave unread\n\t * although one already read supersedes them, for the certificate and its\n\t * delegated OCSP responders. See {@linkcode SupersededDeltaCrlPolicy}.\n\t * Defaults to `'indeterminate'`.\n\t */\n\treadonly unreadSupersededDeltaCrls?: SupersededDeltaCrlPolicy;\n\t/**\n\t * Caller verifiers for signature algorithms micro509 does not verify through\n\t * WebCrypto, keyed by dotted-decimal signature algorithm OID, for the CRL and\n\t * OCSP evidence. A key that micro509 verifies natively, a key that is no OID,\n\t * or a value that is no function throws `RangeError`.\n\t */\n\treadonly signatureVerifiers?: SignatureVerifiers;\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\t| DecodeFailureCode;\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'delta_crl_retry_limit_exceeded',\n\t'delta_crl_unusable',\n\t'issuer_mismatch',\n\t'malformed',\n\t'next_update_missing',\n\t'non_applicable',\n\t'nonce_mismatch',\n\t'ocsp_signing_missing',\n\t'reason_code_unrecognized',\n\t'reason_coverage_incomplete',\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\t'unsupported',\n\t'limit_exceeded',\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 (from CRL evidence). */\n\treadonly revocationReason?: ParsedRevocationReason;\n\t/** CRL reason code (from OCSP evidence). */\n\treadonly revocationReasonCode?: bigint;\n}\n\n/**\n * The certificate carries noRevAvail, so no evidence was consulted (RFC 9608\n * §4). A CRL never lists such a certificate (RFC 9608 §2), so its absence from\n * one shows nothing.\n */\nexport interface RevocationCheckSkippedValue {\n\t/** Status is skipped. */\n\treadonly status: Extract<RevocationStatus, 'skipped'>;\n\t/** The extension that exempts the certificate. */\n\treadonly skipReason: Extract<RevocationSkipReason, 'no_rev_avail'>;\n\t/** Human-readable diagnostic message. */\n\treadonly message: string;\n}\n\n/** Discriminated union of `good`, `revoked`, `indeterminate`, and `skipped` revocation outcomes. */\nexport type CheckCertificateRevocationValue =\n\t| RevocationCheckGoodValue\n\t| RevocationCheckRevokedValue\n\t| RevocationCheckIndeterminateValue\n\t| RevocationCheckSkippedValue;\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| {\n\t\t\treadonly status: 'good';\n\t\t\treadonly result: RevocationCheckGoodValue;\n\t\t\t/** RFC 5280 §6.3.3(d) reasons this CRL covered; absent for OCSP (which is definitive). */\n\t\t\treadonly coveredReasons?: readonly DistributionPointReason[];\n\t }\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' || accessDescription.location.type !== 'uri') {\n\t\t\tcontinue;\n\t\t}\n\t\tconst uri = accessDescription.location.value;\n\t\tif (seen.has(uri)) {\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(uri);\n\t\turis.push(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. Otherwise an OCSP\n * `good` settles the status, then a CRL `good` once the CRLs together cover\n * every revocation reason, else `indeterminate` with diagnostic details about\n * each indeterminate evidence.\n * Each CRL in `evidence` counts as a delta CRL when it carries the delta CRL\n * indicator and as a complete CRL otherwise, whichever field holds it. Each\n * distinct complete CRL is checked once, updated by the newest delta CRL\n * among them that applies to it, as `checkChainRevocation` does, within the\n * same attempt limits, which the CRL checks of delegated OCSP responders\n * share. A delta CRL that cannot settle the status records\n * `delta_crl_unusable` in `details.indeterminateEvidence`, and a candidate\n * the limits leave unread that counts under `unreadSupersededDeltaCrls`\n * records `delta_crl_retry_limit_exceeded` there; either keeps other evidence\n * from settling the status as `good`. Unless other evidence revokes the\n * certificate, the result is then `indeterminate` with the top-level code\n * `revocation_status_indeterminate`.\n * A certificate carrying noRevAvail is `skipped` without consulting evidence\n * (RFC 9608 §4). One carrying id-pkix-ocsp-nocheck is still checked against\n * the evidence, which may list it as revoked.\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\tcallerInput: CheckCertificateRevocationInput,\n): Promise<CheckCertificateRevocationResult> {\n\tconst input = { ...callerInput, at: callerInput.at ?? new Date() };\n\tassertCrlMaxAge(input.crlMaxAgeMs);\n\tassertClockSkew(input.clockSkewMs);\n\tresolveSignatureVerifiers(input.signatureVerifiers);\n\tconst evidence = input.evidence ?? [];\n\tconst checkedSources = evidence.map((entry) => entry.kind);\n\tif (carriesNoRevAvail(input.certificate)) {\n\t\treturn revocationSuccess({\n\t\t\tstatus: 'skipped',\n\t\t\tskipReason: 'no_rev_avail',\n\t\t\tmessage: 'Certificate carries noRevAvail, so no revocation evidence applies',\n\t\t});\n\t}\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 (error) {\n\t\treturn undecodableCertificateResult(error, checkedSources);\n\t}\n\tlet ocspGoodResult: RevocationCheckGoodValue | undefined;\n\tlet crlGoodResult: RevocationCheckGoodValue | undefined;\n\tconst crlCoveredReasons = new Set<string>();\n\tconst indeterminateEvidence: RevocationIndeterminateEvidence[] = [];\n\tfor (const result of await checkRevocationEvidence(input, evidence, normalizedCertificate)) {\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\tif (result.coveredReasons === undefined) {\n\t\t\t\tocspGoodResult ??= result.result;\n\t\t\t} else {\n\t\t\t\tcrlGoodResult ??= result.result;\n\t\t\t\tfor (const reason of result.coveredReasons) {\n\t\t\t\t\tcrlCoveredReasons.add(reason);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tindeterminateEvidence.push(result.detail);\n\t}\n\treturn settleRevocationEvidence(\n\t\tocspGoodResult,\n\t\tcrlGoodResult,\n\t\tcrlCoveredReasons,\n\t\tindeterminateEvidence,\n\t\tcheckedSources,\n\t);\n}\n\n/** The result once no evidence revoked the certificate outright. */\nfunction settleRevocationEvidence(\n\tocspGoodResult: RevocationCheckGoodValue | undefined,\n\tcrlGoodResult: RevocationCheckGoodValue | undefined,\n\tcrlCoveredReasons: Set<string>,\n\tindeterminateEvidence: RevocationIndeterminateEvidence[],\n\tcheckedSources: readonly RevocationEvidenceKind[],\n): CheckCertificateRevocationResult {\n\tconst unrecognizedReason = indeterminateEvidence.some(\n\t\t(entry) =>\n\t\t\tentry.code === 'reason_code_unrecognized' ||\n\t\t\tentry.code === 'delta_crl_unusable' ||\n\t\t\tentry.code === 'delta_crl_retry_limit_exceeded',\n\t);\n\t// An OCSP good is per-certificate and definitive. A CRL good is definitive\n\t// only once the applicable CRLs together cover every revocation reason.\n\tif (ocspGoodResult !== undefined && !unrecognizedReason) {\n\t\treturn revocationSuccess(ocspGoodResult);\n\t}\n\tif (\n\t\tcrlGoodResult !== undefined &&\n\t\t!unrecognizedReason &&\n\t\tcoversAllDistributionPointReasons(crlCoveredReasons)\n\t) {\n\t\treturn revocationSuccess(crlGoodResult);\n\t}\n\tif (crlGoodResult !== undefined && !coversAllDistributionPointReasons(crlCoveredReasons)) {\n\t\tindeterminateEvidence.push({\n\t\t\tkind: 'crl',\n\t\t\tcode: 'reason_coverage_incomplete',\n\t\t\tmessage: 'CRL evidence covers only some revocation reasons',\n\t\t});\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\nfunction undecodableCertificateResult(\n\terror: unknown,\n\tcheckedSources: readonly RevocationEvidenceKind[],\n): CheckCertificateRevocationResult {\n\tconst refusal = decodeRefusalOf(error, DECODE_REFUSAL_CODES);\n\treturn revocationSuccess({\n\t\tstatus: 'indeterminate',\n\t\tcode: refusal?.code ?? 'malformed',\n\t\tmessage: refusal?.message ?? 'Certificate input is malformed',\n\t\tdetails: {\n\t\t\tcheckedSources,\n\t\t\tindeterminateEvidence: [],\n\t\t},\n\t});\n}\n\n/** The checks of `evidence` in order, up to the first that revokes `certificate`. */\nasync function checkRevocationEvidence(\n\tinput: CheckCertificateRevocationInput,\n\tevidence: readonly RevocationEvidenceInput[],\n\tcertificate: ParsedCertificate,\n): Promise<readonly RevocationEvidenceCheck[]> {\n\tconst parsed = evidence.map((entry) =>\n\t\tentry.kind === 'crl' ? parseCrlEvidence(entry) : undefined,\n\t);\n\tconst deltaCrls = distinctSignedCrls(\n\t\tparsed.flatMap((entry) =>\n\t\t\t[entry?.crl, entry?.deltaCrl].flatMap((crl) =>\n\t\t\t\tcrl?.kind === 'parsed' && crl.crl.baseCrlNumber !== undefined ? [crl.crl] : [],\n\t\t\t),\n\t\t),\n\t);\n\tconst budget: DeltaCrlBudget = { remaining: DELTA_CRL_ATTEMPTS_PER_CALL };\n\tconst checkedCompleteCrls = new Set<string>();\n\tconst checks: RevocationEvidenceCheck[] = [];\n\tfor (const [index, entry] of evidence.entries()) {\n\t\tconst entryChecks =\n\t\t\tentry.kind === 'ocsp'\n\t\t\t\t? [await checkCertificateRevocationWithOcsp(input, entry, certificate, budget)]\n\t\t\t\t: await checkCrlEvidenceEntry(parsed[index], checkedCompleteCrls, (completeCrl) =>\n\t\t\t\t\t\tcheckCertificateRevocationWithCrl(input, completeCrl, deltaCrls, certificate, budget),\n\t\t\t\t\t);\n\t\tchecks.push(...entryChecks);\n\t\tif (entryChecks.some((check) => check.status === 'revoked')) return checks;\n\t}\n\treturn checks;\n}\n\n/**\n * The checks of one CRL evidence entry: its CRLs that do not decode, then\n * `check` on each complete CRL not in `checked`, up to the first that revokes.\n */\nasync function checkCrlEvidenceEntry(\n\tentry: ReturnType<typeof parseCrlEvidence> | undefined,\n\tchecked: Set<string>,\n\tcheck: (completeCrl: ParsedCertificateRevocationList) => Promise<RevocationEvidenceCheck>,\n): Promise<readonly RevocationEvidenceCheck[]> {\n\tif (entry === undefined) return [];\n\tconst checks = [entry.deltaCrl, entry.crl].flatMap((crl) =>\n\t\tcrl?.kind === 'indeterminate' ? [crl.check] : [],\n\t);\n\tfor (const completeCrl of completeCrlsOf(entry)) {\n\t\tconst key = signedCrlKey(completeCrl);\n\t\tif (checked.has(key)) continue;\n\t\tchecked.add(key);\n\t\tconst result = await check(completeCrl);\n\t\tchecks.push(result);\n\t\tif (result.status === 'revoked') break;\n\t}\n\treturn checks;\n}\n\n/**\n * The CRLs of one evidence entry to check as complete CRLs: its `crl`, and\n * its `deltaCrl` when that carries no delta CRL indicator. A delta CRL in\n * `crl` is still checked, which reports it as no complete CRL.\n */\nfunction completeCrlsOf(\n\tentry: ReturnType<typeof parseCrlEvidence>,\n): readonly ParsedCertificateRevocationList[] {\n\treturn [\n\t\t...(entry.crl.kind === 'parsed' ? [entry.crl.crl] : []),\n\t\t...(entry.deltaCrl?.kind === 'parsed' && entry.deltaCrl.crl.baseCrlNumber === undefined\n\t\t\t? [entry.deltaCrl.crl]\n\t\t\t: []),\n\t];\n}\n\nfunction undecodableEvidence(\n\tkind: RevocationEvidenceKind,\n\terror: unknown,\n): RevocationEvidenceCheck {\n\trethrowIfInvariant(error);\n\tconst refusal = decodeRefusalOf(error, DECODE_REFUSAL_CODES);\n\treturn {\n\t\tstatus: 'indeterminate',\n\t\tdetail: {\n\t\t\tkind,\n\t\t\tcode: refusal?.code ?? 'malformed',\n\t\t\tmessage: refusal?.message ?? `${kind.toUpperCase()} evidence input is malformed`,\n\t\t},\n\t};\n}\n\n/** One CRL that decoded, or why it does not. */\ntype ParsedCrlEvidence =\n\t| { readonly kind: 'parsed'; readonly crl: ParsedCertificateRevocationList }\n\t| { readonly kind: 'indeterminate'; readonly check: RevocationEvidenceCheck };\n\n/** A CRL evidence entry's complete and delta CRLs, each decoded on its own. */\nfunction parseCrlEvidence(entry: RevocationCrlEvidenceInput): {\n\treadonly crl: ParsedCrlEvidence;\n\treadonly deltaCrl: ParsedCrlEvidence | undefined;\n} {\n\treturn {\n\t\tcrl: parseOneCrl(entry.crl),\n\t\tdeltaCrl: entry.deltaCrl === undefined ? undefined : parseOneCrl(entry.deltaCrl),\n\t};\n}\n\nfunction parseOneCrl(source: CrlSource): ParsedCrlEvidence {\n\ttry {\n\t\treturn { kind: 'parsed', crl: normalizeCrl(source) };\n\t} catch (error) {\n\t\treturn { kind: 'indeterminate', check: undecodableEvidence('crl', error) };\n\t}\n}\n\n/**\n * Checks one complete CRL from `evidence`, updated by the newest delta CRL\n * among every delta CRL in `evidence` that applies to it, as chain revocation\n * does. A delta CRL that cannot settle the status yields `delta_crl_unusable`.\n */\nasync function checkCertificateRevocationWithCrl(\n\tinput: CheckCertificateRevocationInput,\n\tcompleteCrl: ParsedCertificateRevocationList,\n\tdeltaCrls: readonly ParsedCertificateRevocationList[],\n\tcertificate: ParsedCertificate,\n\tbudget: DeltaCrlBudget,\n): Promise<RevocationEvidenceCheck> {\n\tconst outcome = await checkCertificateRevocationAgainstCrlsBy(\n\t\tcertificate,\n\t\tcompleteCrl,\n\t\tdeltaCrls,\n\t\t{ kind: 'certificate', certificate: input.issuerCertificate },\n\t\t{\n\t\t\t...(input.at === undefined ? {} : { at: input.at }),\n\t\t\t...(input.clockSkewMs === undefined ? {} : { clockSkewMs: input.clockSkewMs }),\n\t\t\t...(input.crlMaxAgeMs === undefined ? {} : { maxAgeMs: input.crlMaxAgeMs }),\n\t\t\t...(input.unrecognizedReasonCode === undefined\n\t\t\t\t? {}\n\t\t\t\t: { unrecognizedReasonCode: input.unrecognizedReasonCode }),\n\t\t\t...(input.unreadSupersededDeltaCrls === undefined\n\t\t\t\t? {}\n\t\t\t\t: { unreadSupersededDeltaCrls: input.unreadSupersededDeltaCrls }),\n\t\t},\n\t\tcallerVerification(input.signatureVerifiers),\n\t\t[budget],\n\t);\n\tif (outcome.kind === 'checked') return crlEvidenceCheck(outcome.result);\n\treturn {\n\t\tstatus: 'indeterminate',\n\t\tdetail:\n\t\t\toutcome.reason === 'retry_limit'\n\t\t\t\t? {\n\t\t\t\t\t\tkind: 'crl',\n\t\t\t\t\t\tcode: 'delta_crl_retry_limit_exceeded',\n\t\t\t\t\t\tmessage: 'A delta CRL candidate remained unread after the attempt limit',\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tkind: 'crl',\n\t\t\t\t\t\tcode: 'delta_crl_unusable',\n\t\t\t\t\t\tmessage: 'An applicable delta CRL could not settle the certificate status',\n\t\t\t\t\t},\n\t};\n}\n\n/** The evidence check for one CRL result. */\nfunction crlEvidenceCheck(\n\tresult: CheckCertificateRevocationAgainstCrlResult,\n): RevocationEvidenceCheck {\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\tcoveredReasons: result.value.coveredReasons,\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/** The {@linkcode validateOcspResponseWith} input for one OCSP evidence entry. */\nfunction ocspEvidenceValidationInput(\n\tinput: CheckCertificateRevocationInput,\n\tevidence: RevocationOcspEvidenceInput,\n): ValidateOcspResponseInput {\n\treturn {\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\t...(input.ocspProfile === undefined ? {} : { profile: input.ocspProfile }),\n\t\t...(input.ocspResponderRevocation === undefined\n\t\t\t? {}\n\t\t\t: { responderRevocationPolicy: input.ocspResponderRevocation }),\n\t\tresponderRevocationCrls: (input.evidence ?? []).flatMap((entry) =>\n\t\t\tentry.kind !== 'crl'\n\t\t\t\t? []\n\t\t\t\t: entry.deltaCrl === undefined\n\t\t\t\t\t? [entry.crl]\n\t\t\t\t\t: [entry.crl, entry.deltaCrl],\n\t\t),\n\t\t...(input.crlMaxAgeMs === undefined\n\t\t\t? {}\n\t\t\t: { responderRevocationCrlMaxAgeMs: input.crlMaxAgeMs }),\n\t\t...(input.unrecognizedReasonCode === undefined\n\t\t\t? {}\n\t\t\t: { responderRevocationUnrecognizedReasonCode: input.unrecognizedReasonCode }),\n\t\t...(input.unreadSupersededDeltaCrls === undefined\n\t\t\t? {}\n\t\t\t: { responderRevocationUnreadSupersededDeltaCrls: input.unreadSupersededDeltaCrls }),\n\t\t...(input.signatureVerifiers === undefined\n\t\t\t? {}\n\t\t\t: { signatureVerifiers: input.signatureVerifiers }),\n\t};\n}\n\n/**\n * Evaluates a single OCSP evidence entry via {@linkcode validateOcspResponseWith},\n * spending delta CRL checks of a delegated responder from `budget`.\n */\nasync function checkCertificateRevocationWithOcsp(\n\tinput: CheckCertificateRevocationInput,\n\tevidence: RevocationOcspEvidenceInput,\n\tcertificate: ParsedCertificate,\n\tbudget: DeltaCrlBudget,\n): Promise<RevocationEvidenceCheck> {\n\tconst response = await validateOcspResponseWith(ocspEvidenceValidationInput(input, evidence), {\n\t\tverifiers: resolveSignatureVerifiers(input.signatureVerifiers),\n\t\tdeltaBudget: budget,\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\tif (\n\t\t\tinput.unrecognizedReasonCode === 'reject' &&\n\t\t\ttypeof revocationReasonFromCode(matchedResponse.revocationReasonCode) === 'object'\n\t\t) {\n\t\t\treturn {\n\t\t\t\tstatus: 'indeterminate',\n\t\t\t\tdetail: {\n\t\t\t\t\tkind: 'ocsp',\n\t\t\t\t\tcode: 'reason_code_unrecognized',\n\t\t\t\t\tmessage: `OCSP response carries unrecognized reason code ${String(matchedResponse.revocationReasonCode)}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\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\n/** Whether `source` parses and carries noRevAvail in its signed DER. */\nfunction carriesNoRevAvail(source: RevocationCertificateSource): boolean {\n\ttry {\n\t\treturn normalizeCertificate(source).noRevAvail === true;\n\t} catch (error) {\n\t\trethrowIfInvariant(error);\n\t\treturn false;\n\t}\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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C1C,CAAC,IACD,EAAE,sBAAsBA,EAAgB,qBAAqB;EACjE;CACD,IAEGA,EAAgB,eAAe,SAC3B;EACN,QAAQ;EACR,QAAQ;GACP,QAAQ;GACR,MAAM;GACN,SAAS;EACV;CACD,IAEM;EACN,QAAQ;EACR,QAAQ;GACP,MAAM;GACN,MAAM;GACN,SAAS;EACV;CACD;AACD;;AAGA,SAAS,qBAAqBzC,GAA6D;CAC1F,OAAO,0BAA0BA,CAAW,IACzCH,EAA2B,IAAI,WAAWG,EAAY,GAAG,CAAC,IAC1DF,EAA2BE,CAAW;AAC1C;;AAGA,SAAS,kBAAkBsC,GAA8C;CACxE,IAAI;EACH,OAAO,qBAAqBA,CAAM,CAAC,CAAC,eAAe;CACpD,SAAStB,GAAO;EAEf,OADA7B,EAAmB6B,CAAK,GACjB;CACR;AACD;AAEA,SAAS,0BAA0B0B,GAAgE;CAClG,OAAO,OAAOA,KAAU,YAAY,6BAA6BA;AAClE;;AAGA,SAAS,aAAaA,GAAuB;CAC5C,OAAOA,EAAM,YAAY;AAC1B;;AAGA,SAAS,kBACRA,GACmC;CACnC,OAAO;EAAE,IAAI;EAAMA;CAAM;AAC1B"}
|
package/dist/revocation.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create and validate CRLs and OCSP responses, then check certificate status.
|
|
3
|
+
*
|
|
4
|
+
* Use {@linkcode checkCertificateRevocation} with evidence your application
|
|
5
|
+
* supplies. Create evidence with {@linkcode createCertificateRevocationList}
|
|
6
|
+
* or {@linkcode createOcspResponse}. Network retrieval belongs to the caller.
|
|
7
|
+
*
|
|
8
|
+
* @module micro509/revocation
|
|
9
|
+
*/
|
|
10
|
+
import { CertificateRevocationStatus, CheckChainRevocationInput, CheckChainRevocationResult, CheckChainRevocationValue, OcspResponseSource, REVOCATION_INDETERMINATE_REASONS, RevocationExecutionError, RevocationIndeterminateReason, RevocationParseError, RevocationPolicy, RevocationProcessingError, RevocationSource, TrustedOcspResponder, checkChainRevocation } from "./revocation/chain.js";
|
|
11
|
+
import { CertificateRevocationListMaterial, CheckCertificateRevocationAgainstCrlErrorCode, CheckCertificateRevocationAgainstCrlFailure, CheckCertificateRevocationAgainstCrlFailureDetails, CheckCertificateRevocationAgainstCrlGoodValue, CheckCertificateRevocationAgainstCrlInput, CheckCertificateRevocationAgainstCrlResult, CheckCertificateRevocationAgainstCrlRevokedValue, CheckCertificateRevocationAgainstCrlValue, CreateCertificateRevocationListInput, CrlApplicabilityFailureReason, CrlCertificateSource, CrlEncoderErrorCode, CrlSource, ParseCertificateRevocationListErrorCode, ParseCertificateRevocationListFailure, ParseCertificateRevocationListResult, ParsedCertificateRevocationList, ParsedRevocationReason, ParsedRevokedCertificate, RevocationReason, RevokedCertificateInput, SupersededDeltaCrlPolicy, UnrecognizedReasonCodePolicy, UnrecognizedRevocationReason, ValidateCertificateRevocationListFailure, ValidateCertificateRevocationListInput, ValidateCertificateRevocationListResult, VerifyCertificateRevocationListSignatureFailure, VerifyCertificateRevocationListSignatureOptions, VerifyCertificateRevocationListSignatureResult, checkCertificateRevocationAgainstCrl, createCertificateRevocationList, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, revocationReasonFromCode, validateCertificateRevocationList, verifyCertificateRevocationListSignature } from "./revocation/crl.js";
|
|
12
|
+
import { CreateOcspCertStatusInput, CreateOcspRequestInput, CreateOcspRequestItemInput, CreateOcspResponseInput, CreateOcspSingleResponseInput, OcspCertStatus, OcspCertificateSource, OcspEncoderErrorCode, OcspHashAlgorithm, OcspRequestMaterial, OcspRequestSource, OcspResponderRevocationPolicy, OcspResponseMaterial, OcspResponseStatus, ParseOcspRequestErrorCode, ParseOcspRequestFailure, ParseOcspRequestResult, ParseOcspResponseErrorCode, ParseOcspResponseFailure, ParseOcspResponseResult, ParsedOcspCertId, ParsedOcspCertStatus, ParsedOcspRequest, ParsedOcspResponderId, ParsedOcspResponse, ParsedOcspSingleResponse, RevocationSkipReason, ValidateOcspResponseErrorCode, ValidateOcspResponseFailure, ValidateOcspResponseInput, ValidateOcspResponseResult, VerifyOcspResponseSignatureFailure, VerifyOcspResponseSignatureOptions, VerifyOcspResponseSignatureResult, createOcspRequest, createOcspResponse, hasOcspNoCheckExtension, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, validateOcspResponse, verifyOcspResponseSignature } from "./revocation/ocsp.js";
|
|
13
|
+
import { CheckCertificateRevocationErrorCode, CheckCertificateRevocationFailureDetails, CheckCertificateRevocationInput, CheckCertificateRevocationResult, CheckCertificateRevocationValue, ConfiguredOcspResponder, ConfiguredOcspResponderCertificate, OcspResponderCandidate, OcspResponderSource, REVOCATION_INDETERMINATE_REASON_CODES, ResolveOcspResponderCandidatesInput, RevocationCertificateSource, RevocationCheckGoodValue, RevocationCheckIndeterminateValue, RevocationCheckRevokedValue, RevocationCheckSkippedValue, RevocationCrlEvidenceInput, RevocationEvidenceInput, RevocationEvidenceKind, RevocationIndeterminateEvidence, RevocationIndeterminateReasonCode, RevocationOcspEvidenceInput, RevocationStatus, checkCertificateRevocation, getCertificateOcspResponderUris, resolveOcspResponderCandidates } from "./revocation/revocation.js";
|
|
1
14
|
import { IssuingDistributionPoint, IssuingDistributionPointBase, IssuingDistributionPointForAttributeCerts, IssuingDistributionPointForCaCerts, IssuingDistributionPointForUserCerts } from "./x509/extensions.js";
|
|
2
15
|
import { ParsedIssuingDistributionPoint, ParsedIssuingDistributionPointBase, ParsedIssuingDistributionPointScope } from "./x509/parse.js";
|
|
3
|
-
|
|
4
|
-
import { CreateOcspCertStatusInput, CreateOcspRequestInput, CreateOcspRequestItemInput, CreateOcspResponseInput, CreateOcspSingleResponseInput, OcspCertStatus, OcspCertificateSource, OcspEncoderErrorCode, OcspHashAlgorithm, OcspRequestMaterial, OcspRequestSource, OcspResponderRevocationPolicy, OcspResponseMaterial, OcspResponseStatus, ParseOcspRequestErrorCode, ParseOcspRequestFailure, ParseOcspRequestResult, ParseOcspResponseErrorCode, ParseOcspResponseFailure, ParseOcspResponseResult, ParsedOcspCertId, ParsedOcspCertStatus, ParsedOcspRequest, ParsedOcspResponderId, ParsedOcspResponse, ParsedOcspSingleResponse, ValidateOcspResponseErrorCode, ValidateOcspResponseFailure, ValidateOcspResponseInput, ValidateOcspResponseResult, VerifyOcspResponseSignatureFailure, VerifyOcspResponseSignatureResult, createOcspRequest, createOcspResponse, hasOcspNoCheckExtension, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, validateOcspResponse, verifyOcspResponseSignature } from "./revocation/ocsp.js";
|
|
5
|
-
import { CheckCertificateRevocationErrorCode, CheckCertificateRevocationFailureDetails, CheckCertificateRevocationInput, CheckCertificateRevocationResult, CheckCertificateRevocationValue, ConfiguredOcspResponder, ConfiguredOcspResponderCertificate, OcspResponderCandidate, OcspResponderSource, REVOCATION_INDETERMINATE_REASON_CODES, ResolveOcspResponderCandidatesInput, RevocationCertificateSource, RevocationCheckGoodValue, RevocationCheckIndeterminateValue, RevocationCheckRevokedValue, RevocationCrlEvidenceInput, RevocationEvidenceInput, RevocationEvidenceKind, RevocationIndeterminateEvidence, RevocationIndeterminateReasonCode, RevocationOcspEvidenceInput, RevocationStatus, checkCertificateRevocation, getCertificateOcspResponderUris, resolveOcspResponderCandidates } from "./revocation/revocation.js";
|
|
6
|
-
import { CertificateRevocationStatus, CheckChainRevocationInput, CheckChainRevocationResult, CheckChainRevocationValue, OcspResponseSource, REVOCATION_INDETERMINATE_REASONS, RevocationExecutionError, RevocationIndeterminateReason, RevocationParseError, RevocationPolicy, RevocationProcessingError, RevocationSource, TrustedOcspResponder, checkChainRevocation } from "./revocation/chain.js";
|
|
7
|
-
export { type CertificateRevocationListMaterial, type CertificateRevocationStatus, type CheckCertificateRevocationAgainstCrlErrorCode, type CheckCertificateRevocationAgainstCrlFailure, type CheckCertificateRevocationAgainstCrlFailureDetails, type CheckCertificateRevocationAgainstCrlGoodValue, type CheckCertificateRevocationAgainstCrlInput, type CheckCertificateRevocationAgainstCrlResult, type CheckCertificateRevocationAgainstCrlRevokedValue, type CheckCertificateRevocationAgainstCrlValue, type CheckCertificateRevocationErrorCode, type CheckCertificateRevocationFailureDetails, type CheckCertificateRevocationInput, type CheckCertificateRevocationResult, type CheckCertificateRevocationValue, type CheckChainRevocationInput, type CheckChainRevocationResult, type CheckChainRevocationValue, type ConfiguredOcspResponder, type ConfiguredOcspResponderCertificate, type CreateCertificateRevocationListInput, type CreateOcspCertStatusInput, type CreateOcspRequestInput, type CreateOcspRequestItemInput, type CreateOcspResponseInput, type CreateOcspSingleResponseInput, type CrlApplicabilityFailureReason, type CrlCertificateSource, type CrlEncoderErrorCode, type CrlSource, type IssuingDistributionPoint, type IssuingDistributionPointBase, type IssuingDistributionPointForAttributeCerts, type IssuingDistributionPointForCaCerts, type IssuingDistributionPointForUserCerts, type OcspCertStatus, type OcspCertificateSource, type OcspEncoderErrorCode, type OcspHashAlgorithm, type OcspRequestMaterial, type OcspRequestSource, type OcspResponderCandidate, type OcspResponderRevocationPolicy, type OcspResponderSource, type OcspResponseMaterial, type OcspResponseSource, type OcspResponseStatus, type ParseCertificateRevocationListErrorCode, type ParseCertificateRevocationListFailure, type ParseCertificateRevocationListResult, type ParseOcspRequestErrorCode, type ParseOcspRequestFailure, type ParseOcspRequestResult, type ParseOcspResponseErrorCode, type ParseOcspResponseFailure, type ParseOcspResponseResult, type ParsedCertificateRevocationList, type ParsedIssuingDistributionPoint, type ParsedIssuingDistributionPointBase, type ParsedIssuingDistributionPointScope, type ParsedOcspCertId, type ParsedOcspCertStatus, type ParsedOcspRequest, type ParsedOcspResponderId, type ParsedOcspResponse, type ParsedOcspSingleResponse, type ParsedRevocationReason, type ParsedRevokedCertificate, REVOCATION_INDETERMINATE_REASONS, REVOCATION_INDETERMINATE_REASON_CODES, type ResolveOcspResponderCandidatesInput, type RevocationCertificateSource, type RevocationCheckGoodValue, type RevocationCheckIndeterminateValue, type RevocationCheckRevokedValue, type RevocationCrlEvidenceInput, type RevocationEvidenceInput, type RevocationEvidenceKind, type RevocationExecutionError, type RevocationIndeterminateEvidence, type RevocationIndeterminateReason, type RevocationIndeterminateReasonCode, type RevocationOcspEvidenceInput, type RevocationParseError, type RevocationPolicy, type RevocationProcessingError, type RevocationReason, type RevocationSource, type RevocationStatus, type RevokedCertificateInput, type TrustedOcspResponder, type UnrecognizedReasonCodePolicy, type UnrecognizedRevocationReason, type ValidateCertificateRevocationListFailure, type ValidateCertificateRevocationListInput, type ValidateCertificateRevocationListResult, type ValidateOcspResponseErrorCode, type ValidateOcspResponseFailure, type ValidateOcspResponseInput, type ValidateOcspResponseResult, type VerifyCertificateRevocationListSignatureFailure, type VerifyCertificateRevocationListSignatureResult, type VerifyOcspResponseSignatureFailure, type VerifyOcspResponseSignatureResult, checkCertificateRevocation, checkCertificateRevocationAgainstCrl, checkChainRevocation, createCertificateRevocationList, createOcspRequest, createOcspResponse, getCertificateOcspResponderUris, hasOcspNoCheckExtension, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, resolveOcspResponderCandidates, revocationReasonFromCode, validateCertificateRevocationList, validateOcspResponse, verifyCertificateRevocationListSignature, verifyOcspResponseSignature };
|
|
16
|
+
export { type CertificateRevocationListMaterial, type CertificateRevocationStatus, type CheckCertificateRevocationAgainstCrlErrorCode, type CheckCertificateRevocationAgainstCrlFailure, type CheckCertificateRevocationAgainstCrlFailureDetails, type CheckCertificateRevocationAgainstCrlGoodValue, type CheckCertificateRevocationAgainstCrlInput, type CheckCertificateRevocationAgainstCrlResult, type CheckCertificateRevocationAgainstCrlRevokedValue, type CheckCertificateRevocationAgainstCrlValue, type CheckCertificateRevocationErrorCode, type CheckCertificateRevocationFailureDetails, type CheckCertificateRevocationInput, type CheckCertificateRevocationResult, type CheckCertificateRevocationValue, type CheckChainRevocationInput, type CheckChainRevocationResult, type CheckChainRevocationValue, type ConfiguredOcspResponder, type ConfiguredOcspResponderCertificate, type CreateCertificateRevocationListInput, type CreateOcspCertStatusInput, type CreateOcspRequestInput, type CreateOcspRequestItemInput, type CreateOcspResponseInput, type CreateOcspSingleResponseInput, type CrlApplicabilityFailureReason, type CrlCertificateSource, type CrlEncoderErrorCode, type CrlSource, type IssuingDistributionPoint, type IssuingDistributionPointBase, type IssuingDistributionPointForAttributeCerts, type IssuingDistributionPointForCaCerts, type IssuingDistributionPointForUserCerts, type OcspCertStatus, type OcspCertificateSource, type OcspEncoderErrorCode, type OcspHashAlgorithm, type OcspRequestMaterial, type OcspRequestSource, type OcspResponderCandidate, type OcspResponderRevocationPolicy, type OcspResponderSource, type OcspResponseMaterial, type OcspResponseSource, type OcspResponseStatus, type ParseCertificateRevocationListErrorCode, type ParseCertificateRevocationListFailure, type ParseCertificateRevocationListResult, type ParseOcspRequestErrorCode, type ParseOcspRequestFailure, type ParseOcspRequestResult, type ParseOcspResponseErrorCode, type ParseOcspResponseFailure, type ParseOcspResponseResult, type ParsedCertificateRevocationList, type ParsedIssuingDistributionPoint, type ParsedIssuingDistributionPointBase, type ParsedIssuingDistributionPointScope, type ParsedOcspCertId, type ParsedOcspCertStatus, type ParsedOcspRequest, type ParsedOcspResponderId, type ParsedOcspResponse, type ParsedOcspSingleResponse, type ParsedRevocationReason, type ParsedRevokedCertificate, REVOCATION_INDETERMINATE_REASONS, REVOCATION_INDETERMINATE_REASON_CODES, type ResolveOcspResponderCandidatesInput, type RevocationCertificateSource, type RevocationCheckGoodValue, type RevocationCheckIndeterminateValue, type RevocationCheckRevokedValue, type RevocationCheckSkippedValue, type RevocationCrlEvidenceInput, type RevocationEvidenceInput, type RevocationEvidenceKind, type RevocationExecutionError, type RevocationIndeterminateEvidence, type RevocationIndeterminateReason, type RevocationIndeterminateReasonCode, type RevocationOcspEvidenceInput, type RevocationParseError, type RevocationPolicy, type RevocationProcessingError, type RevocationReason, type RevocationSkipReason, type RevocationSource, type RevocationStatus, type RevokedCertificateInput, type SupersededDeltaCrlPolicy, type TrustedOcspResponder, type UnrecognizedReasonCodePolicy, type UnrecognizedRevocationReason, type ValidateCertificateRevocationListFailure, type ValidateCertificateRevocationListInput, type ValidateCertificateRevocationListResult, type ValidateOcspResponseErrorCode, type ValidateOcspResponseFailure, type ValidateOcspResponseInput, type ValidateOcspResponseResult, type VerifyCertificateRevocationListSignatureFailure, type VerifyCertificateRevocationListSignatureOptions, type VerifyCertificateRevocationListSignatureResult, type VerifyOcspResponseSignatureFailure, type VerifyOcspResponseSignatureOptions, type VerifyOcspResponseSignatureResult, checkCertificateRevocation, checkCertificateRevocationAgainstCrl, checkChainRevocation, createCertificateRevocationList, createOcspRequest, createOcspResponse, getCertificateOcspResponderUris, hasOcspNoCheckExtension, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, resolveOcspResponderCandidates, revocationReasonFromCode, validateCertificateRevocationList, validateOcspResponse, verifyCertificateRevocationListSignature, verifyOcspResponseSignature };
|
package/dist/revocation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { REVOCATION_INDETERMINATE_REASONS as e, checkChainRevocation as t } from "./revocation/chain.js";
|
|
2
|
+
import { checkCertificateRevocationAgainstCrl as n, createCertificateRevocationList as r, isCertificateRevoked as i, parseCertificateRevocationListDer as a, parseCertificateRevocationListDerOrThrow as o, parseCertificateRevocationListPem as s, parseCertificateRevocationListPemOrThrow as c, revocationReasonFromCode as l, validateCertificateRevocationList as u, verifyCertificateRevocationListSignature as d } from "./revocation/crl.js";
|
|
3
|
+
import { createOcspRequest as f, createOcspResponse as p, hasOcspNoCheckExtension as m, parseOcspRequestDer as h, parseOcspRequestDerOrThrow as g, parseOcspRequestPem as _, parseOcspRequestPemOrThrow as v, parseOcspResponseDer as y, parseOcspResponseDerOrThrow as b, parseOcspResponsePem as x, parseOcspResponsePemOrThrow as S, validateOcspResponse as C, verifyOcspResponseSignature as w } from "./revocation/ocsp.js";
|
|
4
4
|
import { REVOCATION_INDETERMINATE_REASON_CODES as T, checkCertificateRevocation as E, getCertificateOcspResponderUris as D, resolveOcspResponderCandidates as O } from "./revocation/revocation.js";
|
|
5
|
-
export {
|
|
5
|
+
export { e as REVOCATION_INDETERMINATE_REASONS, T as REVOCATION_INDETERMINATE_REASON_CODES, E as checkCertificateRevocation, n as checkCertificateRevocationAgainstCrl, t as checkChainRevocation, r as createCertificateRevocationList, f as createOcspRequest, p as createOcspResponse, D as getCertificateOcspResponderUris, m as hasOcspNoCheckExtension, i as isCertificateRevoked, a as parseCertificateRevocationListDer, o as parseCertificateRevocationListDerOrThrow, s as parseCertificateRevocationListPem, c as parseCertificateRevocationListPemOrThrow, h as parseOcspRequestDer, g as parseOcspRequestDerOrThrow, _ as parseOcspRequestPem, v as parseOcspRequestPemOrThrow, y as parseOcspResponseDer, b as parseOcspResponseDerOrThrow, x as parseOcspResponsePem, S as parseOcspResponsePemOrThrow, O as resolveOcspResponderCandidates, l as revocationReasonFromCode, u as validateCertificateRevocationList, C as validateOcspResponse, d as verifyCertificateRevocationListSignature, w as verifyOcspResponseSignature };
|
package/dist/ssh/ssh.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorResult, Micro509Error } from "../result/result.js";
|
|
2
1
|
import { EcNamedCurve, RsaHash, RsaSignatureScheme } from "../keys/keys.js";
|
|
2
|
+
import { ErrorResult, Micro509Error } from "../result/result.js";
|
|
3
3
|
import { SshErrorCode } from "./wire.js";
|
|
4
4
|
/** SSH public-key type names (RFC 4253 §6.6, RFC 5656 §6.2, RFC 8709 §4) this module reads and writes. */
|
|
5
5
|
export type SshKeyType = "ssh-rsa" | "ssh-ed25519" | "ecdsa-sha2-nistp256" | "ecdsa-sha2-nistp384" | "ecdsa-sha2-nistp521";
|
|
@@ -196,5 +196,4 @@ export declare function exportOpenSshPrivateKey(privateKey: CryptoKey, options?:
|
|
|
196
196
|
* @throws {ResultError} Carrying an {@linkcode SshExportErrorCode} when a `CryptoKey` cannot be encoded
|
|
197
197
|
*/
|
|
198
198
|
export declare function sshFingerprintSha256(key: CryptoKey | Uint8Array): Promise<string>;
|
|
199
|
-
export type { SshErrorCode };
|
|
200
|
-
//# sourceMappingURL=ssh.d.ts.map
|
|
199
|
+
export type { SshErrorCode };
|