strypt_core/lib.rs
1//! Detection and removal of hidden identifying metadata from files.
2//!
3//! # Status
4//!
5//! **Phase 1 — in progress.** Format detection, the report types, and the typed error set
6//! exist, along with the PDF and JPEG handlers. PNG and WebP are still to land, each with its
7//! own fuzz target and seed corpus (scope locked by ADR-0005). A format with no handler is
8//! reported as unsupported and is never passed through untouched.
9//!
10//! # Invariants
11//!
12//! These are project invariants, not style preferences. Each has an ADR in
13//! `docs/DECISIONS.md`, and code violating them should not be merged:
14//!
15//! - **No network access, ever, in any code path.** No dependency that opens a socket may
16//! appear in this crate's tree, including transitively. (ADR-0004)
17//! - **No `unsafe`.** Enforced by `unsafe_code = "forbid"` at the workspace level. (ADR-0007)
18//! - **No panics on untrusted input.** Every failure is a typed `Result`. Malformed input is
19//! *expected* input, not an exceptional condition. (ADR-0006)
20//! - **No CLI concerns.** This crate returns structured data; it never formats output for
21//! humans, reads argv, prints, or exits. Front-ends render. (ADR-0003)
22//! - **Fail closed.** Never emit partially-sanitised output, and never report success for a
23//! file that was not actually processed.
24
25mod bytes;
26pub mod detect;
27pub mod error;
28pub mod formats;
29pub mod io;
30pub mod panic_guard;
31pub mod pipeline;
32pub mod registry;
33pub mod report;
34
35pub use detect::{Format, detect};
36pub use error::{IoAction, MalformedDetail, ResourceLimit, Result, StryptError, UnsupportedKind};
37pub use formats::{MetadataHandler, ParseLimits, StripOptions, Stripped};
38pub use io::{AtomicWrite, Limits, Overwrite, Permissions};
39pub use pipeline::{inspect_bytes, inspect_file, strip_bytes, strip_file};
40pub use report::{
41 Finding, InspectOptions, MetadataKind, MetadataReport, MetadataValue, Note, Retained,
42 RetentionReason, Sensitivity, StripReport,
43};
44
45/// The crate version, for front-ends to report.
46#[must_use]
47pub const fn version() -> &'static str {
48 env!("CARGO_PKG_VERSION")
49}
50
51#[cfg(test)]
52mod tests {
53 use super::*;
54
55 #[test]
56 fn version_is_reported() {
57 assert!(!version().is_empty());
58 }
59}