cdx-core 0.7.1

Core library for reading, writing, and validating Codex Document Format (.cdx) files
Documentation
//! Provenance and integrity verification features.
//!
//! This module provides:
//!
//! - **Merkle Trees**: Content-addressable tree structures for efficient verification
//! - **Block Index**: Persistent block hash index for Merkle proof generation
//! - **Block Proofs**: Selective disclosure proofs for individual content blocks
//! - **Lineage Verification**: Chain verification for document version history
//! - **Timestamp Anchoring**: Multiple timestamp methods:
//!   - RFC 3161 Time Stamp Protocol (feature: `timestamps-rfc3161`)
//!   - OpenTimestamps/Bitcoin anchoring (feature: `timestamps-ots`)
//!   - Ethereum blockchain anchoring (types and offline verification)
//! - **Provenance Records**: Complete provenance tracking for documents
//!
//! # Block Index Example
//!
//! ```rust,ignore
//! use cdx_core::provenance::BlockIndex;
//! use cdx_core::HashAlgorithm;
//!
//! // Create block index from document content
//! let index = BlockIndex::from_content(&content, HashAlgorithm::Sha256)?;
//! let merkle_root = index.merkle_root();
//! ```
//!
//! # Merkle Tree Example
//!
//! ```rust,ignore
//! use cdx_core::provenance::{MerkleTree, MerkleProof};
//!
//! // Build a tree from content blocks
//! let tree = MerkleTree::from_blocks(&blocks, HashAlgorithm::Sha256)?;
//! let root = tree.root();
//!
//! // Generate a proof for a specific block
//! let proof = tree.prove(2)?;  // Proof for block at index 2
//!
//! // Verify the proof
//! assert!(proof.verify(&block_hash, &root));
//! ```

mod block_index;
pub mod ethereum;
mod merkle;
#[cfg(feature = "timestamps-ots")]
pub mod ots;
mod proof;
mod record;
#[cfg(feature = "timestamps-rfc3161")]
pub mod rfc3161;
mod timestamp;

pub use block_index::{BlockHashEntry, BlockIndex};
pub use merkle::{MerkleNode, MerkleTree};
pub use proof::{BlockProof, ProofVerification};
pub use record::{
    CreatorInfo, DerivationRecord, DerivationType, MerkleInfo, ProvenanceRecord, TimestampMethod,
    TimestampRecord,
};
pub use timestamp::{TimestampRequest, TimestampResponse, TimestampToken};