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
//! # Atlas Common
//!
//! Core functionality shared across Atlas components for machine learning provenance tracking.
//!
//! This crate provides essential building blocks for creating Content Authenticity Initiative (C2PA)
//! compliant systems for tracking the provenance of machine learning models, datasets, and related assets.
//!
//! ## Features
//!
//! - **Cryptographic Hashing**: SHA-256/384/512 support with constant-time comparison
//! - **C2PA Metadata**: Types and utilities for C2PA manifest management
//! - **Storage Abstractions**: Backend-agnostic storage interfaces
//! - **Validation**: Comprehensive validation for manifests, URNs, and hashes
//! - **Secure File Operations**: Protection against symlink and hardlink attacks
//!
//! ## Feature Flags
//!
//! - `hash` (default): Cryptographic hash functions
//! - `c2pa` (default): C2PA manifest and asset types
//! - `storage`: Storage backend abstractions
//! - `validation`: Validation utilities
//! - `file-utils`: Secure file operation utilities
//! - `async`: Async support for storage operations
//! - `full`: Enable all features
//!
//! ## Example
//!
//! ```rust
//! use atlas_common::{
//! hash::{calculate_hash, HashAlgorithm},
//! c2pa::{ManifestId, ManifestMetadata, ManifestType},
//! Result,
//! };
//!
//! fn main() -> Result<()> {
//! // Calculate hash of model data
//! let model_data = b"pretrained weights";
//! let hash = calculate_hash(model_data);
//!
//! // Create a C2PA manifest ID
//! let manifest_id = ManifestId::new();
//! println!("Manifest URN: {}", manifest_id.as_urn());
//!
//! // Create manifest metadata
//! let metadata = ManifestMetadata {
//! id: manifest_id.as_urn().to_string(),
//! name: "GPT-2 Fine-tuned Model".to_string(),
//! manifest_type: ManifestType::Model,
//! created_at: atlas_common::c2pa::DateTimeWrapper::now_utc().to_rfc3339(),
//! hash: Some(hash),
//! size: Some(1024 * 1024 * 50),
//! version: Some("1.0.0".to_string()),
//! };
//!
//! Ok(())
//! }
//! ```
// Common error types are always available
// Feature-gated modules
// Re-export
pub use ;
pub use ;
pub use ;
pub use ;
/// Library version
pub const VERSION: &str = env!;
/// Initialize the library
///
/// Currently a no-op but reserved for future initialization requirements.
///
/// # Example
///
/// ```rust
/// use atlas_common::init;
///
/// fn main() -> atlas_common::Result<()> {
/// init()?;
/// // Your code here
/// Ok(())
/// }
/// ```