resolver

package
v0.0.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package resolver implements the MALT explicit-arc resolution loop with prefix consumption.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUndefinedRoot is returned when the root CID is undefined.
	ErrUndefinedRoot = errors.New("root is not defined")

	// ErrResolutionFailed is returned when a resolution step fails.
	ErrResolutionFailed = errors.New("resolution failed")

	// ErrTranscriptNil is returned when a nil transcript is passed for verification.
	ErrTranscriptNil = errors.New("transcript is nil")

	// ErrUnknownEvidenceKind is returned when an evidence kind is not recognized.
	ErrUnknownEvidenceKind = errors.New("unknown evidence kind")

	// ErrStepExecutorNotAvailable is returned when no step executor is available for an evidence kind.
	ErrStepExecutorNotAvailable = errors.New("step executor not available")
)

Sentinel errors for resolver operations.

Functions

func ProofListFromTranscript

func ProofListFromTranscript(root cid.Cid, transcript *Transcript) (*prooflist.ProofList, error)

ProofListFromTranscript converts the current resolver transcript into the verifier-facing ProofList schema. It preserves transcript order and evidence bytes; it does not perform cryptographic verification.

Types

type ResolveResult

type ResolveResult struct {
	// Target is the final resolved CID
	Target cid.Cid

	// RemainingPath is non-empty when resolution stopped before consuming the
	// requested path.
	RemainingPath arcset.Path

	// Transcript contains the evidence for each step
	Transcript *Transcript
}

ResolveResult contains the result of a resolution operation.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(explicit step.Step) *Resolver

NewResolver creates a new MALT-native resolver with an explicit step executor.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, root cid.Cid, path string) (*ResolveResult, error)

Resolve is the compatibility materializing resolver. It first performs generic explicit relation traversal, then follows a terminal @payload binding for map roots. Use ResolveKey when a generic map may omit @payload. It stops with RemainingPath set when it reaches a non-MALT CID, a terminal list root, or a root with no matching explicit arc.

func (*Resolver) ResolveKey

func (r *Resolver) ResolveKey(ctx context.Context, root cid.Cid, path string) (*ResolveResult, error)

ResolveKey resolves a path to its terminal typed key without terminal payload materialization. For list roots, traversal is terminal (no auto @payload).

func (*Resolver) VerifyTranscript

func (r *Resolver) VerifyTranscript(ctx context.Context, root cid.Cid, transcript *Transcript) (bool, error)

VerifyTranscript verifies all steps in a transcript.

type StepEvidence

type StepEvidence struct {
	// Path is the path segment consumed in this step.
	Path arcset.Path

	// Target is the CID resolved to in this step.
	Target cid.Cid

	// Evidence is the cryptographic evidence for this step.
	Evidence evidence.Evidence
}

StepEvidence represents evidence for a single resolution step.

type Transcript

type Transcript struct {
	Steps []StepEvidence
}

Transcript records the evidence for each resolution step.

Directories

Path Synopsis
Package step defines the Step interface for single-step resolution.
Package step defines the Step interface for single-step resolution.
explicit
Package explicit implements the Step interface for MALT explicit arcs.
Package explicit implements the Step interface for MALT explicit arcs.

Jump to

Keyboard shortcuts

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