# hdiff-update-core
Core Rust library for signed HDiffPatch-based application updates.
The crate provides:
- SHA-256 file hashing and verification
- signed JSON update manifests
- Ed25519 release key generation, signing, and verification
- HTTP artifact download helpers
- HDiffPatch `hdiffz` / `hpatchz` process invocation
- update preparation with delta selection and full fallback
- delta-only update preparation for clients that must delegate full downloads
to another updater
This crate does not embed HDiffPatch binaries. Production applications should
package or resolve `hpatchz` explicitly.
## Example
```rust
use hdiff_update_core::{prepare_update, PrepareUpdateOptions};
# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let prepared = prepare_update(
PrepareUpdateOptions {
manifest_url: "https://updates.example.com/latest.json".to_string(),
platform: None,
current_version: Some("0.1.0".to_string()),
expected_version: Some("0.2.0".to_string()),
current_artifact_path: None,
output_path: None,
patch_path: None,
cache_dir: None,
hpatchz_path: None,
signature_public_key: Some("base64-ed25519-public-key".to_string()),
require_signature: true,
force: true,
headers: Vec::new(),
timeout_secs: Some(60),
},
|_event| {},
)
.await?;
println!("prepared installer: {}", prepared.artifact_path.display());
# Ok(())
# }
```