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
//! I/O operations for fingerprint files.
//!
//! This module handles reading and writing `.dsf` (DataSynth Fingerprint) files,
//! which are ZIP archives containing YAML/JSON component files.
//!
//! # Overview
//!
//! The `.dsf` format is a portable, self-contained format for storing fingerprints.
//! Files can optionally be signed with HMAC-SHA256 for authenticity verification.
//!
//! # Writing Fingerprints
//!
//! ```ignore
//! use datasynth_fingerprint::io::FingerprintWriter;
//! use std::path::Path;
//!
//! let writer = FingerprintWriter::new();
//! writer.write_to_file(&fingerprint, Path::new("output.dsf"))?;
//! ```
//!
//! # Reading Fingerprints
//!
//! ```ignore
//! use datasynth_fingerprint::io::FingerprintReader;
//! use std::path::Path;
//!
//! let reader = FingerprintReader::new();
//! let fingerprint = reader.read_from_file(Path::new("fingerprint.dsf"))?;
//! ```
//!
//! # Digital Signatures
//!
//! Fingerprints can be signed to ensure authenticity and integrity:
//!
//! ```ignore
//! use datasynth_fingerprint::io::{SigningKey, DsfSigner, DsfVerifier};
//!
//! // Create a signing key (store securely!)
//! let key = SigningKey::generate("my-key-id");
//!
//! // Sign when writing
//! let signer = DsfSigner::new(key.clone());
//! writer.write_to_file_signed(&fingerprint, Path::new("signed.dsf"), &signer)?;
//!
//! // Verify when reading
//! let verifier = DsfVerifier::new(key);
//! let fp = reader.read_from_file_verified(Path::new("signed.dsf"), &verifier)?;
//!
//! // Check if a file is signed without reading it fully
//! let is_signed = reader.is_signed(Path::new("signed.dsf"))?;
//! ```
//!
//! # Validation
//!
//! The [`FingerprintValidator`] can check `.dsf` file integrity:
//!
//! ```ignore
//! use datasynth_fingerprint::io::FingerprintValidator;
//!
//! let validator = FingerprintValidator::new();
//! let result = validator.validate(Path::new("fingerprint.dsf"))?;
//!
//! if result.is_valid {
//! println!("File is valid");
//! } else {
//! for error in &result.errors {
//! eprintln!("Error: {}", error);
//! }
//! }
//! ```
//!
//! # File Structure
//!
//! A `.dsf` file is a ZIP archive containing:
//!
//! | File | Format | Required | Description |
//! |------|--------|----------|-------------|
//! | `manifest.json` | JSON | Yes | Version, checksums, signature |
//! | `schema.yaml` | YAML | Yes | Table and column definitions |
//! | `statistics.yaml` | YAML | Yes | Distribution parameters |
//! | `correlations.yaml` | YAML | No | Correlation matrices |
//! | `integrity.yaml` | YAML | No | FK relationships |
//! | `rules.yaml` | YAML | No | Business rules |
//! | `anomalies.yaml` | YAML | No | Anomaly profiles |
//! | `privacy_audit.json` | JSON | Yes | Privacy audit trail |
//!
//! [`FingerprintValidator`]: validation::FingerprintValidator
pub use *;
pub use ;
pub use *;
pub use *;
/// File names within a .dsf archive.