@credo-ts/core 0.7.3 → 0.7.4-alpha-20261028231852
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/build/agent/TrustedIssuerContext.d.mts +11 -1
- package/build/agent/TrustedIssuerContext.d.mts.map +1 -1
- package/build/agent/TrustedIssuerContext.mjs +7 -0
- package/build/agent/TrustedIssuerContext.mjs.map +1 -1
- package/build/agent/TrustedIssuersForVerification.d.mts +11 -1
- package/build/agent/TrustedIssuersForVerification.d.mts.map +1 -1
- package/build/crypto/webcrypto/CredoWalletWebCrypto.d.mts +1 -1
- package/build/index.d.mts +3 -3
- package/build/index.mjs +2 -2
- package/build/modules/dcql/DcqlService.d.mts.map +1 -1
- package/build/modules/dcql/DcqlService.mjs +24 -12
- package/build/modules/dcql/DcqlService.mjs.map +1 -1
- package/build/modules/dids/services/DidResolverService.d.mts +4 -0
- package/build/modules/dids/services/DidResolverService.d.mts.map +1 -1
- package/build/modules/dids/services/DidResolverService.mjs +21 -5
- package/build/modules/dids/services/DidResolverService.mjs.map +1 -1
- package/build/modules/sd-jwt-vc/utils.mjs +4 -4
- package/build/modules/sd-jwt-vc/utils.mjs.map +1 -1
- package/build/modules/vc/W3cCredentialServiceOptions.d.mts +5 -5
- package/build/modules/vc/W3cCredentialServiceOptions.d.mts.map +1 -1
- package/build/modules/vc/W3cV2CredentialService.d.mts +5 -1
- package/build/modules/vc/W3cV2CredentialService.d.mts.map +1 -1
- package/build/modules/vc/W3cV2CredentialService.mjs +72 -26
- package/build/modules/vc/W3cV2CredentialService.mjs.map +1 -1
- package/build/modules/vc/W3cV2CredentialServiceOptions.d.mts +14 -6
- package/build/modules/vc/W3cV2CredentialServiceOptions.d.mts.map +1 -1
- package/build/modules/vc/data-integrity/W3cV2DataIntegrityCredentialService.d.mts +0 -18
- package/build/modules/vc/data-integrity/W3cV2DataIntegrityCredentialService.d.mts.map +1 -1
- package/build/modules/vc/data-integrity/W3cV2DataIntegrityCredentialService.mjs +38 -36
- package/build/modules/vc/data-integrity/W3cV2DataIntegrityCredentialService.mjs.map +1 -1
- package/build/modules/vc/data-integrity/v2-di-utils.mjs +17 -35
- package/build/modules/vc/data-integrity/v2-di-utils.mjs.map +1 -1
- package/build/modules/vc/jwt-vc/W3cJwtCredentialService.d.mts +0 -23
- package/build/modules/vc/jwt-vc/W3cJwtCredentialService.d.mts.map +1 -1
- package/build/modules/vc/jwt-vc/W3cJwtCredentialService.mjs +17 -68
- package/build/modules/vc/jwt-vc/W3cJwtCredentialService.mjs.map +1 -1
- package/build/modules/vc/jwt-vc/W3cV2JwtCredentialService.d.mts.map +1 -1
- package/build/modules/vc/jwt-vc/W3cV2JwtCredentialService.mjs +11 -17
- package/build/modules/vc/jwt-vc/W3cV2JwtCredentialService.mjs.map +1 -1
- package/build/modules/vc/linked-data-proofs/W3cJsonLdCredentialService.d.mts +5 -0
- package/build/modules/vc/linked-data-proofs/W3cJsonLdCredentialService.d.mts.map +1 -1
- package/build/modules/vc/linked-data-proofs/W3cJsonLdCredentialService.mjs +18 -4
- package/build/modules/vc/linked-data-proofs/W3cJsonLdCredentialService.mjs.map +1 -1
- package/build/modules/vc/models/W3cV2VerifyResult.d.mts +6 -0
- package/build/modules/vc/models/W3cV2VerifyResult.d.mts.map +1 -1
- package/build/modules/vc/models/credential/W3cV2EnvelopedVerifiableCredential.d.mts +1 -1
- package/build/modules/vc/models/credential/W3cV2EnvelopedVerifiableCredential.d.mts.map +1 -1
- package/build/modules/vc/models/credential/W3cV2VerifiableCredential.d.mts +1 -1
- package/build/modules/vc/models/credential/W3cV2VerifiableCredential.d.mts.map +1 -1
- package/build/modules/vc/resolveSigner.mjs +74 -0
- package/build/modules/vc/resolveSigner.mjs.map +1 -0
- package/build/modules/vc/sd-jwt-vc/W3cV2SdJwtCredentialService.d.mts.map +1 -1
- package/build/modules/vc/sd-jwt-vc/W3cV2SdJwtCredentialService.mjs +16 -18
- package/build/modules/vc/sd-jwt-vc/W3cV2SdJwtCredentialService.mjs.map +1 -1
- package/build/modules/vc/sd-jwt-vc/disclosureFrame.d.mts +1 -1
- package/build/modules/vc/sd-jwt-vc/disclosureFrame.d.mts.map +1 -1
- package/build/modules/vc/sd-jwt-vc/disclosureFrame.mjs +2 -1
- package/build/modules/vc/sd-jwt-vc/disclosureFrame.mjs.map +1 -1
- package/build/modules/vc/v2-jwt-utils.mjs +54 -55
- package/build/modules/vc/v2-jwt-utils.mjs.map +1 -1
- package/build/modules/x509/X509ModuleConfig.d.mts +5 -13
- package/build/modules/x509/X509ModuleConfig.d.mts.map +1 -1
- package/build/modules/x509/X509ModuleConfig.mjs +2 -1
- package/build/modules/x509/X509ModuleConfig.mjs.map +1 -1
- package/build/modules/x509/X509RevocationService.d.mts.map +1 -1
- package/build/modules/x509/X509RevocationService.mjs +17 -20
- package/build/modules/x509/X509RevocationService.mjs.map +1 -1
- package/build/modules/x509/X509Service.mjs +1 -1
- package/build/modules/x509/X509Service.mjs.map +1 -1
- package/build/modules/x509/X509ServiceOptions.d.mts +4 -6
- package/build/modules/x509/X509ServiceOptions.d.mts.map +1 -1
- package/build/modules/x509/X509ValidationOptions.d.mts +19 -2
- package/build/modules/x509/X509ValidationOptions.d.mts.map +1 -1
- package/build/modules/x509/X509ValidationOptions.mjs +21 -1
- package/build/modules/x509/X509ValidationOptions.mjs.map +1 -1
- package/build/modules/x509/index.d.mts +2 -2
- package/build/modules/x509/index.mjs +2 -2
- package/build/modules/x509/utils/crlFetcher.mjs +1 -11
- package/build/modules/x509/utils/crlFetcher.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { X509CrlExtensionIdentifier, X509ExtensionIdentifier, createAuthorityKey
|
|
|
5
5
|
import { x509SignatureAlgorithmToJwa } from "./utils/signatureAlgorithm.mjs";
|
|
6
6
|
import "./utils/index.mjs";
|
|
7
7
|
import { X509Certificate, X509ExtendedKeyUsage, X509KeyUsage } from "./X509Certificate.mjs";
|
|
8
|
-
import { X509RevocationCheckMode } from "./X509ValidationOptions.mjs";
|
|
8
|
+
import { X509RevocationCheckMode, defaultX509RevocationCheckOptions, withX509RevocationCheckDefaults } from "./X509ValidationOptions.mjs";
|
|
9
9
|
import { X509ModuleConfig } from "./X509ModuleConfig.mjs";
|
|
10
10
|
import { CertificateSigningRequest } from "./CertificateSigningRequest.mjs";
|
|
11
11
|
import { X509CertificateRevocationList, X509CertificateRevocationListEntryReason } from "./X509CertificateRevocationList.mjs";
|
|
@@ -16,4 +16,4 @@ import "./X509ServiceOptions.mjs";
|
|
|
16
16
|
import { extractX509CertificatesFromJwt } from "./extraction.mjs";
|
|
17
17
|
import { X509Api } from "./X509Api.mjs";
|
|
18
18
|
import { X509Module } from "./X509Module.mjs";
|
|
19
|
-
export { ALL_REVOCATION_REASONS_MASK, CertificateSigningRequest, X509Api, X509Certificate, X509CertificateRevocationList, X509CertificateRevocationListEntryReason, X509CrlExtensionIdentifier, X509CrlUnavailableError, X509Error, X509ExtendedKeyUsage, X509ExtensionIdentifier, X509KeyUsage, X509Module, X509ModuleConfig, X509RevocationCheckMode, X509RevocationReason, X509RevocationService, X509Service, X509ValidationError, convertLegacyTrustedCertificates, convertName, createAuthorityKeyIdentifierExtension, createBasicConstraintsExtension, createCrlDistributionPointsExtension, createCrlEntryCertificateIssuerExtension, createCrlNumberExtension, createDeltaCrlIndicatorExtension, createExtendedKeyUsagesExtension, createIssuerAlternativeNameExtension, createIssuingDistributionPointExtension, createKeyUsagesExtension, createSubjectAlternativeNameExtension, createSubjectKeyIdentifierExtension, extractX509CertificatesFromJwt, legacyTrustedCertificatesToTrustedIssuers, x509SignatureAlgorithmToJwa };
|
|
19
|
+
export { ALL_REVOCATION_REASONS_MASK, CertificateSigningRequest, X509Api, X509Certificate, X509CertificateRevocationList, X509CertificateRevocationListEntryReason, X509CrlExtensionIdentifier, X509CrlUnavailableError, X509Error, X509ExtendedKeyUsage, X509ExtensionIdentifier, X509KeyUsage, X509Module, X509ModuleConfig, X509RevocationCheckMode, X509RevocationReason, X509RevocationService, X509Service, X509ValidationError, convertLegacyTrustedCertificates, convertName, createAuthorityKeyIdentifierExtension, createBasicConstraintsExtension, createCrlDistributionPointsExtension, createCrlEntryCertificateIssuerExtension, createCrlNumberExtension, createDeltaCrlIndicatorExtension, createExtendedKeyUsagesExtension, createIssuerAlternativeNameExtension, createIssuingDistributionPointExtension, createKeyUsagesExtension, createSubjectAlternativeNameExtension, createSubjectKeyIdentifierExtension, defaultX509RevocationCheckOptions, extractX509CertificatesFromJwt, legacyTrustedCertificatesToTrustedIssuers, withX509RevocationCheckDefaults, x509SignatureAlgorithmToJwa };
|
|
@@ -4,16 +4,6 @@ import { CacheModuleConfig } from "../../cache/CacheModuleConfig.mjs";
|
|
|
4
4
|
import "../../cache/index.mjs";
|
|
5
5
|
import { isX509CrlSummary } from "./crlSummary.mjs";
|
|
6
6
|
//#region src/modules/x509/utils/crlFetcher.ts
|
|
7
|
-
/**
|
|
8
|
-
* Default maximum CRL size in bytes (10 MB)
|
|
9
|
-
* This is a reasonable limit as most CRLs are much smaller.
|
|
10
|
-
* Very large CRLs (>10 MB) are uncommon and may indicate issues.
|
|
11
|
-
*/
|
|
12
|
-
const DEFAULT_MAX_CRL_SIZE_BYTES = 10485760;
|
|
13
|
-
/**
|
|
14
|
-
* Default CRL fetch timeout in milliseconds (5 seconds)
|
|
15
|
-
*/
|
|
16
|
-
const DEFAULT_TIMEOUT_MILLISECONDS = 5e3;
|
|
17
7
|
function crlSummaryCacheKey(url) {
|
|
18
8
|
return `x509:crl-summary:v1:${url}`;
|
|
19
9
|
}
|
|
@@ -27,7 +17,7 @@ function crlSummaryCacheKey(url) {
|
|
|
27
17
|
* @throws {X509Error} If the fetch fails, returns a non-OK status, or exceeds the size limit
|
|
28
18
|
*/
|
|
29
19
|
async function fetchCrl(options) {
|
|
30
|
-
const { url, timeoutMs
|
|
20
|
+
const { url, timeoutMs, agentContext, maxSizeBytes } = options;
|
|
31
21
|
try {
|
|
32
22
|
const response = await fetchWithTimeout(agentContext.config.agentDependencies.fetch, url, {
|
|
33
23
|
timeoutMs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crlFetcher.mjs","names":[],"sources":["../../../../src/modules/x509/utils/crlFetcher.ts"],"sourcesContent":["import type { AgentContext } from '../../../agent'\nimport { fetchWithTimeout } from '../../../utils/fetch'\nimport { CacheModuleConfig } from '../../cache'\nimport { X509Error } from '../X509Error'\nimport { isX509CrlSummary, type X509CrlSummary } from './crlSummary'\n\nexport interface CrlFetchOptions {\n url: string\n agentContext: AgentContext\n\n /**\n * Maximum CRL fetch time after which request will be aborted\n
|
|
1
|
+
{"version":3,"file":"crlFetcher.mjs","names":[],"sources":["../../../../src/modules/x509/utils/crlFetcher.ts"],"sourcesContent":["import type { AgentContext } from '../../../agent'\nimport { fetchWithTimeout } from '../../../utils/fetch'\nimport { CacheModuleConfig } from '../../cache'\nimport { X509Error } from '../X509Error'\nimport { isX509CrlSummary, type X509CrlSummary } from './crlSummary'\n\nexport interface CrlFetchOptions {\n url: string\n agentContext: AgentContext\n\n /**\n * Maximum CRL fetch time after which request will be aborted\n */\n timeoutMs: number\n\n /**\n * Maximum size in bytes for CRL downloads\n */\n maxSizeBytes: number\n}\n\n// Versioned so future summary shape changes can bump the key. Distinct from the legacy\n// `x509:crl:${url}` raw-bytes key, which this version no longer reads or writes but which older\n// Credo versions sharing the cache may still use.\nfunction crlSummaryCacheKey(url: string): string {\n return `x509:crl-summary:v1:${url}`\n}\n\n/**\n * Fetches a CRL from a given URL with size limit and timeout enforcement.\n *\n * This does NOT cache: caching is the responsibility of the caller, which should only cache a CRL\n * after it has been verified (see {@link setCachedCrlSummary}), so unverified or expired CRLs are\n * never persisted.\n *\n * @throws {X509Error} If the fetch fails, returns a non-OK status, or exceeds the size limit\n */\nexport async function fetchCrl(options: CrlFetchOptions): Promise<Uint8Array> {\n const { url, timeoutMs, agentContext, maxSizeBytes } = options\n\n try {\n const response = await fetchWithTimeout(agentContext.config.agentDependencies.fetch, url, {\n timeoutMs,\n maxResponseBytes: maxSizeBytes,\n })\n\n if (!response.ok) {\n throw new X509Error(`Failed to fetch CRL from ${url}: HTTP ${response.status} ${response.statusText}`)\n }\n\n return new Uint8Array(await response.arrayBuffer())\n } catch (error) {\n if (error instanceof X509Error) {\n throw error\n }\n throw new X509Error(`Failed to fetch CRL from ${url}: ${error instanceof Error ? error.message : String(error)}`, {\n cause: error instanceof Error ? error : undefined,\n })\n }\n}\n\n/**\n * Return the cached verified CRL summary for a URL, or `null` if not cached. Values that do not\n * match the expected summary shape are treated as a cache miss, never as an error.\n *\n * Summaries are cached in the global scope: CRLs are public data, shared across all agent contexts.\n */\nexport async function getCachedCrlSummary(agentContext: AgentContext, url: string): Promise<X509CrlSummary | null> {\n const cache = agentContext.resolve(CacheModuleConfig).cache\n const cached = await cache.get<unknown>(agentContext, crlSummaryCacheKey(url), { scope: 'global' }).catch(() => null)\n return isX509CrlSummary(cached) ? cached : null\n}\n\n/**\n * Cache the summary of a verified CRL for a URL.\n *\n * Callers must only cache summaries derived from CRLs that have passed verification, and should\n * derive `expiresInSeconds` from the CRL's `nextUpdate` so an expired CRL is never served from the\n * cache.\n *\n * Summaries are cached in the global scope: CRLs are public data, shared across all agent contexts.\n */\nexport async function setCachedCrlSummary(\n agentContext: AgentContext,\n url: string,\n summary: X509CrlSummary,\n expiresInSeconds: number\n): Promise<void> {\n if (expiresInSeconds <= 0) return\n const cache = agentContext.resolve(CacheModuleConfig).cache\n await cache\n .set(agentContext, crlSummaryCacheKey(url), summary, expiresInSeconds, { scope: 'global' })\n .catch(() => null)\n}\n"],"mappings":";;;;;;AAwBA,SAAS,mBAAmB,KAAqB;CAC/C,OAAO,uBAAuB;AAChC;;;;;;;;;;AAWA,eAAsB,SAAS,SAA+C;CAC5E,MAAM,EAAE,KAAK,WAAW,cAAc,iBAAiB;CAEvD,IAAI;EACF,MAAM,WAAW,MAAM,iBAAiB,aAAa,OAAO,kBAAkB,OAAO,KAAK;GACxF;GACA,kBAAkB;EACpB,CAAC;EAED,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,UAAU,4BAA4B,IAAI,SAAS,SAAS,OAAO,GAAG,SAAS,YAAY;EAGvG,OAAO,IAAI,WAAW,MAAM,SAAS,YAAY,CAAC;CACpD,SAAS,OAAO;EACd,IAAI,iBAAiB,WACnB,MAAM;EAER,MAAM,IAAI,UAAU,4BAA4B,IAAI,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KAAK,EAChH,OAAO,iBAAiB,QAAQ,QAAQ,KAAA,EAC1C,CAAC;CACH;AACF;;;;;;;AAQA,eAAsB,oBAAoB,cAA4B,KAA6C;CAEjH,MAAM,SAAS,MADD,aAAa,QAAQ,iBAAiB,CAAC,CAAC,MAC3B,IAAa,cAAc,mBAAmB,GAAG,GAAG,EAAE,OAAO,SAAS,CAAC,CAAC,CAAC,YAAY,IAAI;CACpH,OAAO,iBAAiB,MAAM,IAAI,SAAS;AAC7C;;;;;;;;;;AAWA,eAAsB,oBACpB,cACA,KACA,SACA,kBACe;CACf,IAAI,oBAAoB,GAAG;CAE3B,MADc,aAAa,QAAQ,iBAAiB,CAAC,CAAC,MAEnD,IAAI,cAAc,mBAAmB,GAAG,GAAG,SAAS,kBAAkB,EAAE,OAAO,SAAS,CAAC,CAAC,CAC1F,YAAY,IAAI;AACrB"}
|