4 releases
0.0.4 | Jun 11, 2023 |
---|---|
0.0.3 | Jun 11, 2023 |
0.0.2 | Jun 10, 2023 |
0.0.1 | Jun 10, 2023 |
#12 in #security-policy
22 downloads per month
8KB
144 lines
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"}
Dependencies
~5–10MB
~114K SLoC