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§
- Marketplace
App - Represents a Mini App listing in the marketplace
- Marketplace
Listing - 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
.xdcattachment. - 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.