witness

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package witness is designed to make sure the STHs of CT logs are consistent and store/serve/sign them if so. It is expected that a separate feeder component would be responsible for the actual interaction with logs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	DB        *sql.DB
	PrivKey   string
	KnownLogs map[string]ct.SignatureVerifier
}

Opts is the options passed to a witness.

type Witness

type Witness struct {
	Logs map[string]ct.SignatureVerifier
	// contains filtered or unexported fields
}

Witness consists of a database for storing STHs, a signing key, and a list of logs for which it stores and verifies STHs.

func New

func New(wo Opts) (*Witness, error)

New creates a new witness, which initially has no logs to follow.

func (*Witness) GetLogs

func (w *Witness) GetLogs() ([]string, error)

GetLogs returns a list of all logs the witness is aware of.

func (*Witness) GetSTH

func (w *Witness) GetSTH(logID string) ([]byte, error)

GetSTH gets a cosigned STH for a given log, which is consistent with all other STHs for the same log signed by this witness.

func (*Witness) Update

func (w *Witness) Update(ctx context.Context, logID string, nextRaw []byte, pf [][]byte) ([]byte, error)

Update updates the latest STH if nextRaw is consistent with the current latest one for this log. It returns the latest cosigned STH held by the witness, which is a signed version of nextRaw if the update was applied.

Jump to

Keyboard shortcuts

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