rfc9530

package
v0.0.0-...-e1b65c3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

README

Package cloudeng.io/net/http/httpfs/rfc9530

import cloudeng.io/net/http/httpfs/rfc9530

Package rfc9530 provides utilities for working with RFC 9530. It includes functions for parsing the Repr-Digest header as defined in RFC 9530. The Repr-Digest header is used to convey the digest values of representations in a format that allows multiple algorithms to be specified.

Constants

ReprDigestHeader
ReprDigestHeader = "Repr-Digest"

Functions

Func AsHeaderValue
func AsHeaderValue(algo, base64Digest string) string
Func ChooseDigest
func ChooseDigest(digests map[string]string, algos ...string) (string, bool)

ChooseDigest selects a digest from the provided map of digests based on the specified algorithms with an indication of whether the returned digest matches one of the requested algorithms. It checks the provided algorithms in order and returns the first matching algorithm's digest if found. If no algorithms match, it returns the first available digest in the map based on the alphabetical order of the keys and a boolean indicating that no requested algorithm was matched. The returned value is in the format "algo=base64Digest" suitable for the Repr-Digest header.

Func ParseAlgoDigest
func ParseAlgoDigest(value string) (algo, base64Digest string, bytes []byte, err error)
Func ParseReprDigest
func ParseReprDigest(headerValue string) (map[string]string, error)

ParseReprDigest parses the Repr-Digest header value. It returns a map of algorithm-to-digest mappings or an error if the format is invalid. The digest value is the raw base64 string from the header.

Documentation

Overview

Package rfc9530 provides utilities for working with RFC 9530. It includes functions for parsing the Repr-Digest header as defined in RFC 9530. The Repr-Digest header is used to convey the digest values of representations in a format that allows multiple algorithms to be specified.

Index

Constants

View Source
const ReprDigestHeader = "Repr-Digest"

Variables

This section is empty.

Functions

func AsHeaderValue

func AsHeaderValue(algo, base64Digest string) string

func ChooseDigest

func ChooseDigest(digests map[string]string, algos ...string) (string, bool)

ChooseDigest selects a digest from the provided map of digests based on the specified algorithms with an indication of whether the returned digest matches one of the requested algorithms. It checks the provided algorithms in order and returns the first matching algorithm's digest if found. If no algorithms match, it returns the first available digest in the map based on the alphabetical order of the keys and a boolean indicating that no requested algorithm was matched. The returned value is in the format "algo=base64Digest" suitable for the Repr-Digest header.

func ParseAlgoDigest

func ParseAlgoDigest(value string) (algo, base64Digest string, bytes []byte, err error)

func ParseReprDigest

func ParseReprDigest(headerValue string) (map[string]string, error)

ParseReprDigest parses the Repr-Digest header value. It returns a map of algorithm-to-digest mappings or an error if the format is invalid. The digest value is the raw base64 string from the header.

Types

This section is empty.

Jump to

Keyboard shortcuts

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