Skip to main content

hashtree_core/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod blob_route;
4pub mod builder;
5mod canonical;
6pub mod codec;
7pub mod crypto;
8pub mod diff;
9mod directory;
10pub mod hash;
11pub mod hashtree;
12#[doc(hidden)]
13pub mod lmdb_runtime;
14pub mod nhash;
15pub mod reader;
16pub mod store;
17pub mod types;
18pub mod visibility;
19
20// Re-exports for convenience
21pub use blob_route::{
22    decode_blob_reply_header, decode_blob_request, encode_blob_reply_header, encode_blob_request,
23    BlobCodecError, BlobReply, BlobReplyHeader, BlobRequest, BlobRoute, BlobRouteContext,
24    StoreBlobRoute, BLOB_DEFAULT_HTL, BLOB_MAX_BYTES, BLOB_MAX_HTL, BLOB_REPLY_HEADER_BYTES,
25    BLOB_REQUEST_BYTES,
26};
27
28// Main API - unified HashTree
29pub use hashtree::{
30    decode_tree_node_by_cid, verify_tree as hashtree_verify_tree, HashTree, HashTreeConfig,
31    HashTreeError,
32};
33
34// Constants
35pub use builder::{BEP52_CHUNK_SIZE, DEFAULT_CHUNK_SIZE, DEFAULT_MAX_LINKS};
36
37// Low-level codec
38pub use codec::{
39    decode_tree_node, encode_and_hash, encode_tree_node, get_node_type, is_directory_node,
40    is_tree_node, try_decode_tree_node, CodecError,
41};
42pub use hash::{sha256, verify};
43
44// Reader types (used by HashTree)
45pub use reader::{
46    verify_tree, verify_tree_integrity, ReaderError, TreeEntry, VerifyIntegrityResult,
47    VerifyResult, WalkEntry,
48};
49
50// Store
51pub use nhash::{
52    decode as nhash_decode_any, is_nhash, nhash_decode, nhash_encode, nhash_encode_full,
53    DecodeResult, NHashData, NHashError,
54};
55pub use store::{BufferedStore, MemoryStore, Store, StoreError};
56pub use types::{
57    from_hex, hash_equals, to_hex, Cid, CidParseError, DirEntry, Hash, Link, LinkType, PutResult,
58    TreeNode,
59};
60
61pub use crypto::{
62    content_hash, could_be_encrypted, decrypt, decrypt_chk, encrypt, encrypt_chk, encrypted_size,
63    encrypted_size_chk, generate_key, key_from_hex, key_to_hex, plaintext_size, CryptoError,
64    EncryptionKey,
65};
66pub use visibility::{xor_keys, TreeVisibility};
67
68// Tree diff operations
69pub use diff::{
70    collect_hashes, collect_hashes_with_progress, tree_diff, tree_diff_streaming,
71    tree_diff_with_old_hashes, DiffStats, TreeDiff,
72};