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