client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyConsistencyProofV1

func VerifyConsistencyProofV1(proof, first, second *types.StItem) error

func VerifyInclusionProofV1

func VerifyInclusionProofV1(proof, sth *types.StItem, leafHash []byte) error

func VerifySignedTreeHeadV1

func VerifySignedTreeHeadV1(namespace *types.Namespace, sth *types.StItem) error

Types

type Client

type Client struct {
	HttpClient *http.Client
	Signer     crypto.Signer    // client's private identity
	Namespace  *types.Namespace // client's public identity
	Log        *Descriptor      // log's public identity
}

Client is a log client

func NewClientFromFlags

func NewClientFromFlags() (*Client, error)

func (*Client) AddEntry

func (c *Client) AddEntry(ctx context.Context, data *types.ChecksumV1) ([]byte, error)

AddEntry signs and submits a checksum_v1 entry to the log. Outputs the resulting leaf-hash on success.

func (*Client) GetConsistencyProof

func (c *Client) GetConsistencyProof(ctx context.Context, sth1, sth2 *types.StItem) (*types.StItem, error)

GetConsistencyProof fetches and verifies a consistency proof betweeen two STHs. Outputs the resulting proof.

func (*Client) GetEntries

func (c *Client) GetEntries(ctx context.Context, start, end uint64) ([]*types.StItem, error)

GetEntries fetches a range of entries from the log, verifying that they are of type signed_checksum_v1 but nothing more than that. Outputs the resulting range that may be truncated by the log if [start,end] is too large.

func (*Client) GetLatestSth

func (c *Client) GetLatestSth(ctx context.Context) (*types.StItem, error)

GetLatestSth fetches and verifies the signature of the most recent STH. Outputs the resulting STH.

func (*Client) GetProofByHash

func (c *Client) GetProofByHash(ctx context.Context, leafHash []byte, sth *types.StItem) (*types.StItem, error)

GetProofByHash fetches and verifies an inclusion proof for a leaf hash against an STH. Outputs the resulting proof.

type Descriptor

type Descriptor struct {
	Namespace *types.Namespace // log identifier is a namespace
	Url       string           // log url, e.g., http://example.com/st/v1
}

Descriptor is a log descriptor

func NewDescriptorFromFlags

func NewDescriptorFromFlags() (*Descriptor, error)

Directories

Path Synopsis
cmd
add-entry command
get-entries command
get-sth command

Jump to

Keyboard shortcuts

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