@guildofweavers/merkle
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -9,2 +9,3 @@ "use strict"; | ||
exports.getHashDigestSize = hash_1.getHashDigestSize; | ||
exports.getHashFunction = hash_1.getHashFunction; | ||
//# sourceMappingURL=index.js.map |
declare module '@guildofweavers/merkle' { | ||
/** | ||
* Algorithms that can be used to hash internal tree nodes | ||
*/ | ||
/** Algorithms that can be used to hash internal tree nodes */ | ||
export type HashAlgorithm = 'sha256' | 'blake2s256'; | ||
/** | ||
* Returns digest size (in bytes) for the specified hash algorithm | ||
* @param hashAlgorithm | ||
*/ | ||
/** Returns digest size (in bytes) for the specified hash algorithm */ | ||
export function getHashDigestSize(hashAlgorithm: HashAlgorithm): number; | ||
export interface BatchMerkleProof { | ||
/** leaf nodes located at the indexes covered by the proof */ | ||
values: Buffer[]; | ||
/** Returns a hash function for the specified algorithm */ | ||
export function getHashFunction(hashAlgorithm: HashAlgorithm): HashFunction; | ||
/** Internal nodes that form the actual proof */ | ||
nodes: Buffer[][]; | ||
/** Depth of the source Merkle tree */ | ||
depth: number; | ||
} | ||
export class MerkleTree { | ||
@@ -47,12 +34,6 @@ | ||
/** | ||
* Returns a Merkle proof for a single leaf | ||
* @param index Index at which the leaf is located | ||
*/ | ||
/** Returns a Merkle proof for a single leaf at the specified index */ | ||
prove(index: number): Buffer[]; | ||
/** | ||
* Returns a compressed Merkle proof for leaves at the specified indexes | ||
* @param indexes List of indexes of leaves to prove | ||
*/ | ||
/** Returns a compressed Merkle proof for leaves at the specified indexes */ | ||
proveBatch(indexes: number[]): BatchMerkleProof; | ||
@@ -79,2 +60,13 @@ | ||
export interface BatchMerkleProof { | ||
/** leaf nodes located at the indexes covered by the proof */ | ||
values: Buffer[]; | ||
/** Internal nodes that form the actual proof */ | ||
nodes: Buffer[][]; | ||
/** Depth of the source Merkle tree */ | ||
depth: number; | ||
} | ||
export interface HashFunction { | ||
@@ -81,0 +73,0 @@ (v1: Buffer, v2?: Buffer): Buffer; |
{ | ||
"name": "@guildofweavers/merkle", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Merkle tree and other data structures", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20503
398