Documentation ¶
Overview ¶
An implementation of the Subresource Integrity W3C recommendation (http://www.w3.org/TR/SRI/)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadIntegrity = errors.New("bad integrity metadata")
Functions ¶
func Check ¶
Checks whether the contents of the reader matches the given integrity. This is simply a convenience wrapper around NewChecker and its methods.
func Generate ¶
Generate generates a Subresource Integrity metadata from the given algorithm and byte array. Unrecognized or deprecated algorithms yield an empty string.
func MustGenerate ¶
MustGenerate behaves like Generate, except that an unrecognized or deprecated algortihm causes a panic.
Types ¶
type Checker ¶
type Checker []subChecker
func NewChecker ¶
NewChecker creates a Checker from the given integrity specification, following the format of "integrity metadata" as specified by https://www.w3.org/TR/SRI/#the-integrity-attribute
func (Checker) Check ¶
Check returns whether the data written so far (with Write) matches the original integrity metadata.