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