UNPKG

@s4e/jsentinel

Version:

Script integrity and clipboard tamper detection for browsers.

42 lines (41 loc) 1.05 kB
export type ManifestEntry = { src: string; type: "same-origin"; hash?: string; volatile?: boolean; } | { src: string; type: "versioned-cdn"; hash?: string; volatile?: boolean; } | { src: string; type: "dynamic-loader"; host?: string; path?: string; query?: string; volatile?: boolean; } | { inline: string; type: "inline-stable"; hash: string; volatile?: false; } | { inline: string; type: "inline-volatile"; volatile: true; }; export type RuntimeManifest = { sameOriginHashes: Map<string, string>; inlineHashes: Set<string>; versionedPins: Set<string>; dynamicPins: Array<{ host?: string; path?: string; query?: string; }>; filenameIndex: Map<string, string>; }; export declare function coerceEntries(raw: any): ManifestEntry[]; export declare function buildRuntimeManifest(entries: ManifestEntry[]): RuntimeManifest; export declare function urlMatchesPin(src: string, pins: RuntimeManifest["dynamicPins"]): boolean;