zsign_rs/lib.rs
1//! iOS code signing library.
2//!
3//! This crate provides functionality to sign Mach-O binaries, app bundles, and IPA files
4//! for iOS and macOS. It supports PKCS#12 and PEM certificate formats, provisioning profiles,
5//! and generates valid code signatures compatible with Apple's codesign tool.
6//!
7//! # Quick Start
8//!
9//! ```no_run
10//! use zsign::{ZSign, SigningCredentials};
11//!
12//! // Load credentials from a PKCS#12 file
13//! let p12_data = std::fs::read("certificate.p12").unwrap();
14//! let credentials = SigningCredentials::from_p12(&p12_data, "password").unwrap();
15//!
16//! // Sign an IPA file
17//! ZSign::new()
18//! .credentials(credentials)
19//! .provisioning_profile("app.mobileprovision")
20//! .sign_ipa("input.ipa", "output.ipa")
21//! .unwrap();
22//! ```
23//!
24//! # Modules
25//!
26//! - [`builder`] - High-level builder API for signing operations
27//! - [`bundle`] - App bundle handling and CodeResources generation
28//! - [`codesign`] - Code signature blob generation
29//! - [`crypto`] - Certificate and key handling
30//! - [`error`] - Error types
31//! - [`ipa`] - IPA archive operations
32//! - [`macho`] - Mach-O binary parsing and signing
33//!
34//! # See Also
35//!
36//! - [`ZSign`] - Main entry point for signing operations
37//! - [`SigningCredentials`] - Certificate and key management
38//! - [`Error`] - All possible error conditions
39
40pub mod builder;
41pub mod bundle;
42pub mod codesign;
43pub mod crypto;
44pub mod error;
45pub mod ipa;
46pub mod macho;
47
48pub use builder::ZSign;
49pub use bundle::CodeResourcesBuilder;
50pub use crypto::SigningCredentials;
51pub use error::Error;
52pub use ipa::{create_ipa, extract_ipa, validate_ipa, CompressionLevel, IpaSigner};
53
54/// Convenience result type for zsign operations.
55///
56/// This is a type alias for [`std::result::Result<T, Error>`] using the crate's [`Error`] type.
57pub type Result<T> = std::result::Result<T, Error>;