chain

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package chain verifies that a bundle's claims sit in an intact append-only chain under the declared profile. Unkeyed profiles recompute every link; keyed profiles verify continuity only, because the link key is the producer's forgery secret and never travels.

Index

Constants

View Source
const (
	// ModeFull means every link was recomputed from claim content.
	ModeFull = "full"
	// ModeStructural means only continuity of prev to link could be checked without the key.
	ModeStructural = "structural"
)

Mode names for a chain verification.

Variables

View Source
var ErrBroken = errors.New("chain broken")

ErrBroken marks a chain whose order, continuity, or links do not verify.

View Source
var ErrClaim = errors.New("chain claim")

ErrClaim marks a claim missing what its chain profile needs.

View Source
var ErrProfile = errors.New("chain profile")

ErrProfile marks a chain declaration the verifier cannot process.

Functions

func LinkV1

func LinkV1(key []byte, installID string, seq int64, prev string, claim any) (string, error)

LinkV1 computes a loomseal-chain-v1 link for a claim value tree that carries no chain member. With a key the link is an HMAC only the key holder can extend; without one it is a plain SHA-256 anyone can recompute.

Types

type Result

type Result struct {
	// Mode is ModeFull or ModeStructural.
	Mode string
	// Claims is how many chained claims were checked.
	Claims int
	// HeadMatched reports whether the declared head coincided with the newest claim and
	// matched it. A head beyond the bundled claims cannot be tied to them and stays false.
	HeadMatched bool
}

Result describes how the chain verified.

func Verify

func Verify(raw []byte, b *bundle.Bundle) (Result, error)

Verify checks the bundle's chain: coordinates on every claim, contiguous ascending sequence, continuity, the genesis rule, head consistency, and link recomputation where the profile permits. The raw document is needed for profiles that digest claim bytes.

Jump to

Keyboard shortcuts

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