csp-hashes

Crates.iocsp-hashes
lib.rscsp-hashes
version0.0.4
sourcesrc
created_at2023-06-10 18:01:37.246393
updated_at2023-06-11 12:29:43.267167
descriptionCSP-hashes hashes inline script and style HTML elements for generating a Content Security Policy (CSP)
homepage
repositoryhttps://github.com/DominicBurkart/csp-hashes
max_upload_size
id887008
size18,001
Dominic Burkart (DominicBurkart)

documentation

README

CSP-hashes

CSP-hashes hashes inline script and style HTML elements for generating a Content Security Policy (CSP).

Usage

let hashes = csp_hashes::csp_hashes_from_html_document(
    r#"<!doctype html>
    <html>
        <head>
            <title>woof</title>
            <script>console.log("in head")</script>
        </head>
        <body>
            <script>console.log("in body")</script>
        </body>
    </html>"#
); // {"sha384-8wiu0e3/t6a55K7REGqooaRsccJwaR4CH2UgjuPia5OjmnWavbRbuAk4NL+WJ07o", 
"sha384-DSCsjoY4lRFgW2ltWTCEhMG+WSglTblYcvUcCd/X4ua88hLymWLjdMdNAEXJF1R9"}
Commit count: 11

cargo fmt