tlog

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: ISC Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func MerkleLeafHash

func MerkleLeafHash(leafValue []byte) []byte

MerkleLeafHash returns the merkle leaf hash for the provided leaf value. This is the same merkle leaf hash that is calculated by trillian.

func NewClient

func NewClient(host string) (*client, error)

NewClient returns a new client.

func NewLogLeaf

func NewLogLeaf(leafValue []byte, extraData []byte) *trillian.LogLeaf

NewLogLeaf returns a new trillian LogLeaf.

func NewTestClient

func NewTestClient(t *testing.T) *testClient

NewTestClient returns a new testClient.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Client

type Client interface {
	// Close closes the client connection.
	Close()

	// TreeNew creates a new tree.
	TreeNew() (*trillian.Tree, *trillian.SignedLogRoot, error)

	// TreeFreeze sets the status of a tree to frozen and returns the
	// updated tree.
	TreeFreeze(treeID int64) (*trillian.Tree, error)

	// Tree returns a tree.
	Tree(treeID int64) (*trillian.Tree, error)

	// TreesAll returns all trees in the trillian instance.
	TreesAll() ([]*trillian.Tree, error)

	// LeavesAppend appends leaves onto a tree.
	LeavesAppend(treeID int64, leaves []*trillian.LogLeaf) ([]QueuedLeafProof,
		*types.LogRootV1, error)

	// LeavesAll returns all leaves of a tree.
	LeavesAll(treeID int64) ([]*trillian.LogLeaf, error)

	// SignedLogRoot returns the signed log root for a tree.
	SignedLogRoot(tree *trillian.Tree) (*trillian.SignedLogRoot,
		*types.LogRootV1, error)

	// InclusionProof returns a proof for the inclusion of a merkle
	// leaf hash in a log root.
	InclusionProof(treeID int64, merkleLeafHashe []byte,
		lrv1 *types.LogRootV1) (*trillian.Proof, error)
}

Client provides an interface for interacting with a trillian log (tlog). It creates an abstraction over the trillian provided TrillianLogClient and TrillianAdminClient, providing a simplified client API and allowing for the creation of an implementation that can be used during testing.

type QueuedLeafProof

type QueuedLeafProof struct {
	QueuedLeaf *trillian.QueuedLogLeaf
	Proof      *trillian.Proof
}

QueuedLeafProof contains the results of a leaf append command, i.e. the QueuedLeaf and the inclusion proof for that leaf. If the append leaf command fails the QueuedLeaf will contain an error code from the failure and the Proof will not be present.

Jump to

Keyboard shortcuts

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