artifact

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package artifact implements the frozen malt.artifact/v0alpha2 compatibility profile published by MALT v0.0.4. New integrations use package protocol's operation-specific resolve and read contracts.

Index

Constants

View Source
const Profile = "malt.artifact/v0alpha2"

Profile identifies the frozen artifact contract introduced by MALT v0.0.4. Its operation set is resolve and prove; incompatible extensions require a different serialized profile.

Variables

This section is empty.

Functions

func Schema

func Schema(name string) ([]byte, error)

Schema returns a checked-in JSON Schema by stable filename.

func SchemaNames

func SchemaNames() []string

SchemaNames lists the schemas published by this artifact profile.

func Verify

func Verify(ctx context.Context, req VerifyRequest, verifier malt.ProofVerifier) error

Verify validates the request/artifact envelope and all cryptographic evidence. Resolution is existential: it proves the returned ordered arc chain, not that the execution engine selected a unique or longest chain.

Types

type Artifact

type Artifact struct {
	Profile       string              `json:"profile"`
	Operation     Operation           `json:"operation"`
	Root          string              `json:"root"`
	Query         Query               `json:"query"`
	Target        string              `json:"target"`
	RangeSegments []string            `json:"range_segments,omitempty"`
	ProofList     prooflist.ProofList `json:"prooflist"`
}

Artifact binds one request, target, and ProofList under an explicit profile. RangeSegments is populated only for measured-list range proofs.

func NewProveArtifact

func NewProveArtifact(req ProveRequest, result malt.ReadResult) (Artifact, error)

func NewResolveArtifact

func NewResolveArtifact(req ResolveRequest, target cid.Cid, pl prooflist.ProofList) (Artifact, error)

func (Artifact) Validate

func (a Artifact) Validate() error

type Operation

type Operation string
const (
	OperationResolve Operation = "resolve"
	OperationProve   Operation = "prove"
)

type ProveRequest

type ProveRequest struct {
	Profile string `json:"profile"`
	Root    string `json:"root"`
	Query   Query  `json:"query"`
}

ProveRequest asks for one primitive typed map/list proof.

func (ProveRequest) Validate

func (r ProveRequest) Validate() error

type Query

type Query struct {
	Kind     QueryKind `json:"kind"`
	Segments []string  `json:"segments,omitempty"`
	Index    *uint64   `json:"index,omitempty"`
	Start    *uint64   `json:"start,omitempty"`
	End      *uint64   `json:"end,omitempty"`
}

Query is the stable artifact projection of a MALT path or primitive typed query. Exactly the fields selected by Kind are meaningful.

func QueryFromCore

func QueryFromCore(query malt.Query) (Query, error)

func (Query) Core

func (q Query) Core() (malt.Query, error)

func (Query) Equal added in v0.0.5

func (q Query) Equal(other Query) bool

Equal reports whether two canonical artifact queries select the same operation input. Callers should validate both queries before relying on the result so irrelevant fields cannot be smuggled through an envelope.

func (Query) MarshalJSON added in v0.0.5

func (q Query) MarshalJSON() ([]byte, error)

MarshalJSON emits exactly the fields allowed by the selected query kind. Path queries always carry segments, including the zero-segment identity query required by the published schema.

func (*Query) UnmarshalJSON added in v0.0.5

func (q *Query) UnmarshalJSON(data []byte) error

UnmarshalJSON enforces the same conditional field set as the published JSON Schema instead of silently ignoring unrelated or unknown query fields.

func (Query) Validate

func (q Query) Validate(allowPath bool) error

type QueryKind

type QueryKind string
const (
	QueryPath      QueryKind = "path"
	QueryMapKey    QueryKind = "map_key"
	QueryListIndex QueryKind = "list_index"
	QueryListRange QueryKind = "list_range"
)

type ResolveRequest

type ResolveRequest struct {
	Profile  string   `json:"profile"`
	Root     string   `json:"root"`
	Segments []string `json:"segments"`
}

ResolveRequest asks an execution engine for one authenticated derivation of a caller-supplied segment path. Candidate selection is not part of the proof contract; the reference engine currently prefers the longest prefix.

func (ResolveRequest) Validate

func (r ResolveRequest) Validate() error

type VerifyRequest

type VerifyRequest struct {
	Profile  string   `json:"profile"`
	Artifact Artifact `json:"artifact"`
}

VerifyRequest asks a verifier to validate all artifact bindings and proof evidence without trusting the resolver or gateway that produced it.

func (VerifyRequest) Validate

func (r VerifyRequest) Validate() error

type VerifyResult

type VerifyResult struct {
	Profile string `json:"profile"`
	Valid   bool   `json:"valid"`
}

Jump to

Keyboard shortcuts

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