csp_hasher library

Support for doing something awesome.

More dartdocs go here.

Classes

CspHash
A class that represents a hash for a CSP policy
Hash
An interface for cryptographic hash functions.

Enums

HashMode
HashMode is used to determine whether to hash script or style tags in the given HTMl

Constants

sha256 → const Hash
An implementation of the SHA-256 hash function.
sha384 → const Hash
An implementation of the SHA-384 hash function.
sha512 → const Hash
An implementation of the SHA-512 hash function.

Functions

hashScripts({required File htmlFile, Hash hashType = sha256, HashMode hashMode = HashMode.script}) List<CspHash>
Hashes all the scripts in the html file Returns a list of CspHash If there are no scripts, it returns an empty list hashType is the type of hash to use (sha256, sha384, sha512), defaults to sha256 hashMode is the mode to use (script, style), defaults to script htmlFile is the html file to hash Ignores scripts with a nonce attribute