1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
[]
= "cachekit-core"
= "0.7.2"
= "2021"
= ["cachekit Contributors"]
= "LZ4 compression, xxHash3 integrity, AES-256-GCM encryption for byte payloads"
= "1.91"
= "MIT"
= "https://github.com/cachekit-io/cachekit-core"
= "https://github.com/cachekit-io/cachekit-core"
= "https://docs.rs/cachekit-core"
= "README.md"
= ["lz4", "xxhash3", "aes-gcm", "encryption", "compression"]
= ["compression", "cryptography"]
[]
= "cachekit_core"
# cdylib for C FFI, rlib for Rust crates, staticlib for static linking
= ["cdylib", "rlib", "staticlib"]
[]
# Error handling
= "2.0"
# Core serialization
= { = "1.0", = ["derive"] }
= "0.11"
# MessagePack serialization (optional)
= { = "1.3", = true }
# High-performance LZ4 compression (optional). Block API only, so no `frame`.
# Decode input is untrusted: `safe-decode` and `checked-decode` stay on
# explicitly (the decoder is the bounds-checked one under `forbid(unsafe_code)`
# whatever the encode feature is). On 64-bit targets the encoder is lz4_flex's
# unsafe one: same algorithm and byte-identical output, with unchecked pointer
# reads and writes instead of bounds-checked slice access. Other targets keep
# the safe encoder (target table below). See SECURITY.md, "Decompression limits".
= { = "0.12", = false, = ["std", "safe-decode", "checked-decode"], = true }
# Fast non-cryptographic hashing for data integrity (optional)
# xxHash3-64: fast enough to run on every store and retrieve; it detects corruption, while
# the AES-GCM auth tag provides security
= { = "0.8", = ["xxh3"], = true }
# Encryption dependencies (all optional, gated by encryption feature)
# Uses HKDF-SHA256 for key derivation (NOT Blake2b - that's only for Python cache keys)
# ring is native-only (see [target.'cfg(not(target_arch = "wasm32"))'.dependencies])
= { = "1.8", = ["derive"], = true }
= { = "0.12", = true }
= { = "0.10", = true }
= { = "0.12", = true }
= { = "0.14", = true }
# wasm32 RNG: getrandom with JS feature for wasm32-unknown-unknown targets
= { = "0.2", = ["js"], = true }
# RustCrypto: pure-Rust AES-256-GCM for wasm32 targets (ring requires clang + C asm)
= { = "0.10", = ["zeroize"], = true }
= { = "0.8", = ["zeroize"], = true }
[]
# ring: hardware-accelerated AES-256-GCM for native targets only.
# Does NOT compile on wasm32-unknown-unknown (requires clang for C asm).
# Kept optional so it is only compiled when the `encryption` feature is active.
= { = "0.17", = true }
[]
# Targets below 64 bits (i686, armv7, win32, wasm32) keep lz4_flex's safe
# encoder. lz4_flex 0.12's output bound, `input_len * 110 / 100`, wraps in a
# 32-bit usize above about 37 MiB, inside this crate's 512 MiB input cap: the
# unsafe encoder would then write past its allocation, where the safe one
# panics. On wasm32 (the Workers build) the cached value, the encoder and the
# tenant keys also share one linear memory, and Miri and the fuzzers run 64-bit
# native only. Cargo unions this `safe-encode` with the features above for
# these targets only.
= { = "0.12", = false, = ["safe-encode"], = true }
[]
# C header generation (required for ffi feature)
= { = "0.29", = true }
[]
= "1.0"
= "0.10"
= "0.4"
# Unconditional for tests: the optional sha2 above only exists under `encryption`,
# but the wire-format vector fixture pin must verify under every feature set.
= "0.10"
= { = "0.10", = ["zeroize"] }
# Native-only: neither builds for wasm32-unknown-unknown, and either would
# break the wasm32 test build below. proptest pulls getrandom 0.3, which
# refuses the target; criterion's default rayon feature refuses it too.
[]
= "1.4"
= { = "0.5", = ["html_reports"] }
# wasm32 test harness for tests/wire_format_constructed.rs (libtest's #[test]
# does not run on wasm32-unknown-unknown). Exact-pinned: it releases in
# lockstep with wasm-bindgen, and the wasm-bindgen-test-runner binary in CI
# must match the locked wasm-bindgen version (bump this, Cargo.lock and the
# runner pin in ci.yml together).
[]
= "=0.3.71"
[]
= ["compression", "checksum", "messagepack"]
# Core features
= ["dep:lz4_flex"]
= ["dep:xxhash-rust"]
= ["dep:rmp-serde"]
# Encryption (AES-256-GCM with HKDF-SHA256 key derivation)
# Native: ring provides hardware-accelerated AES-256-GCM (target-conditional dep above)
# wasm32: aes-gcm (pure Rust) is used instead — automatically selected via cfg(target_arch)
# aes-gcm/aes/getrandom compile on native but are dead code in non-test native builds;
# the compiler optimizes them out.
= [
"dep:ring",
"dep:zeroize",
"dep:hkdf",
"dep:sha2",
"dep:hmac",
"dep:generic-array",
"dep:aes-gcm",
"dep:aes",
"dep:getrandom",
]
# C FFI layer (generates include/cachekit.h)
= ["dep:cbindgen"]
# wasm32 support: alias for encryption (deps now folded into encryption feature)
= ["encryption"]
# Kani formal verification configuration
# Provides mathematical proofs of memory safety for unsafe code and FFI boundaries
[]
= 10
= "terse"
= "print"
= false
= "cadical"
[]
= false
# Lint configuration
[]
# Suppress benign warnings about cfg(kani) which is set by Kani verifier
= { = "warn", = ['cfg(kani)'] }
# Release profile for cachekit-core's own release builds.
#
# Cargo only honors the ROOT package's [profile.release]. Workspace consumers
# (cachekit-rs, cachekit-py via PyO3, cachekit-ts via NAPI) define their own
# [profile.release] and use it instead — this profile does NOT propagate to
# them. The value of setting it here is:
#
# 1. `cargo bench` from inside cachekit-core runs under a stable, fully
# optimized profile (Phase 3 perf measurement depends on this).
# 2. `cargo build --release` and `cargo publish` produce a consistently
# optimized artifact.
# 3. Standalone binary consumers WITHOUT their own [profile.release]
# inherit this one instead of Cargo defaults (codegen-units=16, lto=false).
#
# Mirrors cachekit-py/rust/Cargo.toml for consistency.
[]
= 3
= "fat"
= 1
= "abort"
= "symbols"
= "line-tables-only"
# Bench profile: inherits release, but keeps symbols so callgrind/perf can
# attribute cost to functions. Release's strip = "symbols" also drops the
# line tables, which would make debug = "line-tables-only" a no-op here.
[]
= false
= "line-tables-only"
# hot_path also benches ZeroKnowledgeEncryptor, so it needs `encryption`;
# without it a plain `cargo bench` skips this target instead of failing to compile.
[[]]
= "hot_path"
= false
= ["encryption"]
# Instruction-count gate (`make perf-ir`). It needs valgrind, so `bench = false`
# keeps it out of a plain `cargo bench`; `--bench perf_ir` still selects it, and
# `clippy --all-targets` still compiles it.
[[]]
= "perf_ir"
= false
= false
= ["encryption"]
# The README's Performance table. It times ByteStorage's store and retrieve, which need the
# three default features, and encrypt/decrypt.
[[]]
= "bench_throughput"
= ["compression", "checksum", "messagepack", "encryption"]