Skip to main content

signedshot_validator/
lib.rs

1//! SignedShot Validator Library
2//!
3//! Validates SignedShot media authenticity proofs.
4//!
5//! # Quick Start
6//!
7//! Use the high-level `validate` function for complete validation:
8//!
9//! ```no_run
10//! use signedshot_validator::{validate, ValidationResult};
11//! use std::path::Path;
12//!
13//! let result = validate(
14//!     Path::new("photo.sidecar.json"),
15//!     Path::new("photo.jpg"),
16//! ).unwrap();
17//!
18//! if result.valid {
19//!     println!("Valid! Publisher: {}", result.capture_trust.publisher_id);
20//! } else {
21//!     println!("Invalid: {}", result.error.unwrap_or_default());
22//! }
23//! ```
24//!
25//! # Python Bindings
26//!
27//! This library can be built as a Python module using PyO3.
28//! Build with: `maturin build --features python`
29//!
30//! ```python
31//! import signedshot
32//!
33//! result = signedshot.validate_files("photo.sidecar.json", "photo.jpg")
34//! if result.valid:
35//!     print(f"Publisher: {result.capture_trust['publisher_id']}")
36//! ```
37
38pub mod error;
39pub mod integrity;
40pub mod jwt;
41pub mod sidecar;
42pub mod validate;
43
44#[cfg(feature = "python")]
45mod python;
46
47pub use error::{Result, ValidationError};
48pub use integrity::{
49    compute_file_hash, compute_hash, verify_capture_id_match, verify_content_hash,
50    verify_device_public_key_fingerprint, verify_media_integrity,
51    verify_signature as verify_media_signature,
52};
53pub use jwt::{
54    fetch_jwks, parse_jwt, verify_signature, CaptureTrustClaims, Jwk, Jwks, JwtHeader, ParsedJwt,
55};
56pub use sidecar::{CaptureTrust, MediaIntegrity, Sidecar};
57pub use validate::{
58    validate, validate_from_bytes, CaptureTrustResult, MediaIntegrityResult, ValidationResult,
59};