@muhkoo/connect 0.7.0-alpha.3 → 0.7.0-alpha.4
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 +11 -13
- package/dist/browser/index.js +14 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +10 -0
- package/dist/server/index.js +14 -1
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,9 +142,10 @@ const client = new Client({
|
|
|
142
142
|
const user = await client.auth.zk.login("alice", "correct horse battery staple");
|
|
143
143
|
// └ { username, commitment }
|
|
144
144
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
// KV — per-user persistent key/value (collection + id); client-side encrypted,
|
|
146
|
+
// the server stores only ciphertext.
|
|
147
|
+
await client.kv.set("todos", "t1", { title: "Buy groceries", completed: false });
|
|
148
|
+
const todo = await client.kv.get("todos", "t1");
|
|
148
149
|
const ids = await client.storage.list("todos");
|
|
149
150
|
await client.storage.delete("todos", "t1");
|
|
150
151
|
|
|
@@ -169,9 +170,12 @@ online).
|
|
|
169
170
|
message once with a shared group key so the server can persist + replay it.
|
|
170
171
|
`createChannel(name)` mints + registers a channel (you become its first
|
|
171
172
|
key-holder); `joinChannel(name)` resolves an existing one and is admitted by the
|
|
172
|
-
app's **keeper** — a
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
app's **keeper** — a server-side process (the app's Durable Object) that holds
|
|
174
|
+
the channel's group key and re-issues it to newcomers — so a channel is joinable
|
|
175
|
+
even when no human member is online. The message **relay** stays blind (it only
|
|
176
|
+
ever sees opaque, ECIES-wrapped key blobs); the **keeper** does hold group keys,
|
|
177
|
+
so channels are *relay-blind*, not fully server-blind. (Enabling a server-side
|
|
178
|
+
agent on a channel likewise gives that agent the group key.) The space handle was
|
|
175
179
|
once `Room`; that name is still exported as an alias, and `client.message.room()`
|
|
176
180
|
returns the same handle.
|
|
177
181
|
|
|
@@ -459,12 +463,6 @@ yarn lint # eslint ./src
|
|
|
459
463
|
(true for all of the above; on CF Workers, pre-compile via wrangler's
|
|
460
464
|
`.wasm` import if you want to skip startup cost).
|
|
461
465
|
|
|
462
|
-
## Related
|
|
463
|
-
|
|
464
|
-
- [`muhkoo/accelerator`](https://github.com/muhkoo/accelerator) — the CF
|
|
465
|
-
Workers + DOs backend this SDK targets, including the personal-space DO,
|
|
466
|
-
message-bus DO, and the bn128.wasm-driven `verifyZkAuthProof`.
|
|
467
|
-
|
|
468
466
|
## License
|
|
469
467
|
|
|
470
|
-
|
|
468
|
+
MIT — see `LICENSE`.
|
package/dist/browser/index.js
CHANGED
|
@@ -4892,7 +4892,7 @@ function base64UrlDecode(s) {
|
|
|
4892
4892
|
* expect (and isn't serving a stale cached bundle). Keep this in sync with
|
|
4893
4893
|
* `package.json` `version`.
|
|
4894
4894
|
*/
|
|
4895
|
-
const VERSION = "0.7.0-alpha.
|
|
4895
|
+
const VERSION = "0.7.0-alpha.4";
|
|
4896
4896
|
|
|
4897
4897
|
/**
|
|
4898
4898
|
* `HttpClient` — the one place the unified {@link Client} talks to the
|
|
@@ -5452,6 +5452,19 @@ class HostedAuth {
|
|
|
5452
5452
|
this.location().assign(url);
|
|
5453
5453
|
return url;
|
|
5454
5454
|
}
|
|
5455
|
+
/**
|
|
5456
|
+
* (App side) Send the user to centralized account & security management on
|
|
5457
|
+
* the hosted page (auth.muhkoo.dev/security) — manage passkeys, recovery
|
|
5458
|
+
* phrase, email, Google, change password, and remove login methods, all in
|
|
5459
|
+
* one place. `returnUri` (default: the current URL) gives the hosted page a
|
|
5460
|
+
* "Back to app" target. Redirects the browser; resolves to the URL.
|
|
5461
|
+
*/
|
|
5462
|
+
async manageAccount(opts = {}) {
|
|
5463
|
+
const ret = opts.returnUri ?? this.location().href;
|
|
5464
|
+
const url = `${this.deps.authBaseUrl}/security?` + new URLSearchParams({ return: ret }).toString();
|
|
5465
|
+
this.location().assign(url);
|
|
5466
|
+
return url;
|
|
5467
|
+
}
|
|
5455
5468
|
/** Whether the current URL looks like a hosted-auth callback (has code + state). */
|
|
5456
5469
|
isCallback() {
|
|
5457
5470
|
try {
|