verify

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const SizeUnknown = -1

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

Variables

This section is empty.

Functions

func Descriptor

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.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error provides information about the failed hash verification.

func (Error) Error

func (v Error) Error() string

Jump to

Keyboard shortcuts

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