Centralize digest validation in public bundle API

This commit is contained in:
2026-06-02 18:52:33 +00:00
parent d5e3aa7a44
commit eba4d6dd56
4 changed files with 64 additions and 15 deletions

View File

@@ -11,7 +11,8 @@ import (
var digestPattern = regexp.MustCompile(`^sha256:[0-9a-f]{64}$`)
func validateDigest(value string) error {
// ValidateDigest reports whether value uses the lowercase sha256:<64 hex> form.
func ValidateDigest(value string) error {
if !digestPattern.MatchString(value) {
return fmt.Errorf("must be lowercase sha256:<64 hex>")
}