evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Download remote assets while enforcing Subresource Integrity (SRI), emitting verification telemetry, and caching verified content for reuse.
export interface IntegrityFetchOptions {
/** Absolute or relative URL to fetch. */
url: string;
/** Subresource Integrity string that incoming content must satisfy. */
expectedIntegrity: string;
/** Optional hash algorithms to allow during verification. */
algorithms?: string[];
/** Optional expected size, in bytes, for additional validation. */
size?: number;
/** Filesystem path where verified responses should be cached. */
cachePath: string;
/** Callback invoked for each integrity/size verification event. */
onIntegrity?: (payload: { event: "integrity" | "size"; value: string | number }) => void;
}
export interface IntegrityFetchResult {
/** HTTP status code returned by the request or cache. */
status: number;
/** Response body as a Buffer. */
body: Buffer;
/** True when the result originated from a cached, previously verified response. */
fromCache: boolean;
}
/**
* Fetches a resource while enforcing Subresource Integrity, emitting telemetry, and caching verified responses.
*/
export function fetchWithIntegrity(options: IntegrityFetchOptions): Promise<IntegrityFetchResult>;Fetch-compatible HTTP client with built-in integrity verification, telemetry events, and cache support.