[]
        
(Showing Draft Content)

ExternalResourcesOptions

Interface: ExternalResourcesOptions

Configuration options for handling external resources required by X.509 validation and related PDF security features.

This API provides hooks to fully control:

  • URL resolution (proxying, rewriting, signing)
  • network transport layer (custom fetch implementation)
  • request/response lifecycle events (logging, caching, debugging)

Properties

afterResponse?

optional afterResponse?: (resource, responseData) => void;

Hook invoked after a successful resource response is received.

Provides access to both the request context and raw response data, useful for caching, inspection, or telemetry.

Parameters

resource

ResourceProperties

responseData

ArrayBuffer

Returns

void


beforeRequest?

optional beforeRequest?: (resource) => void;

Hook invoked immediately before a resource request is executed.

Can be used for:

  • logging
  • request tracing
  • modifying external state (metrics, UI indicators)

Parameters

resource

ResourceProperties

Returns

void


loader?

optional loader?: ResourceLoader;

Custom resource loader implementation.

If not provided, the library will use a default loader based on the current runtime environment (browser or Node.js).


onError?

optional onError?: (resource, err) => void;

Hook invoked when a resource request fails.

Useful for:

  • retry strategies
  • error reporting
  • fallback logic (e.g., alternate OCSP/CRL endpoints)

Parameters

resource

ResourceProperties

err

unknown

Returns

void


resolveUrl?

optional resolveUrl?: (ctx) => string | Promise<string>;

Optional URL resolver that allows rewriting or proxying external resource URLs before they are fetched.

This is especially useful in browser environments where CORS restrictions prevent direct access to certificate-related endpoints.

Parameters

ctx

ResourceProperties

Returns

string | Promise<string>