Class: MerkleTree
Defined in: packages/agentos/src/core/provenance/crypto/MerkleTree.ts:15
Constructors
Constructor
new MerkleTree():
MerkleTree
Returns
MerkleTree
Methods
computeProof()
staticcomputeProof(leaves,leafIndex,algorithm?):MerkleProof
Defined in: packages/agentos/src/core/provenance/crypto/MerkleTree.ts:49
Compute a Merkle inclusion proof for a leaf at a given index. Returns the sibling hashes needed to reconstruct the root.
Parameters
leaves
string[]
leafIndex
number
algorithm?
string = 'sha256'
Returns
MerkleProof
computeRoot()
staticcomputeRoot(leaves,algorithm?):string
Defined in: packages/agentos/src/core/provenance/crypto/MerkleTree.ts:21
Compute the Merkle root of a list of leaf hashes. If the number of leaves is odd, the last leaf is duplicated. Returns empty string for empty input.
Parameters
leaves
string[]
algorithm?
string = 'sha256'
Returns
string
verifyProof()
staticverifyProof(proof,algorithm?):boolean
Defined in: packages/agentos/src/core/provenance/crypto/MerkleTree.ts:94
Verify a Merkle inclusion proof.
Parameters
proof
MerkleProof
algorithm?
string = 'sha256'
Returns
boolean