apiv1

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTamperHandler

func NewTamperHandler(bundlePath string, verifyErr error) http.Handler

NewTamperHandler returns a static red warning page for invalid hash chains.

func OpenAPITemplate added in v1.1.1

func OpenAPITemplate() []byte

OpenAPITemplate returns the OpenAPI YAML template bytes used by doc generation.

Types

type APIConfig

type APIConfig struct {
	BundlePath       string
	Bundle           *bundle.Bundle
	VerifyErr        error
	RevealAuthToken  string
	RevealRateLimit  int
	RevealRateWindow time.Duration
	ProfileReport    *ProfileReportSummary // optional; pre-computed at startup via --profile
	ProfilePath      string                // optional; re-used by POST /api/v1/bundle/verify
}

APIConfig configures the local viewer JSON API.

type APIError

type APIError struct {
	Error      string `json:"error"`
	RetryAfter int    `json:"retry_after,omitempty"`
}

APIError is a common error envelope used by JSON API endpoints.

type APIServer

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

APIServer serves dashboard data from a verified (or failed-verification) bundle snapshot.

func NewAPIServer

func NewAPIServer(cfg APIConfig) *APIServer

NewAPIServer constructs a local-only viewer API server.

func (*APIServer) Register

func (s *APIServer) Register(mux *http.ServeMux)

Register mounts dashboard API endpoints on the provided mux.

type BundleEventsResponse

type BundleEventsResponse struct {
	Offset int              `json:"offset"`
	Limit  int              `json:"limit"`
	Total  int              `json:"total"`
	Events []EventRecordDTO `json:"events"`
}

BundleEventsResponse contains a paginated slice of event records.

type BundleGraphResponse

type BundleGraphResponse struct {
	Nodes []GraphNodeDTO `json:"nodes"`
	Edges []GraphEdgeDTO `json:"edges"`
}

BundleGraphResponse returns graph nodes and edges for React Flow rendering.

type BundleMetaResponse

type BundleMetaResponse struct {
	BundlePath      string         `json:"bundle_path"`
	EventCount      int            `json:"event_count"`
	TypeCounts      map[string]int `json:"type_counts"`
	FirstTimestamp  string         `json:"first_timestamp,omitempty"`
	LastTimestamp   string         `json:"last_timestamp,omitempty"`
	GenesisHash     string         `json:"genesis_hash"`
	VerifiedAt      string         `json:"verified_at"`
	Verified        bool           `json:"verified"`
	VerificationMsg string         `json:"verification_message"`
}

BundleMetaResponse contains aggregate bundle metadata used by dashboard summary widgets.

type EventRecordDTO

type EventRecordDTO struct {
	Sequence     int         `json:"seq"`
	Type         string      `json:"type"`
	Hash         string      `json:"hash"`
	PrevHash     string      `json:"prev_hash"`
	Timestamp    string      `json:"timestamp,omitempty"`
	TraceID      string      `json:"trace_id,omitempty"`
	SpanID       string      `json:"span_id,omitempty"`
	ParentSpanID string      `json:"parent_span_id,omitempty"`
	Data         interface{} `json:"data"`
}

EventRecordDTO is a sanitized record representation for paginated event API responses.

type FailureDTO added in v1.7.1

type FailureDTO struct {
	Kind   string `json:"kind"`
	Detail string `json:"detail"`
}

FailureDTO is a sanitized obligation-failure entry for API responses.

type GraphEdgeDTO

type GraphEdgeDTO struct {
	ID     string `json:"id"`
	Source string `json:"source"`
	Target string `json:"target"`
	Label  string `json:"label,omitempty"`
}

GraphEdgeDTO models directed links in trace/span visualizations.

type GraphNodeDTO

type GraphNodeDTO struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Type  string `json:"type"`
}

GraphNodeDTO models a single node in trace/span visualizations.

type PrivacyRevealRequest

type PrivacyRevealRequest struct {
	Sequence  int    `json:"seq"`
	FieldPath string `json:"field_path"`
	Reason    string `json:"reason,omitempty"`
}

PrivacyRevealRequest asks the API to reveal one masked field.

type PrivacyRevealResponse

type PrivacyRevealResponse struct {
	Sequence  int         `json:"seq"`
	FieldPath string      `json:"field_path"`
	Value     interface{} `json:"value"`
}

PrivacyRevealResponse returns a single revealed field value.

type ProfileReportSummary added in v1.7.1

type ProfileReportSummary struct {
	ProfileID          string             `json:"profile_id"`
	Pass               bool               `json:"pass"`
	ChainValid         bool               `json:"chain_valid"`
	AnchorStatus       string             `json:"anchor_status"`
	CASScore           float64            `json:"cas_score,omitempty"`
	CASGrade           string             `json:"cas_grade,omitempty"`
	SubScores          map[string]float64 `json:"sub_scores,omitempty"`
	CriticalFailures   []FailureDTO       `json:"critical_failures"`
	Warnings           []string           `json:"warnings"`
	CorroborationBonus float64            `json:"corroboration_bonus,omitempty"`
	EffectiveScore     float64            `json:"effective_score,omitempty"`
}

ProfileReportSummary contains the profile evaluation and CAS outcome for the viewer. GET /api/v1/bundle/profile returns 204 No Content when no verify report has been computed. POST /api/v1/bundle/verify runs (or re-runs) verify and returns a fresh summary.

type VerificationResponse

type VerificationResponse struct {
	Status      string `json:"status"`
	Message     string `json:"message"`
	BundlePath  string `json:"bundle_path"`
	ChainLength int    `json:"chain_length"`
	HeadHash    string `json:"head_hash,omitempty"`
}

VerificationResponse reports top-level integrity status for a bundle view session.

Jump to

Keyboard shortcuts

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