tracker

package
Version: v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package tracker tracks log roots and verifies consistency proofs between them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogRootVerifier

type LogRootVerifier interface {
	// VerifyRoot checks the signature of newRoot and the consistency proof if trusted.TreeSize != 0.
	VerifyRoot(trusted *types.LogRootV1, newRoot *tpb.SignedLogRoot, proof [][]byte) (*types.LogRootV1, error)
}

LogRootVerifier verifies a Trillian Log Root.

type LogTracker

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

LogTracker tracks a series of consistent log roots.

func NewFromSaved

func NewFromSaved(lv LogRootVerifier, lr types.LogRootV1) *LogTracker

NewFromSaved creates a log tracker from a previously saved trusted root.

func NewSynchronous

func NewSynchronous(lv LogRootVerifier) *LogTracker

NewSynchronous creates a log tracker from no trusted root.

func (*LogTracker) LastVerifiedLogRoot

func (l *LogTracker) LastVerifiedLogRoot() *pb.LogRootRequest

LastVerifiedLogRoot retrieves the tree size of the latest log root.

func (*LogTracker) SetUpdatePredicate

func (l *LogTracker) SetUpdatePredicate(f UpdateTrustedPredicate)

SetUpdatePredicate allows relying parties to have finer grained control over when the trusted root is updated. It is legal to set the predicate at any time, but it makes the most sense to do so before any other calls.

func (*LogTracker) VerifyLogRoot

func (l *LogTracker) VerifyLogRoot(state *pb.LogRootRequest, root *pb.LogRoot) (*types.LogRootV1, error)

VerifyLogRoot verifies root and updates the trusted root if it is newer. state must be equal to the most recent value from LastVerifiedLogRoot(). If two clients race to VerifyLogRoot at the same time, if one of them updates the root, the other will fail.

type UpdateTrustedPredicate

type UpdateTrustedPredicate func(cntRoot, newRoot types.LogRootV1) bool

UpdateTrustedPredicate returns a bool indicating whether the local reference for the latest SignedLogRoot should be updated.

Source Files

Jump to

Keyboard shortcuts

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