canonical

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package canonical provides bounded, explicit request fingerprint policies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFingerprint

func BytesFingerprint(version string, input []byte, maxBytes int) (idempotency.Fingerprint, error)

BytesFingerprint hashes bounded bytes whose encoding is already canonical.

func JSON

func JSON(input []byte, limits Limits) ([]byte, error)

JSON validates one JSON value under limits and returns its JCS encoding.

func JSONFingerprint

func JSONFingerprint(version string, input []byte, limits Limits) (idempotency.Fingerprint, error)

JSONFingerprint canonicalizes JSON and hashes it under a policy version.

Types

type Limits

type Limits struct {
	// MaxInputBytes is the largest encoded JSON input accepted.
	MaxInputBytes int
	// MaxOutputBytes is the largest canonical JSON result accepted.
	MaxOutputBytes int
	// MaxDepth is the largest object or array nesting depth accepted.
	MaxDepth int
}

Limits bounds JSON canonicalization before parsing, encoding, and hashing.

Jump to

Keyboard shortcuts

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