[]
function fetchResource(resource, options?): Promise<ArrayBuffer>;
Fetches an external resource using a configurable resolution and loading pipeline.
This function orchestrates the full lifecycle of a resource request:
The initial resource descriptor containing the resource type and original URL (e.g., extracted from a certificate or document).
Optional configuration controlling URL resolution, transport, and lifecycle hooks:
resolveUrl allows rewriting or proxying the resource URLloader overrides the default network implementationbeforeRequest, afterResponse, and onError provide lifecycle hooksPromise<ArrayBuffer>
A promise resolving to the fetched resource as an ArrayBuffer,
or null if the request fails.
resolveUrl is provided, it may return a modified URL (e.g., a proxy endpoint).onError.const data = await fetchResource(
{ type: ResourceType.CRL, url: crlUrl },
{
resolveUrl: (ctx) => `/api/proxy?url=${encodeURIComponent(ctx.url)}`,
onError: (ctx, err) => console.error("Failed:", ctx.url, err)
}
);