Skip to content

godfreyd/html-csp-hash-generator

Repository files navigation

html-csp-hash-generator

Tool to generate hash for inline scripts and styles for CSP.

Usage

const { readFileSync } = require('fs');
const getCspHashes = require('html-csp-hash-generator');

const html = readFileSync('index.html', { encoding: 'utf8' });
const hashes = getCspHashes(html);

const staticPreset = {
    [csp.SCRIPT]: [cdnHost, ...hashes.scripts],
    [csp.STYLE]: [cdnHost, ...hashes.styles],
};

Coverage

coverage

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published