Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyHash ¶
VerifyHash verifies that a file's SHA256 hash matches the expected value
Types ¶
type HashVerifyReader ¶
type HashVerifyReader struct {
// contains filtered or unexported fields
}
HashVerifyReader wraps a reader and computes SHA256 while reading
func VerifyHashReader ¶
func VerifyHashReader(r io.Reader, expectedHash string) *HashVerifyReader
VerifyHashReader verifies SHA256 hash while reading, returns a reader that checks on close
func (*HashVerifyReader) Verify ¶
func (h *HashVerifyReader) Verify() error
Verify checks if the hash matches after reading is complete
type Manifest ¶
type Manifest struct {
URL string // Base URL where manifest was fetched from
Files map[string]string // filename -> SHA256 hash
}
Manifest represents a parsed SHA256SUMS manifest
func Fetch ¶
func Fetch(ctx context.Context, httpClient *http.Client, baseURL string, verify bool) (*Manifest, error)
Fetch downloads and parses a SHA256SUMS manifest from the given base URL. If httpClient is nil, a default client with a 30-second timeout is used. If verify is true, it will also verify the GPG signature.
Click to show internal directories.
Click to hide internal directories.