@nithin93/sri-js
Version:
A lightweight library to enforce Subresource Integrity (SRI) for dynamically loaded scripts in the browser and to update script tags in HTML using Cheerio.
22 lines (21 loc) • 466 B
TypeScript
export interface SRIConfig {
htmlPath?: string;
algorithm?: "sha256" | "sha384" | "sha512";
basePath?: string;
}
export interface SRIMap {
[key: string]: string;
}
export interface SRIOptions {
algorithm: "sha256" | "sha384" | "sha512";
basePath: string;
errorHandler?: string;
}
export interface SRIResult {
integrity: string;
path: string;
}
export interface HTMLUpdateResult {
updatedFiles: string[];
sriMap: SRIMap;
}