vite-plugin-csp-guard
Version:
A Vite plugin that lets SPA applications generate a Content Security Policy (CSP).
30 lines • 1.22 kB
TypeScript
import { HashAlgorithms, HashCollection, HashCollectionKey, HashDataCollection, OverrideCheckerProps, ShouldSkip, WarnMissingPolicyProps } from "../types";
import { CSPPolicy } from "csp-toolkit";
/**
* Used for hash data storage
* @returns A new HashDataCollection where we can store our data
*/
export declare const createNewCollection: () => HashCollection;
/**
* Take a string and generate a hash
* @param str - The string to hash
* @param algorithm - The algorithm to use
* @returns
*/
export declare const generateHash: (str: string, algorithm: HashAlgorithms) => string;
type AddHashProps = {
hash: string;
key: HashCollectionKey;
data: HashDataCollection;
collection: HashCollection;
};
/**
* Adds the hash to the collection provided
* @param
*/
export declare const addHash: ({ hash, key, data, collection }: AddHashProps) => void;
export declare const overrideChecker: ({ userPolicy, override, }: OverrideCheckerProps) => boolean;
export declare const warnMissingPolicy: ({ currentPolicy, source, sourceType, context, }: WarnMissingPolicyProps) => void;
export declare const calculateSkip: (policy: CSPPolicy | undefined) => ShouldSkip;
export {};
//# sourceMappingURL=core.d.ts.map