@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 +26 -18
- package/dist/browser/index.js +1021 -28
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +527 -28
- package/dist/server/index.js +1017 -28
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
5
|
-
`client.auth` / `client.storage` / `client.message` — backed by
|
|
6
|
-
end-to-end-encrypted messaging
|
|
7
|
-
|
|
8
|
-
and a Cloudflare-Workers-compatible Groth16 verifier — all bundled from
|
|
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
|
-
`
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
`
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
|