cdx-core 0.7.0

Core library for reading, writing, and validating Codex Document Format (.cdx) files
Documentation
[package]
name = "cdx-core"
version = "0.7.0"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
description = "Core library for reading, writing, and validating Codex Document Format (.cdx) files"
documentation = "https://docs.rs/cdx-core"
readme = "../README.md"
keywords = ["codex", "document", "format", "semantic", "signatures"]
categories = ["encoding", "parser-implementations", "data-structures"]

[lib]
name = "cdx_core"
path = "src/lib.rs"

[features]
default = ["zstd", "signatures"]
zstd = ["zip/zstd"]
signatures = ["dep:p256", "dep:ecdsa", "dep:base64", "dep:rand_core"]
signatures-es384 = ["dep:p384", "dep:ecdsa", "dep:base64", "dep:rand_core"]
signatures-rsa = ["dep:rsa", "dep:base64", "dep:rand_core"]
encryption = ["signatures", "dep:aes-gcm", "dep:rand_core"]
encryption-chacha = ["encryption", "dep:chacha20poly1305", "dep:rand_core"]
key-wrapping = ["encryption", "dep:aes-kw", "dep:hkdf", "p256/ecdh"]
key-wrapping-rsa = ["key-wrapping", "signatures-rsa"]
key-wrapping-pbes2 = ["key-wrapping", "dep:pbkdf2"]
eddsa = ["dep:ed25519-dalek", "dep:rand_core"]
ml-dsa = ["dep:ml-dsa", "dep:base64", "dep:rand_core"]
wasm = ["getrandom/wasm_js"]

# Network-dependent features (require external services)
timestamps-ots = ["dep:reqwest", "dep:base64"]
timestamps-rfc3161 = ["dep:reqwest", "dep:base64", "dep:const-oid", "dep:rand_core"]

# Certificate revocation checking (OCSP/CRL)
ocsp = ["dep:reqwest", "dep:x509-cert", "dep:der"]

# WebAuthn/FIDO2 signature verification
webauthn = ["signatures"]

# These are stubs for future implementation
# timestamps-bitcoin = []               # Bitcoin anchoring
# timestamps-ethereum = []              # Ethereum anchoring

full = ["zstd", "signatures", "signatures-es384", "signatures-rsa", "encryption", "encryption-chacha", "key-wrapping", "key-wrapping-rsa", "key-wrapping-pbes2", "eddsa", "ml-dsa", "webauthn", "timestamps-ots", "timestamps-rfc3161", "ocsp"]

[dependencies]
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
json-canon = "0.1"  # RFC 8785 JSON Canonicalization

# ZIP handling
zip = { version = "8.0", default-features = false, features = ["deflate"] }

# Cryptography
sha2 = "0.10"
sha3 = "0.10"
blake3 = "1.5"

# Signatures (optional)
p256 = { version = ">=0.14.0-rc.7, <0.15", features = ["ecdsa", "pem"], optional = true }
p384 = { version = ">=0.14.0-rc.7, <0.15", features = ["ecdsa", "pem"], optional = true }
ecdsa = { version = ">=0.17.0-rc.16, <0.18", optional = true }
rsa = { version = ">=0.10.0-rc.15, <0.11", features = ["sha2"], optional = true }
base64 = { version = "0.22", optional = true }
rand_core = { version = "0.10", optional = true }

# EdDSA signatures (optional)
ed25519-dalek = { version = "2.1", features = ["rand_core", "pem"], optional = true }

# ML-DSA post-quantum signatures (optional)
ml-dsa = { version = ">=0.1.0-rc.7, <0.2", features = ["rand_core"], optional = true }

# Encryption (optional)
aes-gcm = { version = "0.11.0-rc.3", optional = true }
chacha20poly1305 = { version = "0.11.0-rc.3", optional = true }

# Key wrapping (optional)
aes-kw = { version = "0.3.0-rc.2", optional = true }
hkdf = { version = "0.12", optional = true }
pbkdf2 = { version = "0.12", optional = true }

# HTTP client for timestamps (optional)
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"], optional = true }

# OID support for RFC 3161 timestamps (optional)
const-oid = { version = "0.10", optional = true }

# X.509 certificate parsing for OCSP/CRL (optional)
x509-cert = { version = ">=0.3.0-rc.4, <0.4", optional = true }
der = { version = "0.8", features = ["std"], optional = true }

# Time
chrono = { version = "0.4", features = ["serde", "now"], default-features = false }

# Derive macros for Display/AsRefStr
strum = { version = "0.27", features = ["derive"] }

# Error handling
thiserror = "2.0"

# Random for WASM
getrandom = "0.4"

[dev-dependencies]
tempfile = "3.14"
pretty_assertions = "1.4"
proptest = "1.5"
criterion = { version = "0.8", features = ["html_reports"] }
jsonschema = "0.28"

[[bench]]
name = "document"
harness = false

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]