KeydbSource owns keydb save + update

Move the keydb save/validation/atomic-write path out of libfreemkv onto
KeydbSource. New KeydbSource::save(bytes) validates + decompresses (zip /
gz / plain, decompressed-size capped) and crash-safely writes to the
source's OWN path (sibling-temp + fsync + rename + parent-dir fsync) —
not a hardcoded default, so the caller chooses the destination.
KeydbSource::update(fetch, url) calls an INJECTED fetch closure then
save, keeping this crate transport-agnostic on the update path (the app
supplies its own TLS / SSRF-guarded transport). UpdateResult moves here
and is re-exported. Add flate2 + zip (already in the resolved graph via
libfreemkv) for decompression; no new HTTP stack.
This commit is contained in:
Matthew Jackson
2026-06-26 17:34:03 -07:00
parent 946632d9fb
commit 17fcf6d8f9
4 changed files with 353 additions and 2 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ mod keydb_format;
mod online;
mod paths;
pub use keydb::KeydbSource;
pub use keydb::{KeydbSource, UpdateResult};
pub use online::{OnlineSource, validate_keyserver_url};
pub use paths::{default_keydb_path, existing_keydb_path, keydb_search_paths};