Optionald?: numberTotal logical size (original uncompressed).
Optionalf?: numberFlags byte.
Optionalh?: Uint8Array<ArrayBufferLike>Resource hash SHA-256(plaintext ‖ r) (32B).
Optionali?: numberSegment index (1-based).
Optionall?: numberTotal segments.
Optionalm?: Uint8Array<ArrayBufferLike>Hashmap fragment (concatenated 4B map_hashes).
Optionaln?: numberNumber of parts in this segment.
Optionalo?: Uint8Array<ArrayBufferLike>Original hash of first segment (32B).
Optionalq?: Uint8Array<ArrayBufferLike>Associated REQUEST id, or undefined/None.
Optionalr?: Uint8Array<ArrayBufferLike>Random hash salt (4B).
Optionalt?: numberTransfer size (encrypted byte length on wire).
Packs the advertisement into a msgpack bin-correct Uint8Array.
StaticunpackUnpacks an advertisement from its msgpack wire form.
Represents a RESOURCE_ADV — the advertisement that opens a Resource transfer.
The wire form is a single msgpack map (PROTOCOL-SPEC.md §10.4). The byte fields (
h,r,o,m,q) MUST be msgpackbin(Pythonbytes), not arrays — encoding them viaArray.from(...)produces a msgpack array and silently breaks Python interop. Keys are emitted in upstream's order so the packed bytes match Pythonumsgpack.packboutput for vector testing.Note that
ris the 4-byte integrity/hashmap salt (get_random_hash()[:4]), NOT the leading wire prefix that the receiver strips (§10.2 step 3 / §10.8).