csp-hash-generator
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/csp-hash-generator package

0.0.3 • Public • Published

csp-hash-generator

Generate Content Security Policy hash for inline styles and scripts.

Example

const cspHashGen = require('csp-hash-generator');
const cspHashInlineCss = cspHashGen('div{color:red}');
console.log('cspHashInlineCss:', cspHashInlineCss);
// cspHashInlineCss: sha256-f4MzgafDG4q2N8Hfvs1qfK8n78s+CV/8OlLVKgrA4zw=
const cspHashInlineJs = cspHashGen('console.log("test")');
console.log('cspHashInlineJs:', cspHashInlineJs);
// cspHashInlineJs: sha256-uNaYvNbqceDXrfK/UyL1z5bgy31m0ahirB8RD98Fcdk=

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i csp-hash-generator

      Weekly Downloads

      244

      Version

      0.0.3

      License

      MIT

      Unpacked Size

      5.2 kB

      Total Files

      6

      Last publish

      Collaborators

      • miguelacallesmba