witness

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package witness contains the implementation for sending out a checkpoint to witnesses and retrieving sufficient signatures to satisfy a policy.

Index

Constants

This section is empty.

Variables

View Source
var ErrPolicyNotSatisfied = errors.New("witness policy was not satisfied")

Functions

This section is empty.

Types

type WitnessGateway

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

WitnessGateway allows a log implementation to send out a checkpoint to witnesses.

func NewWitnessGateway

func NewWitnessGateway(group WitnessGroup, client *http.Client, oldSize uint64, fetchTiles client.TileFetcherFunc) WitnessGateway

NewWitnessGateway returns a WitnessGateway that will send out new checkpoints to witnesses in the group, and will ensure that the policy is satisfied before returning. All outbound requests will be done using the given client. The tile fetcher is used for constructing consistency proofs for the witnesses.

func (*WitnessGateway) Witness

func (wg *WitnessGateway) Witness(ctx context.Context, cp []byte) ([]byte, error)

Witness sends out a new checkpoint (which must be signed by the log), to all witnesses and returns the checkpoint as soon as the policy the WitnessGateway was constructed with is Satisfied.

type WitnessGroup

type WitnessGroup interface {
	// Satisfied returns true if the checkpoint provided is signed by this witness.
	// This will return false if there is no signature, and also if the
	// checkpoint cannot be read as a valid note. It is up to the caller to ensure
	// that the input value represents a valid note.
	Satisfied(cp []byte) bool

	// Endpoints returns the details required for updating a witness and checking the
	// response. The returned result is a map from the URL that should be used to update
	// the witness with a new checkpoint, to the value which is the verifier to check
	// the response is well formed.
	Endpoints() map[string]note.Verifier
}

WitnessGroup defines a group of witnesses, and a threshold of signatures that must be met for this group to be satisfied. Witnesses within a group should be fungible, e.g. all of the Armored Witness devices form a logical group, and N should be picked to represent a threshold of the quorum. For some users this will be a simple majority, but other strategies are available. N must be <= len(WitnessKeys).

Jump to

Keyboard shortcuts

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