html-csp-hash-generator
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i html-csp-hash-generator

Weekly Downloads

23

Version

1.0.1

License

MIT

Unpacked Size

2.62 kB

Total Files

4

Last publish

Collaborators

  • godfreyd