...

Package http

import "github.com/google/certificate-transparency-go/internal/witness/client/http"
Overview
Index

Overview ▾

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

Variables

ErrSTHTooOld is returned if the STH passed to Update needs to be updated.

var ErrSTHTooOld = errors.New("STH too old")

type Witness

Witness consists of the witness' URL and signature verifier.

type Witness struct {
    URL *url.URL
}

func (Witness) GetLatestSTH

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

GetLatestSTH returns a recent STH from the witness for the specified log ID.

func (Witness) Update

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

Update attempts to clock the witness forward for the given logID. The latest signed STH will be returned if this succeeds, or if the error is http.ErrSTHTooOld. In all other cases no STH should be expected.