providers

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package providers defines the AnchorProvider interface implemented by each external anchor backend (OpenTimestamps, git, Sigstore, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anchor

type Anchor struct {
	ProviderName string
	AnchoredAt   time.Time
	ExternalID   string            // provider's anchor reference (Bitcoin tx hash, git commit sha, Rekor entry ID, etc.)
	ProofData    []byte            // provider-specific; opaque to caller; stored in audit_anchors.proof_data
	Confirmation ConfirmationLevel // pending | confirmed | finalized
}

Anchor records a submitted anchor to an external provider.

type AnchorProvider

type AnchorProvider interface {
	// Name returns the provider's stable identifier (e.g. "opentimestamps", "git").
	Name() string

	// Anchor submits the Merkle root to the external anchor target and returns
	// an Anchor struct. The returned Confirmation is always ConfirmationPending
	// immediately after anchoring.
	Anchor(ctx context.Context, root MerkleRoot) (Anchor, error)

	// Verify polls the external target for the current confirmation state of a
	// previously-created Anchor. Follows the swallow-transient-errors contract
	// described above.
	Verify(ctx context.Context, anchor Anchor) (Verification, error)

	// Cost returns the cost model for the given number of anchors (for budgeting).
	Cost(numAnchors int) Cost
}

AnchorProvider is implemented by each anchor backend.

Verify contract (§ 3.5c): transient errors (network failures, calendar-server unreachable, 5xx responses) MUST be returned as a successful Verification with Swallowed=true and ErrorMessage populated — NOT as an error. This lets the cron-audit-anchor-confirm step continue iterating across pending anchors when one calendar server is temporarily down.

Hard errors (invalid/malformed proof data, 4xx semantic rejections) MUST be returned as errors and abort the parent step.

type ConfirmationLevel

type ConfirmationLevel string

ConfirmationLevel represents the confirmation state of an external anchor.

const (
	ConfirmationPending   ConfirmationLevel = "pending"
	ConfirmationConfirmed ConfirmationLevel = "confirmed"
	ConfirmationFinalized ConfirmationLevel = "finalized"
)

type Cost

type Cost struct {
	PerAnchorUSDCents int64
	Notes             string
}

Cost describes the cost model for anchoring via a provider.

type MerkleRoot

type MerkleRoot struct {
	Hex string // hex-encoded sha256 (64 lowercase chars)
}

MerkleRoot is the Merkle root hash to be anchored externally.

type Verification

type Verification struct {
	Provider     string
	Confirmation ConfirmationLevel
	UpdatedAt    time.Time
	Swallowed    bool   // true if a transient error occurred but state was preserved; no error returned
	ErrorMessage string // populated when Swallowed=true; describes the transient error
}

Verification is the result of polling an existing anchor's confirmation status.

Directories

Path Synopsis
Package git implements the AnchorProvider interface by committing the Merkle root to a git repository and pushing to a configured remote.
Package git implements the AnchorProvider interface by committing the Merkle root to a git repository and pushing to a configured remote.
Package opentimestamps implements the AnchorProvider interface using the OpenTimestamps calendar server HTTP API (https://opentimestamps.org).
Package opentimestamps implements the AnchorProvider interface using the OpenTimestamps calendar server HTTP API (https://opentimestamps.org).
Package sigstore implements the AnchorProvider interface using the Sigstore Rekor transparent log (https://rekor.sigstore.dev).
Package sigstore implements the AnchorProvider interface using the Sigstore Rekor transparent log (https://rekor.sigstore.dev).

Jump to

Keyboard shortcuts

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