api

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package api implements the public HTTP API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProofAnchor

type ProofAnchor struct {
	CalendarURL   string `json:"calendar_url"`
	ReceiptBase64 string `json:"receipt_base64"`
	Upgraded      bool   `json:"upgraded"`
	BlockHeight   *int   `json:"block_height,omitempty"`
	SubmittedAt   string `json:"submitted_at"`
}

type ProofDTO

type ProofDTO struct {
	Version             int           `json:"version"`
	SourceID            string        `json:"source_id"`
	SnapshotID          int64         `json:"snapshot_id"`
	SnapshotCollectedAt time.Time     `json:"snapshot_collected_at"`
	Event               ProofEvent    `json:"event"`
	Merkle              ProofMerkle   `json:"merkle"`
	Anchors             []ProofAnchor `json:"anchors"`
	GeneratedAt         time.Time     `json:"generated_at"`
}

ProofDTO is the exported JSON format the verify CLI consumes.

type ProofEvent

type ProofEvent struct {
	ExternalID    string          `json:"external_id"`
	ContentHash   string          `json:"content_hash"`
	CanonicalJSON json.RawMessage `json:"canonical_json"`
}

type ProofMerkle

type ProofMerkle struct {
	Root     string      `json:"root"`
	Index    int         `json:"index"`
	Siblings []ProofStep `json:"siblings"`
}

type ProofStep

type ProofStep struct {
	Sibling string `json:"sibling"`
	Side    string `json:"side"` // "left" or "right"
}

type Server

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

Server is the HTTP API server.

func New

func New(s *store.Store, logger zerolog.Logger, version, baseURL string) *Server

New creates a Server.

func (*Server) Routes

func (s *Server) Routes() http.Handler

Routes returns an http.Handler with all endpoints wired.

Layout:

  • /api/* — JSON HTTP API (collectors, snapshots, events, proofs, diffs)
  • /api/metrics — Prometheus metrics
  • /api/health — liveness probe
  • /* — Embedded React SPA (built from web/ via `make web`) with client-side routing fallback to index.html

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown is a convenience wrapper for callers building a Server directly.

Jump to

Keyboard shortcuts

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