verifcid

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPossiblyInsecureHashFunction = fmt.Errorf("potentially insecure hash functions not allowed")
	ErrBelowMinimumHashLength       = fmt.Errorf("hashes must be at least %d bytes long", minimumHashLength)
	ErrAboveMaximumHashLength       = fmt.Errorf("hashes must be at most %d bytes long", maximumHashLength)
)
View Source
var DefaultAllowlist defaultAllowlist

DefaultAllowlist is the default list of hashes allowed in IPFS.

Functions

func ValidateCid

func ValidateCid(allowlist Allowlist, c cid.Cid) error

ValidateCid validates multihash allowance behind given CID.

Types

type Allowlist

type Allowlist interface {
	// IsAllowed checks for multihash allowance by the code.
	IsAllowed(code uint64) bool
}

Allowlist defines an interface containing list of allowed multihashes.

func NewAllowlist

func NewAllowlist(allowset map[uint64]bool) Allowlist

NewAllowlist constructs new Allowlist from the given map set.

func NewOverridingAllowlist

func NewOverridingAllowlist(override Allowlist, allowset map[uint64]bool) Allowlist

NewOverridingAllowlist is like NewAllowlist but it will fallback to an other [AllowList] if keys are missing. If override is nil it will return unsecure for unknown things.

Jump to

Keyboard shortcuts

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