webtessera/client

Fetchers, proof building, entry streaming, log state tracking.

It ports the Go package tessera/client. Its source is src/client/index.ts.

Functions

entries
entries consumes an async generator of Bundle structs and transforms it using the provided unbundle function, and returns an async generator over the transformed data.
entryBundles
entryBundles produces an async generator which returns a stream of Bundle structs which cover the requested range of entries in their natural order in the log.
fetchCheckpoint
fetchCheckpoint retrieves and opens a checkpoint from the log.
fetchLeafHashes
fetchLeafHashes fetches N consecutive leaf hashes starting with the leaf at index first.
fetchRangeNodes
fetchRangeNodes returns the set of nodes representing the compact range covering a log of size s.
getEntryBundle
getEntryBundle fetches the entry bundle at the given tile index.
newHTTPFetcher
newHTTPFetcher creates a new HTTPFetcher for the log rooted at the given URL, using the provided fetch function. rootURL should end in a trailing slash. c may be undefined, in which case the platform's global fetch will be used.
newLogStateTracker
newLogStateTracker creates a newly initialised tracker.
newProofBuilder
newProofBuilder creates a new ProofBuilder object for a given tree size.
unilateralConsensus
unilateralConsensus blindly trusts the source log, returning the checkpoint it provided.

Classes

ErrInconsistency
ErrInconsistency should be thrown when there has been an error proving consistency between log states.
HTTPFetcher
HTTPFetcher knows how to fetch log artifacts from a log being served via HTTP.
LogStateTracker
LogStateTracker represents a client-side view of a target log's state.
ProofBuilder
ProofBuilder knows how to build inclusion and consistency proofs from tiles.

Interfaces

Bundle
Bundle represents an entry bundle in a log, along with some metadata about which parts of the bundle are relevent.
Entry
Entry represents a single leaf in a log.
FetchedCheckpoint
FetchedCheckpoint is what fetchCheckpoint and ConsensusCheckpointFunc return.
HTTPFetcherOptions
HTTPFetcherOptions configures the requests an HTTPFetcher makes.
UpdateResult
UpdateResult is what LogStateTracker.update returns on success.

Types

CheckpointFetcherFunc
CheckpointFetcherFunc is the signature of a function which can retrieve the latest checkpoint from a log's data storage.
ConsensusCheckpointFunc
ConsensusCheckpointFunc is a function which returns the largest checkpoint known which is signed by logSigV and satisfies some consensus algorithm.
EntryBundleFetcherFunc
EntryBundleFetcherFunc is the signature of a function which can fetch the raw data for a given entry bundle.
FetchFn
FetchFn is the shape of the global fetch function.
TileFetcherFunc
TileFetcherFunc is the signature of a function which can fetch the raw data for a given tile.
TreeSizeFunc
TreeSizeFunc is a function which knows how to return the current tree size of a log.