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.

Structs§

MarketplaceApp
Represents a Mini App listing in the marketplace
MarketplaceListing
The publisher-supplied metadata of a marketplace listing.

Constants§

MINIAPP_APP_ID
The application identifier for Vector Mini Apps marketplace
MINIAPP_MARKETPLACE_KIND
The event kind for Mini App marketplace listings Kind 30078 = Parameterized Replaceable Application-Specific Data
TRUSTED_PUBLISHER
Trusted publisher npub (only apps from this pubkey are shown initially) This is the Vector project’s official npub for publishing verified apps

Functions§

base32_nopad_decode
BASE32 no-pad decoding (RFC 4648), the inverse of base32_nopad_encode.
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.
build_marketplace_event
Build a Nostr event for publishing a Mini App to the marketplace
derive_url_topic_id
Derive the realtime topic for a URL-shared Mini App.
is_safe_app_id
Parse a Nostr event into a MarketplaceApp A marketplace d-tag id is attacker-controlled and becomes a filesystem path (<id>.xdc). Allow only a bounded, separator-free, traversal-free token so an id can never escape the miniapps dir. Permits reverse-DNS / slug / hash ids; bans /, \, .., absolute/UNC paths.
mint_topic_id
Mint a fresh realtime-channel topic id for an outbound .xdc attachment.
parse_marketplace_event
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.