@muhkoo/connect 0.1.0-alpha.2 → 0.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @muhkoo/connect
2
2
 
3
3
  Client SDK for the Muhkoo Accelerator. The headline surface is a single
4
- **`Client`** that hangs everything off three namespaces —
5
- `client.auth` / `client.storage` / `client.message` — backed by
6
- end-to-end-encrypted messaging primitives (Double Ratchet + ECDH P-384), a
7
- turnkey multi-peer `BroadcastChannel`, ZK identity + personal/shared spaces,
8
- and a Cloudflare-Workers-compatible Groth16 verifier — all bundled from a
9
- single TypeScript source tree.
4
+ **`Client`** that hangs everything off four namespaces —
5
+ `client.auth` / `client.storage` / `client.message` / `client.space` — backed by
6
+ end-to-end-encrypted messaging (fan-out group channels with history, plus
7
+ Double Ratchet + ECDH P-384 for direct messages), ZK identity + personal/shared
8
+ spaces, and a Cloudflare-Workers-compatible Groth16 verifier — all bundled from
9
+ a single TypeScript source tree.
10
10
 
11
11
  > Status: alpha. The library is consumed in tree by `../accelerator` and the
12
12
  > `../web` SPA.
@@ -140,20 +140,28 @@ await client.storage.delete("todos", "t1");
140
140
  const sub = client.message.subscribe("todos", (e) => console.log("update:", e.data));
141
141
  await client.message.publish("todos", { id: "t1", done: true });
142
142
  await client.message.send("user:abc", { text: "Hello!" });
143
+
144
+ // Space — fan-out group channels with persisted history (group chat).
145
+ const space = await client.space.joinChannel("project-x"); // or createChannel(...)
146
+ space.onMessage((e) => console.log(e.from, e.message.body));
147
+ await space.sendMessage("Hi everyone");
148
+ const { messages } = await space.history({ limit: 100 });
143
149
  ```
144
150
 
145
- `subscribe(subject)` / `publish(subject, data)` are plaintext fan-out to
146
- everyone on that subject. `send("user:<id>", …)` is an **end-to-end-encrypted**
147
- direct message (Double Ratchet); the recipient receives it by subscribing to
148
- their *own* id — `client.message.subscribe("user:<me>", …)`. Both modes ride a
149
- shared-space room websocket under the hood (opened with a short-lived signed
150
- ticket); E2E delivery needs both parties online, like any ratchet.
151
-
152
- For full **group rooms** (multi-peer E2E chat + room-scoped file sharing), use
153
- `client.message.room(name)` — a shared-space handle exposing the group channel
154
- (`connect`/`on`/`send`/`announce`/`peers`/`sendRaw`) plus
155
- `putFile`/`getFile`. `subscribe`/`publish`/`send` are conveniences layered over
156
- this same room primitive.
151
+ `client.message` is lightweight realtime: `subscribe`/`publish` are plaintext
152
+ fan-out; `send("user:<id>", …)` is an **end-to-end-encrypted** direct message
153
+ (Double Ratchet — forward-secret, ephemeral, no history; both parties must be
154
+ online).
155
+
156
+ `client.space` is **fan-out group messaging with history**. A channel seals each
157
+ message once with a shared group key so the server can persist + replay it.
158
+ `createChannel(name)` mints + registers a channel (you become its first
159
+ key-holder); `joinChannel(name)` resolves an existing one and is admitted by the
160
+ app's **keeper** — a trusted, always-available member that re-issues the group
161
+ key — so a channel is joinable even when no one else is online. The relay stays
162
+ blind (it only ever sees opaque, ECIES-wrapped key blobs). The space handle was
163
+ once `Room`; that name is still exported as an alias, and `client.message.room()`
164
+ returns the same handle.
157
165
 
158
166
  Auth lifecycle:
159
167