| Crates.io | rustpatcher |
| lib.rs | rustpatcher |
| version | 0.1.13 |
| created_at | 2025-03-05 21:50:32.541891+00 |
| updated_at | 2025-06-04 19:03:06.312902+00 |
| description | p2p patching system |
| homepage | |
| repository | https://github.com/rustonbsd/rustpatcher |
| max_upload_size | |
| id | 1579865 |
| size | 194,432 |
Secure Decentralized Software Updates - Working work in progress
# Cargo.toml
[dependencies]
rustpatcher = "0.1"
// main.rs
use rustpatcher::Patcher;
#[rustpatcher::main]
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let patcher = Patcher::new()
.build()
.await?;
}
cargo run -- rustpatcher init
Output:
New keys generated:
Trusted-Key = mw6iuq1iu7qd5gcz59qpjnu6tw9yn7pn4gxxkdbqwwwxfzyziuro
Shared-Secret = 8656fg8j6s43a4jndkzdysjuof588zezsn6s8sd6wwcpwf6b3r9y
// main.rs
use rustpatcher::Patcher;
#[rustpatcher::main]
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let patcher = Patcher::new()
.trusted_key_from_z32_str("mw6iuq1iu7qd5gcz59qpjnu6tw9yn7pn4gxxkdbqwwwxfzyziuro")
.shared_secret_key_from_z32_str("mw6iuq1iu7qd5gcz59qpjnu6tw9yn7pn4gxxkdbqwwwxfzyziuro"))
.build()
.await?;
}
# Increment version in Cargo.toml first
cargo run -- rustpatcher publish
Creates signed package with:
sequenceDiagram
Master->>+PKARR: Publish signed package
Master->>+Iroh: Announce version topic
Master-->>Network: Propagate via DHT
sequenceDiagram
Client->>+PKARR: Check version records
PKARR-->>-Client: Return latest signed package
Client->>+Iroh: Discover peers via topic
Iroh-->>-Client: Return node list
Client->>Peer: Establish P2P connection
Peer-->>Client: Stream verified update
Client->>Self: Safe replace via self_replace
Version Propagation
Update Verification
// Verification chain
if pub_key.verify(&data, &sig).is_ok()
&& compute_hash(data) == stored_hash
&& version > current_version {
apply_update()
}
Self-Update Mechanism
| Command | Function |
|---|---|
init |
Generate cryptographic identity |
publish |
Create/distribute signed package |
Zero configuration needed for peer discovery - automatic via Iroh Topic Tracker