webtessera/merkle/proof

Contains helpers for constructing log Merkle tree proofs.

It ports the Go package transparency-dev/merkle/proof. Its source is src/vendor/merkle/proof/index.ts.

Functions

consistency
consistency returns the information on how to fetch and construct a consistency proof between the two given tree sizes of a log Merkle tree.
inclusion
inclusion returns the information on how to fetch and construct an inclusion proof for the given leaf index in a log Merkle tree of the given size.
rootFromInclusionProof
rootFromInclusionProof calculates the expected root hash for a tree of the given size, provided a leaf index and hash with the corresponding inclusion proof.
verifyConsistency
verifyConsistency checks that the passed-in consistency proof is valid between the passed in tree sizes, with respect to the corresponding root hashes.
verifyInclusion
verifyInclusion verifies the correctness of the inclusion proof for the leaf with the specified hash and index, relatively to the tree of the given size and root hash.

Classes

Nodes
Nodes contains information on how to construct a log Merkle tree proof.
RootMismatchError
RootMismatchError occurs when an inclusion proof fails.

Interfaces

LogHasher
LogHasher provides the hash functions needed to compute dense merkle trees.