feeder

package
v0.0.0-...-c194621 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package feeder provides support for building witness feeder implementations.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSignaturesAdded = errors.New("no additional signatures added")

ErrNoSignaturesAdded is returned when the witness has already signed the presented checkpoint.

Functions

func FeedOnce

func FeedOnce(ctx context.Context, opts FeedOpts) ([]byte, error)

FeedOnce sends the provided checkpoint to the configured witness. This method will block until a witness signature is obtained, or the context becomes done.

func Run

func Run(ctx context.Context, interval time.Duration, opts FeedOpts) error

Run periodically initiates a feed cycle, fetching a checkpoint from the source log and submitting it to the witness. Calling this function will block until the context is done.

Types

type FeedOpts

type FeedOpts struct {
	// LogID is the ID for the log whose checkpoint is being fed.
	//
	// TODO(al/mhutchinson): should this be an impl detail of Witness
	// rather than present here just to be passed back in to Witness calls?
	LogID string

	// FetchCheckpoint should return a recent checkpoint from the source log.
	FetchCheckpoint func(ctx context.Context) ([]byte, error)

	// FetchProof should return a consistency proof from the source log.
	//
	// Note that if the witness knows the log but has no previous checkpoint stored, this
	// function will be called with a default `from` value - this allows compact-range
	// type proofs to be supported.  Implementations for non-compact-range type proofs
	// should return an empty proof and no error.
	FetchProof func(ctx context.Context, from, to log.Checkpoint) ([][]byte, error)

	// LogSigVerifier a verifier for log checkpoint signatures.
	LogSigVerifier note.Verifier
	// LogOrigin is the expected first line of checkpoints from the source log.
	LogOrigin string

	Witness Witness
}

FeedOpts holds parameters when calling the Feed function.

type Witness

type Witness interface {
	// GetLatestCheckpoint returns the latest checkpoint the witness holds for the given logID.
	// Must return os.ErrNotExists if the logID is known, but it has no checkpoint for that log.
	GetLatestCheckpoint(ctx context.Context, logID string) ([]byte, error)
	// Update attempts to clock the witness forward for the given logID.
	// The latest signed checkpoint will be returned if this succeeds, or if the error is
	// http.ErrCheckpointTooOld. In all other cases no checkpoint should be expected.
	Update(ctx context.Context, logID string, oldSize uint64, newCP []byte, proof [][]byte) ([]byte, error)
}

Witness describes the operations the feeder needs to interact with a witness.

Directories

Path Synopsis
Package bastion is an implementation of a witness feeder which talks to a bastion server.
Package bastion is an implementation of a witness feeder which talks to a bastion server.
Package pixelbt is an implementation of a witness feeder for the Pixel BT log.
Package pixelbt is an implementation of a witness feeder for the Pixel BT log.
Package rekor is an implementation of a witness feeder for the Sigstore log: Rekór.
Package rekor is an implementation of a witness feeder for the Sigstore log: Rekór.
Package serverless is an implementation of a witness feeder for serverless logs.
Package serverless is an implementation of a witness feeder for serverless logs.
Package sumdb implements a feeder for the Go SumDB log.
Package sumdb implements a feeder for the Go SumDB log.
Package tiles is an implementation of a witness feeder for C2SP tlog-tiles compatible logs.
Package tiles is an implementation of a witness feeder for C2SP tlog-tiles compatible logs.

Jump to

Keyboard shortcuts

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