Expand description
FCB — Forensic Case Bundle codec.
One Rust crate, two compile targets: native (for the authoring CLI and the teacher review platform) and WASM (for the in-browser student workbench). It owns the FCB container format, passphrase-based crypto, compression, the self-describing evidence model, the embedded task spec, and submission packaging.
This module wires the pieces together; the on-the-wire contract lives in
openspec/specs/fcb-*.
§Example
Pack an evidence case and open it back through the public API:
use ciborium::value::Value;
use fcb::case::{pack_case, CaseInput, CasePayload};
use fcb::container::BundleKind;
use fcb::evidence::{StreamData, StreamManifest};
let manifest = vec![StreamManifest {
id: "s0".into(),
stream_type: "example.note.v1".into(),
records: 1,
}];
let payload = CasePayload {
streams: vec![StreamData {
id: "s0".into(),
records: vec![Value::Text("an event".into())],
}],
};
let input = CaseInput { case_id: "demo".into(), manifest, task: None, payload };
// pack_case computes the canonical bundle_hash, builds the header meta,
// and seals with a fresh random salt/nonce. The literal "passphrase" here is
// illustration only — never hardcode a passphrase in real code.
let bytes = pack_case(&input, "passphrase")?;
let (kind, header, _payload) = fcb::bundle::open_bytes(&bytes, "passphrase")?;
assert_eq!(kind, BundleKind::Case);
assert_eq!(header.case_id, "demo");See docs/fcb-integration-guide.md
for the full consumer guide.
Re-exports§
Modules§
- binding
- Case identity binding and local work isolation (pure logic).
- bundle
- Top-level codec: ties container framing, crypto, and compression into
pack/openfor whole bundles. This is the single place that generates a fresh salt + nonce, derives the key, and assembles the plaintext header. - case
.casebuilder — the authoritative producer interface for evidence bundles.- cbor
- Small CBOR helpers shared by the evidence, task, and bundle layers.
- compress
- Compression and the compress-then-encrypt payload pipeline.
- container
- FCB container framing: the on-disk envelope shared by
.caseand.casework. - crypto
- Passphrase-based cryptography for FCB payloads.
- error
- evidence
- Self-describing evidence model.
- submission
.casework— the student submission bundle.- task
- Embedded task spec and the answer-safety invariant.