social-kit / src / ardegazu / social / invites.cljs
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
;; ported-from: src/invites.ts @ v1.2.0
;;
;; Invite composition: the suite's app catalog + room-link minting. Sending
;; and receiving live in the social agent (presence.cljs) — an invite is just
;; an `inv` envelope carrying a capability URL; this module knows which apps
;; exist and how to mint a fresh room for one.
(ns ardegazu.social.invites
  (:require [ardegazu.id.crypto :as id-crypto]))

;; The invitable suite (hub excluded — you're already there).
;;
;; banca is excluded ON PURPOSE, not forgotten: everything listed here is
;; offered by the hub's invite picker, which mints a fresh room via
;; mint-room-url — a bare 43-char fragment secret. A bank's link is
;; #<secret>.<bankerPub> (policy is a function of the banker key), so a minted
;; bare secret would be a bank nobody can open. Invites sent from INSIDE banca
;; carry the full room URL opaquely and work fine without an entry here, and
;; the presence label's host-prefix fallback already reads "banca".
(def SUITE-APPS
  #js [(js-obj "host" "chat.ardegazu.ro" "name" "sueta" "kind" "chat")
       (js-obj "host" "board.ardegazu.ro" "name" "board" "kind" "board")
       ;; bursa is IN, unlike banca, because its link is a bare secret: a
       ;; minted market opens for everyone, and the fold needs no key from the
       ;; URL — an orderbook has no operator.
       (js-obj "host" "bursa.ardegazu.ro" "name" "bursa" "kind" "market")
       (js-obj "host" "game1.ardegazu.ro" "name" "neon-grid" "kind" "game")
       (js-obj "host" "game2.ardegazu.ro" "name" "valley-blocks" "kind" "game")
       (js-obj "host" "game3.ardegazu.ro" "name" "tessera" "kind" "game")
       (js-obj "host" "game4.ardegazu.ro" "name" "séance" "kind" "game")
       (js-obj "host" "game5.ardegazu.ro" "name" "lampion" "kind" "game")
       (js-obj "host" "game6.ardegazu.ro" "name" "odeon" "kind" "game")])

(defn mint-room-url
  "Mint a fresh room on an app: every suite app accepts a 43-char base64url
  fragment secret (the invite link IS the room key). The inviter opens the
  same URL themselves."
  [host]
  (str "https://" host "/#" (id-crypto/to-b64url (id-crypto/random-bytes 32))))

static mirror of HEAD · about · clone: git clone https://git.ardegazu.ro/social-kit.git