Skip to main content

Crate aleph_cid

Crate aleph_cid 

Source
Expand description

kubo-compatible IPFS CID computation for Aleph Cloud.

This crate is the single source of truth for client-side content addressing in the Aleph Rust workspace:

  • cid: the string-validated cid::Cid type (CIDv0/CIDv1), with serde support behind the serde feature.
  • verify: streaming CID hashers (verify::Hasher) for IPFS CIDv0/CIDv1 (UnixFS dag-pb, 256 KiB chunks, raw leaves), plus verify::compute_cid for one-shot CIDv0 computation.
  • folder_hash: UnixFS directory DAG construction matching ipfs add -r (plain directories and HAMT shards), with a block sink for streaming the DAG into a CAR file.
  • car: CARv1 framing: header/block writers and a strict root reader.

It deliberately contains no networking, signing, or async code, and no Aleph message types, so that it can be reused as-is from FFI bindings (e.g. a Python wheel). Golden CIDs in tests/folder_hash.rs are regenerated against real kubo via tests/regen-folder-hash-goldens.sh.

Modules§

car
CARv1 framing for IPFS directory uploads.
cid
folder_hash
Local UnixFS DAG construction for folder uploads.
verify

Structs§

FolderEntry
UploadFolderOptions

Enums§

CidVersion
CollectError

Functions§

collect_folder_files
Walks root and returns one entry per regular file, with the relative path normalized to forward-slash separators.