Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultMinDigestSize is the default minimum size for hash digests (except for identity hashes) DefaultMinDigestSize = 20 // DefaultMaxDigestSize is the default maximum size for cryptographic hash digests. // This does not apply to identity hashes which are not cryptographic and use DefaultMaxIdentityDigestSize instead. DefaultMaxDigestSize = 128 // DefaultMaxIdentityDigestSize is the default maximum size for identity CID digests. // Identity CIDs (with multihash code 0x00) are not cryptographic hashes - they embed // data directly in the CID. This separate limit prevents abuse while allowing // different size constraints than cryptographic digests. DefaultMaxIdentityDigestSize = 128 )
Variables ¶
View Source
var ( ErrPossiblyInsecureHashFunction = errors.New("potentially insecure hash functions not allowed") ErrDigestTooSmall = errors.New("digest too small") ErrDigestTooLarge = errors.New("digest too large") // Deprecated: Use ErrDigestTooSmall instead ErrBelowMinimumHashLength = ErrDigestTooSmall // Deprecated: Use ErrDigestTooLarge instead ErrAboveMaximumHashLength = ErrDigestTooLarge )
View Source
var DefaultAllowlist defaultAllowlist
DefaultAllowlist is the default list of hashes allowed in IPFS.
Functions ¶
Types ¶
type Allowlist ¶ added in v0.12.0
type Allowlist interface {
// IsAllowed checks for multihash allowance by the code.
IsAllowed(code uint64) bool
// MinDigestSize returns the minimum digest size for a given multihash code.
MinDigestSize(code uint64) int
// MaxDigestSize returns the maximum digest size for a given multihash code.
MaxDigestSize(code uint64) int
}
Allowlist defines an interface containing list of allowed multihashes.
func NewAllowlist ¶ added in v0.12.0
NewAllowlist constructs new Allowlist from the given map set.
func NewOverridingAllowlist ¶ added in v0.12.0
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.
Click to show internal directories.
Click to hide internal directories.