v0.7.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 8 Imported by: 0



Package verify provides a ReadCloser that verifies content matches the expected hash values.



View Source
const SizeUnknown = -1

SizeUnknown is a sentinel value to indicate that the expected size is not known.


This section is empty.


func Descriptor added in v0.6.0

func Descriptor(d v1.Descriptor) error

Descriptor verifies that the embedded Data field matches the Size and Digest fields of the given v1.Descriptor, returning an error if the Data field is missing or if it contains incorrect data.

func ReadCloser

func ReadCloser(r io.ReadCloser, size int64, h v1.Hash) (io.ReadCloser, error)

ReadCloser wraps the given io.ReadCloser to verify that its contents match the provided v1.Hash before io.EOF is returned.

The reader will only be read up to size bytes, to prevent resource exhaustion. If EOF is returned before size bytes are read, an error is returned.

A size of SizeUnknown (-1) indicates disables size verification when the size is unknown ahead of time.


This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL