shared

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0, AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package shared owns wire-adapter helper code that is family-neutral.

It holds only mechanical glue that is reused across wire families without carrying family-specific grammar or semantics.

Index

Constants

This section is empty.

Variables

View Source
var ErrBase64DecodedLimit = errors.New("base64 decoded value exceeds limit")

ErrBase64DecodedLimit reports that decoding would exceed an ingress-owned allocation bound. The check happens against encoded length before DecodeString allocates its destination buffer.

Functions

func DecodeBase64Limited

func DecodeBase64Limited(encoded string, maxDecodedBytes int) ([]byte, error)

DecodeBase64Limited decodes standard padded base64 after proving its decoded allocation cannot exceed maxDecodedBytes.

func DecodeExtensibleRequestObject

func DecodeExtensibleRequestObject(raw []byte, out any, surface string) error

DecodeExtensibleRequestObject applies the public unknown-member contract at a typed protocol request envelope and maps shape failures to wire truth.

func NormalizeImageMediaType

func NormalizeImageMediaType(raw string) (canonical.ImageMediaType, error)

NormalizeImageMediaType maps recognized wire aliases into the closed canonical portable media vocabulary. swobu:lint ignore string-switch because=image media type is a provider-wire boundary value.

func ValidateImageDecodeLimits

func ValidateImageDecodeLimits(items []canonical.CanonicalItem, limits ImageDecodeLimitPolicy) error

ValidateImageDecodeLimits applies request-scoped operational policy after individual inline payloads have already been decoded with a pre-allocation bound. Non-positive aggregate limits are left unspecified for callers that only need the per-image bound.

Types

type ImageDecodeLimitPolicy

type ImageDecodeLimitPolicy struct {
	MaxInlineBytes     int
	MaxImages          int
	MaxTotalImageBytes int
}

ImageDecodeLimitPolicy is ingress-owned allocation policy supplied to image wire decoders. Canonical image construction has no operational byte limit.

Jump to

Keyboard shortcuts

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