@synonymdev/pubky 0.6.0-rc.2 → 0.6.0-rc.7

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.
Files changed (6) hide show
  1. package/README.md +167 -45
  2. package/index.cjs +1335 -514
  3. package/index.js +1454 -601
  4. package/package.json +9 -5
  5. package/pubky.d.ts +397 -167
  6. package/pubky_bg.wasm +0 -0
package/index.cjs CHANGED
@@ -6,8 +6,6 @@ globalThis.fetch = makeFetchCookie(originalFetch);
6
6
 
7
7
  let imports = {};
8
8
  imports['__wbindgen_placeholder__'] = module.exports;
9
- let wasm;
10
- const { TextDecoder, TextEncoder } = require(`util`);
11
9
 
12
10
  let cachedUint8ArrayMemory0 = null;
13
11
 
@@ -33,20 +31,18 @@ function getStringFromWasm0(ptr, len) {
33
31
 
34
32
  let WASM_VECTOR_LEN = 0;
35
33
 
36
- const cachedTextEncoder = new TextEncoder('utf-8');
34
+ const cachedTextEncoder = new TextEncoder();
37
35
 
38
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
39
- ? function (arg, view) {
40
- return cachedTextEncoder.encodeInto(arg, view);
36
+ if (!('encodeInto' in cachedTextEncoder)) {
37
+ cachedTextEncoder.encodeInto = function (arg, view) {
38
+ const buf = cachedTextEncoder.encode(arg);
39
+ view.set(buf);
40
+ return {
41
+ read: arg.length,
42
+ written: buf.length
43
+ };
44
+ }
41
45
  }
42
- : function (arg, view) {
43
- const buf = cachedTextEncoder.encode(arg);
44
- view.set(buf);
45
- return {
46
- read: arg.length,
47
- written: buf.length
48
- };
49
- });
50
46
 
51
47
  function passStringToWasm0(arg, malloc, realloc) {
52
48
 
@@ -77,7 +73,7 @@ function passStringToWasm0(arg, malloc, realloc) {
77
73
  }
78
74
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
79
75
  const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
80
- const ret = encodeString(arg, view);
76
+ const ret = cachedTextEncoder.encodeInto(arg, view);
81
77
 
82
78
  offset += ret.written;
83
79
  ptr = realloc(ptr, len, offset, 1) >>> 0;
@@ -96,61 +92,10 @@ function getDataViewMemory0() {
96
92
  return cachedDataViewMemory0;
97
93
  }
98
94
 
99
- function addToExternrefTable0(obj) {
100
- const idx = wasm.__externref_table_alloc();
101
- wasm.__wbindgen_export_4.set(idx, obj);
102
- return idx;
103
- }
104
-
105
- function handleError(f, args) {
106
- try {
107
- return f.apply(this, args);
108
- } catch (e) {
109
- const idx = addToExternrefTable0(e);
110
- wasm.__wbindgen_exn_store(idx);
111
- }
112
- }
113
-
114
- function getArrayU8FromWasm0(ptr, len) {
115
- ptr = ptr >>> 0;
116
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
117
- }
118
-
119
95
  function isLikeNone(x) {
120
96
  return x === undefined || x === null;
121
97
  }
122
98
 
123
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
124
- ? { register: () => {}, unregister: () => {} }
125
- : new FinalizationRegistry(state => {
126
- wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b)
127
- });
128
-
129
- function makeMutClosure(arg0, arg1, dtor, f) {
130
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
131
- const real = (...args) => {
132
- // First up with a closure we increment the internal reference
133
- // count. This ensures that the Rust closure environment won't
134
- // be deallocated while we're invoking it.
135
- state.cnt++;
136
- const a = state.a;
137
- state.a = 0;
138
- try {
139
- return f(a, state.b, ...args);
140
- } finally {
141
- if (--state.cnt === 0) {
142
- wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
143
- CLOSURE_DTORS.unregister(state);
144
- } else {
145
- state.a = a;
146
- }
147
- }
148
- };
149
- real.original = state;
150
- CLOSURE_DTORS.register(real, state, state);
151
- return real;
152
- }
153
-
154
99
  function debugString(val) {
155
100
  // primitive types
156
101
  const type = typeof val;
@@ -216,6 +161,69 @@ function debugString(val) {
216
161
  return className;
217
162
  }
218
163
 
164
+ function addToExternrefTable0(obj) {
165
+ const idx = wasm.__externref_table_alloc();
166
+ wasm.__wbindgen_externrefs.set(idx, obj);
167
+ return idx;
168
+ }
169
+
170
+ function handleError(f, args) {
171
+ try {
172
+ return f.apply(this, args);
173
+ } catch (e) {
174
+ const idx = addToExternrefTable0(e);
175
+ wasm.__wbindgen_exn_store(idx);
176
+ }
177
+ }
178
+
179
+ function getArrayU8FromWasm0(ptr, len) {
180
+ ptr = ptr >>> 0;
181
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
182
+ }
183
+
184
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
185
+ ? { register: () => {}, unregister: () => {} }
186
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
187
+
188
+ function makeMutClosure(arg0, arg1, dtor, f) {
189
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
190
+ const real = (...args) => {
191
+
192
+ // First up with a closure we increment the internal reference
193
+ // count. This ensures that the Rust closure environment won't
194
+ // be deallocated while we're invoking it.
195
+ state.cnt++;
196
+ const a = state.a;
197
+ state.a = 0;
198
+ try {
199
+ return f(a, state.b, ...args);
200
+ } finally {
201
+ state.a = a;
202
+ real._wbg_cb_unref();
203
+ }
204
+ };
205
+ real._wbg_cb_unref = () => {
206
+ if (--state.cnt === 0) {
207
+ state.dtor(state.a, state.b);
208
+ state.a = 0;
209
+ CLOSURE_DTORS.unregister(state);
210
+ }
211
+ };
212
+ CLOSURE_DTORS.register(real, state, state);
213
+ return real;
214
+ }
215
+
216
+ function getArrayJsValueFromWasm0(ptr, len) {
217
+ ptr = ptr >>> 0;
218
+ const mem = getDataViewMemory0();
219
+ const result = [];
220
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
221
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
222
+ }
223
+ wasm.__externref_drop_slice(ptr, len);
224
+ return result;
225
+ }
226
+
219
227
  function _assertClass(instance, klass) {
220
228
  if (!(instance instanceof klass)) {
221
229
  throw new Error(`expected instance of ${klass.name}`);
@@ -223,7 +231,7 @@ function _assertClass(instance, klass) {
223
231
  }
224
232
 
225
233
  function takeFromExternrefTable0(idx) {
226
- const value = wasm.__wbindgen_export_4.get(idx);
234
+ const value = wasm.__wbindgen_externrefs.get(idx);
227
235
  wasm.__externref_table_dealloc(idx);
228
236
  return value;
229
237
  }
@@ -234,27 +242,16 @@ function passArray8ToWasm0(arg, malloc) {
234
242
  WASM_VECTOR_LEN = arg.length;
235
243
  return ptr;
236
244
  }
237
-
238
- function getArrayJsValueFromWasm0(ptr, len) {
239
- ptr = ptr >>> 0;
240
- const mem = getDataViewMemory0();
241
- const result = [];
242
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
243
- result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
244
- }
245
- wasm.__externref_drop_slice(ptr, len);
246
- return result;
247
- }
248
245
  /**
249
246
  * Set the global logging verbosity for the WASM Pubky SDK. Routes Rust `log` output to the browser console.
250
247
  *
251
- * Accepted values (case-insensitive): "error" | "warn" | "info" | "debug" | "trace".
248
+ * Accepted values (case-sensitive): "error" | "warn" | "info" | "debug" | "trace".
252
249
  * Effects:
253
250
  * - Initializes the logger once; subsequent calls may throw if the logger is already set.
254
251
  * - Emits a single info log: `Log level set to: <level>`.
255
252
  * - Messages at or above `level` are forwarded to the appropriate `console.*` method.
256
253
  *
257
- * @param {string} level
254
+ * @param {Level} level
258
255
  * Minimum log level to enable. One of: "error" | "warn" | "info" | "debug" | "trace".
259
256
  *
260
257
  * @returns {void}
@@ -265,17 +262,44 @@ function getArrayJsValueFromWasm0(ptr, len) {
265
262
  *
266
263
  * Usage:
267
264
  * Call once at application startup, before invoking other SDK APIs.
268
- * @param {string} level
265
+ * @param {Level} level
269
266
  */
270
- module.exports.setLogLevel = function(level) {
271
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
272
- const len0 = WASM_VECTOR_LEN;
273
- const ret = wasm.setLogLevel(ptr0, len0);
267
+ exports.setLogLevel = function(level) {
268
+ const ret = wasm.setLogLevel((__wbindgen_enum_Level.indexOf(level) + 1 || 6) - 1);
274
269
  if (ret[1]) {
275
270
  throw takeFromExternrefTable0(ret[0]);
276
271
  }
277
272
  };
278
273
 
274
+ /**
275
+ * Resolve a `pubky://` or `pubky<pk>/…` identifier into the homeserver transport URL.
276
+ *
277
+ * @param {string} identifier Either `pubky<pk>/...` (preferred) or `pubky://<pk>/...`.
278
+ * @returns {string} HTTPS URL in the form `https://_pubky.<pk>/...`.
279
+ * @param {string} identifier
280
+ * @returns {string}
281
+ */
282
+ exports.resolvePubky = function(identifier) {
283
+ let deferred3_0;
284
+ let deferred3_1;
285
+ try {
286
+ const ptr0 = passStringToWasm0(identifier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
287
+ const len0 = WASM_VECTOR_LEN;
288
+ const ret = wasm.resolvePubky(ptr0, len0);
289
+ var ptr2 = ret[0];
290
+ var len2 = ret[1];
291
+ if (ret[3]) {
292
+ ptr2 = 0; len2 = 0;
293
+ throw takeFromExternrefTable0(ret[2]);
294
+ }
295
+ deferred3_0 = ptr2;
296
+ deferred3_1 = len2;
297
+ return getStringFromWasm0(ptr2, len2);
298
+ } finally {
299
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
300
+ }
301
+ };
302
+
279
303
  /**
280
304
  * Validate and normalize a capabilities string.
281
305
  *
@@ -284,11 +308,12 @@ module.exports.setLogLevel = function(level) {
284
308
  *
285
309
  * @param {string} input
286
310
  * @returns {string} Normalized string (same shape as input).
287
- * @throws {PubkyJsError} `{ name: "InvalidInput" }` with a helpful message.
311
+ * @throws {PubkyError} `{ name: "InvalidInput" }` with a helpful message.
312
+ * The error's `data` field is `{ invalidEntries: string[] }` listing malformed tokens.
288
313
  * @param {string} input
289
314
  * @returns {string}
290
315
  */
291
- module.exports.validateCapabilities = function(input) {
316
+ exports.validateCapabilities = function(input) {
292
317
  let deferred3_0;
293
318
  let deferred3_1;
294
319
  try {
@@ -309,18 +334,22 @@ module.exports.validateCapabilities = function(input) {
309
334
  }
310
335
  };
311
336
 
312
- function __wbg_adapter_54(arg0, arg1) {
313
- wasm.wasm_bindgen__convert__closures_____invoke__h1ed9ddf46f2cacfa(arg0, arg1);
337
+ function wasm_bindgen__convert__closures_____invoke__h13019d5ee70bd6b6(arg0, arg1) {
338
+ wasm.wasm_bindgen__convert__closures_____invoke__h13019d5ee70bd6b6(arg0, arg1);
314
339
  }
315
340
 
316
- function __wbg_adapter_57(arg0, arg1, arg2) {
317
- wasm.closure170_externref_shim(arg0, arg1, arg2);
341
+ function wasm_bindgen__convert__closures_____invoke__h69202035a90512ea(arg0, arg1, arg2) {
342
+ wasm.wasm_bindgen__convert__closures_____invoke__h69202035a90512ea(arg0, arg1, arg2);
318
343
  }
319
344
 
320
- function __wbg_adapter_120(arg0, arg1, arg2, arg3) {
321
- wasm.closure74_externref_shim(arg0, arg1, arg2, arg3);
345
+ function wasm_bindgen__convert__closures_____invoke__h07d45d2c9c5e1bbe(arg0, arg1, arg2, arg3) {
346
+ wasm.wasm_bindgen__convert__closures_____invoke__h07d45d2c9c5e1bbe(arg0, arg1, arg2, arg3);
322
347
  }
323
348
 
349
+ const __wbindgen_enum_Level = ["error", "warn", "info", "debug", "trace"];
350
+
351
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
352
+
324
353
  const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
325
354
 
326
355
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -361,15 +390,22 @@ class AuthFlow {
361
390
  }
362
391
  /**
363
392
  * Start a flow (standalone).
364
- * Prefer `pubky.startAuthFlow()` to reuse a façade client.
393
+ * Prefer `pubky.startAuthFlow()` to reuse a facade client.
365
394
  *
366
395
  * @param {string} capabilities
367
396
  * Comma-separated capabilities, e.g. `"/pub/app/:rw,/priv/foo.txt:r"`.
368
397
  * Each entry must be `"<scope>:<actions>"`, where:
369
- * - `scope` starts with `/` (e.g. `/pub/example.app/`)
398
+ * - `scope` starts with `/` (e.g. `/pub/example.com/`)
370
399
  * - `actions` is any combo of `r` and/or `w` (order is normalized; `wr` -> `rw`)
371
400
  * Empty string is allowed (no scopes).
372
401
  *
402
+ * @param {AuthFlowKind} kind
403
+ * The kind of authentication flow to perform.
404
+ * This can either be a sign in or a sign up flow.
405
+ * Examples:
406
+ * - `AuthFlowKind.signin()` - Sign in to an existing account.
407
+ * - `AuthFlowKind.signup(homeserverPublicKey, signupToken)` - Sign up for a new account.
408
+ *
373
409
  * @param {string} [relay]
374
410
  * Optional HTTP relay base, e.g. `"https://demo.httprelay.io/link/"`.
375
411
  * Defaults to the default Synonym-hosted relay when omitted.
@@ -377,23 +413,26 @@ class AuthFlow {
377
413
  * @returns {AuthFlow}
378
414
  * A running auth flow. Call `authorizationUrl()` to show the deep link,
379
415
  * then `awaitApproval()` to receive a `Session`.
380
- * @throws {PubkyJsError}
416
+ * @throws {PubkyError}
381
417
  * - `{ name: "InvalidInput", message: string }` if any capability entry is invalid
382
418
  * or for an invalid relay URL.
383
419
  * @example
384
- * const flow = AuthFlow.start("/pub/my.app/:rw,/pub/pubky.app/:w");
420
+ * const flow = AuthFlow.start("/pub/my-cool-app/:rw,/pub/pubky.app/:w");
385
421
  * renderQRCode(flow.authorizationUrl());
386
422
  * const session = await flow.awaitApproval();
387
- * @param {string} capabilities
423
+ * @param {Capabilities} capabilities
424
+ * @param {AuthFlowKind} kind
388
425
  * @param {string | null} [relay]
389
426
  * @returns {AuthFlow}
390
427
  */
391
- static start(capabilities, relay) {
428
+ static start(capabilities, kind, relay) {
392
429
  const ptr0 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
393
430
  const len0 = WASM_VECTOR_LEN;
394
- var ptr1 = isLikeNone(relay) ? 0 : passStringToWasm0(relay, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
395
- var len1 = WASM_VECTOR_LEN;
396
- const ret = wasm.authflow_start(ptr0, len0, ptr1, len1);
431
+ _assertClass(kind, AuthFlowKind);
432
+ var ptr1 = kind.__destroy_into_raw();
433
+ var ptr2 = isLikeNone(relay) ? 0 : passStringToWasm0(relay, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
434
+ var len2 = WASM_VECTOR_LEN;
435
+ const ret = wasm.authflow_start(ptr0, len0, ptr1, ptr2, len2);
397
436
  if (ret[2]) {
398
437
  throw takeFromExternrefTable0(ret[1]);
399
438
  }
@@ -408,7 +447,7 @@ class AuthFlow {
408
447
  * renderQr(flow.authorizationUrl());
409
448
  * @returns {string}
410
449
  */
411
- authorizationUrl() {
450
+ get authorizationUrl() {
412
451
  let deferred1_0;
413
452
  let deferred1_1;
414
453
  try {
@@ -426,7 +465,7 @@ class AuthFlow {
426
465
  * @returns {Promise<Session>}
427
466
  * Resolves when approved; rejects on timeout/cancel/network errors.
428
467
  *
429
- * @throws {PubkyJsError}
468
+ * @throws {PubkyError}
430
469
  * - `RequestError` if relay/network fails
431
470
  * - `AuthenticationError` if approval is denied/invalid
432
471
  * @returns {Promise<Session>}
@@ -442,7 +481,7 @@ class AuthFlow {
442
481
  * @returns {Promise<AuthToken>}
443
482
  * Resolves when approved; rejects on timeout/cancel/network errors.
444
483
  *
445
- * @throws {PubkyJsError}
484
+ * @throws {PubkyError}
446
485
  * - `RequestError` if relay/network fails
447
486
  * @returns {Promise<AuthToken>}
448
487
  */
@@ -454,7 +493,7 @@ class AuthFlow {
454
493
  /**
455
494
  * Non-blocking single poll step (advanced UIs).
456
495
  *
457
- * @returns {Promise<Session|null>} A session if the approval arrived, otherwise `null`.
496
+ * @returns {Promise<Session|undefined>} A session if the approval arrived, otherwise `undefined`.
458
497
  * @returns {Promise<Session | undefined>}
459
498
  */
460
499
  tryPollOnce() {
@@ -462,7 +501,85 @@ class AuthFlow {
462
501
  return ret;
463
502
  }
464
503
  }
465
- module.exports.AuthFlow = AuthFlow;
504
+ if (Symbol.dispose) AuthFlow.prototype[Symbol.dispose] = AuthFlow.prototype.free;
505
+
506
+ exports.AuthFlow = AuthFlow;
507
+
508
+ const AuthFlowKindFinalization = (typeof FinalizationRegistry === 'undefined')
509
+ ? { register: () => {}, unregister: () => {} }
510
+ : new FinalizationRegistry(ptr => wasm.__wbg_authflowkind_free(ptr >>> 0, 1));
511
+ /**
512
+ * The kind of authentication flow to perform.
513
+ * This can either be a sign in or a sign up flow.
514
+ */
515
+ class AuthFlowKind {
516
+
517
+ static __wrap(ptr) {
518
+ ptr = ptr >>> 0;
519
+ const obj = Object.create(AuthFlowKind.prototype);
520
+ obj.__wbg_ptr = ptr;
521
+ AuthFlowKindFinalization.register(obj, obj.__wbg_ptr, obj);
522
+ return obj;
523
+ }
524
+
525
+ __destroy_into_raw() {
526
+ const ptr = this.__wbg_ptr;
527
+ this.__wbg_ptr = 0;
528
+ AuthFlowKindFinalization.unregister(this);
529
+ return ptr;
530
+ }
531
+
532
+ free() {
533
+ const ptr = this.__destroy_into_raw();
534
+ wasm.__wbg_authflowkind_free(ptr, 0);
535
+ }
536
+ /**
537
+ * Create a sign in flow.
538
+ * @returns {AuthFlowKind}
539
+ */
540
+ static signin() {
541
+ const ret = wasm.authflowkind_signin();
542
+ return AuthFlowKind.__wrap(ret);
543
+ }
544
+ /**
545
+ * Create a sign up flow.
546
+ * # Arguments
547
+ * * `homeserver_public_key` - The public key of the homeserver to sign up on.
548
+ * * `signup_token` - The signup token to use for the signup flow. This is optional.
549
+ * @param {PublicKey} homeserver_public_key
550
+ * @param {string | null} [signup_token]
551
+ * @returns {AuthFlowKind}
552
+ */
553
+ static signup(homeserver_public_key, signup_token) {
554
+ _assertClass(homeserver_public_key, PublicKey);
555
+ var ptr0 = isLikeNone(signup_token) ? 0 : passStringToWasm0(signup_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
556
+ var len0 = WASM_VECTOR_LEN;
557
+ const ret = wasm.authflowkind_signup(homeserver_public_key.__wbg_ptr, ptr0, len0);
558
+ return AuthFlowKind.__wrap(ret);
559
+ }
560
+ /**
561
+ * Get the intent of the authentication flow.
562
+ * # Returns
563
+ * * `"signin"` - If the authentication flow is a sign in flow.
564
+ * * `"signup"` - If the authentication flow is a sign up flow.
565
+ * @returns {string}
566
+ */
567
+ get intent() {
568
+ let deferred1_0;
569
+ let deferred1_1;
570
+ try {
571
+ const ret = wasm.authflowkind_intent(this.__wbg_ptr);
572
+ deferred1_0 = ret[0];
573
+ deferred1_1 = ret[1];
574
+ return getStringFromWasm0(ret[0], ret[1]);
575
+ } finally {
576
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
577
+ }
578
+ }
579
+ }
580
+ if (Symbol.dispose) AuthFlowKind.prototype[Symbol.dispose] = AuthFlowKind.prototype.free;
581
+
582
+ exports.AuthFlowKind = AuthFlowKind;
466
583
 
467
584
  const AuthTokenFinalization = (typeof FinalizationRegistry === 'undefined')
468
585
  ? { register: () => {}, unregister: () => {} }
@@ -563,12 +680,11 @@ class AuthToken {
563
680
  *
564
681
  * Use `.z32()` on the returned `PublicKey` to get the string form.
565
682
  *
566
- * ```js
567
- * const who = token.publicKey().z32();
568
- * ```
683
+ * @example
684
+ * const who = sessionInfo.publicKey.z32();
569
685
  * @returns {PublicKey}
570
686
  */
571
- publicKey() {
687
+ get publicKey() {
572
688
  const ret = wasm.authtoken_publicKey(this.__wbg_ptr);
573
689
  return PublicKey.__wrap(ret);
574
690
  }
@@ -580,12 +696,14 @@ class AuthToken {
580
696
  *
581
697
  * Returns: `string[]`, where each item is the canonical entry `"<scope>:<actions>"`.
582
698
  *
583
- * Example entry: `"/pub/my.app/:rw"`
584
- * @returns {Array<any>}
699
+ * Example entry: `"/pub/my-cool-app/:rw"`
700
+ * @returns {string[]}
585
701
  */
586
- capabilities() {
702
+ get capabilities() {
587
703
  const ret = wasm.authtoken_capabilities(this.__wbg_ptr);
588
- return ret;
704
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
705
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
706
+ return v1;
589
707
  }
590
708
  /**
591
709
  * Serialize the token to a `Uint8Array` in its **canonical** (postcard) binary format.
@@ -603,15 +721,17 @@ class AuthToken {
603
721
  return ret;
604
722
  }
605
723
  }
606
- module.exports.AuthToken = AuthToken;
724
+ if (Symbol.dispose) AuthToken.prototype[Symbol.dispose] = AuthToken.prototype.free;
725
+
726
+ exports.AuthToken = AuthToken;
607
727
 
608
728
  const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
609
729
  ? { register: () => {}, unregister: () => {} }
610
730
  : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
611
731
  /**
612
- * Low-level HTTP bridge used by the Pubky façade and actors.
732
+ * Low-level HTTP bridge used by the Pubky facade and actors.
613
733
  *
614
- * - Supports `pubky://<user-z32>/<abs-path>` and `http(s)://` URLs.
734
+ * - Supports `http(s)://` URLs targeting Pubky or ICANN hosts.
615
735
  * - In browsers/undici, passes `credentials: "include"` to send cookies.
616
736
  */
617
737
  class Client {
@@ -643,7 +763,7 @@ class Client {
643
763
  * `{ pkarr?: { relays?: string[], request_timeout?: number } }`.
644
764
  *
645
765
  * @returns {Client}
646
- * A configured low-level client. Prefer `new Pubky().client()` unless you
766
+ * A configured low-level client. Prefer `new Pubky().client` unless you
647
767
  * need custom relays/timeouts.
648
768
  *
649
769
  * @throws {InvalidInput}
@@ -668,8 +788,7 @@ class Client {
668
788
  /**
669
789
  * Create a client wired for **local testnet**.
670
790
  *
671
- * Sets PKARR relays to `http://<host>:15411/` and enables WASM `pubky://`
672
- * mapping for that host.
791
+ * Configures PKARR relays for the testnet and remembers the hostname for WASM `_pubky` mapping.
673
792
  *
674
793
  * @param {string} [host="localhost"]
675
794
  * Testnet hostname or IP.
@@ -696,18 +815,18 @@ class Client {
696
815
  return Client.__wrap(ret[0]);
697
816
  }
698
817
  /**
699
- * Perform a raw fetch. Works with `pubky://` or `http(s)://` URLs.
818
+ * Perform a raw fetch. Works with `http(s)://` URLs.
700
819
  *
701
820
  * @param {string} url
702
- * @param {RequestInit=} init Standard fetch options; `credentials: "include"` recommended for session I/O.
821
+ * @param {RequestInit} init Standard fetch options; `credentials: "include"` recommended for session I/O.
703
822
  * @returns {Promise<Response>}
704
823
  *
705
824
  * @example
706
- * const client = pubky.client();
707
- * const res = await client.fetch(`pubky://${user}/pub/app/file.txt`, { method: "PUT", body: "hi", credentials: "include" });
825
+ * const client = pubky.client;
826
+ * const res = await client.fetch(`https://_pubky.${user}/pub/app/file.txt`, { method: "PUT", body: "hi", credentials: "include" });
708
827
  * @param {string} url
709
- * @param {any | null} [init]
710
- * @returns {Promise<Promise<any>>}
828
+ * @param {RequestInit | null} [init]
829
+ * @returns {Promise<Response>}
711
830
  */
712
831
  fetch(url, init) {
713
832
  const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -716,80 +835,230 @@ class Client {
716
835
  return ret;
717
836
  }
718
837
  }
719
- module.exports.Client = Client;
838
+ if (Symbol.dispose) Client.prototype[Symbol.dispose] = Client.prototype.free;
720
839
 
721
- const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
722
- ? { register: () => {}, unregister: () => {} }
723
- : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
840
+ exports.Client = Client;
724
841
 
725
- class Keypair {
842
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
843
+ ? { register: () => {}, unregister: () => {} }
844
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
726
845
 
727
- static __wrap(ptr) {
728
- ptr = ptr >>> 0;
729
- const obj = Object.create(Keypair.prototype);
730
- obj.__wbg_ptr = ptr;
731
- KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
732
- return obj;
733
- }
846
+ class IntoUnderlyingByteSource {
734
847
 
735
848
  __destroy_into_raw() {
736
849
  const ptr = this.__wbg_ptr;
737
850
  this.__wbg_ptr = 0;
738
- KeypairFinalization.unregister(this);
851
+ IntoUnderlyingByteSourceFinalization.unregister(this);
739
852
  return ptr;
740
853
  }
741
854
 
742
855
  free() {
743
856
  const ptr = this.__destroy_into_raw();
744
- wasm.__wbg_keypair_free(ptr, 0);
857
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
745
858
  }
746
859
  /**
747
- * Generate a random [Keypair]
748
- * @returns {Keypair}
860
+ * @returns {ReadableStreamType}
749
861
  */
750
- static random() {
751
- const ret = wasm.keypair_random();
752
- return Keypair.__wrap(ret);
862
+ get type() {
863
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
864
+ return __wbindgen_enum_ReadableStreamType[ret];
753
865
  }
754
866
  /**
755
- * Generate a [Keypair] from a secret key.
756
- * @param {Uint8Array} secret_key
757
- * @returns {Keypair}
867
+ * @returns {number}
758
868
  */
759
- static fromSecretKey(secret_key) {
760
- const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
761
- const len0 = WASM_VECTOR_LEN;
762
- const ret = wasm.keypair_fromSecretKey(ptr0, len0);
763
- if (ret[2]) {
764
- throw takeFromExternrefTable0(ret[1]);
765
- }
766
- return Keypair.__wrap(ret[0]);
869
+ get autoAllocateChunkSize() {
870
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
871
+ return ret >>> 0;
767
872
  }
768
873
  /**
769
- * Returns the secret key of this keypair.
770
- * @returns {Uint8Array}
874
+ * @param {ReadableByteStreamController} controller
771
875
  */
772
- secretKey() {
773
- const ret = wasm.keypair_secretKey(this.__wbg_ptr);
774
- return ret;
876
+ start(controller) {
877
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
775
878
  }
776
879
  /**
777
- * Returns the [PublicKey] of this keypair.
778
- * @returns {PublicKey}
880
+ * @param {ReadableByteStreamController} controller
881
+ * @returns {Promise<any>}
779
882
  */
780
- publicKey() {
781
- const ret = wasm.keypair_publicKey(this.__wbg_ptr);
782
- return PublicKey.__wrap(ret);
883
+ pull(controller) {
884
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
885
+ return ret;
886
+ }
887
+ cancel() {
888
+ const ptr = this.__destroy_into_raw();
889
+ wasm.intounderlyingbytesource_cancel(ptr);
890
+ }
891
+ }
892
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
893
+
894
+ exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
895
+
896
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
897
+ ? { register: () => {}, unregister: () => {} }
898
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
899
+
900
+ class IntoUnderlyingSink {
901
+
902
+ __destroy_into_raw() {
903
+ const ptr = this.__wbg_ptr;
904
+ this.__wbg_ptr = 0;
905
+ IntoUnderlyingSinkFinalization.unregister(this);
906
+ return ptr;
907
+ }
908
+
909
+ free() {
910
+ const ptr = this.__destroy_into_raw();
911
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
783
912
  }
784
913
  /**
785
- * Create a recovery file for this keypair (encrypted with the given passphrase).
786
- * @param {string} passphrase
787
- * @returns {Uint8Array}
914
+ * @param {any} chunk
915
+ * @returns {Promise<any>}
788
916
  */
789
- createRecoveryFile(passphrase) {
790
- const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
791
- const len0 = WASM_VECTOR_LEN;
792
- const ret = wasm.keypair_createRecoveryFile(this.__wbg_ptr, ptr0, len0);
917
+ write(chunk) {
918
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
919
+ return ret;
920
+ }
921
+ /**
922
+ * @returns {Promise<any>}
923
+ */
924
+ close() {
925
+ const ptr = this.__destroy_into_raw();
926
+ const ret = wasm.intounderlyingsink_close(ptr);
927
+ return ret;
928
+ }
929
+ /**
930
+ * @param {any} reason
931
+ * @returns {Promise<any>}
932
+ */
933
+ abort(reason) {
934
+ const ptr = this.__destroy_into_raw();
935
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
936
+ return ret;
937
+ }
938
+ }
939
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
940
+
941
+ exports.IntoUnderlyingSink = IntoUnderlyingSink;
942
+
943
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
944
+ ? { register: () => {}, unregister: () => {} }
945
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
946
+
947
+ class IntoUnderlyingSource {
948
+
949
+ static __wrap(ptr) {
950
+ ptr = ptr >>> 0;
951
+ const obj = Object.create(IntoUnderlyingSource.prototype);
952
+ obj.__wbg_ptr = ptr;
953
+ IntoUnderlyingSourceFinalization.register(obj, obj.__wbg_ptr, obj);
954
+ return obj;
955
+ }
956
+
957
+ __destroy_into_raw() {
958
+ const ptr = this.__wbg_ptr;
959
+ this.__wbg_ptr = 0;
960
+ IntoUnderlyingSourceFinalization.unregister(this);
961
+ return ptr;
962
+ }
963
+
964
+ free() {
965
+ const ptr = this.__destroy_into_raw();
966
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
967
+ }
968
+ /**
969
+ * @param {ReadableStreamDefaultController} controller
970
+ * @returns {Promise<any>}
971
+ */
972
+ pull(controller) {
973
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
974
+ return ret;
975
+ }
976
+ cancel() {
977
+ const ptr = this.__destroy_into_raw();
978
+ wasm.intounderlyingsource_cancel(ptr);
979
+ }
980
+ }
981
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
982
+
983
+ exports.IntoUnderlyingSource = IntoUnderlyingSource;
984
+
985
+ const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
986
+ ? { register: () => {}, unregister: () => {} }
987
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
988
+
989
+ class Keypair {
990
+
991
+ static __wrap(ptr) {
992
+ ptr = ptr >>> 0;
993
+ const obj = Object.create(Keypair.prototype);
994
+ obj.__wbg_ptr = ptr;
995
+ KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
996
+ return obj;
997
+ }
998
+
999
+ __destroy_into_raw() {
1000
+ const ptr = this.__wbg_ptr;
1001
+ this.__wbg_ptr = 0;
1002
+ KeypairFinalization.unregister(this);
1003
+ return ptr;
1004
+ }
1005
+
1006
+ free() {
1007
+ const ptr = this.__destroy_into_raw();
1008
+ wasm.__wbg_keypair_free(ptr, 0);
1009
+ }
1010
+ /**
1011
+ * Generate a random [Keypair]
1012
+ * @returns {Keypair}
1013
+ */
1014
+ static random() {
1015
+ const ret = wasm.keypair_random();
1016
+ return Keypair.__wrap(ret);
1017
+ }
1018
+ /**
1019
+ * Generate a [Keypair] from a secret key.
1020
+ * @param {Uint8Array} secret_key
1021
+ * @returns {Keypair}
1022
+ */
1023
+ static fromSecretKey(secret_key) {
1024
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
1025
+ const len0 = WASM_VECTOR_LEN;
1026
+ const ret = wasm.keypair_fromSecretKey(ptr0, len0);
1027
+ if (ret[2]) {
1028
+ throw takeFromExternrefTable0(ret[1]);
1029
+ }
1030
+ return Keypair.__wrap(ret[0]);
1031
+ }
1032
+ /**
1033
+ * Returns the secret key of this keypair.
1034
+ * @returns {Uint8Array}
1035
+ */
1036
+ secretKey() {
1037
+ const ret = wasm.keypair_secretKey(this.__wbg_ptr);
1038
+ return ret;
1039
+ }
1040
+ /**
1041
+ * Returns the [PublicKey] of this keypair.
1042
+ *
1043
+ * Use `.z32()` on the returned `PublicKey` to get the string form.
1044
+ *
1045
+ * @example
1046
+ * const who = keypair.publicKey.z32();
1047
+ * @returns {PublicKey}
1048
+ */
1049
+ get publicKey() {
1050
+ const ret = wasm.keypair_publicKey(this.__wbg_ptr);
1051
+ return PublicKey.__wrap(ret);
1052
+ }
1053
+ /**
1054
+ * Create a recovery file for this keypair (encrypted with the given passphrase).
1055
+ * @param {string} passphrase
1056
+ * @returns {Uint8Array}
1057
+ */
1058
+ createRecoveryFile(passphrase) {
1059
+ const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1060
+ const len0 = WASM_VECTOR_LEN;
1061
+ const ret = wasm.keypair_createRecoveryFile(this.__wbg_ptr, ptr0, len0);
793
1062
  return ret;
794
1063
  }
795
1064
  /**
@@ -810,7 +1079,9 @@ class Keypair {
810
1079
  return Keypair.__wrap(ret[0]);
811
1080
  }
812
1081
  }
813
- module.exports.Keypair = Keypair;
1082
+ if (Symbol.dispose) Keypair.prototype[Symbol.dispose] = Keypair.prototype.free;
1083
+
1084
+ exports.Keypair = Keypair;
814
1085
 
815
1086
  const PkdnsFinalization = (typeof FinalizationRegistry === 'undefined')
816
1087
  ? { register: () => {}, unregister: () => {} }
@@ -868,9 +1139,9 @@ class Pkdns {
868
1139
  * Resolve the homeserver for a given public key (read-only).
869
1140
  *
870
1141
  * @param {PublicKey} user
871
- * @returns {Promise<string|undefined>} Homeserver public key (z32) or `undefined` if not found.
1142
+ * @returns {Promise<PublicKey|undefined>} Homeserver public key or `undefined` if not found.
872
1143
  * @param {PublicKey} pubky
873
- * @returns {Promise<string | undefined>}
1144
+ * @returns {Promise<PublicKey | undefined>}
874
1145
  */
875
1146
  getHomeserverOf(pubky) {
876
1147
  _assertClass(pubky, PublicKey);
@@ -880,15 +1151,15 @@ class Pkdns {
880
1151
  /**
881
1152
  * Resolve the homeserver for **this** user (requires keypair).
882
1153
  *
883
- * @returns {Promise<string|undefined>} Homeserver public key (z32) or `undefined` if not found.
884
- * @returns {Promise<string | undefined>}
1154
+ * @returns {Promise<PublicKey|undefined>} Homeserver public key or `undefined` if not found.
1155
+ * @returns {Promise<PublicKey | undefined>}
885
1156
  */
886
1157
  getHomeserver() {
887
1158
  const ret = wasm.pkdns_getHomeserver(this.__wbg_ptr);
888
1159
  return ret;
889
1160
  }
890
1161
  /**
891
- * Republish homeserver if record is missing/stale.
1162
+ * Force publish homeserver immediately (even if fresh).
892
1163
  *
893
1164
  * Requires keypair or to be signer bound.
894
1165
  *
@@ -907,7 +1178,7 @@ class Pkdns {
907
1178
  return ret;
908
1179
  }
909
1180
  /**
910
- * Force publish homeserver immediately (even if fresh).
1181
+ * Republish homeserver if record is missing/stale.
911
1182
  *
912
1183
  * Requires keypair or to be signer bound.
913
1184
  *
@@ -926,7 +1197,9 @@ class Pkdns {
926
1197
  return ret;
927
1198
  }
928
1199
  }
929
- module.exports.Pkdns = Pkdns;
1200
+ if (Symbol.dispose) Pkdns.prototype[Symbol.dispose] = Pkdns.prototype.free;
1201
+
1202
+ exports.Pkdns = Pkdns;
930
1203
 
931
1204
  const PubkyFinalization = (typeof FinalizationRegistry === 'undefined')
932
1205
  ? { register: () => {}, unregister: () => {} }
@@ -956,10 +1229,10 @@ class Pubky {
956
1229
  wasm.__wbg_pubky_free(ptr, 0);
957
1230
  }
958
1231
  /**
959
- * Create a Pubky façade wired for **mainnet** defaults (public relays).
1232
+ * Create a Pubky facade wired for **mainnet** defaults (public relays).
960
1233
  *
961
1234
  * @returns {Pubky}
962
- * A new façade instance. Use this to create signers, start auth flows, etc.
1235
+ * A new facade instance. Use this to create signers, start auth flows, etc.
963
1236
  *
964
1237
  * @example
965
1238
  * const pubky = new Pubky();
@@ -975,7 +1248,7 @@ class Pubky {
975
1248
  return this;
976
1249
  }
977
1250
  /**
978
- * Create a Pubky façade preconfigured for a **local testnet**.
1251
+ * Create a Pubky facade preconfigured for a **local testnet**.
979
1252
  *
980
1253
  * If `host` is provided, PKARR and HTTP endpoints are derived as `http://<host>:ports/...`.
981
1254
  * If omitted, `"localhost"` is assumed (handy for `cargo install pubky-testnet`).
@@ -999,7 +1272,7 @@ class Pubky {
999
1272
  return Pubky.__wrap(ret[0]);
1000
1273
  }
1001
1274
  /**
1002
- * Wrap an existing configured HTTP client into a Pubky façade.
1275
+ * Wrap an existing configured HTTP client into a Pubky facade.
1003
1276
  *
1004
1277
  * @param {Client} client A previously constructed client.
1005
1278
  * @returns {Pubky}
@@ -1021,34 +1294,41 @@ class Pubky {
1021
1294
  * Provide a **capabilities string** and (optionally) a relay base URL.
1022
1295
  * The capabilities string is a comma-separated list of entries:
1023
1296
  * `"<scope>:<actions>"`, where:
1024
- * - `scope` starts with `/` (e.g. `/pub/example.app/`).
1297
+ * - `scope` starts with `/` (e.g. `/pub/example.com/`).
1025
1298
  * - `actions` is any combo of `r` and/or `w` (order normalized; `wr` -> `rw`).
1026
1299
  * Pass `""` for no scopes (read-only public session).
1027
1300
  *
1028
1301
  * @param {string} capabilities Comma-separated caps, e.g. `"/pub/app/:rw,/pub/foo/file:r"`.
1302
+ * @param {AuthFlowKind} kind The kind of authentication flow to perform.
1303
+ * Examples:
1304
+ * - `AuthFlowKind.signin()` - Sign in to an existing account.
1305
+ * - `AuthFlowKind.signup(homeserverPublicKey, signupToken)` - Sign up for a new account.
1029
1306
  * @param {string=} relay Optional HTTP relay base (e.g. `"https://…/link/"`).
1030
1307
  * @returns {AuthFlow}
1031
- * A running auth flow. Call `authorizationUrl()` to show a QR/deeplink,
1308
+ * A running auth flow. Show `authorizationUrl` as QR/deeplink,
1032
1309
  * then `awaitApproval()` to obtain a `Session`.
1033
1310
  *
1034
- * @throws {PubkyJsError}
1311
+ * @throws {PubkyError}
1035
1312
  * - `{ name: "InvalidInput" }` for malformed capabilities or bad relay URL
1036
1313
  * - `{ name: "RequestError" }` if the flow cannot be started (network/relay)
1037
1314
  *
1038
1315
  * @example
1039
- * const flow = pubky.startAuthFlow("/pub/my.app/:rw");
1040
- * renderQr(flow.authorizationUrl());
1316
+ * const flow = pubky.startAuthFlow("/pub/my-cool-app/:rw");
1317
+ * renderQr(flow.authorizationUrl);
1041
1318
  * const session = await flow.awaitApproval();
1042
- * @param {string} capabilities
1319
+ * @param {Capabilities} capabilities
1320
+ * @param {AuthFlowKind} kind
1043
1321
  * @param {string | null} [relay]
1044
1322
  * @returns {AuthFlow}
1045
1323
  */
1046
- startAuthFlow(capabilities, relay) {
1324
+ startAuthFlow(capabilities, kind, relay) {
1047
1325
  const ptr0 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1048
1326
  const len0 = WASM_VECTOR_LEN;
1049
- var ptr1 = isLikeNone(relay) ? 0 : passStringToWasm0(relay, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1050
- var len1 = WASM_VECTOR_LEN;
1051
- const ret = wasm.pubky_startAuthFlow(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1327
+ _assertClass(kind, AuthFlowKind);
1328
+ var ptr1 = kind.__destroy_into_raw();
1329
+ var ptr2 = isLikeNone(relay) ? 0 : passStringToWasm0(relay, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1330
+ var len2 = WASM_VECTOR_LEN;
1331
+ const ret = wasm.pubky_startAuthFlow(this.__wbg_ptr, ptr0, len0, ptr1, ptr2, len2);
1052
1332
  if (ret[2]) {
1053
1333
  throw takeFromExternrefTable0(ret[1]);
1054
1334
  }
@@ -1068,8 +1348,7 @@ class Pubky {
1068
1348
  */
1069
1349
  signer(keypair) {
1070
1350
  _assertClass(keypair, Keypair);
1071
- var ptr0 = keypair.__destroy_into_raw();
1072
- const ret = wasm.pubky_signer(this.__wbg_ptr, ptr0);
1351
+ const ret = wasm.pubky_signer(this.__wbg_ptr, keypair.__wbg_ptr);
1073
1352
  return Signer.__wrap(ret);
1074
1353
  }
1075
1354
  /**
@@ -1081,27 +1360,27 @@ class Pubky {
1081
1360
  * @returns {PublicStorage}
1082
1361
  *
1083
1362
  * @example
1084
- * const pub = pubky.publicStorage();
1085
- * const text = await pub.getText(`${userPk.z32()}/pub/example.com/hello.txt`);
1363
+ * const text = await pubky.publicStorage.getText(`${userPk.z32()}/pub/example.com/hello.txt`);
1086
1364
  * @returns {PublicStorage}
1087
1365
  */
1088
- publicStorage() {
1089
- const ret = wasm.pubky_publicStorage(this.__wbg_ptr);
1366
+ get publicStorage() {
1367
+ const ret = wasm.pubky_client(this.__wbg_ptr);
1090
1368
  return PublicStorage.__wrap(ret);
1091
1369
  }
1092
1370
  /**
1093
- * Read-only PKDNS (Pkarr) resolver.
1371
+ * Resolve the homeserver for a given public key (read-only).
1094
1372
  *
1095
- * @returns {Pkdns}
1373
+ * Uses an internal read-only Pkdns actor.
1096
1374
  *
1097
- * @example
1098
- * const dns = pubky.pkdns();
1099
- * const homeserver = await dns.getHomeserverOf(userPk);
1100
- * @returns {Pkdns}
1375
+ * @param {PublicKey} user
1376
+ * @returns {Promise<PublicKey|undefined>} Homeserver public key (z32) or `undefined` if not found.
1377
+ * @param {PublicKey} user_public_key
1378
+ * @returns {Promise<PublicKey | undefined>}
1101
1379
  */
1102
- pkdns() {
1103
- const ret = wasm.pubky_pkdns(this.__wbg_ptr);
1104
- return Pkdns.__wrap(ret);
1380
+ getHomeserverOf(user_public_key) {
1381
+ _assertClass(user_public_key, PublicKey);
1382
+ const ret = wasm.pubky_getHomeserverOf(this.__wbg_ptr, user_public_key.__wbg_ptr);
1383
+ return ret;
1105
1384
  }
1106
1385
  /**
1107
1386
  * Access the underlying HTTP client (advanced).
@@ -1110,15 +1389,38 @@ class Pubky {
1110
1389
  * Use this for low-level `fetch()` calls or testing with raw URLs.
1111
1390
  *
1112
1391
  * @example
1113
- * const r = await pubky.client().fetch(`pubky://${user}/pub/app/file.txt`, { credentials: "include" });
1392
+ * const r = await pubky.client.fetch(`pubky://${user}/pub/app/file.txt`, { credentials: "include" });
1114
1393
  * @returns {Client}
1115
1394
  */
1116
- client() {
1395
+ get client() {
1117
1396
  const ret = wasm.pubky_client(this.__wbg_ptr);
1118
1397
  return Client.__wrap(ret);
1119
1398
  }
1399
+ /**
1400
+ * Restore a session from a previously exported snapshot, using this instance's client.
1401
+ *
1402
+ * This does **not** read or write any secrets. It revalidates the session metadata with
1403
+ * the server using the browser-managed HTTP-only cookie that must still be present.
1404
+ *
1405
+ * @param {string} exported A string produced by `session.export()`.
1406
+ * @returns {Promise<Session>}
1407
+ * A rehydrated session bound to this SDK's HTTP client.
1408
+ *
1409
+ * @example
1410
+ * const restored = await pubky.restoreSession(localStorage.getItem("pubky-session")!);
1411
+ * @param {string} exported
1412
+ * @returns {Promise<Session>}
1413
+ */
1414
+ restoreSession(exported) {
1415
+ const ptr0 = passStringToWasm0(exported, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1416
+ const len0 = WASM_VECTOR_LEN;
1417
+ const ret = wasm.pubky_restoreSession(this.__wbg_ptr, ptr0, len0);
1418
+ return ret;
1419
+ }
1120
1420
  }
1121
- module.exports.Pubky = Pubky;
1421
+ if (Symbol.dispose) Pubky.prototype[Symbol.dispose] = Pubky.prototype.free;
1422
+
1423
+ exports.Pubky = Pubky;
1122
1424
 
1123
1425
  const PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1124
1426
  ? { register: () => {}, unregister: () => {} }
@@ -1184,7 +1486,9 @@ class PublicKey {
1184
1486
  return PublicKey.__wrap(ret[0]);
1185
1487
  }
1186
1488
  }
1187
- module.exports.PublicKey = PublicKey;
1489
+ if (Symbol.dispose) PublicKey.prototype[Symbol.dispose] = PublicKey.prototype.free;
1490
+
1491
+ exports.PublicKey = PublicKey;
1188
1492
 
1189
1493
  const PublicStorageFinalization = (typeof FinalizationRegistry === 'undefined')
1190
1494
  ? { register: () => {}, unregister: () => {} }
@@ -1226,15 +1530,15 @@ class PublicStorage {
1226
1530
  return this;
1227
1531
  }
1228
1532
  /**
1229
- * List a directory. Results are `pubky://…` absolute URLs.
1533
+ * List a directory. Results are `pubky://…` identifier URLs.
1230
1534
  *
1231
- * @param {string} address Addressed directory (must end with `/`).
1535
+ * @param {Address} address Addressed directory (must end with `/`).
1232
1536
  * @param {string|null=} cursor Optional suffix or full URL to start **after**.
1233
1537
  * @param {boolean=} reverse Default `false`. When `true`, newest/lexicographically-last first.
1234
1538
  * @param {number=} limit Optional result limit.
1235
1539
  * @param {boolean=} shallow Default `false`. When `true`, lists only first-level entries.
1236
1540
  * @returns {Promise<string[]>}
1237
- * @param {string} address
1541
+ * @param {Address} address
1238
1542
  * @param {string | null} [cursor]
1239
1543
  * @param {boolean | null} [reverse]
1240
1544
  * @param {number | null} [limit]
@@ -1249,12 +1553,26 @@ class PublicStorage {
1249
1553
  const ret = wasm.publicstorage_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
1250
1554
  return ret;
1251
1555
  }
1556
+ /**
1557
+ * Perform a streaming `GET` and expose the raw `Response` object.
1558
+ *
1559
+ * @param {Address} address
1560
+ * @returns {Promise<Response>}
1561
+ * @param {Address} address
1562
+ * @returns {Promise<Response>}
1563
+ */
1564
+ get(address) {
1565
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1566
+ const len0 = WASM_VECTOR_LEN;
1567
+ const ret = wasm.publicstorage_get(this.__wbg_ptr, ptr0, len0);
1568
+ return ret;
1569
+ }
1252
1570
  /**
1253
1571
  * Fetch bytes from an addressed path.
1254
1572
  *
1255
- * @param {string} address
1573
+ * @param {Address} address
1256
1574
  * @returns {Promise<Uint8Array>}
1257
- * @param {string} address
1575
+ * @param {Address} address
1258
1576
  * @returns {Promise<Uint8Array>}
1259
1577
  */
1260
1578
  getBytes(address) {
@@ -1266,9 +1584,9 @@ class PublicStorage {
1266
1584
  /**
1267
1585
  * Fetch text from an addressed path as UTF-8 text.
1268
1586
  *
1269
- * @param {string} address
1587
+ * @param {Address} address
1270
1588
  * @returns {Promise<string>}
1271
- * @param {string} address
1589
+ * @param {Address} address
1272
1590
  * @returns {Promise<string>}
1273
1591
  */
1274
1592
  getText(address) {
@@ -1280,9 +1598,9 @@ class PublicStorage {
1280
1598
  /**
1281
1599
  * Fetch JSON from an addressed path.
1282
1600
  *
1283
- * @param {string} address `"<user-z32>/pub/.../file.json"` or `pubky://<user>/pub/...`.
1601
+ * @param {Address} address `"pubky<user>/pub/.../file.json"` (preferred) or `pubky://<user>/pub/...`.
1284
1602
  * @returns {Promise<any>}
1285
- * @param {string} address
1603
+ * @param {Address} address
1286
1604
  * @returns {Promise<any>}
1287
1605
  */
1288
1606
  getJson(address) {
@@ -1294,9 +1612,9 @@ class PublicStorage {
1294
1612
  /**
1295
1613
  * Check if a path exists.
1296
1614
  *
1297
- * @param {string} address
1615
+ * @param {Address} address
1298
1616
  * @returns {Promise<boolean>}
1299
- * @param {string} address
1617
+ * @param {Address} address
1300
1618
  * @returns {Promise<boolean>}
1301
1619
  */
1302
1620
  exists(address) {
@@ -1308,10 +1626,10 @@ class PublicStorage {
1308
1626
  /**
1309
1627
  * Get metadata for an address
1310
1628
  *
1311
- * @param {string} address `"<user-z32>/pub/.../file.json"` or `pubky://<user>/pub/...`.
1629
+ * @param {Address} address `"pubky<user>/pub/.../file.json"` (preferred) or `pubky://<user>/pub/...`.
1312
1630
  * @returns {Promise<ResourceStats|undefined>} `undefined` if the resource does not exist.
1313
- * @throws {PubkyJsError} On invalid input or transport/server errors.
1314
- * @param {string} address
1631
+ * @throws {PubkyError} On invalid input or transport/server errors.
1632
+ * @param {Address} address
1315
1633
  * @returns {Promise<ResourceStats | undefined>}
1316
1634
  */
1317
1635
  stats(address) {
@@ -1321,14 +1639,81 @@ class PublicStorage {
1321
1639
  return ret;
1322
1640
  }
1323
1641
  }
1324
- module.exports.PublicStorage = PublicStorage;
1642
+ if (Symbol.dispose) PublicStorage.prototype[Symbol.dispose] = PublicStorage.prototype.free;
1643
+
1644
+ exports.PublicStorage = PublicStorage;
1645
+
1646
+ const SeedExportDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
1647
+ ? { register: () => {}, unregister: () => {} }
1648
+ : new FinalizationRegistry(ptr => wasm.__wbg_seedexportdeeplink_free(ptr >>> 0, 1));
1649
+
1650
+ class SeedExportDeepLink {
1651
+
1652
+ static __wrap(ptr) {
1653
+ ptr = ptr >>> 0;
1654
+ const obj = Object.create(SeedExportDeepLink.prototype);
1655
+ obj.__wbg_ptr = ptr;
1656
+ SeedExportDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
1657
+ return obj;
1658
+ }
1659
+
1660
+ __destroy_into_raw() {
1661
+ const ptr = this.__wbg_ptr;
1662
+ this.__wbg_ptr = 0;
1663
+ SeedExportDeepLinkFinalization.unregister(this);
1664
+ return ptr;
1665
+ }
1666
+
1667
+ free() {
1668
+ const ptr = this.__destroy_into_raw();
1669
+ wasm.__wbg_seedexportdeeplink_free(ptr, 0);
1670
+ }
1671
+ /**
1672
+ * @param {string} url
1673
+ * @returns {SeedExportDeepLink}
1674
+ */
1675
+ static parse(url) {
1676
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1677
+ const len0 = WASM_VECTOR_LEN;
1678
+ const ret = wasm.seedexportdeeplink_parse(ptr0, len0);
1679
+ if (ret[2]) {
1680
+ throw takeFromExternrefTable0(ret[1]);
1681
+ }
1682
+ return SeedExportDeepLink.__wrap(ret[0]);
1683
+ }
1684
+ /**
1685
+ * @returns {Uint8Array}
1686
+ */
1687
+ get secret() {
1688
+ const ret = wasm.seedexportdeeplink_secret(this.__wbg_ptr);
1689
+ return ret;
1690
+ }
1691
+ /**
1692
+ * @returns {string}
1693
+ */
1694
+ toString() {
1695
+ let deferred1_0;
1696
+ let deferred1_1;
1697
+ try {
1698
+ const ret = wasm.seedexportdeeplink_toString(this.__wbg_ptr);
1699
+ deferred1_0 = ret[0];
1700
+ deferred1_1 = ret[1];
1701
+ return getStringFromWasm0(ret[0], ret[1]);
1702
+ } finally {
1703
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1704
+ }
1705
+ }
1706
+ }
1707
+ if (Symbol.dispose) SeedExportDeepLink.prototype[Symbol.dispose] = SeedExportDeepLink.prototype.free;
1708
+
1709
+ exports.SeedExportDeepLink = SeedExportDeepLink;
1325
1710
 
1326
1711
  const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
1327
1712
  ? { register: () => {}, unregister: () => {} }
1328
1713
  : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr >>> 0, 1));
1329
1714
  /**
1330
1715
  * An authenticated context “as the user”.
1331
- * - Use `storage()` for reads/writes (absolute paths like `/pub/app/file.txt`)
1716
+ * - Use `storage` for reads/writes (absolute paths like `/pub/app/file.txt`)
1332
1717
  * - Cookie is managed automatically by the underlying fetch client
1333
1718
  */
1334
1719
  class Session {
@@ -1358,7 +1743,7 @@ class Session {
1358
1743
  * @returns {SessionInfo}
1359
1744
  * @returns {SessionInfo}
1360
1745
  */
1361
- info() {
1746
+ get info() {
1362
1747
  const ret = wasm.session_info(this.__wbg_ptr);
1363
1748
  return SessionInfo.__wrap(ret);
1364
1749
  }
@@ -1368,24 +1753,73 @@ class Session {
1368
1753
  * @returns {SessionStorage}
1369
1754
  * @returns {SessionStorage}
1370
1755
  */
1371
- storage() {
1756
+ get storage() {
1372
1757
  const ret = wasm.session_storage(this.__wbg_ptr);
1373
1758
  return SessionStorage.__wrap(ret);
1374
1759
  }
1375
1760
  /**
1376
1761
  * Invalidate the session on the server (clears server cookie).
1377
- * It also consumes this JS/Wasm Session. Further calls will fail.
1762
+ * Further calls to storage API will fail.
1378
1763
  *
1379
1764
  * @returns {Promise<void>}
1380
1765
  * @returns {Promise<void>}
1381
1766
  */
1382
1767
  signout() {
1383
- const ptr = this.__destroy_into_raw();
1384
- const ret = wasm.session_signout(ptr);
1768
+ const ret = wasm.session_signout(this.__wbg_ptr);
1769
+ return ret;
1770
+ }
1771
+ /**
1772
+ * Export the session metadata so it can be restored after a tab refresh.
1773
+ *
1774
+ * The export string contains **no secrets**; it only serializes the public `SessionInfo`.
1775
+ * Browsers remain responsible for persisting the HTTP-only session cookie.
1776
+ *
1777
+ * @returns {string}
1778
+ * A base64 string to store (e.g. in `localStorage`).
1779
+ * @returns {string}
1780
+ */
1781
+ export() {
1782
+ let deferred1_0;
1783
+ let deferred1_1;
1784
+ try {
1785
+ const ret = wasm.session_export(this.__wbg_ptr);
1786
+ deferred1_0 = ret[0];
1787
+ deferred1_1 = ret[1];
1788
+ return getStringFromWasm0(ret[0], ret[1]);
1789
+ } finally {
1790
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1791
+ }
1792
+ }
1793
+ /**
1794
+ * Restore a session from an `export()` string.
1795
+ *
1796
+ * The HTTP-only cookie must still be present in the browser; this function does not
1797
+ * read or write any secrets.
1798
+ *
1799
+ * @param {string} exported
1800
+ * A string produced by `session.export()`.
1801
+ * @param {Client=} client
1802
+ * Optional client to reuse transport configuration.
1803
+ * @returns {Promise<Session>}
1804
+ * @param {string} exported
1805
+ * @param {Client | null} [client]
1806
+ * @returns {Promise<Session>}
1807
+ */
1808
+ static restore(exported, client) {
1809
+ const ptr0 = passStringToWasm0(exported, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1810
+ const len0 = WASM_VECTOR_LEN;
1811
+ let ptr1 = 0;
1812
+ if (!isLikeNone(client)) {
1813
+ _assertClass(client, Client);
1814
+ ptr1 = client.__destroy_into_raw();
1815
+ }
1816
+ const ret = wasm.session_restore(ptr0, len0, ptr1);
1385
1817
  return ret;
1386
1818
  }
1387
1819
  }
1388
- module.exports.Session = Session;
1820
+ if (Symbol.dispose) Session.prototype[Symbol.dispose] = Session.prototype.free;
1821
+
1822
+ exports.Session = Session;
1389
1823
 
1390
1824
  const SessionInfoFinalization = (typeof FinalizationRegistry === 'undefined')
1391
1825
  ? { register: () => {}, unregister: () => {} }
@@ -1417,10 +1851,15 @@ class SessionInfo {
1417
1851
  /**
1418
1852
  * The user’s public key for this session.
1419
1853
  *
1854
+ * Use `.z32()` on the returned `PublicKey` to get the string form.
1855
+ *
1420
1856
  * @returns {PublicKey}
1857
+ *
1858
+ * @example
1859
+ * const who = sessionInfo.publicKey.z32();
1421
1860
  * @returns {PublicKey}
1422
1861
  */
1423
- publicKey() {
1862
+ get publicKey() {
1424
1863
  const ret = wasm.sessioninfo_publicKey(this.__wbg_ptr);
1425
1864
  return PublicKey.__wrap(ret);
1426
1865
  }
@@ -1430,14 +1869,16 @@ class SessionInfo {
1430
1869
  * @returns {string[]} Normalized capability entries (e.g. `"/pub/app/:rw"`).
1431
1870
  * @returns {string[]}
1432
1871
  */
1433
- capabilities() {
1872
+ get capabilities() {
1434
1873
  const ret = wasm.sessioninfo_capabilities(this.__wbg_ptr);
1435
1874
  var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1436
1875
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1437
1876
  return v1;
1438
1877
  }
1439
1878
  }
1440
- module.exports.SessionInfo = SessionInfo;
1879
+ if (Symbol.dispose) SessionInfo.prototype[Symbol.dispose] = SessionInfo.prototype.free;
1880
+
1881
+ exports.SessionInfo = SessionInfo;
1441
1882
 
1442
1883
  const SessionStorageFinalization = (typeof FinalizationRegistry === 'undefined')
1443
1884
  ? { register: () => {}, unregister: () => {} }
@@ -1469,13 +1910,13 @@ class SessionStorage {
1469
1910
  /**
1470
1911
  * List a directory (absolute session path). Returns `pubky://…` URLs.
1471
1912
  *
1472
- * @param {string} path Must end with `/`.
1913
+ * @param {Path} path Must end with `/`.
1473
1914
  * @param {string|null=} cursor Optional suffix or full URL to start **after**.
1474
1915
  * @param {boolean=} reverse Default `false`.
1475
1916
  * @param {number=} limit Optional result limit.
1476
1917
  * @param {boolean=} shallow Default `false`.
1477
1918
  * @returns {Promise<string[]>}
1478
- * @param {string} path
1919
+ * @param {Path} path
1479
1920
  * @param {string | null} [cursor]
1480
1921
  * @param {boolean | null} [reverse]
1481
1922
  * @param {number | null} [limit]
@@ -1490,12 +1931,26 @@ class SessionStorage {
1490
1931
  const ret = wasm.sessionstorage_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
1491
1932
  return ret;
1492
1933
  }
1934
+ /**
1935
+ * GET a streaming response for an absolute session path.
1936
+ *
1937
+ * @param {Path} path
1938
+ * @returns {Promise<Response>}
1939
+ * @param {Path} path
1940
+ * @returns {Promise<Response>}
1941
+ */
1942
+ get(path) {
1943
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1944
+ const len0 = WASM_VECTOR_LEN;
1945
+ const ret = wasm.sessionstorage_get(this.__wbg_ptr, ptr0, len0);
1946
+ return ret;
1947
+ }
1493
1948
  /**
1494
1949
  * GET bytes from an absolute session path.
1495
1950
  *
1496
- * @param {string} path
1951
+ * @param {Path} path
1497
1952
  * @returns {Promise<Uint8Array>}
1498
- * @param {string} path
1953
+ * @param {Path} path
1499
1954
  * @returns {Promise<Uint8Array>}
1500
1955
  */
1501
1956
  getBytes(path) {
@@ -1507,9 +1962,9 @@ class SessionStorage {
1507
1962
  /**
1508
1963
  * GET text from an absolute session path.
1509
1964
  *
1510
- * @param {string} path
1965
+ * @param {Path} path
1511
1966
  * @returns {Promise<string>}
1512
- * @param {string} path
1967
+ * @param {Path} path
1513
1968
  * @returns {Promise<string>}
1514
1969
  */
1515
1970
  getText(path) {
@@ -1521,13 +1976,13 @@ class SessionStorage {
1521
1976
  /**
1522
1977
  * GET JSON from an absolute session path.
1523
1978
  *
1524
- * @param {string} path
1979
+ * @param {Path} path
1525
1980
  * @returns {Promise<any>}
1526
- * @param {string} addr
1981
+ * @param {Path} path
1527
1982
  * @returns {Promise<any>}
1528
1983
  */
1529
- getJson(addr) {
1530
- const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1984
+ getJson(path) {
1985
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1531
1986
  const len0 = WASM_VECTOR_LEN;
1532
1987
  const ret = wasm.sessionstorage_getJson(this.__wbg_ptr, ptr0, len0);
1533
1988
  return ret;
@@ -1535,9 +1990,9 @@ class SessionStorage {
1535
1990
  /**
1536
1991
  * Check existence.
1537
1992
  *
1538
- * @param {string} path
1993
+ * @param {Path} path
1539
1994
  * @returns {Promise<boolean>}
1540
- * @param {string} path
1995
+ * @param {Path} path
1541
1996
  * @returns {Promise<boolean>}
1542
1997
  */
1543
1998
  exists(path) {
@@ -1549,10 +2004,10 @@ class SessionStorage {
1549
2004
  /**
1550
2005
  * Get metadata for an absolute, session-scoped path (e.g. `"/pub/app/file.json"`).
1551
2006
  *
1552
- * @param {string} path Absolute path under your user (starts with `/`).
2007
+ * @param {Path} path Absolute path under your user (starts with `/`).
1553
2008
  * @returns {Promise<ResourceStats|undefined>} `undefined` if the resource does not exist.
1554
- * @throws {PubkyJsError} On invalid input or transport/server errors.
1555
- * @param {string} path
2009
+ * @throws {PubkyError} On invalid input or transport/server errors.
2010
+ * @param {Path} path
1556
2011
  * @returns {Promise<ResourceStats | undefined>}
1557
2012
  */
1558
2013
  stats(path) {
@@ -1564,10 +2019,10 @@ class SessionStorage {
1564
2019
  /**
1565
2020
  * PUT binary at an absolute session path.
1566
2021
  *
1567
- * @param {string} path
2022
+ * @param {Path} path
1568
2023
  * @param {Uint8Array} bytes
1569
2024
  * @returns {Promise<void>}
1570
- * @param {string} path
2025
+ * @param {Path} path
1571
2026
  * @param {Uint8Array} body
1572
2027
  * @returns {Promise<void>}
1573
2028
  */
@@ -1582,10 +2037,10 @@ class SessionStorage {
1582
2037
  /**
1583
2038
  * PUT text at an absolute session path.
1584
2039
  *
1585
- * @param {string} path
2040
+ * @param {Path} path
1586
2041
  * @param {string} text
1587
2042
  * @returns {Promise<void>}
1588
- * @param {string} path
2043
+ * @param {Path} path
1589
2044
  * @param {string} body
1590
2045
  * @returns {Promise<void>}
1591
2046
  */
@@ -1600,10 +2055,10 @@ class SessionStorage {
1600
2055
  /**
1601
2056
  * PUT JSON at an absolute session path.
1602
2057
  *
1603
- * @param {string} path Absolute path (e.g. `"/pub/app/data.json"`).
2058
+ * @param {Path} path Absolute path (e.g. `"/pub/app/data.json"`).
1604
2059
  * @param {any} value JSON-serializable value.
1605
2060
  * @returns {Promise<void>}
1606
- * @param {string} path
2061
+ * @param {Path} path
1607
2062
  * @param {any} body
1608
2063
  * @returns {Promise<void>}
1609
2064
  */
@@ -1616,9 +2071,9 @@ class SessionStorage {
1616
2071
  /**
1617
2072
  * Delete a path (file or empty directory).
1618
2073
  *
1619
- * @param {string} path
2074
+ * @param {Path} path
1620
2075
  * @returns {Promise<void>}
1621
- * @param {string} path
2076
+ * @param {Path} path
1622
2077
  * @returns {Promise<void>}
1623
2078
  */
1624
2079
  delete(path) {
@@ -1628,7 +2083,9 @@ class SessionStorage {
1628
2083
  return ret;
1629
2084
  }
1630
2085
  }
1631
- module.exports.SessionStorage = SessionStorage;
2086
+ if (Symbol.dispose) SessionStorage.prototype[Symbol.dispose] = SessionStorage.prototype.free;
2087
+
2088
+ exports.SessionStorage = SessionStorage;
1632
2089
 
1633
2090
  const SignerFinalization = (typeof FinalizationRegistry === 'undefined')
1634
2091
  ? { register: () => {}, unregister: () => {} }
@@ -1672,7 +2129,10 @@ class Signer {
1672
2129
  static fromKeypair(keypair) {
1673
2130
  _assertClass(keypair, Keypair);
1674
2131
  const ret = wasm.signer_fromKeypair(keypair.__wbg_ptr);
1675
- return Signer.__wrap(ret);
2132
+ if (ret[2]) {
2133
+ throw takeFromExternrefTable0(ret[1]);
2134
+ }
2135
+ return Signer.__wrap(ret[0]);
1676
2136
  }
1677
2137
  /**
1678
2138
  * Get the public key of this signer.
@@ -1680,7 +2140,7 @@ class Signer {
1680
2140
  * @returns {PublicKey}
1681
2141
  * @returns {PublicKey}
1682
2142
  */
1683
- publicKey() {
2143
+ get publicKey() {
1684
2144
  const ret = wasm.signer_publicKey(this.__wbg_ptr);
1685
2145
  return PublicKey.__wrap(ret);
1686
2146
  }
@@ -1693,7 +2153,7 @@ class Signer {
1693
2153
  * @param {string|null} signupToken Invite/registration token or `null`.
1694
2154
  * @returns {Promise<Session>}
1695
2155
  *
1696
- * @throws {PubkyJsError}
2156
+ * @throws {PubkyError}
1697
2157
  * - `AuthenticationError` (bad/expired token)
1698
2158
  * - `RequestError` (network/server)
1699
2159
  * @param {PublicKey} homeserver
@@ -1714,7 +2174,7 @@ class Signer {
1714
2174
  *
1715
2175
  * @returns {Promise<Session>}
1716
2176
  *
1717
- * @throws {PubkyJsError}
2177
+ * @throws {PubkyError}
1718
2178
  * @returns {Promise<Session>}
1719
2179
  */
1720
2180
  signin() {
@@ -1748,21 +2208,235 @@ class Signer {
1748
2208
  * Get a PKDNS actor bound to this signer's client & keypair (publishing enabled).
1749
2209
  *
1750
2210
  * @returns {Pkdns}
2211
+ *
2212
+ * @example
2213
+ * await signer.pkdns.publishHomeserverIfStale(homeserverPk);
1751
2214
  * @returns {Pkdns}
1752
2215
  */
1753
- pkdns() {
2216
+ get pkdns() {
1754
2217
  const ret = wasm.signer_pkdns(this.__wbg_ptr);
1755
2218
  return Pkdns.__wrap(ret);
1756
2219
  }
1757
2220
  }
1758
- module.exports.Signer = Signer;
2221
+ if (Symbol.dispose) Signer.prototype[Symbol.dispose] = Signer.prototype.free;
2222
+
2223
+ exports.Signer = Signer;
2224
+
2225
+ const SigninDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
2226
+ ? { register: () => {}, unregister: () => {} }
2227
+ : new FinalizationRegistry(ptr => wasm.__wbg_signindeeplink_free(ptr >>> 0, 1));
2228
+
2229
+ class SigninDeepLink {
1759
2230
 
1760
- module.exports.__wbg_Error_0497d5bdba9362e5 = function(arg0, arg1) {
2231
+ static __wrap(ptr) {
2232
+ ptr = ptr >>> 0;
2233
+ const obj = Object.create(SigninDeepLink.prototype);
2234
+ obj.__wbg_ptr = ptr;
2235
+ SigninDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
2236
+ return obj;
2237
+ }
2238
+
2239
+ __destroy_into_raw() {
2240
+ const ptr = this.__wbg_ptr;
2241
+ this.__wbg_ptr = 0;
2242
+ SigninDeepLinkFinalization.unregister(this);
2243
+ return ptr;
2244
+ }
2245
+
2246
+ free() {
2247
+ const ptr = this.__destroy_into_raw();
2248
+ wasm.__wbg_signindeeplink_free(ptr, 0);
2249
+ }
2250
+ /**
2251
+ * @param {string} url
2252
+ * @returns {SigninDeepLink}
2253
+ */
2254
+ static parse(url) {
2255
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2256
+ const len0 = WASM_VECTOR_LEN;
2257
+ const ret = wasm.signindeeplink_parse(ptr0, len0);
2258
+ if (ret[2]) {
2259
+ throw takeFromExternrefTable0(ret[1]);
2260
+ }
2261
+ return SigninDeepLink.__wrap(ret[0]);
2262
+ }
2263
+ /**
2264
+ * @returns {string}
2265
+ */
2266
+ get capabilities() {
2267
+ let deferred1_0;
2268
+ let deferred1_1;
2269
+ try {
2270
+ const ret = wasm.signindeeplink_capabilities(this.__wbg_ptr);
2271
+ deferred1_0 = ret[0];
2272
+ deferred1_1 = ret[1];
2273
+ return getStringFromWasm0(ret[0], ret[1]);
2274
+ } finally {
2275
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2276
+ }
2277
+ }
2278
+ /**
2279
+ * @returns {string}
2280
+ */
2281
+ get baseRelayUrl() {
2282
+ let deferred1_0;
2283
+ let deferred1_1;
2284
+ try {
2285
+ const ret = wasm.signindeeplink_baseRelayUrl(this.__wbg_ptr);
2286
+ deferred1_0 = ret[0];
2287
+ deferred1_1 = ret[1];
2288
+ return getStringFromWasm0(ret[0], ret[1]);
2289
+ } finally {
2290
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2291
+ }
2292
+ }
2293
+ /**
2294
+ * @returns {Uint8Array}
2295
+ */
2296
+ get secret() {
2297
+ const ret = wasm.signindeeplink_secret(this.__wbg_ptr);
2298
+ return ret;
2299
+ }
2300
+ /**
2301
+ * @returns {string}
2302
+ */
2303
+ toString() {
2304
+ let deferred1_0;
2305
+ let deferred1_1;
2306
+ try {
2307
+ const ret = wasm.signindeeplink_toString(this.__wbg_ptr);
2308
+ deferred1_0 = ret[0];
2309
+ deferred1_1 = ret[1];
2310
+ return getStringFromWasm0(ret[0], ret[1]);
2311
+ } finally {
2312
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2313
+ }
2314
+ }
2315
+ }
2316
+ if (Symbol.dispose) SigninDeepLink.prototype[Symbol.dispose] = SigninDeepLink.prototype.free;
2317
+
2318
+ exports.SigninDeepLink = SigninDeepLink;
2319
+
2320
+ const SignupDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
2321
+ ? { register: () => {}, unregister: () => {} }
2322
+ : new FinalizationRegistry(ptr => wasm.__wbg_signupdeeplink_free(ptr >>> 0, 1));
2323
+
2324
+ class SignupDeepLink {
2325
+
2326
+ static __wrap(ptr) {
2327
+ ptr = ptr >>> 0;
2328
+ const obj = Object.create(SignupDeepLink.prototype);
2329
+ obj.__wbg_ptr = ptr;
2330
+ SignupDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
2331
+ return obj;
2332
+ }
2333
+
2334
+ __destroy_into_raw() {
2335
+ const ptr = this.__wbg_ptr;
2336
+ this.__wbg_ptr = 0;
2337
+ SignupDeepLinkFinalization.unregister(this);
2338
+ return ptr;
2339
+ }
2340
+
2341
+ free() {
2342
+ const ptr = this.__destroy_into_raw();
2343
+ wasm.__wbg_signupdeeplink_free(ptr, 0);
2344
+ }
2345
+ /**
2346
+ * @param {string} url
2347
+ * @returns {SignupDeepLink}
2348
+ */
2349
+ static parse(url) {
2350
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2351
+ const len0 = WASM_VECTOR_LEN;
2352
+ const ret = wasm.signupdeeplink_parse(ptr0, len0);
2353
+ if (ret[2]) {
2354
+ throw takeFromExternrefTable0(ret[1]);
2355
+ }
2356
+ return SignupDeepLink.__wrap(ret[0]);
2357
+ }
2358
+ /**
2359
+ * @returns {string}
2360
+ */
2361
+ get capabilities() {
2362
+ let deferred1_0;
2363
+ let deferred1_1;
2364
+ try {
2365
+ const ret = wasm.signupdeeplink_capabilities(this.__wbg_ptr);
2366
+ deferred1_0 = ret[0];
2367
+ deferred1_1 = ret[1];
2368
+ return getStringFromWasm0(ret[0], ret[1]);
2369
+ } finally {
2370
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2371
+ }
2372
+ }
2373
+ /**
2374
+ * @returns {string}
2375
+ */
2376
+ get baseRelayUrl() {
2377
+ let deferred1_0;
2378
+ let deferred1_1;
2379
+ try {
2380
+ const ret = wasm.signupdeeplink_baseRelayUrl(this.__wbg_ptr);
2381
+ deferred1_0 = ret[0];
2382
+ deferred1_1 = ret[1];
2383
+ return getStringFromWasm0(ret[0], ret[1]);
2384
+ } finally {
2385
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2386
+ }
2387
+ }
2388
+ /**
2389
+ * @returns {Uint8Array}
2390
+ */
2391
+ get secret() {
2392
+ const ret = wasm.signupdeeplink_secret(this.__wbg_ptr);
2393
+ return ret;
2394
+ }
2395
+ /**
2396
+ * @returns {PublicKey}
2397
+ */
2398
+ get homeserver() {
2399
+ const ret = wasm.signupdeeplink_homeserver(this.__wbg_ptr);
2400
+ return PublicKey.__wrap(ret);
2401
+ }
2402
+ /**
2403
+ * @returns {string | undefined}
2404
+ */
2405
+ get signupToken() {
2406
+ const ret = wasm.signupdeeplink_signupToken(this.__wbg_ptr);
2407
+ let v1;
2408
+ if (ret[0] !== 0) {
2409
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2410
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2411
+ }
2412
+ return v1;
2413
+ }
2414
+ /**
2415
+ * @returns {string}
2416
+ */
2417
+ toString() {
2418
+ let deferred1_0;
2419
+ let deferred1_1;
2420
+ try {
2421
+ const ret = wasm.signupdeeplink_toString(this.__wbg_ptr);
2422
+ deferred1_0 = ret[0];
2423
+ deferred1_1 = ret[1];
2424
+ return getStringFromWasm0(ret[0], ret[1]);
2425
+ } finally {
2426
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2427
+ }
2428
+ }
2429
+ }
2430
+ if (Symbol.dispose) SignupDeepLink.prototype[Symbol.dispose] = SignupDeepLink.prototype.free;
2431
+
2432
+ exports.SignupDeepLink = SignupDeepLink;
2433
+
2434
+ exports.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
1761
2435
  const ret = Error(getStringFromWasm0(arg0, arg1));
1762
2436
  return ret;
1763
2437
  };
1764
2438
 
1765
- module.exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
2439
+ exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1766
2440
  const ret = String(arg1);
1767
2441
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1768
2442
  const len1 = WASM_VECTOR_LEN;
@@ -1770,119 +2444,272 @@ module.exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1770
2444
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1771
2445
  };
1772
2446
 
1773
- module.exports.__wbg_abort_18ba44d46e13d7fe = function(arg0) {
1774
- arg0.abort();
2447
+ exports.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
2448
+ const v = arg1;
2449
+ const ret = typeof(v) === 'bigint' ? v : undefined;
2450
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2451
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2452
+ };
2453
+
2454
+ exports.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
2455
+ const v = arg0;
2456
+ const ret = typeof(v) === 'boolean' ? v : undefined;
2457
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2458
+ };
2459
+
2460
+ exports.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
2461
+ const ret = debugString(arg1);
2462
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2463
+ const len1 = WASM_VECTOR_LEN;
2464
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2465
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2466
+ };
2467
+
2468
+ exports.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
2469
+ const ret = arg0 in arg1;
2470
+ return ret;
2471
+ };
2472
+
2473
+ exports.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
2474
+ const ret = typeof(arg0) === 'bigint';
2475
+ return ret;
2476
+ };
2477
+
2478
+ exports.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
2479
+ const ret = typeof(arg0) === 'function';
2480
+ return ret;
2481
+ };
2482
+
2483
+ exports.__wbg___wbindgen_is_null_5e69f72e906cc57c = function(arg0) {
2484
+ const ret = arg0 === null;
2485
+ return ret;
2486
+ };
2487
+
2488
+ exports.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
2489
+ const val = arg0;
2490
+ const ret = typeof(val) === 'object' && val !== null;
2491
+ return ret;
2492
+ };
2493
+
2494
+ exports.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
2495
+ const ret = typeof(arg0) === 'string';
2496
+ return ret;
1775
2497
  };
1776
2498
 
1777
- module.exports.__wbg_abort_4198a1129c47f21a = function(arg0, arg1) {
2499
+ exports.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
2500
+ const ret = arg0 === undefined;
2501
+ return ret;
2502
+ };
2503
+
2504
+ exports.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
2505
+ const ret = arg0 === arg1;
2506
+ return ret;
2507
+ };
2508
+
2509
+ exports.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
2510
+ const ret = arg0 == arg1;
2511
+ return ret;
2512
+ };
2513
+
2514
+ exports.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
2515
+ const obj = arg1;
2516
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2517
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2518
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2519
+ };
2520
+
2521
+ exports.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
2522
+ const obj = arg1;
2523
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2524
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2525
+ var len1 = WASM_VECTOR_LEN;
2526
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2527
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2528
+ };
2529
+
2530
+ exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
2531
+ throw new Error(getStringFromWasm0(arg0, arg1));
2532
+ };
2533
+
2534
+ exports.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
2535
+ arg0._wbg_cb_unref();
2536
+ };
2537
+
2538
+ exports.__wbg_abort_28ad55c5825b004d = function(arg0, arg1) {
1778
2539
  arg0.abort(arg1);
1779
2540
  };
1780
2541
 
1781
- module.exports.__wbg_append_0342728346e47425 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2542
+ exports.__wbg_abort_e7eb059f72f9ed0c = function(arg0) {
2543
+ arg0.abort();
2544
+ };
2545
+
2546
+ exports.__wbg_append_b577eb3a177bc0fa = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1782
2547
  arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1783
2548
  }, arguments) };
1784
2549
 
1785
- module.exports.__wbg_arrayBuffer_d58b858456021d7f = function() { return handleError(function (arg0) {
2550
+ exports.__wbg_arrayBuffer_b375eccb84b4ddf3 = function() { return handleError(function (arg0) {
1786
2551
  const ret = arg0.arrayBuffer();
1787
2552
  return ret;
1788
2553
  }, arguments) };
1789
2554
 
1790
- module.exports.__wbg_authtoken_new = function(arg0) {
2555
+ exports.__wbg_authtoken_new = function(arg0) {
1791
2556
  const ret = AuthToken.__wrap(arg0);
1792
2557
  return ret;
1793
2558
  };
1794
2559
 
1795
- module.exports.__wbg_buffer_a1a27a0dfa70165d = function(arg0) {
2560
+ exports.__wbg_body_587542b2fd8e06c0 = function(arg0) {
2561
+ const ret = arg0.body;
2562
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2563
+ };
2564
+
2565
+ exports.__wbg_buffer_ccc4520b36d3ccf4 = function(arg0) {
1796
2566
  const ret = arg0.buffer;
1797
2567
  return ret;
1798
2568
  };
1799
2569
 
1800
- module.exports.__wbg_call_f2db6205e5c51dc8 = function() { return handleError(function (arg0, arg1, arg2) {
2570
+ exports.__wbg_byobRequest_2344e6975f27456e = function(arg0) {
2571
+ const ret = arg0.byobRequest;
2572
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2573
+ };
2574
+
2575
+ exports.__wbg_byteLength_bcd42e4025299788 = function(arg0) {
2576
+ const ret = arg0.byteLength;
2577
+ return ret;
2578
+ };
2579
+
2580
+ exports.__wbg_byteOffset_ca3a6cf7944b364b = function(arg0) {
2581
+ const ret = arg0.byteOffset;
2582
+ return ret;
2583
+ };
2584
+
2585
+ exports.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
1801
2586
  const ret = arg0.call(arg1, arg2);
1802
2587
  return ret;
1803
2588
  }, arguments) };
1804
2589
 
1805
- module.exports.__wbg_call_fbe8be8bf6436ce5 = function() { return handleError(function (arg0, arg1) {
2590
+ exports.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
1806
2591
  const ret = arg0.call(arg1);
1807
2592
  return ret;
1808
2593
  }, arguments) };
1809
2594
 
1810
- module.exports.__wbg_clearTimeout_6222fede17abcb1a = function(arg0) {
2595
+ exports.__wbg_cancel_48ab6f9dc366e369 = function(arg0) {
2596
+ const ret = arg0.cancel();
2597
+ return ret;
2598
+ };
2599
+
2600
+ exports.__wbg_catch_943836faa5d29bfb = function(arg0, arg1) {
2601
+ const ret = arg0.catch(arg1);
2602
+ return ret;
2603
+ };
2604
+
2605
+ exports.__wbg_clearTimeout_7a42b49784aea641 = function(arg0) {
1811
2606
  const ret = clearTimeout(arg0);
1812
2607
  return ret;
1813
2608
  };
1814
2609
 
1815
- module.exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
2610
+ exports.__wbg_close_5a6caed3231b68cd = function() { return handleError(function (arg0) {
2611
+ arg0.close();
2612
+ }, arguments) };
2613
+
2614
+ exports.__wbg_close_6956df845478561a = function() { return handleError(function (arg0) {
2615
+ arg0.close();
2616
+ }, arguments) };
2617
+
2618
+ exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
1816
2619
  const ret = arg0.crypto;
1817
2620
  return ret;
1818
2621
  };
1819
2622
 
1820
- module.exports.__wbg_debug_103948ed4c500577 = function(arg0, arg1, arg2, arg3) {
2623
+ exports.__wbg_debug_e55e1461940eb14d = function(arg0, arg1, arg2, arg3) {
1821
2624
  console.debug(arg0, arg1, arg2, arg3);
1822
2625
  };
1823
2626
 
1824
- module.exports.__wbg_done_4d01f352bade43b7 = function(arg0) {
2627
+ exports.__wbg_done_2042aa2670fb1db1 = function(arg0) {
1825
2628
  const ret = arg0.done;
1826
2629
  return ret;
1827
2630
  };
1828
2631
 
1829
- module.exports.__wbg_entries_41651c850143b957 = function(arg0) {
2632
+ exports.__wbg_enqueue_7b18a650aec77898 = function() { return handleError(function (arg0, arg1) {
2633
+ arg0.enqueue(arg1);
2634
+ }, arguments) };
2635
+
2636
+ exports.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
1830
2637
  const ret = Object.entries(arg0);
1831
2638
  return ret;
1832
2639
  };
1833
2640
 
1834
- module.exports.__wbg_error_624160881466fd69 = function(arg0, arg1, arg2, arg3) {
2641
+ exports.__wbg_error_d8b22cf4e59a6791 = function(arg0, arg1, arg2, arg3) {
1835
2642
  console.error(arg0, arg1, arg2, arg3);
1836
2643
  };
1837
2644
 
1838
- module.exports.__wbg_fetch_0fde801b2e1aa024 = function(arg0) {
2645
+ exports.__wbg_fetch_74a3e84ebd2c9a0e = function(arg0) {
1839
2646
  const ret = fetch(arg0);
1840
2647
  return ret;
1841
2648
  };
1842
2649
 
1843
- module.exports.__wbg_fetch_a8e43a4e138dfc93 = function(arg0, arg1) {
2650
+ exports.__wbg_fetch_cd778f2325984326 = function(arg0) {
2651
+ const ret = fetch(arg0);
2652
+ return ret;
2653
+ };
2654
+
2655
+ exports.__wbg_fetch_f8ba0e29a9d6de0d = function(arg0, arg1) {
1844
2656
  const ret = arg0.fetch(arg1);
1845
2657
  return ret;
1846
2658
  };
1847
2659
 
1848
- module.exports.__wbg_fetch_f156d10be9a5c88a = function(arg0) {
1849
- const ret = fetch(arg0);
2660
+ exports.__wbg_from_a4ad7cbddd0d7135 = function(arg0) {
2661
+ const ret = Array.from(arg0);
1850
2662
  return ret;
1851
2663
  };
1852
2664
 
1853
- module.exports.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) {
2665
+ exports.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
1854
2666
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1855
2667
  }, arguments) };
1856
2668
 
1857
- module.exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
2669
+ exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
1858
2670
  arg0.getRandomValues(arg1);
1859
2671
  }, arguments) };
1860
2672
 
1861
- module.exports.__wbg_get_92470be87867c2e5 = function() { return handleError(function (arg0, arg1) {
1862
- const ret = Reflect.get(arg0, arg1);
2673
+ exports.__wbg_getReader_48e00749fe3f6089 = function() { return handleError(function (arg0) {
2674
+ const ret = arg0.getReader();
1863
2675
  return ret;
1864
2676
  }, arguments) };
1865
2677
 
1866
- module.exports.__wbg_get_a131a44bd1eb6979 = function(arg0, arg1) {
2678
+ exports.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
1867
2679
  const ret = arg0[arg1 >>> 0];
1868
2680
  return ret;
1869
2681
  };
1870
2682
 
1871
- module.exports.__wbg_has_809e438ee9d787a7 = function() { return handleError(function (arg0, arg1) {
2683
+ exports.__wbg_get_done_a0463af43a1fc764 = function(arg0) {
2684
+ const ret = arg0.done;
2685
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2686
+ };
2687
+
2688
+ exports.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
2689
+ const ret = Reflect.get(arg0, arg1);
2690
+ return ret;
2691
+ }, arguments) };
2692
+
2693
+ exports.__wbg_get_value_5ce96c9f81ce7398 = function(arg0) {
2694
+ const ret = arg0.value;
2695
+ return ret;
2696
+ };
2697
+
2698
+ exports.__wbg_has_787fafc980c3ccdb = function() { return handleError(function (arg0, arg1) {
1872
2699
  const ret = Reflect.has(arg0, arg1);
1873
2700
  return ret;
1874
2701
  }, arguments) };
1875
2702
 
1876
- module.exports.__wbg_headers_0f0cbdc6290b6780 = function(arg0) {
2703
+ exports.__wbg_headers_b87d7eaba61c3278 = function(arg0) {
1877
2704
  const ret = arg0.headers;
1878
2705
  return ret;
1879
2706
  };
1880
2707
 
1881
- module.exports.__wbg_info_a1cc312ecc877319 = function(arg0, arg1, arg2, arg3) {
2708
+ exports.__wbg_info_68cd5b51ef7e5137 = function(arg0, arg1, arg2, arg3) {
1882
2709
  console.info(arg0, arg1, arg2, arg3);
1883
2710
  };
1884
2711
 
1885
- module.exports.__wbg_instanceof_ArrayBuffer_a8b6f580b363f2bc = function(arg0) {
2712
+ exports.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
1886
2713
  let result;
1887
2714
  try {
1888
2715
  result = arg0 instanceof ArrayBuffer;
@@ -1893,7 +2720,18 @@ module.exports.__wbg_instanceof_ArrayBuffer_a8b6f580b363f2bc = function(arg0) {
1893
2720
  return ret;
1894
2721
  };
1895
2722
 
1896
- module.exports.__wbg_instanceof_Headers_8b4c0df841a5ed48 = function(arg0) {
2723
+ exports.__wbg_instanceof_Error_a944ec10920129e2 = function(arg0) {
2724
+ let result;
2725
+ try {
2726
+ result = arg0 instanceof Error;
2727
+ } catch (_) {
2728
+ result = false;
2729
+ }
2730
+ const ret = result;
2731
+ return ret;
2732
+ };
2733
+
2734
+ exports.__wbg_instanceof_Headers_e1daf97ed6a469e9 = function(arg0) {
1897
2735
  let result;
1898
2736
  try {
1899
2737
  result = arg0 instanceof Headers;
@@ -1904,7 +2742,7 @@ module.exports.__wbg_instanceof_Headers_8b4c0df841a5ed48 = function(arg0) {
1904
2742
  return ret;
1905
2743
  };
1906
2744
 
1907
- module.exports.__wbg_instanceof_Map_80cc65041c96417a = function(arg0) {
2745
+ exports.__wbg_instanceof_Map_8579b5e2ab5437c7 = function(arg0) {
1908
2746
  let result;
1909
2747
  try {
1910
2748
  result = arg0 instanceof Map;
@@ -1915,7 +2753,7 @@ module.exports.__wbg_instanceof_Map_80cc65041c96417a = function(arg0) {
1915
2753
  return ret;
1916
2754
  };
1917
2755
 
1918
- module.exports.__wbg_instanceof_Response_e80ce8b7a2b968d2 = function(arg0) {
2756
+ exports.__wbg_instanceof_Response_f4f3e87e07f3135c = function(arg0) {
1919
2757
  let result;
1920
2758
  try {
1921
2759
  result = arg0 instanceof Response;
@@ -1926,7 +2764,7 @@ module.exports.__wbg_instanceof_Response_e80ce8b7a2b968d2 = function(arg0) {
1926
2764
  return ret;
1927
2765
  };
1928
2766
 
1929
- module.exports.__wbg_instanceof_Uint8Array_ca460677bc155827 = function(arg0) {
2767
+ exports.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
1930
2768
  let result;
1931
2769
  try {
1932
2770
  result = arg0 instanceof Uint8Array;
@@ -1937,73 +2775,58 @@ module.exports.__wbg_instanceof_Uint8Array_ca460677bc155827 = function(arg0) {
1937
2775
  return ret;
1938
2776
  };
1939
2777
 
1940
- module.exports.__wbg_isArray_5f090bed72bd4f89 = function(arg0) {
2778
+ exports.__wbg_isArray_96e0af9891d0945d = function(arg0) {
1941
2779
  const ret = Array.isArray(arg0);
1942
2780
  return ret;
1943
2781
  };
1944
2782
 
1945
- module.exports.__wbg_isSafeInteger_90d7c4674047d684 = function(arg0) {
2783
+ exports.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
1946
2784
  const ret = Number.isSafeInteger(arg0);
1947
2785
  return ret;
1948
2786
  };
1949
2787
 
1950
- module.exports.__wbg_iterator_4068add5b2aef7a6 = function() {
2788
+ exports.__wbg_iterator_e5822695327a3c39 = function() {
1951
2789
  const ret = Symbol.iterator;
1952
2790
  return ret;
1953
2791
  };
1954
2792
 
1955
- module.exports.__wbg_length_ab6d22b5ead75c72 = function(arg0) {
2793
+ exports.__wbg_length_69bca3cb64fc8748 = function(arg0) {
1956
2794
  const ret = arg0.length;
1957
2795
  return ret;
1958
2796
  };
1959
2797
 
1960
- module.exports.__wbg_length_f00ec12454a5d9fd = function(arg0) {
2798
+ exports.__wbg_length_cdd215e10d9dd507 = function(arg0) {
1961
2799
  const ret = arg0.length;
1962
2800
  return ret;
1963
2801
  };
1964
2802
 
1965
- module.exports.__wbg_log_bff357b3df4db934 = function(arg0, arg1, arg2, arg3) {
2803
+ exports.__wbg_log_45eb3a49e7cdcb64 = function(arg0, arg1, arg2, arg3) {
1966
2804
  console.log(arg0, arg1, arg2, arg3);
1967
2805
  };
1968
2806
 
1969
- module.exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
2807
+ exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
1970
2808
  const ret = arg0.msCrypto;
1971
2809
  return ret;
1972
2810
  };
1973
2811
 
1974
- module.exports.__wbg_new_07b483f72211fd66 = function() {
2812
+ exports.__wbg_new_1acc0b6eea89d040 = function() {
1975
2813
  const ret = new Object();
1976
2814
  return ret;
1977
2815
  };
1978
2816
 
1979
- module.exports.__wbg_new_186abcfdff244e42 = function() { return handleError(function () {
2817
+ exports.__wbg_new_2531773dac38ebb3 = function() { return handleError(function () {
1980
2818
  const ret = new AbortController();
1981
2819
  return ret;
1982
2820
  }, arguments) };
1983
2821
 
1984
- module.exports.__wbg_new_4796e1cd2eb9ea6d = function() { return handleError(function () {
1985
- const ret = new Headers();
1986
- return ret;
1987
- }, arguments) };
1988
-
1989
- module.exports.__wbg_new_58353953ad2097cc = function() {
1990
- const ret = new Array();
1991
- return ret;
1992
- };
1993
-
1994
- module.exports.__wbg_new_a979b4b45bd55c7f = function() {
1995
- const ret = new Map();
1996
- return ret;
1997
- };
1998
-
1999
- module.exports.__wbg_new_e30c39c06edaabf2 = function(arg0, arg1) {
2822
+ exports.__wbg_new_3c3d849046688a66 = function(arg0, arg1) {
2000
2823
  try {
2001
2824
  var state0 = {a: arg0, b: arg1};
2002
2825
  var cb0 = (arg0, arg1) => {
2003
2826
  const a = state0.a;
2004
2827
  state0.a = 0;
2005
2828
  try {
2006
- return __wbg_adapter_120(a, state0.b, arg0, arg1);
2829
+ return wasm_bindgen__convert__closures_____invoke__h07d45d2c9c5e1bbe(a, state0.b, arg0, arg1);
2007
2830
  } finally {
2008
2831
  state0.a = a;
2009
2832
  }
@@ -2015,209 +2838,296 @@ module.exports.__wbg_new_e30c39c06edaabf2 = function(arg0, arg1) {
2015
2838
  }
2016
2839
  };
2017
2840
 
2018
- module.exports.__wbg_new_e52b3efaaa774f96 = function(arg0) {
2841
+ exports.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
2019
2842
  const ret = new Uint8Array(arg0);
2020
2843
  return ret;
2021
2844
  };
2022
2845
 
2023
- module.exports.__wbg_newfromslice_7c05ab1297cb2d88 = function(arg0, arg1) {
2846
+ exports.__wbg_new_68651c719dcda04e = function() {
2847
+ const ret = new Map();
2848
+ return ret;
2849
+ };
2850
+
2851
+ exports.__wbg_new_9edf9838a2def39c = function() { return handleError(function () {
2852
+ const ret = new Headers();
2853
+ return ret;
2854
+ }, arguments) };
2855
+
2856
+ exports.__wbg_new_a7442b4b19c1a356 = function(arg0, arg1) {
2857
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2858
+ return ret;
2859
+ };
2860
+
2861
+ exports.__wbg_new_e17d9f43105b08be = function() {
2862
+ const ret = new Array();
2863
+ return ret;
2864
+ };
2865
+
2866
+ exports.__wbg_new_from_slice_92f4d78ca282a2d2 = function(arg0, arg1) {
2024
2867
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2025
2868
  return ret;
2026
2869
  };
2027
2870
 
2028
- module.exports.__wbg_newnoargs_ff528e72d35de39a = function(arg0, arg1) {
2871
+ exports.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
2029
2872
  const ret = new Function(getStringFromWasm0(arg0, arg1));
2030
2873
  return ret;
2031
2874
  };
2032
2875
 
2033
- module.exports.__wbg_newwithbyteoffsetandlength_3b01ecda099177e8 = function(arg0, arg1, arg2) {
2876
+ exports.__wbg_new_with_byte_offset_and_length_46e3e6a5e9f9e89b = function(arg0, arg1, arg2) {
2034
2877
  const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
2035
2878
  return ret;
2036
2879
  };
2037
2880
 
2038
- module.exports.__wbg_newwithlength_08f872dc1e3ada2e = function(arg0) {
2881
+ exports.__wbg_new_with_into_underlying_source_b47f6a6a596a7f24 = function(arg0, arg1) {
2882
+ const ret = new ReadableStream(IntoUnderlyingSource.__wrap(arg0), arg1);
2883
+ return ret;
2884
+ };
2885
+
2886
+ exports.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
2039
2887
  const ret = new Uint8Array(arg0 >>> 0);
2040
2888
  return ret;
2041
2889
  };
2042
2890
 
2043
- module.exports.__wbg_newwithstrandinit_f8a9dbe009d6be37 = function() { return handleError(function (arg0, arg1, arg2) {
2044
- const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
2891
+ exports.__wbg_new_with_opt_readable_stream_and_init_b3dac7204db32cac = function() { return handleError(function (arg0, arg1) {
2892
+ const ret = new Response(arg0, arg1);
2045
2893
  return ret;
2046
2894
  }, arguments) };
2047
2895
 
2048
- module.exports.__wbg_next_8bb824d217961b5d = function(arg0) {
2049
- const ret = arg0.next;
2896
+ exports.__wbg_new_with_str_and_init_0ae7728b6ec367b1 = function() { return handleError(function (arg0, arg1, arg2) {
2897
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
2050
2898
  return ret;
2051
- };
2899
+ }, arguments) };
2052
2900
 
2053
- module.exports.__wbg_next_e2da48d8fff7439a = function() { return handleError(function (arg0) {
2901
+ exports.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
2054
2902
  const ret = arg0.next();
2055
2903
  return ret;
2056
2904
  }, arguments) };
2057
2905
 
2058
- module.exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
2906
+ exports.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
2907
+ const ret = arg0.next;
2908
+ return ret;
2909
+ };
2910
+
2911
+ exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
2059
2912
  const ret = arg0.node;
2060
2913
  return ret;
2061
2914
  };
2062
2915
 
2063
- module.exports.__wbg_now_eb0821f3bd9f6529 = function() {
2916
+ exports.__wbg_now_2c95c9de01293173 = function(arg0) {
2917
+ const ret = arg0.now();
2918
+ return ret;
2919
+ };
2920
+
2921
+ exports.__wbg_now_793306c526e2e3b6 = function() {
2064
2922
  const ret = Date.now();
2065
2923
  return ret;
2066
2924
  };
2067
2925
 
2068
- module.exports.__wbg_parse_c7ba327fb6231e7f = function() { return handleError(function (arg0, arg1) {
2926
+ exports.__wbg_parse_2a704d6b78abb2b8 = function() { return handleError(function (arg0, arg1) {
2069
2927
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
2070
2928
  return ret;
2071
2929
  }, arguments) };
2072
2930
 
2073
- module.exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
2074
- const ret = arg0.process;
2931
+ exports.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
2932
+ const ret = arg0.performance;
2075
2933
  return ret;
2076
2934
  };
2077
2935
 
2078
- module.exports.__wbg_push_73fd7b5550ebf707 = function(arg0, arg1) {
2079
- const ret = arg0.push(arg1);
2936
+ exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
2937
+ const ret = arg0.process;
2080
2938
  return ret;
2081
2939
  };
2082
2940
 
2083
- module.exports.__wbg_queueMicrotask_46c1df247678729f = function(arg0) {
2084
- queueMicrotask(arg0);
2941
+ exports.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
2942
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2943
+ };
2944
+
2945
+ exports.__wbg_publickey_new = function(arg0) {
2946
+ const ret = PublicKey.__wrap(arg0);
2947
+ return ret;
2085
2948
  };
2086
2949
 
2087
- module.exports.__wbg_queueMicrotask_8acf3ccb75ed8d11 = function(arg0) {
2950
+ exports.__wbg_queueMicrotask_34d692c25c47d05b = function(arg0) {
2088
2951
  const ret = arg0.queueMicrotask;
2089
2952
  return ret;
2090
2953
  };
2091
2954
 
2092
- module.exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
2955
+ exports.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
2956
+ queueMicrotask(arg0);
2957
+ };
2958
+
2959
+ exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
2093
2960
  arg0.randomFillSync(arg1);
2094
2961
  }, arguments) };
2095
2962
 
2096
- module.exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
2963
+ exports.__wbg_read_48f1593df542f968 = function(arg0) {
2964
+ const ret = arg0.read();
2965
+ return ret;
2966
+ };
2967
+
2968
+ exports.__wbg_releaseLock_5d0b5a68887b891d = function(arg0) {
2969
+ arg0.releaseLock();
2970
+ };
2971
+
2972
+ exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
2097
2973
  const ret = module.require;
2098
2974
  return ret;
2099
2975
  }, arguments) };
2100
2976
 
2101
- module.exports.__wbg_resolve_0dac8c580ffd4678 = function(arg0) {
2977
+ exports.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
2102
2978
  const ret = Promise.resolve(arg0);
2103
2979
  return ret;
2104
2980
  };
2105
2981
 
2106
- module.exports.__wbg_session_new = function(arg0) {
2982
+ exports.__wbg_respond_0f4dbf5386f5c73e = function() { return handleError(function (arg0, arg1) {
2983
+ arg0.respond(arg1 >>> 0);
2984
+ }, arguments) };
2985
+
2986
+ exports.__wbg_session_new = function(arg0) {
2107
2987
  const ret = Session.__wrap(arg0);
2108
2988
  return ret;
2109
2989
  };
2110
2990
 
2111
- module.exports.__wbg_setTimeout_2b339866a2aa3789 = function(arg0, arg1) {
2991
+ exports.__wbg_setTimeout_7bb3429662ab1e70 = function(arg0, arg1) {
2112
2992
  const ret = setTimeout(arg0, arg1);
2113
2993
  return ret;
2114
2994
  };
2115
2995
 
2116
- module.exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
2996
+ exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
2117
2997
  arg0[arg1] = arg2;
2118
2998
  };
2119
2999
 
2120
- module.exports.__wbg_set_7422acbe992d64ab = function(arg0, arg1, arg2) {
2121
- arg0[arg1 >>> 0] = arg2;
2122
- };
2123
-
2124
- module.exports.__wbg_set_b042eef31c50834d = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3000
+ exports.__wbg_set_8b342d8cd9d2a02c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2125
3001
  arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2126
3002
  }, arguments) };
2127
3003
 
2128
- module.exports.__wbg_set_d6bdfd275fb8a4ce = function(arg0, arg1, arg2) {
3004
+ exports.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
2129
3005
  const ret = arg0.set(arg1, arg2);
2130
3006
  return ret;
2131
3007
  };
2132
3008
 
2133
- module.exports.__wbg_set_fe4e79d1ed3b0e9b = function(arg0, arg1, arg2) {
2134
- arg0.set(arg1, arg2 >>> 0);
3009
+ exports.__wbg_set_9e6516df7b7d0f19 = function(arg0, arg1, arg2) {
3010
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
2135
3011
  };
2136
3012
 
2137
- module.exports.__wbg_setbody_971ec015fc13d6b4 = function(arg0, arg1) {
3013
+ exports.__wbg_set_body_3c365989753d61f4 = function(arg0, arg1) {
2138
3014
  arg0.body = arg1;
2139
3015
  };
2140
3016
 
2141
- module.exports.__wbg_setcache_a94cd14dc0cc72a2 = function(arg0, arg1) {
3017
+ exports.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
3018
+ arg0[arg1 >>> 0] = arg2;
3019
+ };
3020
+
3021
+ exports.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
3022
+ const ret = Reflect.set(arg0, arg1, arg2);
3023
+ return ret;
3024
+ }, arguments) };
3025
+
3026
+ exports.__wbg_set_cache_2f9deb19b92b81e3 = function(arg0, arg1) {
2142
3027
  arg0.cache = __wbindgen_enum_RequestCache[arg1];
2143
3028
  };
2144
3029
 
2145
- module.exports.__wbg_setcredentials_920d91fb5984c94a = function(arg0, arg1) {
3030
+ exports.__wbg_set_credentials_f621cd2d85c0c228 = function(arg0, arg1) {
2146
3031
  arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
2147
3032
  };
2148
3033
 
2149
- module.exports.__wbg_setheaders_65a4eb4c0443ae61 = function(arg0, arg1) {
3034
+ exports.__wbg_set_headers_107379072e02fee5 = function(arg0, arg1) {
3035
+ arg0.headers = arg1;
3036
+ };
3037
+
3038
+ exports.__wbg_set_headers_6926da238cd32ee4 = function(arg0, arg1) {
2150
3039
  arg0.headers = arg1;
2151
3040
  };
2152
3041
 
2153
- module.exports.__wbg_setmethod_8ce1be0b4d701b7c = function(arg0, arg1, arg2) {
3042
+ exports.__wbg_set_high_water_mark_5142ac1d2fb46365 = function(arg0, arg1) {
3043
+ arg0.highWaterMark = arg1;
3044
+ };
3045
+
3046
+ exports.__wbg_set_method_c02d8cbbe204ac2d = function(arg0, arg1, arg2) {
2154
3047
  arg0.method = getStringFromWasm0(arg1, arg2);
2155
3048
  };
2156
3049
 
2157
- module.exports.__wbg_setmode_bd35f026f55b6247 = function(arg0, arg1) {
3050
+ exports.__wbg_set_mode_52ef73cfa79639cb = function(arg0, arg1) {
2158
3051
  arg0.mode = __wbindgen_enum_RequestMode[arg1];
2159
3052
  };
2160
3053
 
2161
- module.exports.__wbg_setsignal_8e72abfe7ee03c97 = function(arg0, arg1) {
3054
+ exports.__wbg_set_name_d94846a29e626702 = function(arg0, arg1, arg2) {
3055
+ arg0.name = getStringFromWasm0(arg1, arg2);
3056
+ };
3057
+
3058
+ exports.__wbg_set_signal_dda2cf7ccb6bee0f = function(arg0, arg1) {
2162
3059
  arg0.signal = arg1;
2163
3060
  };
2164
3061
 
2165
- module.exports.__wbg_signal_b96223519a041faa = function(arg0) {
3062
+ exports.__wbg_set_status_886bf143c25d0706 = function(arg0, arg1) {
3063
+ arg0.status = arg1;
3064
+ };
3065
+
3066
+ exports.__wbg_set_status_text_3d83b7e559c076b2 = function(arg0, arg1, arg2) {
3067
+ arg0.statusText = getStringFromWasm0(arg1, arg2);
3068
+ };
3069
+
3070
+ exports.__wbg_signal_4db5aa055bf9eb9a = function(arg0) {
2166
3071
  const ret = arg0.signal;
2167
3072
  return ret;
2168
3073
  };
2169
3074
 
2170
- module.exports.__wbg_static_accessor_GLOBAL_487c52c58d65314d = function() {
3075
+ exports.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
2171
3076
  const ret = typeof global === 'undefined' ? null : global;
2172
3077
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2173
3078
  };
2174
3079
 
2175
- module.exports.__wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291 = function() {
3080
+ exports.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
2176
3081
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
2177
3082
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2178
3083
  };
2179
3084
 
2180
- module.exports.__wbg_static_accessor_SELF_78c9e3071b912620 = function() {
3085
+ exports.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
2181
3086
  const ret = typeof self === 'undefined' ? null : self;
2182
3087
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2183
3088
  };
2184
3089
 
2185
- module.exports.__wbg_static_accessor_WINDOW_a093d21393777366 = function() {
3090
+ exports.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
2186
3091
  const ret = typeof window === 'undefined' ? null : window;
2187
3092
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2188
3093
  };
2189
3094
 
2190
- module.exports.__wbg_status_a54682bbe52f9058 = function(arg0) {
3095
+ exports.__wbg_status_de7eed5a7a5bfd5d = function(arg0) {
2191
3096
  const ret = arg0.status;
2192
3097
  return ret;
2193
3098
  };
2194
3099
 
2195
- module.exports.__wbg_stringify_c242842b97f054cc = function() { return handleError(function (arg0) {
3100
+ exports.__wbg_stringify_b5fb28f6465d9c3e = function() { return handleError(function (arg0) {
2196
3101
  const ret = JSON.stringify(arg0);
2197
3102
  return ret;
2198
3103
  }, arguments) };
2199
3104
 
2200
- module.exports.__wbg_subarray_dd4ade7d53bd8e26 = function(arg0, arg1, arg2) {
3105
+ exports.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
2201
3106
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
2202
3107
  return ret;
2203
3108
  };
2204
3109
 
2205
- module.exports.__wbg_text_ec0e22f60e30dd2f = function() { return handleError(function (arg0) {
3110
+ exports.__wbg_text_dc33c15c17bdfb52 = function() { return handleError(function (arg0) {
2206
3111
  const ret = arg0.text();
2207
3112
  return ret;
2208
3113
  }, arguments) };
2209
3114
 
2210
- module.exports.__wbg_then_82ab9fb4080f1707 = function(arg0, arg1, arg2) {
3115
+ exports.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
3116
+ const ret = arg0.then(arg1);
3117
+ return ret;
3118
+ };
3119
+
3120
+ exports.__wbg_then_70d05cf780a18d77 = function(arg0, arg1, arg2) {
2211
3121
  const ret = arg0.then(arg1, arg2);
2212
3122
  return ret;
2213
3123
  };
2214
3124
 
2215
- module.exports.__wbg_then_db882932c0c714c6 = function(arg0, arg1) {
2216
- const ret = arg0.then(arg1);
3125
+ exports.__wbg_toString_8eec07f6f4c057e4 = function(arg0) {
3126
+ const ret = arg0.toString();
2217
3127
  return ret;
2218
3128
  };
2219
3129
 
2220
- module.exports.__wbg_url_e6ed869ea05b7a71 = function(arg0, arg1) {
3130
+ exports.__wbg_url_b36d2a5008eb056f = function(arg0, arg1) {
2221
3131
  const ret = arg1.url;
2222
3132
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2223
3133
  const len1 = WASM_VECTOR_LEN;
@@ -2225,87 +3135,77 @@ module.exports.__wbg_url_e6ed869ea05b7a71 = function(arg0, arg1) {
2225
3135
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2226
3136
  };
2227
3137
 
2228
- module.exports.__wbg_value_17b896954e14f896 = function(arg0) {
3138
+ exports.__wbg_value_692627309814bb8c = function(arg0) {
2229
3139
  const ret = arg0.value;
2230
3140
  return ret;
2231
3141
  };
2232
3142
 
2233
- module.exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
3143
+ exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
2234
3144
  const ret = arg0.versions;
2235
3145
  return ret;
2236
3146
  };
2237
3147
 
2238
- module.exports.__wbg_warn_90607373221a6b1c = function(arg0, arg1, arg2, arg3) {
2239
- console.warn(arg0, arg1, arg2, arg3);
2240
- };
2241
-
2242
- module.exports.__wbindgen_array_new = function() {
2243
- const ret = [];
2244
- return ret;
3148
+ exports.__wbg_view_f6c15ac9fed63bbd = function(arg0) {
3149
+ const ret = arg0.view;
3150
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2245
3151
  };
2246
3152
 
2247
- module.exports.__wbindgen_array_push = function(arg0, arg1) {
2248
- arg0.push(arg1);
3153
+ exports.__wbg_warn_8f5b5437666d0885 = function(arg0, arg1, arg2, arg3) {
3154
+ console.warn(arg0, arg1, arg2, arg3);
2249
3155
  };
2250
3156
 
2251
- module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
2252
- const ret = arg0;
3157
+ exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
3158
+ // Cast intrinsic for `Ref(String) -> Externref`.
3159
+ const ret = getStringFromWasm0(arg0, arg1);
2253
3160
  return ret;
2254
3161
  };
2255
3162
 
2256
- module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
2257
- const ret = BigInt.asUintN(64, arg0);
3163
+ exports.__wbindgen_cast_236fa6323a6eeed0 = function(arg0, arg1) {
3164
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 175, function: Function { arguments: [], shim_idx: 176, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3165
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h762d1c23bf8139ea, wasm_bindgen__convert__closures_____invoke__h13019d5ee70bd6b6);
2258
3166
  return ret;
2259
3167
  };
2260
3168
 
2261
- module.exports.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
2262
- const v = arg1;
2263
- const ret = typeof(v) === 'bigint' ? v : undefined;
2264
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2265
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2266
- };
2267
-
2268
- module.exports.__wbindgen_boolean_get = function(arg0) {
2269
- const v = arg0;
2270
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
3169
+ exports.__wbindgen_cast_25a0a844437d0e92 = function(arg0, arg1) {
3170
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3171
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
3172
+ // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
3173
+ const ret = v0;
2271
3174
  return ret;
2272
3175
  };
2273
3176
 
2274
- module.exports.__wbindgen_cb_drop = function(arg0) {
2275
- const obj = arg0.original;
2276
- if (obj.cnt-- == 1) {
2277
- obj.a = 0;
2278
- return true;
2279
- }
2280
- const ret = false;
3177
+ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
3178
+ // Cast intrinsic for `U64 -> Externref`.
3179
+ const ret = BigInt.asUintN(64, arg0);
2281
3180
  return ret;
2282
3181
  };
2283
3182
 
2284
- module.exports.__wbindgen_closure_wrapper2747 = function(arg0, arg1, arg2) {
2285
- const ret = makeMutClosure(arg0, arg1, 154, __wbg_adapter_54);
3183
+ exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
3184
+ // Cast intrinsic for `I64 -> Externref`.
3185
+ const ret = arg0;
2286
3186
  return ret;
2287
3187
  };
2288
3188
 
2289
- module.exports.__wbindgen_closure_wrapper3056 = function(arg0, arg1, arg2) {
2290
- const ret = makeMutClosure(arg0, arg1, 154, __wbg_adapter_57);
3189
+ exports.__wbindgen_cast_c389e99dd7b90da6 = function(arg0, arg1) {
3190
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 175, function: Function { arguments: [Externref], shim_idx: 193, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3191
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h762d1c23bf8139ea, wasm_bindgen__convert__closures_____invoke__h69202035a90512ea);
2291
3192
  return ret;
2292
3193
  };
2293
3194
 
2294
- module.exports.__wbindgen_debug_string = function(arg0, arg1) {
2295
- const ret = debugString(arg1);
2296
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2297
- const len1 = WASM_VECTOR_LEN;
2298
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2299
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3195
+ exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
3196
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
3197
+ const ret = getArrayU8FromWasm0(arg0, arg1);
3198
+ return ret;
2300
3199
  };
2301
3200
 
2302
- module.exports.__wbindgen_in = function(arg0, arg1) {
2303
- const ret = arg0 in arg1;
3201
+ exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
3202
+ // Cast intrinsic for `F64 -> Externref`.
3203
+ const ret = arg0;
2304
3204
  return ret;
2305
3205
  };
2306
3206
 
2307
- module.exports.__wbindgen_init_externref_table = function() {
2308
- const table = wasm.__wbindgen_export_4;
3207
+ exports.__wbindgen_init_externref_table = function() {
3208
+ const table = wasm.__wbindgen_externrefs;
2309
3209
  const offset = table.grow(4);
2310
3210
  table.set(0, undefined);
2311
3211
  table.set(offset + 0, undefined);
@@ -2315,89 +3215,10 @@ module.exports.__wbindgen_init_externref_table = function() {
2315
3215
  ;
2316
3216
  };
2317
3217
 
2318
- module.exports.__wbindgen_is_bigint = function(arg0) {
2319
- const ret = typeof(arg0) === 'bigint';
2320
- return ret;
2321
- };
2322
-
2323
- module.exports.__wbindgen_is_function = function(arg0) {
2324
- const ret = typeof(arg0) === 'function';
2325
- return ret;
2326
- };
2327
-
2328
- module.exports.__wbindgen_is_null = function(arg0) {
2329
- const ret = arg0 === null;
2330
- return ret;
2331
- };
2332
-
2333
- module.exports.__wbindgen_is_object = function(arg0) {
2334
- const val = arg0;
2335
- const ret = typeof(val) === 'object' && val !== null;
2336
- return ret;
2337
- };
2338
-
2339
- module.exports.__wbindgen_is_string = function(arg0) {
2340
- const ret = typeof(arg0) === 'string';
2341
- return ret;
2342
- };
2343
-
2344
- module.exports.__wbindgen_is_undefined = function(arg0) {
2345
- const ret = arg0 === undefined;
2346
- return ret;
2347
- };
2348
-
2349
- module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
2350
- const ret = arg0 === arg1;
2351
- return ret;
2352
- };
2353
-
2354
- module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2355
- const ret = arg0 == arg1;
2356
- return ret;
2357
- };
2358
-
2359
- module.exports.__wbindgen_memory = function() {
2360
- const ret = wasm.memory;
2361
- return ret;
2362
- };
2363
-
2364
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
2365
- const obj = arg1;
2366
- const ret = typeof(obj) === 'number' ? obj : undefined;
2367
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2368
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2369
- };
2370
-
2371
- module.exports.__wbindgen_number_new = function(arg0) {
2372
- const ret = arg0;
2373
- return ret;
2374
- };
2375
-
2376
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
2377
- const obj = arg1;
2378
- const ret = typeof(obj) === 'string' ? obj : undefined;
2379
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2380
- var len1 = WASM_VECTOR_LEN;
2381
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2382
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2383
- };
2384
-
2385
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
2386
- const ret = getStringFromWasm0(arg0, arg1);
2387
- return ret;
2388
- };
2389
-
2390
- module.exports.__wbindgen_throw = function(arg0, arg1) {
2391
- throw new Error(getStringFromWasm0(arg0, arg1));
2392
- };
2393
-
2394
- const path = require('path').join(__dirname, 'pubky_bg.wasm');
2395
- const bytes = require('fs').readFileSync(path);
2396
-
2397
- const wasmModule = new WebAssembly.Module(bytes);
2398
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
2399
- wasm = wasmInstance.exports;
2400
- module.exports.__wasm = wasm;
3218
+ const wasmPath = `${__dirname}/pubky_bg.wasm`;
3219
+ const wasmBytes = require('fs').readFileSync(wasmPath);
3220
+ const wasmModule = new WebAssembly.Module(wasmBytes);
3221
+ const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
2401
3222
 
2402
3223
  wasm.__wbindgen_start();
2403
3224