Skip to main content

Module webxdc

Module webxdc 

Source
Expand description

WebXDC Mini App helpers shared across transports (DM + Community).

The realtime-channel topic for a Mini App is minted ONCE at send time and carried on the file event as a webxdc-topic tag, so every participant joins the SAME gossip topic. Locally-derived topics are asymmetric in DMs (each side’s chat_id is the other party’s npub), which silently splits the players onto disjoint topics — the tag is the single source of truth.

Functions§

base32_nopad_encode
BASE32 no-pad encoding (RFC 4648). Mirrors the miniapp realtime layer’s codec exactly — the two must agree for topic tags to decode.
mint_topic_id
Mint a fresh realtime-channel topic id for an outbound .xdc attachment.
parse_peer_signal
Parse + bound a kind-3310 peer signal: Some((topic, Some(addr))) for an advertisement, Some((topic, None)) for a departure. Both fields are author-controlled: the topic must be a 52-char base32 TopicId and the addr is size-bounded — the realtime layer’s decode is the final word.
peer_signal_content
The kind-3310 peer-signal content, shared by every community transport (the v1 channel plane and the v2 chat plane must stay byte-compatible): {"op":"ad","topic":..,"addr":..} advertises an Iroh node, {"op":"left",..} departs.