mirror of
https://github.com/ratspeak/microReticulum
synced 2026-11-27 13:52:14 +00:00
Complete rewrite of Resource.h/cpp with full protocol implementation: ResourceAdvertisement: msgpack map pack/unpack with 11 string keys (t,d,n,h,r,o,i,l,q,f,m) matching Python/Rust wire format. OutboundResource (sender): compress → encrypt → chunk → hashmap → advertise. Splits encrypted blob into SDU-sized parts (263 bytes), computes SHA256(chunk||random_hash)[:4] map hashes, handles receiver requests. InboundResource (receiver): accept advertisement → receive parts by map hash → assemble → decrypt → decompress. Sends initial request, generates proof. Helper functions: get_map_hash(), compute_resource_hash(), compute_expected_proof() — all match Python/Rust implementations. 8 new tests (test_resource_transfer): advertisement roundtrip, map hash, resource hash, proof, flag encoding, nil/non-nil request_id. Legacy Resource class preserved for Link.cpp compatibility.