evidence

package
v1.0.24 Latest Latest
Warning

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

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

Documentation

Overview

Package evidence defines the content-addressed evidence-bundle manifest. Manifest data is an observation only: parsing or verifying it never grants approval, publication authority, or any other capability.

Index

Constants

View Source
const (
	SchemaName    = "aurum.evidence-bundle"
	SchemaVersion = 1

	MaxManifestBytes = 4 * 1024 * 1024
	MaxArtifacts     = 64
	MaxArtifactBytes = 4 * 1024 * 1024
	MaxPathBytes     = 512
)
View Source
const (
	CodeMalformed          = "malformed"
	CodeUnknownField       = "unknown_field"
	CodeDuplicateField     = "duplicate_field"
	CodeMissingField       = "missing_field"
	CodeInvalidField       = "invalid_field"
	CodeUnsafePath         = "unsafe_path"
	CodeLimitExceeded      = "limit_exceeded"
	CodeNonCanonical       = "non_canonical"
	CodeDigestMismatch     = "digest_mismatch"
	CodeCandidateMismatch  = "candidate_mismatch"
	CodeArtifactMissing    = "artifact_missing"
	CodeArtifactUnexpected = "artifact_unexpected"
	CodeAuthorityDenied    = "authority_denied"
	CodeSchemaContract     = "schema_contract"
)

Variables

This section is empty.

Functions

func Marshal

func Marshal(manifest Manifest) ([]byte, error)

Marshal returns the one accepted canonical JSON representation.

func ValidateSchema

func ValidateSchema(data []byte) error

ValidateSchema checks that the repository JSON Schema expresses the same closed fields, limits, enums, and canonicalization rules as this parser.

func Verify

func Verify(manifest Manifest, expected CandidateIdentityV1, outputs []ArtifactInput) error

Verify recomputes candidate, manifest, and output bindings without I/O.

func VerifyBytes

func VerifyBytes(data []byte, expected CandidateIdentityV1, outputs []ArtifactInput) error

VerifyBytes combines hostile parsing and verification.

Types

type Artifact

type Artifact struct {
	Path      string `json:"path"`
	Kind      string `json:"kind"`
	MediaType string `json:"media_type"`
	Authority string `json:"authority"`
	Bytes     int64  `json:"bytes"`
	SHA256    string `json:"sha256"`
}

Artifact is a digest record for one sanitized output. Authority is always "none"; an evidence record cannot authorize its own acceptance.

type ArtifactInput

type ArtifactInput struct {
	Path      string
	Kind      string
	MediaType string
	Data      []byte
}

ArtifactInput carries output bytes only while sealing or verifying. The bytes are never persisted in a Manifest by this package.

type CandidateIdentityV1

type CandidateIdentityV1 struct {
	RepositoryIdentity                 string `json:"repository_identity"`
	BaseTreeDigest                     string `json:"base_tree_digest"`
	HeadTreeDigest                     string `json:"head_tree_digest"`
	ChangeDigest                       string `json:"change_digest"`
	TaskSpecDigest                     string `json:"task_spec_digest"`
	ConfigurationDigest                string `json:"configuration_digest"`
	PolicyDigest                       string `json:"policy_digest"`
	PromptAndRubricDigest              string `json:"prompt_and_rubric_digest"`
	SkillSetDigest                     string `json:"skill_set_digest"`
	ProviderModelBackendIdentityDigest string `json:"provider_model_backend_identity_digest"`
	ToolchainAndToolSetDigest          string `json:"toolchain_and_tool_set_digest"`
	DependencyLockDigest               string `json:"dependency_lock_digest"`
	ContainerImageSetDigest            string `json:"container_image_set_digest"`
	TestManifestDigest                 string `json:"test_manifest_digest"`
	RoleContextManifestDigest          string `json:"role_context_manifest_digest"`
}

CandidateIdentityV1 is the complete canonical tuple. Every member is a digest; consumers may not define a shorter local identity.

type Error

type Error struct {
	Field string
	Code  string
}

Error is a bounded, typed rejection. It intentionally never includes an untrusted value from the manifest or an evidence output.

func (*Error) Error

func (e *Error) Error() string

type Manifest

type Manifest struct {
	Schema            string              `json:"schema"`
	Version           int                 `json:"version"`
	CandidateIdentity CandidateIdentityV1 `json:"candidate_identity"`
	Artifacts         []Artifact          `json:"artifacts"`
	ManifestDigest    string              `json:"manifest_digest"`
}

Manifest is self-addressed through ManifestDigest. That digest is computed over the canonical form with manifest_digest omitted.

func Parse

func Parse(data []byte) (Manifest, error)

Parse rejects malformed, duplicate, unknown, non-canonical, or unsealed input before returning a manifest.

func Seal

func Seal(candidate CandidateIdentityV1, inputs []ArtifactInput) (Manifest, error)

Seal constructs a deterministic manifest from an externally established candidate identity and sanitized output bytes.

Jump to

Keyboard shortcuts

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