http

package
v0.0.0-...-92fee54 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package http is a simple client for interacting with witnesses over HTTP.

Index

Constants

This section is empty.

Variables

View Source
var ErrCheckpointTooOld = errors.New("checkpoint too old")

ErrCheckpointTooOld is returned if the checkpoint passed to Update needs to be updated.

Functions

This section is empty.

Types

type Witness

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

Witness is a simple client for interacting with witnesses over HTTP.

func NewWitness

func NewWitness(url *url.URL, c *http.Client) Witness

NewWitness returns a Witness accessed over http at the given URL using the client provided.

func (Witness) GetLatestCheckpoint

func (w Witness) GetLatestCheckpoint(ctx context.Context, logID string) ([]byte, error)

GetLatestCheckpoint returns a recent checkpoint from the witness for the specified log ID.

func (Witness) Update

func (w Witness) Update(ctx context.Context, logID string, cp []byte, proof [][]byte) ([]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.

Jump to

Keyboard shortcuts

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