verify

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package verify provides snapshot integrity verification.

Index

Constants

View Source
const (
	ErrorCodeLineageParentMissing = "E_LINEAGE_PARENT_MISSING"
	ErrorCodeLineageParentInvalid = "E_LINEAGE_PARENT_INVALID"
	ErrorCodeLineageCycle         = "E_LINEAGE_CYCLE"
)
View Source
const (
	ErrorCodeSnapshotIDInvalid          = snapshot.PublishStateCodeSnapshotIDInvalid
	ErrorCodeDescriptorMissing          = snapshot.PublishStateCodeDescriptorMissing
	ErrorCodeDescriptorCorrupt          = snapshot.PublishStateCodeDescriptorCorrupt
	ErrorCodeDescriptorChecksumMismatch = snapshot.PublishStateCodeDescriptorChecksumMismatch
	ErrorCodePayloadMissing             = snapshot.PublishStateCodePayloadMissing
	ErrorCodePayloadInvalid             = snapshot.PublishStateCodePayloadInvalid
	ErrorCodePayloadHashMismatch        = snapshot.PublishStateCodePayloadHashMismatch
	ErrorCodeReadyMissing               = snapshot.PublishStateCodeReadyMissing
	ErrorCodeReadyInvalid               = snapshot.PublishStateCodeReadyInvalid
	ErrorCodeReadyDescriptorMissing     = snapshot.PublishStateCodeReadyDescriptorMissing
)

Variables

This section is empty.

Functions

func IsAncestor

func IsAncestor(repoRoot string, ancestorID, descendantID model.SnapshotID) (bool, error)

IsAncestor reports whether ancestorID is reachable from descendantID by following parent links. It returns a LineageIssue when traversal encounters missing parents, invalid parent IDs, or cycles.

Types

type LineageIssue

type LineageIssue struct {
	Code       string
	SnapshotID model.SnapshotID
	ParentID   model.SnapshotID
	Message    string
}

LineageIssue describes a machine-readable lineage problem.

func CheckLineage

func CheckLineage(repoRoot string, snapshotID model.SnapshotID) *LineageIssue

CheckLineage validates parent links reachable from snapshotID.

func (*LineageIssue) Error

func (i *LineageIssue) Error() string

type Result

type Result struct {
	SnapshotID       model.SnapshotID `json:"snapshot_id"`
	ChecksumValid    bool             `json:"checksum_valid"`
	PayloadHashValid bool             `json:"payload_hash_valid"`
	TamperDetected   bool             `json:"tamper_detected"`
	Severity         string           `json:"severity,omitempty"`
	Error            string           `json:"error,omitempty"`
	ErrorCode        string           `json:"error_code,omitempty"`
}

Result contains verification results for a single snapshot.

type Verifier

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

Verifier performs integrity verification on snapshots.

func NewVerifier

func NewVerifier(repoRoot string) *Verifier

NewVerifier creates a new verifier.

func (*Verifier) VerifyAll

func (v *Verifier) VerifyAll(verifyPayloadHash bool) ([]*Result, error)

VerifyAll verifies all snapshots in the repository.

func (*Verifier) VerifySnapshot

func (v *Verifier) VerifySnapshot(snapshotID model.SnapshotID, verifyPayloadHash bool) (*Result, error)

VerifySnapshot verifies a single snapshot's integrity.

Jump to

Keyboard shortcuts

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