@synonymdev/pubky 0.6.0 → 0.7.0

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 +1 -1
  2. package/index.cjs +2244 -1967
  3. package/index.js +2247 -2116
  4. package/package.json +1 -1
  5. package/pubky.d.ts +1135 -840
  6. package/pubky_bg.wasm +0 -0
package/index.cjs CHANGED
@@ -3,362 +3,8 @@ const makeFetchCookie = require("fetch-cookie").default;
3
3
  let originalFetch = globalThis.fetch;
4
4
  globalThis.fetch = makeFetchCookie(originalFetch);
5
5
 
6
+ /* @ts-self-types="./pubky.d.ts" */
6
7
 
7
- let imports = {};
8
- imports['__wbindgen_placeholder__'] = module.exports;
9
-
10
- let cachedUint8ArrayMemory0 = null;
11
-
12
- function getUint8ArrayMemory0() {
13
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
14
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
15
- }
16
- return cachedUint8ArrayMemory0;
17
- }
18
-
19
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
20
-
21
- cachedTextDecoder.decode();
22
-
23
- function decodeText(ptr, len) {
24
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
25
- }
26
-
27
- function getStringFromWasm0(ptr, len) {
28
- ptr = ptr >>> 0;
29
- return decodeText(ptr, len);
30
- }
31
-
32
- let WASM_VECTOR_LEN = 0;
33
-
34
- const cachedTextEncoder = new TextEncoder();
35
-
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
- }
45
- }
46
-
47
- function passStringToWasm0(arg, malloc, realloc) {
48
-
49
- if (realloc === undefined) {
50
- const buf = cachedTextEncoder.encode(arg);
51
- const ptr = malloc(buf.length, 1) >>> 0;
52
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
53
- WASM_VECTOR_LEN = buf.length;
54
- return ptr;
55
- }
56
-
57
- let len = arg.length;
58
- let ptr = malloc(len, 1) >>> 0;
59
-
60
- const mem = getUint8ArrayMemory0();
61
-
62
- let offset = 0;
63
-
64
- for (; offset < len; offset++) {
65
- const code = arg.charCodeAt(offset);
66
- if (code > 0x7F) break;
67
- mem[ptr + offset] = code;
68
- }
69
-
70
- if (offset !== len) {
71
- if (offset !== 0) {
72
- arg = arg.slice(offset);
73
- }
74
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
75
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
76
- const ret = cachedTextEncoder.encodeInto(arg, view);
77
-
78
- offset += ret.written;
79
- ptr = realloc(ptr, len, offset, 1) >>> 0;
80
- }
81
-
82
- WASM_VECTOR_LEN = offset;
83
- return ptr;
84
- }
85
-
86
- let cachedDataViewMemory0 = null;
87
-
88
- function getDataViewMemory0() {
89
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
90
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
91
- }
92
- return cachedDataViewMemory0;
93
- }
94
-
95
- function isLikeNone(x) {
96
- return x === undefined || x === null;
97
- }
98
-
99
- function debugString(val) {
100
- // primitive types
101
- const type = typeof val;
102
- if (type == 'number' || type == 'boolean' || val == null) {
103
- return `${val}`;
104
- }
105
- if (type == 'string') {
106
- return `"${val}"`;
107
- }
108
- if (type == 'symbol') {
109
- const description = val.description;
110
- if (description == null) {
111
- return 'Symbol';
112
- } else {
113
- return `Symbol(${description})`;
114
- }
115
- }
116
- if (type == 'function') {
117
- const name = val.name;
118
- if (typeof name == 'string' && name.length > 0) {
119
- return `Function(${name})`;
120
- } else {
121
- return 'Function';
122
- }
123
- }
124
- // objects
125
- if (Array.isArray(val)) {
126
- const length = val.length;
127
- let debug = '[';
128
- if (length > 0) {
129
- debug += debugString(val[0]);
130
- }
131
- for(let i = 1; i < length; i++) {
132
- debug += ', ' + debugString(val[i]);
133
- }
134
- debug += ']';
135
- return debug;
136
- }
137
- // Test for built-in
138
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
139
- let className;
140
- if (builtInMatches && builtInMatches.length > 1) {
141
- className = builtInMatches[1];
142
- } else {
143
- // Failed to match the standard '[object ClassName]'
144
- return toString.call(val);
145
- }
146
- if (className == 'Object') {
147
- // we're a user defined class or Object
148
- // JSON.stringify avoids problems with cycles, and is generally much
149
- // easier than looping through ownProperties of `val`.
150
- try {
151
- return 'Object(' + JSON.stringify(val) + ')';
152
- } catch (_) {
153
- return 'Object';
154
- }
155
- }
156
- // errors
157
- if (val instanceof Error) {
158
- return `${val.name}: ${val.message}\n${val.stack}`;
159
- }
160
- // TODO we could test for more things here, like `Set`s and `Map`s.
161
- return className;
162
- }
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
-
227
- function _assertClass(instance, klass) {
228
- if (!(instance instanceof klass)) {
229
- throw new Error(`expected instance of ${klass.name}`);
230
- }
231
- }
232
-
233
- function takeFromExternrefTable0(idx) {
234
- const value = wasm.__wbindgen_externrefs.get(idx);
235
- wasm.__externref_table_dealloc(idx);
236
- return value;
237
- }
238
-
239
- function passArray8ToWasm0(arg, malloc) {
240
- const ptr = malloc(arg.length * 1, 1) >>> 0;
241
- getUint8ArrayMemory0().set(arg, ptr / 1);
242
- WASM_VECTOR_LEN = arg.length;
243
- return ptr;
244
- }
245
- /**
246
- * Set the global logging verbosity for the WASM Pubky SDK. Routes Rust `log` output to the browser console.
247
- *
248
- * Accepted values (case-sensitive): "error" | "warn" | "info" | "debug" | "trace".
249
- * Effects:
250
- * - Initializes the logger once; subsequent calls may throw if the logger is already set.
251
- * - Emits a single info log: `Log level set to: <level>`.
252
- * - Messages at or above `level` are forwarded to the appropriate `console.*` method.
253
- *
254
- * @param {Level} level
255
- * Minimum log level to enable. One of: "error" | "warn" | "info" | "debug" | "trace".
256
- *
257
- * @returns {void}
258
- *
259
- * @throws {Error}
260
- * If `level` is invalid ("Invalid log level") or the logger cannot be initialized
261
- * (e.g., already initialized).
262
- *
263
- * Usage:
264
- * Call once at application startup, before invoking other SDK APIs.
265
- * @param {Level} level
266
- */
267
- exports.setLogLevel = function(level) {
268
- const ret = wasm.setLogLevel((__wbindgen_enum_Level.indexOf(level) + 1 || 6) - 1);
269
- if (ret[1]) {
270
- throw takeFromExternrefTable0(ret[0]);
271
- }
272
- };
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
-
303
- /**
304
- * Validate and normalize a capabilities string.
305
- *
306
- * - Normalizes action order (`wr` -> `rw`)
307
- * - Throws `InvalidInput` listing malformed entries.
308
- *
309
- * @param {string} input
310
- * @returns {string} Normalized string (same shape as input).
311
- * @throws {PubkyError} `{ name: "InvalidInput" }` with a helpful message.
312
- * The error's `data` field is `{ invalidEntries: string[] }` listing malformed tokens.
313
- * @param {string} input
314
- * @returns {string}
315
- */
316
- exports.validateCapabilities = function(input) {
317
- let deferred3_0;
318
- let deferred3_1;
319
- try {
320
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
- const len0 = WASM_VECTOR_LEN;
322
- const ret = wasm.validateCapabilities(ptr0, len0);
323
- var ptr2 = ret[0];
324
- var len2 = ret[1];
325
- if (ret[3]) {
326
- ptr2 = 0; len2 = 0;
327
- throw takeFromExternrefTable0(ret[2]);
328
- }
329
- deferred3_0 = ptr2;
330
- deferred3_1 = len2;
331
- return getStringFromWasm0(ptr2, len2);
332
- } finally {
333
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
334
- }
335
- };
336
-
337
- function wasm_bindgen__convert__closures_____invoke__h13019d5ee70bd6b6(arg0, arg1) {
338
- wasm.wasm_bindgen__convert__closures_____invoke__h13019d5ee70bd6b6(arg0, arg1);
339
- }
340
-
341
- function wasm_bindgen__convert__closures_____invoke__h69202035a90512ea(arg0, arg1, arg2) {
342
- wasm.wasm_bindgen__convert__closures_____invoke__h69202035a90512ea(arg0, arg1, arg2);
343
- }
344
-
345
- function wasm_bindgen__convert__closures_____invoke__h07d45d2c9c5e1bbe(arg0, arg1, arg2, arg3) {
346
- wasm.wasm_bindgen__convert__closures_____invoke__h07d45d2c9c5e1bbe(arg0, arg1, arg2, arg3);
347
- }
348
-
349
- const __wbindgen_enum_Level = ["error", "warn", "info", "debug", "trace"];
350
-
351
- const __wbindgen_enum_ReadableStreamType = ["bytes"];
352
-
353
- const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
354
-
355
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
356
-
357
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
358
-
359
- const AuthFlowFinalization = (typeof FinalizationRegistry === 'undefined')
360
- ? { register: () => {}, unregister: () => {} }
361
- : new FinalizationRegistry(ptr => wasm.__wbg_authflow_free(ptr >>> 0, 1));
362
8
  /**
363
9
  * Start and control a pubkyauth authorization flow.
364
10
  *
@@ -368,7 +14,6 @@ const AuthFlowFinalization = (typeof FinalizationRegistry === 'undefined')
368
14
  * 3) `awaitApproval()` to receive a ready `Session`
369
15
  */
370
16
  class AuthFlow {
371
-
372
17
  static __wrap(ptr) {
373
18
  ptr = ptr >>> 0;
374
19
  const obj = Object.create(AuthFlow.prototype);
@@ -376,68 +21,16 @@ class AuthFlow {
376
21
  AuthFlowFinalization.register(obj, obj.__wbg_ptr, obj);
377
22
  return obj;
378
23
  }
379
-
380
24
  __destroy_into_raw() {
381
25
  const ptr = this.__wbg_ptr;
382
26
  this.__wbg_ptr = 0;
383
27
  AuthFlowFinalization.unregister(this);
384
28
  return ptr;
385
29
  }
386
-
387
30
  free() {
388
31
  const ptr = this.__destroy_into_raw();
389
32
  wasm.__wbg_authflow_free(ptr, 0);
390
33
  }
391
- /**
392
- * Start a flow (standalone).
393
- * Prefer `pubky.startAuthFlow()` to reuse a facade client.
394
- *
395
- * @param {string} capabilities
396
- * Comma-separated capabilities, e.g. `"/pub/app/:rw,/priv/foo.txt:r"`.
397
- * Each entry must be `"<scope>:<actions>"`, where:
398
- * - `scope` starts with `/` (e.g. `/pub/example.com/`)
399
- * - `actions` is any combo of `r` and/or `w` (order is normalized; `wr` -> `rw`)
400
- * Empty string is allowed (no scopes).
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
- *
409
- * @param {string} [relay]
410
- * Optional HTTP relay base, e.g. `"https://demo.httprelay.io/link/"`.
411
- * Defaults to the default Synonym-hosted relay when omitted.
412
- *
413
- * @returns {AuthFlow}
414
- * A running auth flow. Call `authorizationUrl()` to show the deep link,
415
- * then `awaitApproval()` to receive a `Session`.
416
- * @throws {PubkyError}
417
- * - `{ name: "InvalidInput", message: string }` if any capability entry is invalid
418
- * or for an invalid relay URL.
419
- * @example
420
- * const flow = AuthFlow.start("/pub/my-cool-app/:rw,/pub/pubky.app/:w");
421
- * renderQRCode(flow.authorizationUrl());
422
- * const session = await flow.awaitApproval();
423
- * @param {Capabilities} capabilities
424
- * @param {AuthFlowKind} kind
425
- * @param {string | null} [relay]
426
- * @returns {AuthFlow}
427
- */
428
- static start(capabilities, kind, relay) {
429
- const ptr0 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
430
- const len0 = WASM_VECTOR_LEN;
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);
436
- if (ret[2]) {
437
- throw takeFromExternrefTable0(ret[1]);
438
- }
439
- return AuthFlow.__wrap(ret[0]);
440
- }
441
34
  /**
442
35
  * Return the authorization deep link (URL) to show as QR or open on the signer device.
443
36
  *
@@ -488,6 +81,56 @@ class AuthFlow {
488
81
  const ret = wasm.authflow_awaitToken(this.__wbg_ptr);
489
82
  return ret;
490
83
  }
84
+ /**
85
+ * Start a flow (standalone).
86
+ * Prefer `pubky.startAuthFlow()` to reuse a facade client.
87
+ *
88
+ * @param {string} capabilities
89
+ * Comma-separated capabilities, e.g. `"/pub/app/:rw,/priv/foo.txt:r"`.
90
+ * Each entry must be `"<scope>:<actions>"`, where:
91
+ * - `scope` starts with `/` (e.g. `/pub/example.com/`)
92
+ * - `actions` is any combo of `r` and/or `w` (order is normalized; `wr` -> `rw`)
93
+ * Empty string is allowed (no scopes).
94
+ *
95
+ * @param {AuthFlowKind} kind
96
+ * The kind of authentication flow to perform.
97
+ * This can either be a sign in or a sign up flow.
98
+ * Examples:
99
+ * - `AuthFlowKind.signin()` - Sign in to an existing account.
100
+ * - `AuthFlowKind.signup(homeserverPublicKey, signupToken)` - Sign up for a new account.
101
+ *
102
+ * @param {string} [relay]
103
+ * Optional HTTP relay base, e.g. `"https://demo.httprelay.io/inbox/"`.
104
+ * Defaults to the default Synonym-hosted relay when omitted.
105
+ *
106
+ * @returns {AuthFlow}
107
+ * A running auth flow. Call `authorizationUrl()` to show the deep link,
108
+ * then `awaitApproval()` to receive a `Session`.
109
+ * @throws {PubkyError}
110
+ * - `{ name: "InvalidInput", message: string }` if any capability entry is invalid
111
+ * or for an invalid relay URL.
112
+ * @example
113
+ * const flow = AuthFlow.start("/pub/my-cool-app/:rw,/pub/pubky.app/:w");
114
+ * renderQRCode(flow.authorizationUrl());
115
+ * const session = await flow.awaitApproval();
116
+ * @param {Capabilities} capabilities
117
+ * @param {AuthFlowKind} kind
118
+ * @param {string | null} [relay]
119
+ * @returns {AuthFlow}
120
+ */
121
+ static start(capabilities, kind, relay) {
122
+ const ptr0 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
123
+ const len0 = WASM_VECTOR_LEN;
124
+ _assertClass(kind, AuthFlowKind);
125
+ var ptr1 = kind.__destroy_into_raw();
126
+ var ptr2 = isLikeNone(relay) ? 0 : passStringToWasm0(relay, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
127
+ var len2 = WASM_VECTOR_LEN;
128
+ const ret = wasm.authflow_start(ptr0, len0, ptr1, ptr2, len2);
129
+ if (ret[2]) {
130
+ throw takeFromExternrefTable0(ret[1]);
131
+ }
132
+ return AuthFlow.__wrap(ret[0]);
133
+ }
491
134
  /**
492
135
  * Non-blocking single poll step (advanced UIs).
493
136
  *
@@ -500,18 +143,13 @@ class AuthFlow {
500
143
  }
501
144
  }
502
145
  if (Symbol.dispose) AuthFlow.prototype[Symbol.dispose] = AuthFlow.prototype.free;
503
-
504
146
  exports.AuthFlow = AuthFlow;
505
147
 
506
- const AuthFlowKindFinalization = (typeof FinalizationRegistry === 'undefined')
507
- ? { register: () => {}, unregister: () => {} }
508
- : new FinalizationRegistry(ptr => wasm.__wbg_authflowkind_free(ptr >>> 0, 1));
509
148
  /**
510
149
  * The kind of authentication flow to perform.
511
150
  * This can either be a sign in or a sign up flow.
512
151
  */
513
152
  class AuthFlowKind {
514
-
515
153
  static __wrap(ptr) {
516
154
  ptr = ptr >>> 0;
517
155
  const obj = Object.create(AuthFlowKind.prototype);
@@ -519,18 +157,35 @@ class AuthFlowKind {
519
157
  AuthFlowKindFinalization.register(obj, obj.__wbg_ptr, obj);
520
158
  return obj;
521
159
  }
522
-
523
160
  __destroy_into_raw() {
524
161
  const ptr = this.__wbg_ptr;
525
162
  this.__wbg_ptr = 0;
526
163
  AuthFlowKindFinalization.unregister(this);
527
164
  return ptr;
528
165
  }
529
-
530
166
  free() {
531
167
  const ptr = this.__destroy_into_raw();
532
168
  wasm.__wbg_authflowkind_free(ptr, 0);
533
169
  }
170
+ /**
171
+ * Get the intent of the authentication flow.
172
+ * # Returns
173
+ * * `"signin"` - If the authentication flow is a sign in flow.
174
+ * * `"signup"` - If the authentication flow is a sign up flow.
175
+ * @returns {string}
176
+ */
177
+ get intent() {
178
+ let deferred1_0;
179
+ let deferred1_1;
180
+ try {
181
+ const ret = wasm.authflowkind_intent(this.__wbg_ptr);
182
+ deferred1_0 = ret[0];
183
+ deferred1_1 = ret[1];
184
+ return getStringFromWasm0(ret[0], ret[1]);
185
+ } finally {
186
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
187
+ }
188
+ }
534
189
  /**
535
190
  * Create a sign in flow.
536
191
  * @returns {AuthFlowKind}
@@ -555,33 +210,10 @@ class AuthFlowKind {
555
210
  const ret = wasm.authflowkind_signup(homeserver_public_key.__wbg_ptr, ptr0, len0);
556
211
  return AuthFlowKind.__wrap(ret);
557
212
  }
558
- /**
559
- * Get the intent of the authentication flow.
560
- * # Returns
561
- * * `"signin"` - If the authentication flow is a sign in flow.
562
- * * `"signup"` - If the authentication flow is a sign up flow.
563
- * @returns {string}
564
- */
565
- get intent() {
566
- let deferred1_0;
567
- let deferred1_1;
568
- try {
569
- const ret = wasm.authflowkind_intent(this.__wbg_ptr);
570
- deferred1_0 = ret[0];
571
- deferred1_1 = ret[1];
572
- return getStringFromWasm0(ret[0], ret[1]);
573
- } finally {
574
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
575
- }
576
- }
577
213
  }
578
214
  if (Symbol.dispose) AuthFlowKind.prototype[Symbol.dispose] = AuthFlowKind.prototype.free;
579
-
580
215
  exports.AuthFlowKind = AuthFlowKind;
581
216
 
582
- const AuthTokenFinalization = (typeof FinalizationRegistry === 'undefined')
583
- ? { register: () => {}, unregister: () => {} }
584
- : new FinalizationRegistry(ptr => wasm.__wbg_authtoken_free(ptr >>> 0, 1));
585
217
  /**
586
218
  * AuthToken: signed, time-bound proof of key ownership.
587
219
  *
@@ -609,7 +241,6 @@ const AuthTokenFinalization = (typeof FinalizationRegistry === 'undefined')
609
241
  * `Uint8Array`, and [`AuthToken.verify()`] to parse + verify on the server.
610
242
  */
611
243
  class AuthToken {
612
-
613
244
  static __wrap(ptr) {
614
245
  ptr = ptr >>> 0;
615
246
  const obj = Object.create(AuthToken.prototype);
@@ -617,44 +248,32 @@ class AuthToken {
617
248
  AuthTokenFinalization.register(obj, obj.__wbg_ptr, obj);
618
249
  return obj;
619
250
  }
620
-
621
251
  __destroy_into_raw() {
622
252
  const ptr = this.__wbg_ptr;
623
253
  this.__wbg_ptr = 0;
624
254
  AuthTokenFinalization.unregister(this);
625
255
  return ptr;
626
256
  }
627
-
628
257
  free() {
629
258
  const ptr = this.__destroy_into_raw();
630
259
  wasm.__wbg_authtoken_free(ptr, 0);
631
260
  }
632
261
  /**
633
- * Parse and verify an `AuthToken` from its canonical bytes.
634
- *
635
- * - Verifies version, timestamp freshness window, and signature.
636
- * - Throws on invalid/expired/unknown version.
262
+ * Returns the **capabilities** requested by the flow at the time this token was signed.
637
263
  *
638
- * Use this on your server after receiving `Uint8Array` from the client.
264
+ * Most auth-only flows pass an empty string to `startAuthFlow("", relay)`, so this will
265
+ * commonly be an empty array.
639
266
  *
640
- * ```js
641
- * import { AuthToken } from "@synonymdev/pubky";
267
+ * Returns: `string[]`, where each item is the canonical entry `"<scope>:<actions>"`.
642
268
  *
643
- * export async function POST(req) {
644
- * const bytes = new Uint8Array(await req.arrayBuffer());
645
- * const token = AuthToken.verify(bytes); // throws on failure
646
- * return new Response(token.publicKey().toString(), { status: 200 });
647
- * }
648
- * ```
649
- * @param {Uint8Array} bytes
650
- * @returns {AuthToken}
269
+ * Example entry: `"/pub/my-cool-app/:rw"`
270
+ * @returns {string[]}
651
271
  */
652
- static verify(bytes) {
653
- const ret = wasm.authtoken_verify(bytes);
654
- if (ret[2]) {
655
- throw takeFromExternrefTable0(ret[1]);
656
- }
657
- return AuthToken.__wrap(ret[0]);
272
+ get capabilities() {
273
+ const ret = wasm.authtoken_capabilities(this.__wbg_ptr);
274
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
275
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
276
+ return v1;
658
277
  }
659
278
  /**
660
279
  * Deserialize an `AuthToken` **without** verification.
@@ -687,23 +306,6 @@ class AuthToken {
687
306
  const ret = wasm.authtoken_publicKey(this.__wbg_ptr);
688
307
  return PublicKey.__wrap(ret);
689
308
  }
690
- /**
691
- * Returns the **capabilities** requested by the flow at the time this token was signed.
692
- *
693
- * Most auth-only flows pass an empty string to `startAuthFlow("", relay)`, so this will
694
- * commonly be an empty array.
695
- *
696
- * Returns: `string[]`, where each item is the canonical entry `"<scope>:<actions>"`.
697
- *
698
- * Example entry: `"/pub/my-cool-app/:rw"`
699
- * @returns {string[]}
700
- */
701
- get capabilities() {
702
- const ret = wasm.authtoken_capabilities(this.__wbg_ptr);
703
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
704
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
705
- return v1;
706
- }
707
309
  /**
708
310
  * Serialize the token to a `Uint8Array` in its **canonical** (postcard) binary format.
709
311
  *
@@ -719,14 +321,37 @@ class AuthToken {
719
321
  const ret = wasm.authtoken_toBytes(this.__wbg_ptr);
720
322
  return ret;
721
323
  }
324
+ /**
325
+ * Parse and verify an `AuthToken` from its canonical bytes.
326
+ *
327
+ * - Verifies version, timestamp freshness window, and signature.
328
+ * - Throws on invalid/expired/unknown version.
329
+ *
330
+ * Use this on your server after receiving `Uint8Array` from the client.
331
+ *
332
+ * ```js
333
+ * import { AuthToken } from "@synonymdev/pubky";
334
+ *
335
+ * export async function POST(req) {
336
+ * const bytes = new Uint8Array(await req.arrayBuffer());
337
+ * const token = AuthToken.verify(bytes); // throws on failure
338
+ * return new Response(token.publicKey().toString(), { status: 200 });
339
+ * }
340
+ * ```
341
+ * @param {Uint8Array} bytes
342
+ * @returns {AuthToken}
343
+ */
344
+ static verify(bytes) {
345
+ const ret = wasm.authtoken_verify(bytes);
346
+ if (ret[2]) {
347
+ throw takeFromExternrefTable0(ret[1]);
348
+ }
349
+ return AuthToken.__wrap(ret[0]);
350
+ }
722
351
  }
723
352
  if (Symbol.dispose) AuthToken.prototype[Symbol.dispose] = AuthToken.prototype.free;
724
-
725
353
  exports.AuthToken = AuthToken;
726
354
 
727
- const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
728
- ? { register: () => {}, unregister: () => {} }
729
- : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
730
355
  /**
731
356
  * Low-level HTTP bridge used by the Pubky facade and actors.
732
357
  *
@@ -734,7 +359,6 @@ const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
734
359
  * - In browsers/undici, passes `credentials: "include"` to send cookies.
735
360
  */
736
361
  class Client {
737
-
738
362
  static __wrap(ptr) {
739
363
  ptr = ptr >>> 0;
740
364
  const obj = Object.create(Client.prototype);
@@ -742,14 +366,12 @@ class Client {
742
366
  ClientFinalization.register(obj, obj.__wbg_ptr, obj);
743
367
  return obj;
744
368
  }
745
-
746
369
  __destroy_into_raw() {
747
370
  const ptr = this.__wbg_ptr;
748
371
  this.__wbg_ptr = 0;
749
372
  ClientFinalization.unregister(this);
750
373
  return ptr;
751
374
  }
752
-
753
375
  free() {
754
376
  const ptr = this.__destroy_into_raw();
755
377
  wasm.__wbg_client_free(ptr, 0);
@@ -835,32 +457,302 @@ class Client {
835
457
  }
836
458
  }
837
459
  if (Symbol.dispose) Client.prototype[Symbol.dispose] = Client.prototype.free;
838
-
839
460
  exports.Client = Client;
840
461
 
841
- const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
842
- ? { register: () => {}, unregister: () => {} }
843
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
844
-
845
- class IntoUnderlyingByteSource {
846
-
462
+ /**
463
+ * A single event from the event stream.
464
+ *
465
+ * @example
466
+ * ```typescript
467
+ * for await (const event of stream) {
468
+ * console.log(event.eventType); // "PUT" or "DEL"
469
+ * console.log(event.cursor); // cursor string for pagination
470
+ *
471
+ * if (event.eventType === "PUT") {
472
+ * console.log("Hash:", event.contentHash);
473
+ * }
474
+ *
475
+ * // Access resource details
476
+ * console.log(event.resource.owner.z32()); // User's public key
477
+ * console.log(event.resource.path); // "/pub/example.txt"
478
+ * console.log(event.resource.toPubkyUrl()); // Full pubky:// URL
479
+ * }
480
+ * ```
481
+ */
482
+ class Event {
483
+ static __wrap(ptr) {
484
+ ptr = ptr >>> 0;
485
+ const obj = Object.create(Event.prototype);
486
+ obj.__wbg_ptr = ptr;
487
+ EventFinalization.register(obj, obj.__wbg_ptr, obj);
488
+ return obj;
489
+ }
847
490
  __destroy_into_raw() {
848
491
  const ptr = this.__wbg_ptr;
849
492
  this.__wbg_ptr = 0;
850
- IntoUnderlyingByteSourceFinalization.unregister(this);
493
+ EventFinalization.unregister(this);
851
494
  return ptr;
852
495
  }
496
+ free() {
497
+ const ptr = this.__destroy_into_raw();
498
+ wasm.__wbg_event_free(ptr, 0);
499
+ }
500
+ /**
501
+ * Get the content hash (only for PUT events).
502
+ * Returns the blake3 hash in base64 format, or undefined for DELETE events.
503
+ * @returns {string | undefined}
504
+ */
505
+ get contentHash() {
506
+ const ret = wasm.event_contentHash(this.__wbg_ptr);
507
+ let v1;
508
+ if (ret[0] !== 0) {
509
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
510
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
511
+ }
512
+ return v1;
513
+ }
514
+ /**
515
+ * Get the cursor for pagination.
516
+ * @returns {string}
517
+ */
518
+ get cursor() {
519
+ let deferred1_0;
520
+ let deferred1_1;
521
+ try {
522
+ const ret = wasm.event_cursor(this.__wbg_ptr);
523
+ deferred1_0 = ret[0];
524
+ deferred1_1 = ret[1];
525
+ return getStringFromWasm0(ret[0], ret[1]);
526
+ } finally {
527
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
528
+ }
529
+ }
530
+ /**
531
+ * Get the event type ("PUT" or "DEL").
532
+ * @returns {string}
533
+ */
534
+ get eventType() {
535
+ let deferred1_0;
536
+ let deferred1_1;
537
+ try {
538
+ const ret = wasm.event_eventType(this.__wbg_ptr);
539
+ deferred1_0 = ret[0];
540
+ deferred1_1 = ret[1];
541
+ return getStringFromWasm0(ret[0], ret[1]);
542
+ } finally {
543
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
544
+ }
545
+ }
546
+ /**
547
+ * Get the resource that was created, updated, or deleted.
548
+ * @returns {PubkyResource}
549
+ */
550
+ get resource() {
551
+ const ret = wasm.event_resource(this.__wbg_ptr);
552
+ return PubkyResource.__wrap(ret);
553
+ }
554
+ }
555
+ if (Symbol.dispose) Event.prototype[Symbol.dispose] = Event.prototype.free;
556
+ exports.Event = Event;
853
557
 
558
+ /**
559
+ * Builder for creating an event stream subscription.
560
+ *
561
+ * Construct via `Pubky.eventStreamForUser()` or `Pubky.eventStreamFor()`.
562
+ *
563
+ * @example
564
+ * ```typescript
565
+ * const stream = await pubky.eventStreamForUser(userPubkey, null)
566
+ * .live()
567
+ * .limit(100)
568
+ * .path("/pub/")
569
+ * .subscribe();
570
+ *
571
+ * for await (const event of stream) {
572
+ * console.log(event.eventType, event.resource.path);
573
+ * }
574
+ * ```
575
+ */
576
+ class EventStreamBuilder {
577
+ static __wrap(ptr) {
578
+ ptr = ptr >>> 0;
579
+ const obj = Object.create(EventStreamBuilder.prototype);
580
+ obj.__wbg_ptr = ptr;
581
+ EventStreamBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
582
+ return obj;
583
+ }
584
+ __destroy_into_raw() {
585
+ const ptr = this.__wbg_ptr;
586
+ this.__wbg_ptr = 0;
587
+ EventStreamBuilderFinalization.unregister(this);
588
+ return ptr;
589
+ }
854
590
  free() {
855
591
  const ptr = this.__destroy_into_raw();
856
- wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
592
+ wasm.__wbg_eventstreambuilder_free(ptr, 0);
857
593
  }
858
594
  /**
859
- * @returns {ReadableStreamType}
595
+ * Add multiple users to the event stream subscription at once.
596
+ *
597
+ * Each user can have an independent cursor position. If a user already exists,
598
+ * their cursor value is overwritten.
599
+ *
600
+ * @param {Array<[string, string | null]>} users - Array of [z32PublicKey, cursor] tuples
601
+ * @returns {EventStreamBuilder} - Builder for chaining
602
+ * @throws {Error} - If total users would exceed 50 or if any cursor/pubkey is invalid
603
+ *
604
+ * @example
605
+ * ```typescript
606
+ * const users: [string, string | null][] = [
607
+ * [user1.z32(), null],
608
+ * [user2.z32(), "100"],
609
+ * ];
610
+ * const stream = await pubky.eventStreamFor(homeserver)
611
+ * .addUsers(users)
612
+ * .live()
613
+ * .subscribe();
614
+ * ```
615
+ * @param {Array<any>} users
616
+ * @returns {EventStreamBuilder}
860
617
  */
861
- get type() {
862
- const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
863
- return __wbindgen_enum_ReadableStreamType[ret];
618
+ addUsers(users) {
619
+ const ptr = this.__destroy_into_raw();
620
+ const ret = wasm.eventstreambuilder_addUsers(ptr, users);
621
+ if (ret[2]) {
622
+ throw takeFromExternrefTable0(ret[1]);
623
+ }
624
+ return EventStreamBuilder.__wrap(ret[0]);
625
+ }
626
+ /**
627
+ * Set maximum number of events to receive before closing the connection.
628
+ *
629
+ * If omitted:
630
+ * - With `live=false`: sends all historical events, then closes
631
+ * - With `live=true`: sends all historical events, then enters live mode (infinite stream)
632
+ *
633
+ * @param {number} limit - Maximum number of events (1-65535)
634
+ * @returns {EventStreamBuilder} - Builder for chaining
635
+ * @param {number} limit
636
+ * @returns {EventStreamBuilder}
637
+ */
638
+ limit(limit) {
639
+ const ptr = this.__destroy_into_raw();
640
+ const ret = wasm.eventstreambuilder_limit(ptr, limit);
641
+ return EventStreamBuilder.__wrap(ret);
642
+ }
643
+ /**
644
+ * Enable live streaming mode.
645
+ *
646
+ * When called, the stream will:
647
+ * 1. First deliver all historical events (oldest first)
648
+ * 2. Then remain open to stream new events as they occur in real-time
649
+ *
650
+ * Without this flag (default): Stream only delivers historical events and closes.
651
+ *
652
+ * **Note**: Cannot be combined with `reverse()`.
653
+ *
654
+ * ## Cleanup
655
+ * To stop a live stream, use the reader's `cancel()` method:
656
+ * ```typescript
657
+ * const stream = await pubky.eventStreamForUser(user, null).live().subscribe();
658
+ * const reader = stream.getReader();
659
+ *
660
+ * while (true) {
661
+ * const { done, value } = await reader.read();
662
+ * if (shouldStop) {
663
+ * await reader.cancel(); // Closes the connection
664
+ * break;
665
+ * }
666
+ * }
667
+ * ```
668
+ *
669
+ * @returns {EventStreamBuilder} - Builder for chaining
670
+ * @returns {EventStreamBuilder}
671
+ */
672
+ live() {
673
+ const ptr = this.__destroy_into_raw();
674
+ const ret = wasm.eventstreambuilder_live(ptr);
675
+ return EventStreamBuilder.__wrap(ret);
676
+ }
677
+ /**
678
+ * Filter events by path prefix.
679
+ *
680
+ * Format: Path WITHOUT `pubky://` scheme or user pubkey (e.g., "/pub/files/" or "/pub/").
681
+ * Only events whose path starts with this prefix are returned.
682
+ *
683
+ * @param {string} path - Path prefix to filter by
684
+ * @returns {EventStreamBuilder} - Builder for chaining
685
+ * @param {string} path
686
+ * @returns {EventStreamBuilder}
687
+ */
688
+ path(path) {
689
+ const ptr = this.__destroy_into_raw();
690
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
691
+ const len0 = WASM_VECTOR_LEN;
692
+ const ret = wasm.eventstreambuilder_path(ptr, ptr0, len0);
693
+ return EventStreamBuilder.__wrap(ret);
694
+ }
695
+ /**
696
+ * Return events in reverse chronological order (newest first).
697
+ *
698
+ * When called, events are delivered from newest to oldest, then the stream closes.
699
+ *
700
+ * Without this flag (default): Events are delivered oldest first.
701
+ *
702
+ * **Note**: Cannot be combined with `live()`.
703
+ *
704
+ * @returns {EventStreamBuilder} - Builder for chaining
705
+ * @returns {EventStreamBuilder}
706
+ */
707
+ reverse() {
708
+ const ptr = this.__destroy_into_raw();
709
+ const ret = wasm.eventstreambuilder_reverse(ptr);
710
+ return EventStreamBuilder.__wrap(ret);
711
+ }
712
+ /**
713
+ * Subscribe to the event stream.
714
+ *
715
+ * This performs the following steps:
716
+ * 1. Resolves the user's homeserver via DHT/PKDNS
717
+ * 2. Constructs the `/events-stream` URL with query parameters
718
+ * 3. Makes the HTTP request
719
+ * 4. Returns a Web ReadableStream of parsed events
720
+ *
721
+ * @returns {Promise<ReadableStream>} - A Web ReadableStream that yields Event objects
722
+ *
723
+ * @throws {PubkyError}
724
+ * - `{ name: "RequestError" }` if the homeserver cannot be resolved
725
+ * - `{ name: "ValidationError" }` if `live=true` and `reverse=true` (invalid combination)
726
+ * - Propagates HTTP request errors
727
+ *
728
+ * @example
729
+ * ```typescript
730
+ * const stream = await builder.subscribe();
731
+ * for await (const event of stream) {
732
+ * console.log(`${event.eventType}: ${event.resource.path}`);
733
+ * }
734
+ * ```
735
+ * @returns {Promise<ReadableStream>}
736
+ */
737
+ subscribe() {
738
+ const ptr = this.__destroy_into_raw();
739
+ const ret = wasm.eventstreambuilder_subscribe(ptr);
740
+ return ret;
741
+ }
742
+ }
743
+ if (Symbol.dispose) EventStreamBuilder.prototype[Symbol.dispose] = EventStreamBuilder.prototype.free;
744
+ exports.EventStreamBuilder = EventStreamBuilder;
745
+
746
+ class IntoUnderlyingByteSource {
747
+ __destroy_into_raw() {
748
+ const ptr = this.__wbg_ptr;
749
+ this.__wbg_ptr = 0;
750
+ IntoUnderlyingByteSourceFinalization.unregister(this);
751
+ return ptr;
752
+ }
753
+ free() {
754
+ const ptr = this.__destroy_into_raw();
755
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
864
756
  }
865
757
  /**
866
758
  * @returns {number}
@@ -869,11 +761,9 @@ class IntoUnderlyingByteSource {
869
761
  const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
870
762
  return ret >>> 0;
871
763
  }
872
- /**
873
- * @param {ReadableByteStreamController} controller
874
- */
875
- start(controller) {
876
- wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
764
+ cancel() {
765
+ const ptr = this.__destroy_into_raw();
766
+ wasm.intounderlyingbytesource_cancel(ptr);
877
767
  }
878
768
  /**
879
769
  * @param {ReadableByteStreamController} controller
@@ -883,38 +773,41 @@ class IntoUnderlyingByteSource {
883
773
  const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
884
774
  return ret;
885
775
  }
886
- cancel() {
887
- const ptr = this.__destroy_into_raw();
888
- wasm.intounderlyingbytesource_cancel(ptr);
776
+ /**
777
+ * @param {ReadableByteStreamController} controller
778
+ */
779
+ start(controller) {
780
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
781
+ }
782
+ /**
783
+ * @returns {ReadableStreamType}
784
+ */
785
+ get type() {
786
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
787
+ return __wbindgen_enum_ReadableStreamType[ret];
889
788
  }
890
789
  }
891
790
  if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
892
-
893
791
  exports.IntoUnderlyingByteSource = IntoUnderlyingByteSource;
894
792
 
895
- const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
896
- ? { register: () => {}, unregister: () => {} }
897
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
898
-
899
793
  class IntoUnderlyingSink {
900
-
901
794
  __destroy_into_raw() {
902
795
  const ptr = this.__wbg_ptr;
903
796
  this.__wbg_ptr = 0;
904
797
  IntoUnderlyingSinkFinalization.unregister(this);
905
798
  return ptr;
906
799
  }
907
-
908
800
  free() {
909
801
  const ptr = this.__destroy_into_raw();
910
802
  wasm.__wbg_intounderlyingsink_free(ptr, 0);
911
803
  }
912
804
  /**
913
- * @param {any} chunk
805
+ * @param {any} reason
914
806
  * @returns {Promise<any>}
915
807
  */
916
- write(chunk) {
917
- const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
808
+ abort(reason) {
809
+ const ptr = this.__destroy_into_raw();
810
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
918
811
  return ret;
919
812
  }
920
813
  /**
@@ -926,25 +819,18 @@ class IntoUnderlyingSink {
926
819
  return ret;
927
820
  }
928
821
  /**
929
- * @param {any} reason
822
+ * @param {any} chunk
930
823
  * @returns {Promise<any>}
931
824
  */
932
- abort(reason) {
933
- const ptr = this.__destroy_into_raw();
934
- const ret = wasm.intounderlyingsink_abort(ptr, reason);
825
+ write(chunk) {
826
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
935
827
  return ret;
936
828
  }
937
829
  }
938
830
  if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
939
-
940
831
  exports.IntoUnderlyingSink = IntoUnderlyingSink;
941
832
 
942
- const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
943
- ? { register: () => {}, unregister: () => {} }
944
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
945
-
946
833
  class IntoUnderlyingSource {
947
-
948
834
  static __wrap(ptr) {
949
835
  ptr = ptr >>> 0;
950
836
  const obj = Object.create(IntoUnderlyingSource.prototype);
@@ -952,18 +838,20 @@ class IntoUnderlyingSource {
952
838
  IntoUnderlyingSourceFinalization.register(obj, obj.__wbg_ptr, obj);
953
839
  return obj;
954
840
  }
955
-
956
841
  __destroy_into_raw() {
957
842
  const ptr = this.__wbg_ptr;
958
843
  this.__wbg_ptr = 0;
959
844
  IntoUnderlyingSourceFinalization.unregister(this);
960
845
  return ptr;
961
846
  }
962
-
963
847
  free() {
964
848
  const ptr = this.__destroy_into_raw();
965
849
  wasm.__wbg_intounderlyingsource_free(ptr, 0);
966
850
  }
851
+ cancel() {
852
+ const ptr = this.__destroy_into_raw();
853
+ wasm.intounderlyingsource_cancel(ptr);
854
+ }
967
855
  /**
968
856
  * @param {ReadableStreamDefaultController} controller
969
857
  * @returns {Promise<any>}
@@ -972,21 +860,11 @@ class IntoUnderlyingSource {
972
860
  const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
973
861
  return ret;
974
862
  }
975
- cancel() {
976
- const ptr = this.__destroy_into_raw();
977
- wasm.intounderlyingsource_cancel(ptr);
978
- }
979
863
  }
980
864
  if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
981
-
982
865
  exports.IntoUnderlyingSource = IntoUnderlyingSource;
983
866
 
984
- const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
985
- ? { register: () => {}, unregister: () => {} }
986
- : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
987
-
988
867
  class Keypair {
989
-
990
868
  static __wrap(ptr) {
991
869
  ptr = ptr >>> 0;
992
870
  const obj = Object.create(Keypair.prototype);
@@ -994,25 +872,43 @@ class Keypair {
994
872
  KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
995
873
  return obj;
996
874
  }
997
-
998
875
  __destroy_into_raw() {
999
876
  const ptr = this.__wbg_ptr;
1000
877
  this.__wbg_ptr = 0;
1001
878
  KeypairFinalization.unregister(this);
1002
879
  return ptr;
1003
880
  }
1004
-
1005
881
  free() {
1006
882
  const ptr = this.__destroy_into_raw();
1007
883
  wasm.__wbg_keypair_free(ptr, 0);
1008
884
  }
1009
885
  /**
1010
- * Generate a random [Keypair]
886
+ * Create a recovery file for this keypair (encrypted with the given passphrase).
887
+ * @param {string} passphrase
888
+ * @returns {Uint8Array}
889
+ */
890
+ createRecoveryFile(passphrase) {
891
+ const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
892
+ const len0 = WASM_VECTOR_LEN;
893
+ const ret = wasm.keypair_createRecoveryFile(this.__wbg_ptr, ptr0, len0);
894
+ return ret;
895
+ }
896
+ /**
897
+ * Decrypt a recovery file and return a Keypair (decrypted with the given passphrase).
898
+ * @param {Uint8Array} recovery_file
899
+ * @param {string} passphrase
1011
900
  * @returns {Keypair}
1012
901
  */
1013
- static random() {
1014
- const ret = wasm.keypair_random();
1015
- return Keypair.__wrap(ret);
902
+ static fromRecoveryFile(recovery_file, passphrase) {
903
+ const ptr0 = passArray8ToWasm0(recovery_file, wasm.__wbindgen_malloc);
904
+ const len0 = WASM_VECTOR_LEN;
905
+ const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
906
+ const len1 = WASM_VECTOR_LEN;
907
+ const ret = wasm.keypair_fromRecoveryFile(ptr0, len0, ptr1, len1);
908
+ if (ret[2]) {
909
+ throw takeFromExternrefTable0(ret[1]);
910
+ }
911
+ return Keypair.__wrap(ret[0]);
1016
912
  }
1017
913
  /**
1018
914
  * Generate a [Keypair] from a 32-byte secret.
@@ -1028,14 +924,6 @@ class Keypair {
1028
924
  }
1029
925
  return Keypair.__wrap(ret[0]);
1030
926
  }
1031
- /**
1032
- * Returns the secret of this keypair.
1033
- * @returns {Uint8Array}
1034
- */
1035
- secret() {
1036
- const ret = wasm.keypair_secret(this.__wbg_ptr);
1037
- return ret;
1038
- }
1039
927
  /**
1040
928
  * Returns the [PublicKey] of this keypair.
1041
929
  *
@@ -1052,46 +940,29 @@ class Keypair {
1052
940
  return PublicKey.__wrap(ret);
1053
941
  }
1054
942
  /**
1055
- * Create a recovery file for this keypair (encrypted with the given passphrase).
1056
- * @param {string} passphrase
1057
- * @returns {Uint8Array}
943
+ * Generate a random [Keypair]
944
+ * @returns {Keypair}
1058
945
  */
1059
- createRecoveryFile(passphrase) {
1060
- const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1061
- const len0 = WASM_VECTOR_LEN;
1062
- const ret = wasm.keypair_createRecoveryFile(this.__wbg_ptr, ptr0, len0);
1063
- return ret;
946
+ static random() {
947
+ const ret = wasm.keypair_random();
948
+ return Keypair.__wrap(ret);
1064
949
  }
1065
950
  /**
1066
- * Decrypt a recovery file and return a Keypair (decrypted with the given passphrase).
1067
- * @param {Uint8Array} recovery_file
1068
- * @param {string} passphrase
1069
- * @returns {Keypair}
951
+ * Returns the secret of this keypair.
952
+ * @returns {Uint8Array}
1070
953
  */
1071
- static fromRecoveryFile(recovery_file, passphrase) {
1072
- const ptr0 = passArray8ToWasm0(recovery_file, wasm.__wbindgen_malloc);
1073
- const len0 = WASM_VECTOR_LEN;
1074
- const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1075
- const len1 = WASM_VECTOR_LEN;
1076
- const ret = wasm.keypair_fromRecoveryFile(ptr0, len0, ptr1, len1);
1077
- if (ret[2]) {
1078
- throw takeFromExternrefTable0(ret[1]);
1079
- }
1080
- return Keypair.__wrap(ret[0]);
954
+ secret() {
955
+ const ret = wasm.keypair_secret(this.__wbg_ptr);
956
+ return ret;
1081
957
  }
1082
958
  }
1083
959
  if (Symbol.dispose) Keypair.prototype[Symbol.dispose] = Keypair.prototype.free;
1084
-
1085
960
  exports.Keypair = Keypair;
1086
961
 
1087
- const PkdnsFinalization = (typeof FinalizationRegistry === 'undefined')
1088
- ? { register: () => {}, unregister: () => {} }
1089
- : new FinalizationRegistry(ptr => wasm.__wbg_pkdns_free(ptr >>> 0, 1));
1090
962
  /**
1091
963
  * Resolve/publish `_pubky` PKDNS records (homeserver pointers).
1092
964
  */
1093
965
  class Pkdns {
1094
-
1095
966
  static __wrap(ptr) {
1096
967
  ptr = ptr >>> 0;
1097
968
  const obj = Object.create(Pkdns.prototype);
@@ -1099,30 +970,16 @@ class Pkdns {
1099
970
  PkdnsFinalization.register(obj, obj.__wbg_ptr, obj);
1100
971
  return obj;
1101
972
  }
1102
-
1103
973
  __destroy_into_raw() {
1104
974
  const ptr = this.__wbg_ptr;
1105
975
  this.__wbg_ptr = 0;
1106
976
  PkdnsFinalization.unregister(this);
1107
977
  return ptr;
1108
978
  }
1109
-
1110
979
  free() {
1111
980
  const ptr = this.__destroy_into_raw();
1112
981
  wasm.__wbg_pkdns_free(ptr, 0);
1113
982
  }
1114
- /**
1115
- * Read-only PKDNS actor (no keypair; resolve only).
1116
- */
1117
- constructor() {
1118
- const ret = wasm.pkdns_new();
1119
- if (ret[2]) {
1120
- throw takeFromExternrefTable0(ret[1]);
1121
- }
1122
- this.__wbg_ptr = ret[0] >>> 0;
1123
- PkdnsFinalization.register(this, this.__wbg_ptr, this);
1124
- return this;
1125
- }
1126
983
  /**
1127
984
  * PKDNS actor with publishing enabled (requires a keypair).
1128
985
  * @param {Keypair} keypair
@@ -1136,6 +993,16 @@ class Pkdns {
1136
993
  }
1137
994
  return Pkdns.__wrap(ret[0]);
1138
995
  }
996
+ /**
997
+ * Resolve the homeserver for **this** user (requires keypair).
998
+ *
999
+ * @returns {Promise<PublicKey|undefined>} Homeserver public key or `undefined` if not found.
1000
+ * @returns {Promise<PublicKey | undefined>}
1001
+ */
1002
+ getHomeserver() {
1003
+ const ret = wasm.pkdns_getHomeserver(this.__wbg_ptr);
1004
+ return ret;
1005
+ }
1139
1006
  /**
1140
1007
  * Resolve the homeserver for a given public key (read-only).
1141
1008
  *
@@ -1150,14 +1017,16 @@ class Pkdns {
1150
1017
  return ret;
1151
1018
  }
1152
1019
  /**
1153
- * Resolve the homeserver for **this** user (requires keypair).
1154
- *
1155
- * @returns {Promise<PublicKey|undefined>} Homeserver public key or `undefined` if not found.
1156
- * @returns {Promise<PublicKey | undefined>}
1020
+ * Read-only PKDNS actor (no keypair; resolve only).
1157
1021
  */
1158
- getHomeserver() {
1159
- const ret = wasm.pkdns_getHomeserver(this.__wbg_ptr);
1160
- return ret;
1022
+ constructor() {
1023
+ const ret = wasm.pkdns_new();
1024
+ if (ret[2]) {
1025
+ throw takeFromExternrefTable0(ret[1]);
1026
+ }
1027
+ this.__wbg_ptr = ret[0] >>> 0;
1028
+ PkdnsFinalization.register(this, this.__wbg_ptr, this);
1029
+ return this;
1161
1030
  }
1162
1031
  /**
1163
1032
  * Force publish homeserver immediately (even if fresh).
@@ -1199,17 +1068,12 @@ class Pkdns {
1199
1068
  }
1200
1069
  }
1201
1070
  if (Symbol.dispose) Pkdns.prototype[Symbol.dispose] = Pkdns.prototype.free;
1202
-
1203
1071
  exports.Pkdns = Pkdns;
1204
1072
 
1205
- const PubkyFinalization = (typeof FinalizationRegistry === 'undefined')
1206
- ? { register: () => {}, unregister: () => {} }
1207
- : new FinalizationRegistry(ptr => wasm.__wbg_pubky_free(ptr >>> 0, 1));
1208
1073
  /**
1209
1074
  * High-level entrypoint to the Pubky SDK.
1210
1075
  */
1211
1076
  class Pubky {
1212
-
1213
1077
  static __wrap(ptr) {
1214
1078
  ptr = ptr >>> 0;
1215
1079
  const obj = Object.create(Pubky.prototype);
@@ -1217,18 +1081,109 @@ class Pubky {
1217
1081
  PubkyFinalization.register(obj, obj.__wbg_ptr, obj);
1218
1082
  return obj;
1219
1083
  }
1220
-
1221
1084
  __destroy_into_raw() {
1222
1085
  const ptr = this.__wbg_ptr;
1223
1086
  this.__wbg_ptr = 0;
1224
1087
  PubkyFinalization.unregister(this);
1225
1088
  return ptr;
1226
1089
  }
1227
-
1228
1090
  free() {
1229
1091
  const ptr = this.__destroy_into_raw();
1230
1092
  wasm.__wbg_pubky_free(ptr, 0);
1231
1093
  }
1094
+ /**
1095
+ * Access the underlying HTTP client (advanced).
1096
+ *
1097
+ * @returns {Client}
1098
+ * Use this for low-level `fetch()` calls or testing with raw URLs.
1099
+ *
1100
+ * @example
1101
+ * const r = await pubky.client.fetch(`pubky://${userPk.z32()}/pub/app/file.txt`, { credentials: "include" });
1102
+ * @returns {Client}
1103
+ */
1104
+ get client() {
1105
+ const ret = wasm.pubky_client(this.__wbg_ptr);
1106
+ return Client.__wrap(ret);
1107
+ }
1108
+ /**
1109
+ * Create an event stream builder for a specific homeserver.
1110
+ *
1111
+ * Use this when you already know the homeserver pubkey. This avoids
1112
+ * Pkarr resolution overhead. Obtain a homeserver pubkey via `getHomeserverOf()`.
1113
+ *
1114
+ * @param {PublicKey} homeserver - The homeserver public key
1115
+ * @returns {EventStreamBuilder} - Builder for configuring and subscribing to the stream
1116
+ *
1117
+ * @example
1118
+ * ```typescript
1119
+ * const homeserver = await pubky.getHomeserverOf(user1);
1120
+ * const stream = await pubky.eventStreamFor(homeserver)
1121
+ * .addUsers([[user1.z32(), null], [user2.z32(), null]])
1122
+ * .live()
1123
+ * .subscribe();
1124
+ *
1125
+ * for await (const event of stream) {
1126
+ * console.log(`${event.eventType}: ${event.resource.path}`);
1127
+ * }
1128
+ * ```
1129
+ * @param {PublicKey} homeserver
1130
+ * @returns {EventStreamBuilder}
1131
+ */
1132
+ eventStreamFor(homeserver) {
1133
+ _assertClass(homeserver, PublicKey);
1134
+ const ret = wasm.pubky_eventStreamFor(this.__wbg_ptr, homeserver.__wbg_ptr);
1135
+ return EventStreamBuilder.__wrap(ret);
1136
+ }
1137
+ /**
1138
+ * Create an event stream builder for a single user.
1139
+ *
1140
+ * This is the simplest way to subscribe to events for one user. The homeserver
1141
+ * is automatically resolved from the user's Pkarr record.
1142
+ *
1143
+ * @param {PublicKey} user - The user's public key
1144
+ * @param {string | null} cursor - Optional cursor position to start from
1145
+ * @returns {EventStreamBuilder} - Builder for configuring and subscribing to the stream
1146
+ *
1147
+ * @example
1148
+ * ```typescript
1149
+ * const user = PublicKey.from("o1gg96ewuojmopcjbz8895478wdtxtzzuxnfjjz8o8e77csa1ngo");
1150
+ * const stream = await pubky.eventStreamForUser(user, null)
1151
+ * .live()
1152
+ * .subscribe();
1153
+ *
1154
+ * for await (const event of stream) {
1155
+ * console.log(`${event.eventType}: ${event.resource.path}`);
1156
+ * }
1157
+ * ```
1158
+ * @param {PublicKey} user
1159
+ * @param {string | null} [cursor]
1160
+ * @returns {EventStreamBuilder}
1161
+ */
1162
+ eventStreamForUser(user, cursor) {
1163
+ _assertClass(user, PublicKey);
1164
+ var ptr0 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1165
+ var len0 = WASM_VECTOR_LEN;
1166
+ const ret = wasm.pubky_eventStreamForUser(this.__wbg_ptr, user.__wbg_ptr, ptr0, len0);
1167
+ if (ret[2]) {
1168
+ throw takeFromExternrefTable0(ret[1]);
1169
+ }
1170
+ return EventStreamBuilder.__wrap(ret[0]);
1171
+ }
1172
+ /**
1173
+ * Resolve the homeserver for a given public key (read-only).
1174
+ *
1175
+ * Uses an internal read-only Pkdns actor.
1176
+ *
1177
+ * @param {PublicKey} user
1178
+ * @returns {Promise<PublicKey|undefined>} Homeserver public key or `undefined` if not found.
1179
+ * @param {PublicKey} user_public_key
1180
+ * @returns {Promise<PublicKey | undefined>}
1181
+ */
1182
+ getHomeserverOf(user_public_key) {
1183
+ _assertClass(user_public_key, PublicKey);
1184
+ const ret = wasm.pubky_getHomeserverOf(this.__wbg_ptr, user_public_key.__wbg_ptr);
1185
+ return ret;
1186
+ }
1232
1187
  /**
1233
1188
  * Create a Pubky facade wired for **mainnet** defaults (public relays).
1234
1189
  *
@@ -1253,45 +1208,58 @@ class Pubky {
1253
1208
  return this;
1254
1209
  }
1255
1210
  /**
1256
- * Create a Pubky facade preconfigured for a **local testnet**.
1211
+ * Public, unauthenticated storage API.
1257
1212
  *
1258
- * If `host` is provided, PKARR and HTTP endpoints are derived as `http://<host>:ports/...`.
1259
- * If omitted, `"localhost"` is assumed (handy for `cargo install pubky-testnet`).
1213
+ * Use for **read-only** public access via addressed paths:
1214
+ * `"pubky<user>/pub/…"`.
1260
1215
  *
1261
- * @param {string=} host Optional host (e.g. `"localhost"`, `"docker-host"`, `"127.0.0.1"`).
1262
- * @returns {Pubky}
1216
+ * @returns {PublicStorage}
1263
1217
  *
1264
1218
  * @example
1265
- * const pubky = Pubky.testnet(); // localhost default
1266
- * const pubky = Pubky.testnet("docker-host"); // custom hostname/IP
1267
- * @param {string | null} [host]
1268
- * @returns {Pubky}
1219
+ * const text = await pubky.publicStorage.getText(`${userPk.toString()}/pub/example.com/hello.txt`);
1220
+ * @returns {PublicStorage}
1221
+ */
1222
+ get publicStorage() {
1223
+ const ret = wasm.pubky_publicStorage(this.__wbg_ptr);
1224
+ return PublicStorage.__wrap(ret);
1225
+ }
1226
+ /**
1227
+ * Restore a session from a previously exported snapshot, using this instance's client.
1228
+ *
1229
+ * This does **not** read or write any secrets. It revalidates the session metadata with
1230
+ * the server using the browser-managed HTTP-only cookie that must still be present.
1231
+ *
1232
+ * @param {string} exported A string produced by `session.export()`.
1233
+ * @returns {Promise<Session>}
1234
+ * A rehydrated session bound to this SDK's HTTP client.
1235
+ *
1236
+ * @example
1237
+ * const restored = await pubky.restoreSession(localStorage.getItem("pubky-session")!);
1238
+ * @param {string} exported
1239
+ * @returns {Promise<Session>}
1269
1240
  */
1270
- static testnet(host) {
1271
- var ptr0 = isLikeNone(host) ? 0 : passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1272
- var len0 = WASM_VECTOR_LEN;
1273
- const ret = wasm.pubky_testnet(ptr0, len0);
1274
- if (ret[2]) {
1275
- throw takeFromExternrefTable0(ret[1]);
1276
- }
1277
- return Pubky.__wrap(ret[0]);
1241
+ restoreSession(exported) {
1242
+ const ptr0 = passStringToWasm0(exported, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1243
+ const len0 = WASM_VECTOR_LEN;
1244
+ const ret = wasm.pubky_restoreSession(this.__wbg_ptr, ptr0, len0);
1245
+ return ret;
1278
1246
  }
1279
1247
  /**
1280
- * Wrap an existing configured HTTP client into a Pubky facade.
1248
+ * Create a `Signer` from an existing `Keypair`.
1281
1249
  *
1282
- * @param {Client} client A previously constructed client.
1283
- * @returns {Pubky}
1250
+ * @param {Keypair} keypair The user’s keys.
1251
+ * @returns {Signer}
1284
1252
  *
1285
1253
  * @example
1286
- * const client = Client.testnet();
1287
- * const pubky = Pubky.withClient(client);
1288
- * @param {Client} client
1289
- * @returns {Pubky}
1254
+ * const signer = pubky.signer(Keypair.random());
1255
+ * const session = await signer.signup(homeserverPk, null);
1256
+ * @param {Keypair} keypair
1257
+ * @returns {Signer}
1290
1258
  */
1291
- static withClient(client) {
1292
- _assertClass(client, Client);
1293
- const ret = wasm.pubky_withClient(client.__wbg_ptr);
1294
- return Pubky.__wrap(ret);
1259
+ signer(keypair) {
1260
+ _assertClass(keypair, Keypair);
1261
+ const ret = wasm.pubky_signer(this.__wbg_ptr, keypair.__wbg_ptr);
1262
+ return Signer.__wrap(ret);
1295
1263
  }
1296
1264
  /**
1297
1265
  * Start a **pubkyauth** flow.
@@ -1308,7 +1276,7 @@ class Pubky {
1308
1276
  * Examples:
1309
1277
  * - `AuthFlowKind.signin()` - Sign in to an existing account.
1310
1278
  * - `AuthFlowKind.signup(homeserverPublicKey, signupToken)` - Sign up for a new account.
1311
- * @param {string=} relay Optional HTTP relay base (e.g. `"https://…/link/"`).
1279
+ * @param {string=} relay Optional HTTP relay base (e.g. `"https://…/inbox/"`).
1312
1280
  * @returns {AuthFlow}
1313
1281
  * A running auth flow. Show `authorizationUrl` as QR/deeplink,
1314
1282
  * then `awaitApproval()` to obtain a `Session`.
@@ -1340,135 +1308,121 @@ class Pubky {
1340
1308
  return AuthFlow.__wrap(ret[0]);
1341
1309
  }
1342
1310
  /**
1343
- * Create a `Signer` from an existing `Keypair`.
1344
- *
1345
- * @param {Keypair} keypair The user’s keys.
1346
- * @returns {Signer}
1347
- *
1348
- * @example
1349
- * const signer = pubky.signer(Keypair.random());
1350
- * const session = await signer.signup(homeserverPk, null);
1351
- * @param {Keypair} keypair
1352
- * @returns {Signer}
1353
- */
1354
- signer(keypair) {
1355
- _assertClass(keypair, Keypair);
1356
- const ret = wasm.pubky_signer(this.__wbg_ptr, keypair.__wbg_ptr);
1357
- return Signer.__wrap(ret);
1358
- }
1359
- /**
1360
- * Public, unauthenticated storage API.
1361
- *
1362
- * Use for **read-only** public access via addressed paths:
1363
- * `"pubky<user>/pub/…"`.
1364
- *
1365
- * @returns {PublicStorage}
1366
- *
1367
- * @example
1368
- * const text = await pubky.publicStorage.getText(`${userPk.toString()}/pub/example.com/hello.txt`);
1369
- * @returns {PublicStorage}
1370
- */
1371
- get publicStorage() {
1372
- const ret = wasm.pubky_client(this.__wbg_ptr);
1373
- return PublicStorage.__wrap(ret);
1374
- }
1375
- /**
1376
- * Resolve the homeserver for a given public key (read-only).
1377
- *
1378
- * Uses an internal read-only Pkdns actor.
1311
+ * Create a Pubky facade preconfigured for a **local testnet**.
1379
1312
  *
1380
- * @param {PublicKey} user
1381
- * @returns {Promise<PublicKey|undefined>} Homeserver public key or `undefined` if not found.
1382
- * @param {PublicKey} user_public_key
1383
- * @returns {Promise<PublicKey | undefined>}
1384
- */
1385
- getHomeserverOf(user_public_key) {
1386
- _assertClass(user_public_key, PublicKey);
1387
- const ret = wasm.pubky_getHomeserverOf(this.__wbg_ptr, user_public_key.__wbg_ptr);
1388
- return ret;
1389
- }
1390
- /**
1391
- * Access the underlying HTTP client (advanced).
1313
+ * If `host` is provided, PKARR and HTTP endpoints are derived as `http://<host>:ports/...`.
1314
+ * If omitted, `"localhost"` is assumed (handy for `cargo install pubky-testnet`).
1392
1315
  *
1393
- * @returns {Client}
1394
- * Use this for low-level `fetch()` calls or testing with raw URLs.
1316
+ * @param {string=} host Optional host (e.g. `"localhost"`, `"docker-host"`, `"127.0.0.1"`).
1317
+ * @returns {Pubky}
1395
1318
  *
1396
1319
  * @example
1397
- * const r = await pubky.client.fetch(`pubky://${userPk.z32()}/pub/app/file.txt`, { credentials: "include" });
1398
- * @returns {Client}
1320
+ * const pubky = Pubky.testnet(); // localhost default
1321
+ * const pubky = Pubky.testnet("docker-host"); // custom hostname/IP
1322
+ * @param {string | null} [host]
1323
+ * @returns {Pubky}
1399
1324
  */
1400
- get client() {
1401
- const ret = wasm.pubky_client(this.__wbg_ptr);
1402
- return Client.__wrap(ret);
1325
+ static testnet(host) {
1326
+ var ptr0 = isLikeNone(host) ? 0 : passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1327
+ var len0 = WASM_VECTOR_LEN;
1328
+ const ret = wasm.pubky_testnet(ptr0, len0);
1329
+ if (ret[2]) {
1330
+ throw takeFromExternrefTable0(ret[1]);
1331
+ }
1332
+ return Pubky.__wrap(ret[0]);
1403
1333
  }
1404
1334
  /**
1405
- * Restore a session from a previously exported snapshot, using this instance's client.
1406
- *
1407
- * This does **not** read or write any secrets. It revalidates the session metadata with
1408
- * the server using the browser-managed HTTP-only cookie that must still be present.
1335
+ * Wrap an existing configured HTTP client into a Pubky facade.
1409
1336
  *
1410
- * @param {string} exported A string produced by `session.export()`.
1411
- * @returns {Promise<Session>}
1412
- * A rehydrated session bound to this SDK's HTTP client.
1337
+ * @param {Client} client A previously constructed client.
1338
+ * @returns {Pubky}
1413
1339
  *
1414
1340
  * @example
1415
- * const restored = await pubky.restoreSession(localStorage.getItem("pubky-session")!);
1416
- * @param {string} exported
1417
- * @returns {Promise<Session>}
1341
+ * const client = Client.testnet();
1342
+ * const pubky = Pubky.withClient(client);
1343
+ * @param {Client} client
1344
+ * @returns {Pubky}
1418
1345
  */
1419
- restoreSession(exported) {
1420
- const ptr0 = passStringToWasm0(exported, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1421
- const len0 = WASM_VECTOR_LEN;
1422
- const ret = wasm.pubky_restoreSession(this.__wbg_ptr, ptr0, len0);
1423
- return ret;
1346
+ static withClient(client) {
1347
+ _assertClass(client, Client);
1348
+ const ret = wasm.pubky_withClient(client.__wbg_ptr);
1349
+ return Pubky.__wrap(ret);
1424
1350
  }
1425
1351
  }
1426
1352
  if (Symbol.dispose) Pubky.prototype[Symbol.dispose] = Pubky.prototype.free;
1427
-
1428
1353
  exports.Pubky = Pubky;
1429
1354
 
1430
- const PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1431
- ? { register: () => {}, unregister: () => {} }
1432
- : new FinalizationRegistry(ptr => wasm.__wbg_publickey_free(ptr >>> 0, 1));
1433
-
1434
- class PublicKey {
1435
-
1355
+ /**
1356
+ * An addressed resource: a user's public key paired with an absolute path.
1357
+ *
1358
+ * This represents a specific file or directory on a user's homeserver.
1359
+ *
1360
+ * @example
1361
+ * ```typescript
1362
+ * // Parse from a pubky URL
1363
+ * const resource = PubkyResource.parse("pubky://o1gg96ewuojmopcjbz8895478wdtxtzzuxnfjjz8o8e77csa1ngo/pub/example.txt");
1364
+ * console.log(resource.owner.z32()); // The user's public key
1365
+ * console.log(resource.path); // "/pub/example.txt"
1366
+ * console.log(resource.toPubkyUrl()); // "pubky://o1gg96.../pub/example.txt"
1367
+ * ```
1368
+ */
1369
+ class PubkyResource {
1436
1370
  static __wrap(ptr) {
1437
1371
  ptr = ptr >>> 0;
1438
- const obj = Object.create(PublicKey.prototype);
1372
+ const obj = Object.create(PubkyResource.prototype);
1439
1373
  obj.__wbg_ptr = ptr;
1440
- PublicKeyFinalization.register(obj, obj.__wbg_ptr, obj);
1374
+ PubkyResourceFinalization.register(obj, obj.__wbg_ptr, obj);
1441
1375
  return obj;
1442
1376
  }
1443
-
1444
1377
  __destroy_into_raw() {
1445
1378
  const ptr = this.__wbg_ptr;
1446
1379
  this.__wbg_ptr = 0;
1447
- PublicKeyFinalization.unregister(this);
1380
+ PubkyResourceFinalization.unregister(this);
1448
1381
  return ptr;
1449
1382
  }
1450
-
1451
1383
  free() {
1452
1384
  const ptr = this.__destroy_into_raw();
1453
- wasm.__wbg_publickey_free(ptr, 0);
1385
+ wasm.__wbg_pubkyresource_free(ptr, 0);
1454
1386
  }
1455
1387
  /**
1456
- * Convert the PublicKey to Uint8Array
1457
- * @returns {Uint8Array}
1388
+ * Get the owner's public key.
1389
+ * @returns {PublicKey}
1458
1390
  */
1459
- toUint8Array() {
1460
- const ret = wasm.publickey_toUint8Array(this.__wbg_ptr);
1461
- return ret;
1391
+ get owner() {
1392
+ const ret = wasm.pubkyresource_owner(this.__wbg_ptr);
1393
+ return PublicKey.__wrap(ret);
1462
1394
  }
1463
1395
  /**
1464
- * Returns the z-base32 encoding of this public key
1396
+ * Parse a pubky resource from a string.
1397
+ *
1398
+ * Accepts:
1399
+ * - `pubky://<public_key>/<path>` (URL form)
1400
+ * - `pubky<public_key>/<path>` (identifier form)
1401
+ *
1402
+ * @param {string} value - The resource string to parse
1403
+ * @returns {PubkyResource} - The parsed resource
1404
+ * @throws {Error} - If the string is not a valid pubky resource
1405
+ * @param {string} value
1406
+ * @returns {PubkyResource}
1407
+ */
1408
+ static parse(value) {
1409
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1410
+ const len0 = WASM_VECTOR_LEN;
1411
+ const ret = wasm.pubkyresource_parse(ptr0, len0);
1412
+ if (ret[2]) {
1413
+ throw takeFromExternrefTable0(ret[1]);
1414
+ }
1415
+ return PubkyResource.__wrap(ret[0]);
1416
+ }
1417
+ /**
1418
+ * Get the absolute path (e.g., "/pub/example.txt").
1465
1419
  * @returns {string}
1466
1420
  */
1467
- z32() {
1421
+ get path() {
1468
1422
  let deferred1_0;
1469
1423
  let deferred1_1;
1470
1424
  try {
1471
- const ret = wasm.publickey_z32(this.__wbg_ptr);
1425
+ const ret = wasm.pubkyresource_path(this.__wbg_ptr);
1472
1426
  deferred1_0 = ret[0];
1473
1427
  deferred1_1 = ret[1];
1474
1428
  return getStringFromWasm0(ret[0], ret[1]);
@@ -1477,15 +1431,30 @@ class PublicKey {
1477
1431
  }
1478
1432
  }
1479
1433
  /**
1480
- * Returns the identifier form with the `pubky` prefix.
1481
- * Use for display only; transport/storage should use `.z32()`.
1434
+ * Render as `pubky://<owner>/<path>` (deep-link/URL form).
1435
+ * @returns {string}
1436
+ */
1437
+ toPubkyUrl() {
1438
+ let deferred1_0;
1439
+ let deferred1_1;
1440
+ try {
1441
+ const ret = wasm.pubkyresource_toPubkyUrl(this.__wbg_ptr);
1442
+ deferred1_0 = ret[0];
1443
+ deferred1_1 = ret[1];
1444
+ return getStringFromWasm0(ret[0], ret[1]);
1445
+ } finally {
1446
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1447
+ }
1448
+ }
1449
+ /**
1450
+ * Render as `pubky<owner>/<path>` (identifier form).
1482
1451
  * @returns {string}
1483
1452
  */
1484
1453
  toString() {
1485
1454
  let deferred1_0;
1486
1455
  let deferred1_1;
1487
1456
  try {
1488
- const ret = wasm.publickey_toString(this.__wbg_ptr);
1457
+ const ret = wasm.pubkyresource_toString(this.__wbg_ptr);
1489
1458
  deferred1_0 = ret[0];
1490
1459
  deferred1_1 = ret[1];
1491
1460
  return getStringFromWasm0(ret[0], ret[1]);
@@ -1493,6 +1462,28 @@ class PublicKey {
1493
1462
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1494
1463
  }
1495
1464
  }
1465
+ }
1466
+ if (Symbol.dispose) PubkyResource.prototype[Symbol.dispose] = PubkyResource.prototype.free;
1467
+ exports.PubkyResource = PubkyResource;
1468
+
1469
+ class PublicKey {
1470
+ static __wrap(ptr) {
1471
+ ptr = ptr >>> 0;
1472
+ const obj = Object.create(PublicKey.prototype);
1473
+ obj.__wbg_ptr = ptr;
1474
+ PublicKeyFinalization.register(obj, obj.__wbg_ptr, obj);
1475
+ return obj;
1476
+ }
1477
+ __destroy_into_raw() {
1478
+ const ptr = this.__wbg_ptr;
1479
+ this.__wbg_ptr = 0;
1480
+ PublicKeyFinalization.unregister(this);
1481
+ return ptr;
1482
+ }
1483
+ free() {
1484
+ const ptr = this.__destroy_into_raw();
1485
+ wasm.__wbg_publickey_free(ptr, 0);
1486
+ }
1496
1487
  /**
1497
1488
  * @throws
1498
1489
  * @param {string} value
@@ -1507,19 +1498,55 @@ class PublicKey {
1507
1498
  }
1508
1499
  return PublicKey.__wrap(ret[0]);
1509
1500
  }
1501
+ /**
1502
+ * Returns the identifier form with the `pubky` prefix.
1503
+ * Use for display only; transport/storage should use `.z32()`.
1504
+ * @returns {string}
1505
+ */
1506
+ toString() {
1507
+ let deferred1_0;
1508
+ let deferred1_1;
1509
+ try {
1510
+ const ret = wasm.publickey_toString(this.__wbg_ptr);
1511
+ deferred1_0 = ret[0];
1512
+ deferred1_1 = ret[1];
1513
+ return getStringFromWasm0(ret[0], ret[1]);
1514
+ } finally {
1515
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1516
+ }
1517
+ }
1518
+ /**
1519
+ * Convert the PublicKey to Uint8Array
1520
+ * @returns {Uint8Array}
1521
+ */
1522
+ toUint8Array() {
1523
+ const ret = wasm.publickey_toUint8Array(this.__wbg_ptr);
1524
+ return ret;
1525
+ }
1526
+ /**
1527
+ * Returns the z-base32 encoding of this public key
1528
+ * @returns {string}
1529
+ */
1530
+ z32() {
1531
+ let deferred1_0;
1532
+ let deferred1_1;
1533
+ try {
1534
+ const ret = wasm.publickey_z32(this.__wbg_ptr);
1535
+ deferred1_0 = ret[0];
1536
+ deferred1_1 = ret[1];
1537
+ return getStringFromWasm0(ret[0], ret[1]);
1538
+ } finally {
1539
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1540
+ }
1541
+ }
1510
1542
  }
1511
1543
  if (Symbol.dispose) PublicKey.prototype[Symbol.dispose] = PublicKey.prototype.free;
1512
-
1513
1544
  exports.PublicKey = PublicKey;
1514
1545
 
1515
- const PublicStorageFinalization = (typeof FinalizationRegistry === 'undefined')
1516
- ? { register: () => {}, unregister: () => {} }
1517
- : new FinalizationRegistry(ptr => wasm.__wbg_publicstorage_free(ptr >>> 0, 1));
1518
1546
  /**
1519
1547
  * Read-only public storage using addressed paths (`"pubky<user>/pub/..."`).
1520
1548
  */
1521
1549
  class PublicStorage {
1522
-
1523
1550
  static __wrap(ptr) {
1524
1551
  ptr = ptr >>> 0;
1525
1552
  const obj = Object.create(PublicStorage.prototype);
@@ -1527,52 +1554,28 @@ class PublicStorage {
1527
1554
  PublicStorageFinalization.register(obj, obj.__wbg_ptr, obj);
1528
1555
  return obj;
1529
1556
  }
1530
-
1531
1557
  __destroy_into_raw() {
1532
1558
  const ptr = this.__wbg_ptr;
1533
1559
  this.__wbg_ptr = 0;
1534
1560
  PublicStorageFinalization.unregister(this);
1535
1561
  return ptr;
1536
1562
  }
1537
-
1538
1563
  free() {
1539
1564
  const ptr = this.__destroy_into_raw();
1540
1565
  wasm.__wbg_publicstorage_free(ptr, 0);
1541
1566
  }
1542
1567
  /**
1543
- * Construct PublicStorage using global client (mainline relays).
1544
- */
1545
- constructor() {
1546
- const ret = wasm.publicstorage_new();
1547
- if (ret[2]) {
1548
- throw takeFromExternrefTable0(ret[1]);
1549
- }
1550
- this.__wbg_ptr = ret[0] >>> 0;
1551
- PublicStorageFinalization.register(this, this.__wbg_ptr, this);
1552
- return this;
1553
- }
1554
- /**
1555
- * List a directory. Results are `pubky://…` identifier URLs.
1568
+ * Check if a path exists.
1556
1569
  *
1557
- * @param {Address} address Addressed directory (must end with `/`).
1558
- * @param {string|null=} cursor Optional suffix or full URL to start **after**.
1559
- * @param {boolean=} reverse Default `false`. When `true`, newest/lexicographically-last first.
1560
- * @param {number=} limit Optional result limit.
1561
- * @param {boolean=} shallow Default `false`. When `true`, lists only first-level entries.
1562
- * @returns {Promise<string[]>}
1563
1570
  * @param {Address} address
1564
- * @param {string | null} [cursor]
1565
- * @param {boolean | null} [reverse]
1566
- * @param {number | null} [limit]
1567
- * @param {boolean | null} [shallow]
1568
- * @returns {Promise<string[]>}
1571
+ * @returns {Promise<boolean>}
1572
+ * @param {Address} address
1573
+ * @returns {Promise<boolean>}
1569
1574
  */
1570
- list(address, cursor, reverse, limit, shallow) {
1575
+ exists(address) {
1571
1576
  const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1572
1577
  const len0 = WASM_VECTOR_LEN;
1573
- var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1574
- var len1 = WASM_VECTOR_LEN;
1575
- 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);
1578
+ const ret = wasm.publicstorage_exists(this.__wbg_ptr, ptr0, len0);
1576
1579
  return ret;
1577
1580
  }
1578
1581
  /**
@@ -1603,6 +1606,20 @@ class PublicStorage {
1603
1606
  const ret = wasm.publicstorage_getBytes(this.__wbg_ptr, ptr0, len0);
1604
1607
  return ret;
1605
1608
  }
1609
+ /**
1610
+ * Fetch JSON from an addressed path.
1611
+ *
1612
+ * @param {Address} address `"pubky<user>/pub/.../file.json"` (preferred) or `pubky://<user>/pub/...`.
1613
+ * @returns {Promise<any>}
1614
+ * @param {Address} address
1615
+ * @returns {Promise<any>}
1616
+ */
1617
+ getJson(address) {
1618
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1619
+ const len0 = WASM_VECTOR_LEN;
1620
+ const ret = wasm.publicstorage_getJson(this.__wbg_ptr, ptr0, len0);
1621
+ return ret;
1622
+ }
1606
1623
  /**
1607
1624
  * Fetch text from an addressed path as UTF-8 text.
1608
1625
  *
@@ -1618,32 +1635,40 @@ class PublicStorage {
1618
1635
  return ret;
1619
1636
  }
1620
1637
  /**
1621
- * Fetch JSON from an addressed path.
1638
+ * List a directory. Results are `pubky://…` identifier URLs.
1622
1639
  *
1623
- * @param {Address} address `"pubky<user>/pub/.../file.json"` (preferred) or `pubky://<user>/pub/...`.
1624
- * @returns {Promise<any>}
1640
+ * @param {Address} address Addressed directory (must end with `/`).
1641
+ * @param {string|null=} cursor Optional suffix or full URL to start **after**.
1642
+ * @param {boolean=} reverse Default `false`. When `true`, newest/lexicographically-last first.
1643
+ * @param {number=} limit Optional result limit.
1644
+ * @param {boolean=} shallow Default `false`. When `true`, lists only first-level entries.
1645
+ * @returns {Promise<string[]>}
1625
1646
  * @param {Address} address
1626
- * @returns {Promise<any>}
1647
+ * @param {string | null} [cursor]
1648
+ * @param {boolean | null} [reverse]
1649
+ * @param {number | null} [limit]
1650
+ * @param {boolean | null} [shallow]
1651
+ * @returns {Promise<string[]>}
1627
1652
  */
1628
- getJson(address) {
1653
+ list(address, cursor, reverse, limit, shallow) {
1629
1654
  const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1630
1655
  const len0 = WASM_VECTOR_LEN;
1631
- const ret = wasm.publicstorage_getJson(this.__wbg_ptr, ptr0, len0);
1656
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1657
+ var len1 = WASM_VECTOR_LEN;
1658
+ 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);
1632
1659
  return ret;
1633
1660
  }
1634
1661
  /**
1635
- * Check if a path exists.
1636
- *
1637
- * @param {Address} address
1638
- * @returns {Promise<boolean>}
1639
- * @param {Address} address
1640
- * @returns {Promise<boolean>}
1662
+ * Construct PublicStorage using global client (mainline relays).
1641
1663
  */
1642
- exists(address) {
1643
- const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1644
- const len0 = WASM_VECTOR_LEN;
1645
- const ret = wasm.publicstorage_exists(this.__wbg_ptr, ptr0, len0);
1646
- return ret;
1664
+ constructor() {
1665
+ const ret = wasm.publicstorage_new();
1666
+ if (ret[2]) {
1667
+ throw takeFromExternrefTable0(ret[1]);
1668
+ }
1669
+ this.__wbg_ptr = ret[0] >>> 0;
1670
+ PublicStorageFinalization.register(this, this.__wbg_ptr, this);
1671
+ return this;
1647
1672
  }
1648
1673
  /**
1649
1674
  * Get metadata for an address
@@ -1662,15 +1687,9 @@ class PublicStorage {
1662
1687
  }
1663
1688
  }
1664
1689
  if (Symbol.dispose) PublicStorage.prototype[Symbol.dispose] = PublicStorage.prototype.free;
1665
-
1666
1690
  exports.PublicStorage = PublicStorage;
1667
1691
 
1668
- const SeedExportDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
1669
- ? { register: () => {}, unregister: () => {} }
1670
- : new FinalizationRegistry(ptr => wasm.__wbg_seedexportdeeplink_free(ptr >>> 0, 1));
1671
-
1672
1692
  class SeedExportDeepLink {
1673
-
1674
1693
  static __wrap(ptr) {
1675
1694
  ptr = ptr >>> 0;
1676
1695
  const obj = Object.create(SeedExportDeepLink.prototype);
@@ -1678,14 +1697,12 @@ class SeedExportDeepLink {
1678
1697
  SeedExportDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
1679
1698
  return obj;
1680
1699
  }
1681
-
1682
1700
  __destroy_into_raw() {
1683
1701
  const ptr = this.__wbg_ptr;
1684
1702
  this.__wbg_ptr = 0;
1685
1703
  SeedExportDeepLinkFinalization.unregister(this);
1686
1704
  return ptr;
1687
1705
  }
1688
-
1689
1706
  free() {
1690
1707
  const ptr = this.__destroy_into_raw();
1691
1708
  wasm.__wbg_seedexportdeeplink_free(ptr, 0);
@@ -1727,19 +1744,14 @@ class SeedExportDeepLink {
1727
1744
  }
1728
1745
  }
1729
1746
  if (Symbol.dispose) SeedExportDeepLink.prototype[Symbol.dispose] = SeedExportDeepLink.prototype.free;
1730
-
1731
1747
  exports.SeedExportDeepLink = SeedExportDeepLink;
1732
1748
 
1733
- const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
1734
- ? { register: () => {}, unregister: () => {} }
1735
- : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr >>> 0, 1));
1736
1749
  /**
1737
1750
  * An authenticated context “as the user”.
1738
1751
  * - Use `storage` for reads/writes (absolute paths like `/pub/app/file.txt`)
1739
1752
  * - Cookie is managed automatically by the underlying fetch client
1740
1753
  */
1741
1754
  class Session {
1742
-
1743
1755
  static __wrap(ptr) {
1744
1756
  ptr = ptr >>> 0;
1745
1757
  const obj = Object.create(Session.prototype);
@@ -1747,49 +1759,16 @@ class Session {
1747
1759
  SessionFinalization.register(obj, obj.__wbg_ptr, obj);
1748
1760
  return obj;
1749
1761
  }
1750
-
1751
1762
  __destroy_into_raw() {
1752
1763
  const ptr = this.__wbg_ptr;
1753
1764
  this.__wbg_ptr = 0;
1754
1765
  SessionFinalization.unregister(this);
1755
1766
  return ptr;
1756
1767
  }
1757
-
1758
1768
  free() {
1759
1769
  const ptr = this.__destroy_into_raw();
1760
1770
  wasm.__wbg_session_free(ptr, 0);
1761
1771
  }
1762
- /**
1763
- * Retrieve immutable info about this session (user & capabilities).
1764
- *
1765
- * @returns {SessionInfo}
1766
- * @returns {SessionInfo}
1767
- */
1768
- get info() {
1769
- const ret = wasm.session_info(this.__wbg_ptr);
1770
- return SessionInfo.__wrap(ret);
1771
- }
1772
- /**
1773
- * Access the session-scoped storage API (read/write).
1774
- *
1775
- * @returns {SessionStorage}
1776
- * @returns {SessionStorage}
1777
- */
1778
- get storage() {
1779
- const ret = wasm.session_storage(this.__wbg_ptr);
1780
- return SessionStorage.__wrap(ret);
1781
- }
1782
- /**
1783
- * Invalidate the session on the server (clears server cookie).
1784
- * Further calls to storage API will fail.
1785
- *
1786
- * @returns {Promise<void>}
1787
- * @returns {Promise<void>}
1788
- */
1789
- signout() {
1790
- const ret = wasm.session_signout(this.__wbg_ptr);
1791
- return ret;
1792
- }
1793
1772
  /**
1794
1773
  * Export the session metadata so it can be restored after a tab refresh.
1795
1774
  *
@@ -1812,6 +1791,16 @@ class Session {
1812
1791
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1813
1792
  }
1814
1793
  }
1794
+ /**
1795
+ * Retrieve immutable info about this session (user & capabilities).
1796
+ *
1797
+ * @returns {SessionInfo}
1798
+ * @returns {SessionInfo}
1799
+ */
1800
+ get info() {
1801
+ const ret = wasm.session_info(this.__wbg_ptr);
1802
+ return SessionInfo.__wrap(ret);
1803
+ }
1815
1804
  /**
1816
1805
  * Restore a session from an `export()` string.
1817
1806
  *
@@ -1838,19 +1827,35 @@ class Session {
1838
1827
  const ret = wasm.session_restore(ptr0, len0, ptr1);
1839
1828
  return ret;
1840
1829
  }
1830
+ /**
1831
+ * Invalidate the session on the server (clears server cookie).
1832
+ * Further calls to storage API will fail.
1833
+ *
1834
+ * @returns {Promise<void>}
1835
+ * @returns {Promise<void>}
1836
+ */
1837
+ signout() {
1838
+ const ret = wasm.session_signout(this.__wbg_ptr);
1839
+ return ret;
1840
+ }
1841
+ /**
1842
+ * Access the session-scoped storage API (read/write).
1843
+ *
1844
+ * @returns {SessionStorage}
1845
+ * @returns {SessionStorage}
1846
+ */
1847
+ get storage() {
1848
+ const ret = wasm.session_storage(this.__wbg_ptr);
1849
+ return SessionStorage.__wrap(ret);
1850
+ }
1841
1851
  }
1842
1852
  if (Symbol.dispose) Session.prototype[Symbol.dispose] = Session.prototype.free;
1843
-
1844
1853
  exports.Session = Session;
1845
1854
 
1846
- const SessionInfoFinalization = (typeof FinalizationRegistry === 'undefined')
1847
- ? { register: () => {}, unregister: () => {} }
1848
- : new FinalizationRegistry(ptr => wasm.__wbg_sessioninfo_free(ptr >>> 0, 1));
1849
1855
  /**
1850
1856
  * Static snapshot of session metadata.
1851
1857
  */
1852
1858
  class SessionInfo {
1853
-
1854
1859
  static __wrap(ptr) {
1855
1860
  ptr = ptr >>> 0;
1856
1861
  const obj = Object.create(SessionInfo.prototype);
@@ -1858,18 +1863,28 @@ class SessionInfo {
1858
1863
  SessionInfoFinalization.register(obj, obj.__wbg_ptr, obj);
1859
1864
  return obj;
1860
1865
  }
1861
-
1862
1866
  __destroy_into_raw() {
1863
1867
  const ptr = this.__wbg_ptr;
1864
1868
  this.__wbg_ptr = 0;
1865
1869
  SessionInfoFinalization.unregister(this);
1866
1870
  return ptr;
1867
1871
  }
1868
-
1869
1872
  free() {
1870
1873
  const ptr = this.__destroy_into_raw();
1871
1874
  wasm.__wbg_sessioninfo_free(ptr, 0);
1872
1875
  }
1876
+ /**
1877
+ * Effective capabilities granted to this session.
1878
+ *
1879
+ * @returns {string[]} Normalized capability entries (e.g. `"/pub/app/:rw"`).
1880
+ * @returns {string[]}
1881
+ */
1882
+ get capabilities() {
1883
+ const ret = wasm.sessioninfo_capabilities(this.__wbg_ptr);
1884
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1885
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1886
+ return v1;
1887
+ }
1873
1888
  /**
1874
1889
  * The user’s public key for this session.
1875
1890
  *
@@ -1886,31 +1901,14 @@ class SessionInfo {
1886
1901
  const ret = wasm.sessioninfo_publicKey(this.__wbg_ptr);
1887
1902
  return PublicKey.__wrap(ret);
1888
1903
  }
1889
- /**
1890
- * Effective capabilities granted to this session.
1891
- *
1892
- * @returns {string[]} Normalized capability entries (e.g. `"/pub/app/:rw"`).
1893
- * @returns {string[]}
1894
- */
1895
- get capabilities() {
1896
- const ret = wasm.sessioninfo_capabilities(this.__wbg_ptr);
1897
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1898
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1899
- return v1;
1900
- }
1901
1904
  }
1902
1905
  if (Symbol.dispose) SessionInfo.prototype[Symbol.dispose] = SessionInfo.prototype.free;
1903
-
1904
1906
  exports.SessionInfo = SessionInfo;
1905
1907
 
1906
- const SessionStorageFinalization = (typeof FinalizationRegistry === 'undefined')
1907
- ? { register: () => {}, unregister: () => {} }
1908
- : new FinalizationRegistry(ptr => wasm.__wbg_sessionstorage_free(ptr >>> 0, 1));
1909
1908
  /**
1910
1909
  * Read/write storage scoped to **your** session (absolute paths: `/pub/...`).
1911
1910
  */
1912
1911
  class SessionStorage {
1913
-
1914
1912
  static __wrap(ptr) {
1915
1913
  ptr = ptr >>> 0;
1916
1914
  const obj = Object.create(SessionStorage.prototype);
@@ -1918,40 +1916,42 @@ class SessionStorage {
1918
1916
  SessionStorageFinalization.register(obj, obj.__wbg_ptr, obj);
1919
1917
  return obj;
1920
1918
  }
1921
-
1922
1919
  __destroy_into_raw() {
1923
1920
  const ptr = this.__wbg_ptr;
1924
1921
  this.__wbg_ptr = 0;
1925
1922
  SessionStorageFinalization.unregister(this);
1926
1923
  return ptr;
1927
1924
  }
1928
-
1929
1925
  free() {
1930
1926
  const ptr = this.__destroy_into_raw();
1931
1927
  wasm.__wbg_sessionstorage_free(ptr, 0);
1932
1928
  }
1933
1929
  /**
1934
- * List a directory (absolute session path). Returns `pubky://…` URLs.
1930
+ * Delete a path (file or empty directory).
1935
1931
  *
1936
- * @param {Path} path Must end with `/`.
1937
- * @param {string|null=} cursor Optional suffix or full URL to start **after**.
1938
- * @param {boolean=} reverse Default `false`.
1939
- * @param {number=} limit Optional result limit.
1940
- * @param {boolean=} shallow Default `false`.
1941
- * @returns {Promise<string[]>}
1942
1932
  * @param {Path} path
1943
- * @param {string | null} [cursor]
1944
- * @param {boolean | null} [reverse]
1945
- * @param {number | null} [limit]
1946
- * @param {boolean | null} [shallow]
1947
- * @returns {Promise<string[]>}
1933
+ * @returns {Promise<void>}
1934
+ * @param {Path} path
1935
+ * @returns {Promise<void>}
1948
1936
  */
1949
- list(path, cursor, reverse, limit, shallow) {
1937
+ delete(path) {
1950
1938
  const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1951
1939
  const len0 = WASM_VECTOR_LEN;
1952
- var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1953
- var len1 = WASM_VECTOR_LEN;
1954
- 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);
1940
+ const ret = wasm.sessionstorage_delete(this.__wbg_ptr, ptr0, len0);
1941
+ return ret;
1942
+ }
1943
+ /**
1944
+ * Check existence.
1945
+ *
1946
+ * @param {Path} path
1947
+ * @returns {Promise<boolean>}
1948
+ * @param {Path} path
1949
+ * @returns {Promise<boolean>}
1950
+ */
1951
+ exists(path) {
1952
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1953
+ const len0 = WASM_VECTOR_LEN;
1954
+ const ret = wasm.sessionstorage_exists(this.__wbg_ptr, ptr0, len0);
1955
1955
  return ret;
1956
1956
  }
1957
1957
  /**
@@ -1982,20 +1982,6 @@ class SessionStorage {
1982
1982
  const ret = wasm.sessionstorage_getBytes(this.__wbg_ptr, ptr0, len0);
1983
1983
  return ret;
1984
1984
  }
1985
- /**
1986
- * GET text from an absolute session path.
1987
- *
1988
- * @param {Path} path
1989
- * @returns {Promise<string>}
1990
- * @param {Path} path
1991
- * @returns {Promise<string>}
1992
- */
1993
- getText(path) {
1994
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1995
- const len0 = WASM_VECTOR_LEN;
1996
- const ret = wasm.sessionstorage_getText(this.__wbg_ptr, ptr0, len0);
1997
- return ret;
1998
- }
1999
1985
  /**
2000
1986
  * GET JSON from an absolute session path.
2001
1987
  *
@@ -2011,32 +1997,41 @@ class SessionStorage {
2011
1997
  return ret;
2012
1998
  }
2013
1999
  /**
2014
- * Check existence.
2000
+ * GET text from an absolute session path.
2015
2001
  *
2016
2002
  * @param {Path} path
2017
- * @returns {Promise<boolean>}
2003
+ * @returns {Promise<string>}
2018
2004
  * @param {Path} path
2019
- * @returns {Promise<boolean>}
2005
+ * @returns {Promise<string>}
2020
2006
  */
2021
- exists(path) {
2007
+ getText(path) {
2022
2008
  const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2023
2009
  const len0 = WASM_VECTOR_LEN;
2024
- const ret = wasm.sessionstorage_exists(this.__wbg_ptr, ptr0, len0);
2010
+ const ret = wasm.sessionstorage_getText(this.__wbg_ptr, ptr0, len0);
2025
2011
  return ret;
2026
2012
  }
2027
2013
  /**
2028
- * Get metadata for an absolute, session-scoped path (e.g. `"/pub/app/file.json"`).
2014
+ * List a directory (absolute session path). Returns `pubky://…` URLs.
2029
2015
  *
2030
- * @param {Path} path Absolute path under your user (starts with `/`).
2031
- * @returns {Promise<ResourceStats|undefined>} `undefined` if the resource does not exist.
2032
- * @throws {PubkyError} On invalid input or transport/server errors.
2016
+ * @param {Path} path Must end with `/`.
2017
+ * @param {string|null=} cursor Optional suffix or full URL to start **after**.
2018
+ * @param {boolean=} reverse Default `false`.
2019
+ * @param {number=} limit Optional result limit.
2020
+ * @param {boolean=} shallow Default `false`.
2021
+ * @returns {Promise<string[]>}
2033
2022
  * @param {Path} path
2034
- * @returns {Promise<ResourceStats | undefined>}
2023
+ * @param {string | null} [cursor]
2024
+ * @param {boolean | null} [reverse]
2025
+ * @param {number | null} [limit]
2026
+ * @param {boolean | null} [shallow]
2027
+ * @returns {Promise<string[]>}
2035
2028
  */
2036
- stats(path) {
2029
+ list(path, cursor, reverse, limit, shallow) {
2037
2030
  const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2038
2031
  const len0 = WASM_VECTOR_LEN;
2039
- const ret = wasm.sessionstorage_stats(this.__wbg_ptr, ptr0, len0);
2032
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2033
+ var len1 = WASM_VECTOR_LEN;
2034
+ 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);
2040
2035
  return ret;
2041
2036
  }
2042
2037
  /**
@@ -2057,6 +2052,22 @@ class SessionStorage {
2057
2052
  const ret = wasm.sessionstorage_putBytes(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2058
2053
  return ret;
2059
2054
  }
2055
+ /**
2056
+ * PUT JSON at an absolute session path.
2057
+ *
2058
+ * @param {Path} path Absolute path (e.g. `"/pub/app/data.json"`).
2059
+ * @param {any} value JSON-serializable value.
2060
+ * @returns {Promise<void>}
2061
+ * @param {Path} path
2062
+ * @param {any} body
2063
+ * @returns {Promise<void>}
2064
+ */
2065
+ putJson(path, body) {
2066
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2067
+ const len0 = WASM_VECTOR_LEN;
2068
+ const ret = wasm.sessionstorage_putJson(this.__wbg_ptr, ptr0, len0, body);
2069
+ return ret;
2070
+ }
2060
2071
  /**
2061
2072
  * PUT text at an absolute session path.
2062
2073
  *
@@ -2076,1172 +2087,1438 @@ class SessionStorage {
2076
2087
  return ret;
2077
2088
  }
2078
2089
  /**
2079
- * PUT JSON at an absolute session path.
2090
+ * Get metadata for an absolute, session-scoped path (e.g. `"/pub/app/file.json"`).
2080
2091
  *
2081
- * @param {Path} path Absolute path (e.g. `"/pub/app/data.json"`).
2082
- * @param {any} value JSON-serializable value.
2083
- * @returns {Promise<void>}
2092
+ * @param {Path} path Absolute path under your user (starts with `/`).
2093
+ * @returns {Promise<ResourceStats|undefined>} `undefined` if the resource does not exist.
2094
+ * @throws {PubkyError} On invalid input or transport/server errors.
2084
2095
  * @param {Path} path
2085
- * @param {any} body
2096
+ * @returns {Promise<ResourceStats | undefined>}
2097
+ */
2098
+ stats(path) {
2099
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2100
+ const len0 = WASM_VECTOR_LEN;
2101
+ const ret = wasm.sessionstorage_stats(this.__wbg_ptr, ptr0, len0);
2102
+ return ret;
2103
+ }
2104
+ }
2105
+ if (Symbol.dispose) SessionStorage.prototype[Symbol.dispose] = SessionStorage.prototype.free;
2106
+ exports.SessionStorage = SessionStorage;
2107
+
2108
+ /**
2109
+ * Holds a user’s `Keypair` and performs identity operations:
2110
+ * - `signup` creates a new homeserver user.
2111
+ * - `signin` creates a homeserver session for an existing user.
2112
+ * - Approve pubkyauth requests
2113
+ * - Publish PKDNS when signer-bound
2114
+ */
2115
+ class Signer {
2116
+ static __wrap(ptr) {
2117
+ ptr = ptr >>> 0;
2118
+ const obj = Object.create(Signer.prototype);
2119
+ obj.__wbg_ptr = ptr;
2120
+ SignerFinalization.register(obj, obj.__wbg_ptr, obj);
2121
+ return obj;
2122
+ }
2123
+ __destroy_into_raw() {
2124
+ const ptr = this.__wbg_ptr;
2125
+ this.__wbg_ptr = 0;
2126
+ SignerFinalization.unregister(this);
2127
+ return ptr;
2128
+ }
2129
+ free() {
2130
+ const ptr = this.__destroy_into_raw();
2131
+ wasm.__wbg_signer_free(ptr, 0);
2132
+ }
2133
+ /**
2134
+ * Approve a `pubkyauth://` request URL (encrypts & POSTs the signed AuthToken).
2135
+ * @param {string} pubkyauth_url
2086
2136
  * @returns {Promise<void>}
2087
2137
  */
2088
- putJson(path, body) {
2089
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2090
- const len0 = WASM_VECTOR_LEN;
2091
- const ret = wasm.sessionstorage_putJson(this.__wbg_ptr, ptr0, len0, body);
2138
+ approveAuthRequest(pubkyauth_url) {
2139
+ const ptr0 = passStringToWasm0(pubkyauth_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2140
+ const len0 = WASM_VECTOR_LEN;
2141
+ const ret = wasm.signer_approveAuthRequest(this.__wbg_ptr, ptr0, len0);
2142
+ return ret;
2143
+ }
2144
+ /**
2145
+ * Create a signer from a `Keypair` (prefer `pubky.signer(kp)`).
2146
+ *
2147
+ * @param {Keypair} keypair
2148
+ * @returns {Signer}
2149
+ * @param {Keypair} keypair
2150
+ * @returns {Signer}
2151
+ */
2152
+ static fromKeypair(keypair) {
2153
+ _assertClass(keypair, Keypair);
2154
+ const ret = wasm.signer_fromKeypair(keypair.__wbg_ptr);
2155
+ if (ret[2]) {
2156
+ throw takeFromExternrefTable0(ret[1]);
2157
+ }
2158
+ return Signer.__wrap(ret[0]);
2159
+ }
2160
+ /**
2161
+ * Get a PKDNS actor bound to this signer's client & keypair (publishing enabled).
2162
+ *
2163
+ * @returns {Pkdns}
2164
+ *
2165
+ * @example
2166
+ * await signer.pkdns.publishHomeserverIfStale(homeserverPk);
2167
+ * @returns {Pkdns}
2168
+ */
2169
+ get pkdns() {
2170
+ const ret = wasm.signer_pkdns(this.__wbg_ptr);
2171
+ return Pkdns.__wrap(ret);
2172
+ }
2173
+ /**
2174
+ * Get the public key of this signer.
2175
+ *
2176
+ * @returns {PublicKey}
2177
+ * @returns {PublicKey}
2178
+ */
2179
+ get publicKey() {
2180
+ const ret = wasm.signer_publicKey(this.__wbg_ptr);
2181
+ return PublicKey.__wrap(ret);
2182
+ }
2183
+ /**
2184
+ * Fast sign-in for a returning user. Publishes PKDNS in the background.
2185
+ *
2186
+ * Creates a valid homeserver Session with root capabilities
2187
+ *
2188
+ * @returns {Promise<Session>}
2189
+ *
2190
+ * @throws {PubkyError}
2191
+ * @returns {Promise<Session>}
2192
+ */
2193
+ signin() {
2194
+ const ret = wasm.signer_signin(this.__wbg_ptr);
2195
+ return ret;
2196
+ }
2197
+ /**
2198
+ * Blocking sign-in. Waits for PKDNS publish to complete (slower; safer).
2199
+ *
2200
+ * Creates a valid homeserver Session with root capabilities
2201
+ *
2202
+ * @returns {Promise<Session>}
2203
+ * @returns {Promise<Session>}
2204
+ */
2205
+ signinBlocking() {
2206
+ const ret = wasm.signer_signinBlocking(this.__wbg_ptr);
2207
+ return ret;
2208
+ }
2209
+ /**
2210
+ * Sign up at a homeserver. Returns a ready `Session`.
2211
+ *
2212
+ * Creates a valid homeserver Session with root capabilities
2213
+ *
2214
+ * @param {PublicKey} homeserver The homeserver’s public key.
2215
+ * @param {string|null} signupToken Invite/registration token or `null`.
2216
+ * @returns {Promise<Session>}
2217
+ *
2218
+ * @throws {PubkyError}
2219
+ * - `AuthenticationError` (bad/expired token)
2220
+ * - `RequestError` (network/server)
2221
+ * @param {PublicKey} homeserver
2222
+ * @param {string | null} [signup_token]
2223
+ * @returns {Promise<Session>}
2224
+ */
2225
+ signup(homeserver, signup_token) {
2226
+ _assertClass(homeserver, PublicKey);
2227
+ var ptr0 = isLikeNone(signup_token) ? 0 : passStringToWasm0(signup_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2228
+ var len0 = WASM_VECTOR_LEN;
2229
+ const ret = wasm.signer_signup(this.__wbg_ptr, homeserver.__wbg_ptr, ptr0, len0);
2230
+ return ret;
2231
+ }
2232
+ }
2233
+ if (Symbol.dispose) Signer.prototype[Symbol.dispose] = Signer.prototype.free;
2234
+ exports.Signer = Signer;
2235
+
2236
+ class SigninDeepLink {
2237
+ static __wrap(ptr) {
2238
+ ptr = ptr >>> 0;
2239
+ const obj = Object.create(SigninDeepLink.prototype);
2240
+ obj.__wbg_ptr = ptr;
2241
+ SigninDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
2242
+ return obj;
2243
+ }
2244
+ __destroy_into_raw() {
2245
+ const ptr = this.__wbg_ptr;
2246
+ this.__wbg_ptr = 0;
2247
+ SigninDeepLinkFinalization.unregister(this);
2248
+ return ptr;
2249
+ }
2250
+ free() {
2251
+ const ptr = this.__destroy_into_raw();
2252
+ wasm.__wbg_signindeeplink_free(ptr, 0);
2253
+ }
2254
+ /**
2255
+ * @returns {string}
2256
+ */
2257
+ get baseRelayUrl() {
2258
+ let deferred1_0;
2259
+ let deferred1_1;
2260
+ try {
2261
+ const ret = wasm.signindeeplink_baseRelayUrl(this.__wbg_ptr);
2262
+ deferred1_0 = ret[0];
2263
+ deferred1_1 = ret[1];
2264
+ return getStringFromWasm0(ret[0], ret[1]);
2265
+ } finally {
2266
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2267
+ }
2268
+ }
2269
+ /**
2270
+ * @returns {string}
2271
+ */
2272
+ get capabilities() {
2273
+ let deferred1_0;
2274
+ let deferred1_1;
2275
+ try {
2276
+ const ret = wasm.signindeeplink_capabilities(this.__wbg_ptr);
2277
+ deferred1_0 = ret[0];
2278
+ deferred1_1 = ret[1];
2279
+ return getStringFromWasm0(ret[0], ret[1]);
2280
+ } finally {
2281
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2282
+ }
2283
+ }
2284
+ /**
2285
+ * @param {string} url
2286
+ * @returns {SigninDeepLink}
2287
+ */
2288
+ static parse(url) {
2289
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2290
+ const len0 = WASM_VECTOR_LEN;
2291
+ const ret = wasm.signindeeplink_parse(ptr0, len0);
2292
+ if (ret[2]) {
2293
+ throw takeFromExternrefTable0(ret[1]);
2294
+ }
2295
+ return SigninDeepLink.__wrap(ret[0]);
2296
+ }
2297
+ /**
2298
+ * @returns {Uint8Array}
2299
+ */
2300
+ get secret() {
2301
+ const ret = wasm.signindeeplink_secret(this.__wbg_ptr);
2092
2302
  return ret;
2093
2303
  }
2094
2304
  /**
2095
- * Delete a path (file or empty directory).
2096
- *
2097
- * @param {Path} path
2098
- * @returns {Promise<void>}
2099
- * @param {Path} path
2100
- * @returns {Promise<void>}
2305
+ * @returns {string}
2101
2306
  */
2102
- delete(path) {
2103
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2104
- const len0 = WASM_VECTOR_LEN;
2105
- const ret = wasm.sessionstorage_delete(this.__wbg_ptr, ptr0, len0);
2106
- return ret;
2307
+ toString() {
2308
+ let deferred1_0;
2309
+ let deferred1_1;
2310
+ try {
2311
+ const ret = wasm.signindeeplink_toString(this.__wbg_ptr);
2312
+ deferred1_0 = ret[0];
2313
+ deferred1_1 = ret[1];
2314
+ return getStringFromWasm0(ret[0], ret[1]);
2315
+ } finally {
2316
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2317
+ }
2107
2318
  }
2108
2319
  }
2109
- if (Symbol.dispose) SessionStorage.prototype[Symbol.dispose] = SessionStorage.prototype.free;
2110
-
2111
- exports.SessionStorage = SessionStorage;
2112
-
2113
- const SignerFinalization = (typeof FinalizationRegistry === 'undefined')
2114
- ? { register: () => {}, unregister: () => {} }
2115
- : new FinalizationRegistry(ptr => wasm.__wbg_signer_free(ptr >>> 0, 1));
2116
- /**
2117
- * Holds a user’s `Keypair` and performs identity operations:
2118
- * - `signup` creates a new homeserver user.
2119
- * - `signin` creates a homeserver session for an existing user.
2120
- * - Approve pubkyauth requests
2121
- * - Publish PKDNS when signer-bound
2122
- */
2123
- class Signer {
2320
+ if (Symbol.dispose) SigninDeepLink.prototype[Symbol.dispose] = SigninDeepLink.prototype.free;
2321
+ exports.SigninDeepLink = SigninDeepLink;
2124
2322
 
2323
+ class SignupDeepLink {
2125
2324
  static __wrap(ptr) {
2126
2325
  ptr = ptr >>> 0;
2127
- const obj = Object.create(Signer.prototype);
2326
+ const obj = Object.create(SignupDeepLink.prototype);
2128
2327
  obj.__wbg_ptr = ptr;
2129
- SignerFinalization.register(obj, obj.__wbg_ptr, obj);
2328
+ SignupDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
2130
2329
  return obj;
2131
2330
  }
2132
-
2133
2331
  __destroy_into_raw() {
2134
2332
  const ptr = this.__wbg_ptr;
2135
2333
  this.__wbg_ptr = 0;
2136
- SignerFinalization.unregister(this);
2334
+ SignupDeepLinkFinalization.unregister(this);
2137
2335
  return ptr;
2138
2336
  }
2139
-
2140
2337
  free() {
2141
2338
  const ptr = this.__destroy_into_raw();
2142
- wasm.__wbg_signer_free(ptr, 0);
2339
+ wasm.__wbg_signupdeeplink_free(ptr, 0);
2143
2340
  }
2144
2341
  /**
2145
- * Create a signer from a `Keypair` (prefer `pubky.signer(kp)`).
2146
- *
2147
- * @param {Keypair} keypair
2148
- * @returns {Signer}
2149
- * @param {Keypair} keypair
2150
- * @returns {Signer}
2342
+ * @returns {string}
2151
2343
  */
2152
- static fromKeypair(keypair) {
2153
- _assertClass(keypair, Keypair);
2154
- const ret = wasm.signer_fromKeypair(keypair.__wbg_ptr);
2155
- if (ret[2]) {
2156
- throw takeFromExternrefTable0(ret[1]);
2344
+ get baseRelayUrl() {
2345
+ let deferred1_0;
2346
+ let deferred1_1;
2347
+ try {
2348
+ const ret = wasm.signupdeeplink_baseRelayUrl(this.__wbg_ptr);
2349
+ deferred1_0 = ret[0];
2350
+ deferred1_1 = ret[1];
2351
+ return getStringFromWasm0(ret[0], ret[1]);
2352
+ } finally {
2353
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2354
+ }
2355
+ }
2356
+ /**
2357
+ * @returns {string}
2358
+ */
2359
+ get capabilities() {
2360
+ let deferred1_0;
2361
+ let deferred1_1;
2362
+ try {
2363
+ const ret = wasm.signupdeeplink_capabilities(this.__wbg_ptr);
2364
+ deferred1_0 = ret[0];
2365
+ deferred1_1 = ret[1];
2366
+ return getStringFromWasm0(ret[0], ret[1]);
2367
+ } finally {
2368
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2157
2369
  }
2158
- return Signer.__wrap(ret[0]);
2159
2370
  }
2160
2371
  /**
2161
- * Get the public key of this signer.
2162
- *
2163
- * @returns {PublicKey}
2164
2372
  * @returns {PublicKey}
2165
2373
  */
2166
- get publicKey() {
2167
- const ret = wasm.signer_publicKey(this.__wbg_ptr);
2374
+ get homeserver() {
2375
+ const ret = wasm.signupdeeplink_homeserver(this.__wbg_ptr);
2168
2376
  return PublicKey.__wrap(ret);
2169
2377
  }
2170
2378
  /**
2171
- * Sign up at a homeserver. Returns a ready `Session`.
2172
- *
2173
- * Creates a valid homeserver Session with root capabilities
2174
- *
2175
- * @param {PublicKey} homeserver The homeserver’s public key.
2176
- * @param {string|null} signupToken Invite/registration token or `null`.
2177
- * @returns {Promise<Session>}
2178
- *
2179
- * @throws {PubkyError}
2180
- * - `AuthenticationError` (bad/expired token)
2181
- * - `RequestError` (network/server)
2182
- * @param {PublicKey} homeserver
2183
- * @param {string | null} [signup_token]
2184
- * @returns {Promise<Session>}
2379
+ * @param {string} url
2380
+ * @returns {SignupDeepLink}
2185
2381
  */
2186
- signup(homeserver, signup_token) {
2187
- _assertClass(homeserver, PublicKey);
2188
- var ptr0 = isLikeNone(signup_token) ? 0 : passStringToWasm0(signup_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2189
- var len0 = WASM_VECTOR_LEN;
2190
- const ret = wasm.signer_signup(this.__wbg_ptr, homeserver.__wbg_ptr, ptr0, len0);
2191
- return ret;
2382
+ static parse(url) {
2383
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2384
+ const len0 = WASM_VECTOR_LEN;
2385
+ const ret = wasm.signupdeeplink_parse(ptr0, len0);
2386
+ if (ret[2]) {
2387
+ throw takeFromExternrefTable0(ret[1]);
2388
+ }
2389
+ return SignupDeepLink.__wrap(ret[0]);
2192
2390
  }
2193
2391
  /**
2194
- * Fast sign-in for a returning user. Publishes PKDNS in the background.
2195
- *
2196
- * Creates a valid homeserver Session with root capabilities
2197
- *
2198
- * @returns {Promise<Session>}
2199
- *
2200
- * @throws {PubkyError}
2201
- * @returns {Promise<Session>}
2392
+ * @returns {Uint8Array}
2202
2393
  */
2203
- signin() {
2204
- const ret = wasm.signer_signin(this.__wbg_ptr);
2394
+ get secret() {
2395
+ const ret = wasm.signupdeeplink_secret(this.__wbg_ptr);
2205
2396
  return ret;
2206
2397
  }
2207
2398
  /**
2208
- * Blocking sign-in. Waits for PKDNS publish to complete (slower; safer).
2209
- *
2210
- * Creates a valid homeserver Session with root capabilities
2211
- *
2212
- * @returns {Promise<Session>}
2213
- * @returns {Promise<Session>}
2399
+ * @returns {string | undefined}
2214
2400
  */
2215
- signinBlocking() {
2216
- const ret = wasm.signer_signinBlocking(this.__wbg_ptr);
2217
- return ret;
2401
+ get signupToken() {
2402
+ const ret = wasm.signupdeeplink_signupToken(this.__wbg_ptr);
2403
+ let v1;
2404
+ if (ret[0] !== 0) {
2405
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2406
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2407
+ }
2408
+ return v1;
2218
2409
  }
2219
2410
  /**
2220
- * Approve a `pubkyauth://` request URL (encrypts & POSTs the signed AuthToken).
2221
- * @param {string} pubkyauth_url
2222
- * @returns {Promise<void>}
2411
+ * @returns {string}
2223
2412
  */
2224
- approveAuthRequest(pubkyauth_url) {
2225
- const ptr0 = passStringToWasm0(pubkyauth_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2413
+ toString() {
2414
+ let deferred1_0;
2415
+ let deferred1_1;
2416
+ try {
2417
+ const ret = wasm.signupdeeplink_toString(this.__wbg_ptr);
2418
+ deferred1_0 = ret[0];
2419
+ deferred1_1 = ret[1];
2420
+ return getStringFromWasm0(ret[0], ret[1]);
2421
+ } finally {
2422
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2423
+ }
2424
+ }
2425
+ }
2426
+ if (Symbol.dispose) SignupDeepLink.prototype[Symbol.dispose] = SignupDeepLink.prototype.free;
2427
+ exports.SignupDeepLink = SignupDeepLink;
2428
+
2429
+ /**
2430
+ * Resolve a `pubky://` or `pubky<pk>/…` identifier into the homeserver transport URL.
2431
+ *
2432
+ * @param {string} identifier Either `pubky<pk>/...` (preferred) or `pubky://<pk>/...`.
2433
+ * @returns {string} HTTPS URL in the form `https://_pubky.<pk>/...`.
2434
+ * @param {string} identifier
2435
+ * @returns {string}
2436
+ */
2437
+ function resolvePubky(identifier) {
2438
+ let deferred3_0;
2439
+ let deferred3_1;
2440
+ try {
2441
+ const ptr0 = passStringToWasm0(identifier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2442
+ const len0 = WASM_VECTOR_LEN;
2443
+ const ret = wasm.resolvePubky(ptr0, len0);
2444
+ var ptr2 = ret[0];
2445
+ var len2 = ret[1];
2446
+ if (ret[3]) {
2447
+ ptr2 = 0; len2 = 0;
2448
+ throw takeFromExternrefTable0(ret[2]);
2449
+ }
2450
+ deferred3_0 = ptr2;
2451
+ deferred3_1 = len2;
2452
+ return getStringFromWasm0(ptr2, len2);
2453
+ } finally {
2454
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2455
+ }
2456
+ }
2457
+ exports.resolvePubky = resolvePubky;
2458
+
2459
+ /**
2460
+ * Set the global logging verbosity for the WASM Pubky SDK. Routes Rust `log` output to the browser console.
2461
+ *
2462
+ * Accepted values (case-sensitive): "error" | "warn" | "info" | "debug" | "trace".
2463
+ * Effects:
2464
+ * - Initializes the logger once; subsequent calls may throw if the logger is already set.
2465
+ * - Emits a single info log: `Log level set to: <level>`.
2466
+ * - Messages at or above `level` are forwarded to the appropriate `console.*` method.
2467
+ *
2468
+ * @param {Level} level
2469
+ * Minimum log level to enable. One of: "error" | "warn" | "info" | "debug" | "trace".
2470
+ *
2471
+ * @returns {void}
2472
+ *
2473
+ * @throws {Error}
2474
+ * If `level` is invalid ("Invalid log level") or the logger cannot be initialized
2475
+ * (e.g., already initialized).
2476
+ *
2477
+ * Usage:
2478
+ * Call once at application startup, before invoking other SDK APIs.
2479
+ * @param {Level} level
2480
+ */
2481
+ function setLogLevel(level) {
2482
+ const ret = wasm.setLogLevel((__wbindgen_enum_Level.indexOf(level) + 1 || 6) - 1);
2483
+ if (ret[1]) {
2484
+ throw takeFromExternrefTable0(ret[0]);
2485
+ }
2486
+ }
2487
+ exports.setLogLevel = setLogLevel;
2488
+
2489
+ /**
2490
+ * Validate and normalize a capabilities string.
2491
+ *
2492
+ * - Normalizes action order (`wr` -> `rw`)
2493
+ * - Throws `InvalidInput` listing malformed entries.
2494
+ *
2495
+ * @param {string} input
2496
+ * @returns {string} Normalized string (same shape as input).
2497
+ * @throws {PubkyError} `{ name: "InvalidInput" }` with a helpful message.
2498
+ * The error's `data` field is `{ invalidEntries: string[] }` listing malformed tokens.
2499
+ * @param {string} input
2500
+ * @returns {string}
2501
+ */
2502
+ function validateCapabilities(input) {
2503
+ let deferred3_0;
2504
+ let deferred3_1;
2505
+ try {
2506
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2226
2507
  const len0 = WASM_VECTOR_LEN;
2227
- const ret = wasm.signer_approveAuthRequest(this.__wbg_ptr, ptr0, len0);
2228
- return ret;
2508
+ const ret = wasm.validateCapabilities(ptr0, len0);
2509
+ var ptr2 = ret[0];
2510
+ var len2 = ret[1];
2511
+ if (ret[3]) {
2512
+ ptr2 = 0; len2 = 0;
2513
+ throw takeFromExternrefTable0(ret[2]);
2514
+ }
2515
+ deferred3_0 = ptr2;
2516
+ deferred3_1 = len2;
2517
+ return getStringFromWasm0(ptr2, len2);
2518
+ } finally {
2519
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2229
2520
  }
2230
- /**
2231
- * Get a PKDNS actor bound to this signer's client & keypair (publishing enabled).
2232
- *
2233
- * @returns {Pkdns}
2234
- *
2235
- * @example
2236
- * await signer.pkdns.publishHomeserverIfStale(homeserverPk);
2237
- * @returns {Pkdns}
2238
- */
2239
- get pkdns() {
2240
- const ret = wasm.signer_pkdns(this.__wbg_ptr);
2241
- return Pkdns.__wrap(ret);
2521
+ }
2522
+ exports.validateCapabilities = validateCapabilities;
2523
+
2524
+ function __wbg_get_imports() {
2525
+ const import0 = {
2526
+ __proto__: null,
2527
+ __wbg_Error_ecbf49c1b9d07c30: function(arg0, arg1) {
2528
+ const ret = Error(getStringFromWasm0(arg0, arg1));
2529
+ return ret;
2530
+ },
2531
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
2532
+ const ret = String(arg1);
2533
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2534
+ const len1 = WASM_VECTOR_LEN;
2535
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2536
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2537
+ },
2538
+ __wbg___wbindgen_bigint_get_as_i64_a4925bc53b16f3d6: function(arg0, arg1) {
2539
+ const v = arg1;
2540
+ const ret = typeof(v) === 'bigint' ? v : undefined;
2541
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2542
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2543
+ },
2544
+ __wbg___wbindgen_boolean_get_4a348b369b009243: function(arg0) {
2545
+ const v = arg0;
2546
+ const ret = typeof(v) === 'boolean' ? v : undefined;
2547
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2548
+ },
2549
+ __wbg___wbindgen_debug_string_43c7ccb034739216: function(arg0, arg1) {
2550
+ const ret = debugString(arg1);
2551
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2552
+ const len1 = WASM_VECTOR_LEN;
2553
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2554
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2555
+ },
2556
+ __wbg___wbindgen_in_035107858ad0083e: function(arg0, arg1) {
2557
+ const ret = arg0 in arg1;
2558
+ return ret;
2559
+ },
2560
+ __wbg___wbindgen_is_bigint_15e2d080220c7748: function(arg0) {
2561
+ const ret = typeof(arg0) === 'bigint';
2562
+ return ret;
2563
+ },
2564
+ __wbg___wbindgen_is_function_18bea6e84080c016: function(arg0) {
2565
+ const ret = typeof(arg0) === 'function';
2566
+ return ret;
2567
+ },
2568
+ __wbg___wbindgen_is_null_c5f5bb76436a9ab1: function(arg0) {
2569
+ const ret = arg0 === null;
2570
+ return ret;
2571
+ },
2572
+ __wbg___wbindgen_is_object_8d3fac158b36498d: function(arg0) {
2573
+ const val = arg0;
2574
+ const ret = typeof(val) === 'object' && val !== null;
2575
+ return ret;
2576
+ },
2577
+ __wbg___wbindgen_is_string_4d5f2c5b2acf65b0: function(arg0) {
2578
+ const ret = typeof(arg0) === 'string';
2579
+ return ret;
2580
+ },
2581
+ __wbg___wbindgen_is_undefined_4a711ea9d2e1ef93: function(arg0) {
2582
+ const ret = arg0 === undefined;
2583
+ return ret;
2584
+ },
2585
+ __wbg___wbindgen_jsval_eq_65f99081d9ee8f4d: function(arg0, arg1) {
2586
+ const ret = arg0 === arg1;
2587
+ return ret;
2588
+ },
2589
+ __wbg___wbindgen_jsval_loose_eq_1a2067dfb025b5ec: function(arg0, arg1) {
2590
+ const ret = arg0 == arg1;
2591
+ return ret;
2592
+ },
2593
+ __wbg___wbindgen_number_get_eed4462ef92e1bed: function(arg0, arg1) {
2594
+ const obj = arg1;
2595
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2596
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2597
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2598
+ },
2599
+ __wbg___wbindgen_string_get_d09f733449cbf7a2: function(arg0, arg1) {
2600
+ const obj = arg1;
2601
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2602
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2603
+ var len1 = WASM_VECTOR_LEN;
2604
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2605
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2606
+ },
2607
+ __wbg___wbindgen_throw_df03e93053e0f4bc: function(arg0, arg1) {
2608
+ throw new Error(getStringFromWasm0(arg0, arg1));
2609
+ },
2610
+ __wbg__wbg_cb_unref_9f02ce912168c354: function(arg0) {
2611
+ arg0._wbg_cb_unref();
2612
+ },
2613
+ __wbg_abort_7100d741d811fdb2: function(arg0, arg1) {
2614
+ arg0.abort(arg1);
2615
+ },
2616
+ __wbg_abort_bf4dbbb6563f9ad6: function(arg0) {
2617
+ arg0.abort();
2618
+ },
2619
+ __wbg_append_057d2867b781cdc3: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2620
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2621
+ }, arguments); },
2622
+ __wbg_arrayBuffer_6881d775e5087c3c: function() { return handleError(function (arg0) {
2623
+ const ret = arg0.arrayBuffer();
2624
+ return ret;
2625
+ }, arguments); },
2626
+ __wbg_authtoken_new: function(arg0) {
2627
+ const ret = AuthToken.__wrap(arg0);
2628
+ return ret;
2629
+ },
2630
+ __wbg_body_1f1b47b98078274a: function(arg0) {
2631
+ const ret = arg0.body;
2632
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2633
+ },
2634
+ __wbg_buffer_d8bcb2548b84f613: function(arg0) {
2635
+ const ret = arg0.buffer;
2636
+ return ret;
2637
+ },
2638
+ __wbg_byobRequest_d4c119d77083ad7a: function(arg0) {
2639
+ const ret = arg0.byobRequest;
2640
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2641
+ },
2642
+ __wbg_byteLength_9f07c790d3b57e52: function(arg0) {
2643
+ const ret = arg0.byteLength;
2644
+ return ret;
2645
+ },
2646
+ __wbg_byteOffset_f141aa06796258e0: function(arg0) {
2647
+ const ret = arg0.byteOffset;
2648
+ return ret;
2649
+ },
2650
+ __wbg_call_85e5437fa1ab109d: function() { return handleError(function (arg0, arg1, arg2) {
2651
+ const ret = arg0.call(arg1, arg2);
2652
+ return ret;
2653
+ }, arguments); },
2654
+ __wbg_call_df7a43aecab856a8: function() { return handleError(function (arg0, arg1) {
2655
+ const ret = arg0.call(arg1);
2656
+ return ret;
2657
+ }, arguments); },
2658
+ __wbg_cancel_9c3f52242a659f49: function(arg0) {
2659
+ const ret = arg0.cancel();
2660
+ return ret;
2661
+ },
2662
+ __wbg_catch_03e7dc8db176651d: function(arg0, arg1) {
2663
+ const ret = arg0.catch(arg1);
2664
+ return ret;
2665
+ },
2666
+ __wbg_clearTimeout_2256f1e7b94ef517: function(arg0) {
2667
+ const ret = clearTimeout(arg0);
2668
+ return ret;
2669
+ },
2670
+ __wbg_close_1d57e0361a94e720: function() { return handleError(function (arg0) {
2671
+ arg0.close();
2672
+ }, arguments); },
2673
+ __wbg_close_29dcd39cb851697f: function() { return handleError(function (arg0) {
2674
+ arg0.close();
2675
+ }, arguments); },
2676
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
2677
+ const ret = arg0.crypto;
2678
+ return ret;
2679
+ },
2680
+ __wbg_debug_9fa2e16fc1df8e5c: function(arg0, arg1, arg2, arg3) {
2681
+ console.debug(arg0, arg1, arg2, arg3);
2682
+ },
2683
+ __wbg_done_0ad70482cae88a68: function(arg0) {
2684
+ const ret = arg0.done;
2685
+ return ret;
2686
+ },
2687
+ __wbg_enqueue_42644feecc53c816: function() { return handleError(function (arg0, arg1) {
2688
+ arg0.enqueue(arg1);
2689
+ }, arguments); },
2690
+ __wbg_entries_0612723091672151: function(arg0) {
2691
+ const ret = arg0.entries();
2692
+ return ret;
2693
+ },
2694
+ __wbg_entries_d58050057c0390ac: function(arg0) {
2695
+ const ret = Object.entries(arg0);
2696
+ return ret;
2697
+ },
2698
+ __wbg_error_28af238a3cff9f08: function(arg0, arg1, arg2, arg3) {
2699
+ console.error(arg0, arg1, arg2, arg3);
2700
+ },
2701
+ __wbg_event_new: function(arg0) {
2702
+ const ret = Event.__wrap(arg0);
2703
+ return ret;
2704
+ },
2705
+ __wbg_fetch_43b2f110608a59ff: function(arg0) {
2706
+ const ret = fetch(arg0);
2707
+ return ret;
2708
+ },
2709
+ __wbg_fetch_45acaeeb56cea876: function(arg0) {
2710
+ const ret = fetch(arg0);
2711
+ return ret;
2712
+ },
2713
+ __wbg_fetch_8508e14acc7090e7: function(arg0, arg1) {
2714
+ const ret = arg0.fetch(arg1);
2715
+ return ret;
2716
+ },
2717
+ __wbg_from_291708c278f9eb83: function(arg0) {
2718
+ const ret = Array.from(arg0);
2719
+ return ret;
2720
+ },
2721
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
2722
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2723
+ }, arguments); },
2724
+ __wbg_getRandomValues_ab1935b403569652: function() { return handleError(function (arg0, arg1) {
2725
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2726
+ }, arguments); },
2727
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
2728
+ arg0.getRandomValues(arg1);
2729
+ }, arguments); },
2730
+ __wbg_getReader_9facd4f899beac89: function() { return handleError(function (arg0) {
2731
+ const ret = arg0.getReader();
2732
+ return ret;
2733
+ }, arguments); },
2734
+ __wbg_get_6f5cf69c8f3f094a: function() { return handleError(function (arg0, arg1) {
2735
+ const ret = Reflect.get(arg0, arg1);
2736
+ return ret;
2737
+ }, arguments); },
2738
+ __wbg_get_c40e2c3262995a8e: function(arg0, arg1) {
2739
+ const ret = arg0[arg1 >>> 0];
2740
+ return ret;
2741
+ },
2742
+ __wbg_get_d0e1306db90b68d9: function() { return handleError(function (arg0, arg1) {
2743
+ const ret = Reflect.get(arg0, arg1);
2744
+ return ret;
2745
+ }, arguments); },
2746
+ __wbg_get_done_7c83ea32e40589f6: function(arg0) {
2747
+ const ret = arg0.done;
2748
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2749
+ },
2750
+ __wbg_get_unchecked_3de5bfaaea65f86b: function(arg0, arg1) {
2751
+ const ret = arg0[arg1 >>> 0];
2752
+ return ret;
2753
+ },
2754
+ __wbg_get_value_d01127aa5554a340: function(arg0) {
2755
+ const ret = arg0.value;
2756
+ return ret;
2757
+ },
2758
+ __wbg_has_393943c179c58bfe: function() { return handleError(function (arg0, arg1) {
2759
+ const ret = Reflect.has(arg0, arg1);
2760
+ return ret;
2761
+ }, arguments); },
2762
+ __wbg_headers_5960155bb72206d7: function(arg0) {
2763
+ const ret = arg0.headers;
2764
+ return ret;
2765
+ },
2766
+ __wbg_info_fc55b8d216b2710c: function(arg0, arg1, arg2, arg3) {
2767
+ console.info(arg0, arg1, arg2, arg3);
2768
+ },
2769
+ __wbg_instanceof_ArrayBuffer_d8e4e51f1cf7287a: function(arg0) {
2770
+ let result;
2771
+ try {
2772
+ result = arg0 instanceof ArrayBuffer;
2773
+ } catch (_) {
2774
+ result = false;
2775
+ }
2776
+ const ret = result;
2777
+ return ret;
2778
+ },
2779
+ __wbg_instanceof_Error_bd90cad2d1c17510: function(arg0) {
2780
+ let result;
2781
+ try {
2782
+ result = arg0 instanceof Error;
2783
+ } catch (_) {
2784
+ result = false;
2785
+ }
2786
+ const ret = result;
2787
+ return ret;
2788
+ },
2789
+ __wbg_instanceof_Headers_453883a986b5b9c9: function(arg0) {
2790
+ let result;
2791
+ try {
2792
+ result = arg0 instanceof Headers;
2793
+ } catch (_) {
2794
+ result = false;
2795
+ }
2796
+ const ret = result;
2797
+ return ret;
2798
+ },
2799
+ __wbg_instanceof_Map_53b6790994271123: function(arg0) {
2800
+ let result;
2801
+ try {
2802
+ result = arg0 instanceof Map;
2803
+ } catch (_) {
2804
+ result = false;
2805
+ }
2806
+ const ret = result;
2807
+ return ret;
2808
+ },
2809
+ __wbg_instanceof_Response_4d70bea95d48a514: function(arg0) {
2810
+ let result;
2811
+ try {
2812
+ result = arg0 instanceof Response;
2813
+ } catch (_) {
2814
+ result = false;
2815
+ }
2816
+ const ret = result;
2817
+ return ret;
2818
+ },
2819
+ __wbg_instanceof_Uint8Array_6e48d83da6091cc8: function(arg0) {
2820
+ let result;
2821
+ try {
2822
+ result = arg0 instanceof Uint8Array;
2823
+ } catch (_) {
2824
+ result = false;
2825
+ }
2826
+ const ret = result;
2827
+ return ret;
2828
+ },
2829
+ __wbg_isArray_2efa5973cef6ec32: function(arg0) {
2830
+ const ret = Array.isArray(arg0);
2831
+ return ret;
2832
+ },
2833
+ __wbg_isSafeInteger_6709fb28be12d738: function(arg0) {
2834
+ const ret = Number.isSafeInteger(arg0);
2835
+ return ret;
2836
+ },
2837
+ __wbg_iterator_e77d2b7575cca5a7: function() {
2838
+ const ret = Symbol.iterator;
2839
+ return ret;
2840
+ },
2841
+ __wbg_length_00dd7227fd4626ad: function(arg0) {
2842
+ const ret = arg0.length;
2843
+ return ret;
2844
+ },
2845
+ __wbg_length_5e07cf181b2745fb: function(arg0) {
2846
+ const ret = arg0.length;
2847
+ return ret;
2848
+ },
2849
+ __wbg_log_9ce7e40080101249: function(arg0, arg1, arg2, arg3) {
2850
+ console.log(arg0, arg1, arg2, arg3);
2851
+ },
2852
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
2853
+ const ret = arg0.msCrypto;
2854
+ return ret;
2855
+ },
2856
+ __wbg_new_58794ce12509602d: function(arg0, arg1) {
2857
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2858
+ return ret;
2859
+ },
2860
+ __wbg_new_62f131e968c83d75: function() {
2861
+ const ret = new Object();
2862
+ return ret;
2863
+ },
2864
+ __wbg_new_66075f8c2ea6575e: function() {
2865
+ const ret = new Array();
2866
+ return ret;
2867
+ },
2868
+ __wbg_new_74eb411a4d7bd3f1: function() {
2869
+ const ret = new Map();
2870
+ return ret;
2871
+ },
2872
+ __wbg_new_a0479da6258a0d71: function(arg0) {
2873
+ const ret = new Uint8Array(arg0);
2874
+ return ret;
2875
+ },
2876
+ __wbg_new_a23ce0a01d189235: function() { return handleError(function () {
2877
+ const ret = new Headers();
2878
+ return ret;
2879
+ }, arguments); },
2880
+ __wbg_new_eb8f6841a0421871: function() { return handleError(function () {
2881
+ const ret = new AbortController();
2882
+ return ret;
2883
+ }, arguments); },
2884
+ __wbg_new_from_slice_e98c2bb0a59c32a0: function(arg0, arg1) {
2885
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2886
+ return ret;
2887
+ },
2888
+ __wbg_new_typed_893dbec5fe999814: function(arg0, arg1) {
2889
+ try {
2890
+ var state0 = {a: arg0, b: arg1};
2891
+ var cb0 = (arg0, arg1) => {
2892
+ const a = state0.a;
2893
+ state0.a = 0;
2894
+ try {
2895
+ return wasm_bindgen__convert__closures_____invoke__h2ffe4d8ada5ad683(a, state0.b, arg0, arg1);
2896
+ } finally {
2897
+ state0.a = a;
2898
+ }
2899
+ };
2900
+ const ret = new Promise(cb0);
2901
+ return ret;
2902
+ } finally {
2903
+ state0.a = state0.b = 0;
2904
+ }
2905
+ },
2906
+ __wbg_new_with_byte_offset_and_length_5c494ef1df19d087: function(arg0, arg1, arg2) {
2907
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
2908
+ return ret;
2909
+ },
2910
+ __wbg_new_with_into_underlying_source_fd904252f385f59c: function(arg0, arg1) {
2911
+ const ret = new ReadableStream(IntoUnderlyingSource.__wrap(arg0), arg1);
2912
+ return ret;
2913
+ },
2914
+ __wbg_new_with_length_9b57e4a9683723fa: function(arg0) {
2915
+ const ret = new Uint8Array(arg0 >>> 0);
2916
+ return ret;
2917
+ },
2918
+ __wbg_new_with_opt_readable_stream_and_init_404b48c41e625497: function() { return handleError(function (arg0, arg1) {
2919
+ const ret = new Response(arg0, arg1);
2920
+ return ret;
2921
+ }, arguments); },
2922
+ __wbg_new_with_str_and_init_ccd7de5a7b7630b8: function() { return handleError(function (arg0, arg1, arg2) {
2923
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
2924
+ return ret;
2925
+ }, arguments); },
2926
+ __wbg_next_5428439dfc1d0362: function() { return handleError(function (arg0) {
2927
+ const ret = arg0.next();
2928
+ return ret;
2929
+ }, arguments); },
2930
+ __wbg_next_d314789a105729f3: function(arg0) {
2931
+ const ret = arg0.next;
2932
+ return ret;
2933
+ },
2934
+ __wbg_node_84ea875411254db1: function(arg0) {
2935
+ const ret = arg0.node;
2936
+ return ret;
2937
+ },
2938
+ __wbg_now_81a04fc60f4b9917: function() {
2939
+ const ret = Date.now();
2940
+ return ret;
2941
+ },
2942
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
2943
+ const ret = arg0.now();
2944
+ return ret;
2945
+ },
2946
+ __wbg_parse_18a4a613f7a65376: function() { return handleError(function (arg0, arg1) {
2947
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
2948
+ return ret;
2949
+ }, arguments); },
2950
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
2951
+ const ret = arg0.performance;
2952
+ return ret;
2953
+ },
2954
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
2955
+ const ret = arg0.process;
2956
+ return ret;
2957
+ },
2958
+ __wbg_prototypesetcall_d1a7133bc8d83aa9: function(arg0, arg1, arg2) {
2959
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2960
+ },
2961
+ __wbg_publickey_new: function(arg0) {
2962
+ const ret = PublicKey.__wrap(arg0);
2963
+ return ret;
2964
+ },
2965
+ __wbg_queueMicrotask_622e69f0935dfab2: function(arg0) {
2966
+ const ret = arg0.queueMicrotask;
2967
+ return ret;
2968
+ },
2969
+ __wbg_queueMicrotask_d0528786d26e067c: function(arg0) {
2970
+ queueMicrotask(arg0);
2971
+ },
2972
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
2973
+ arg0.randomFillSync(arg1);
2974
+ }, arguments); },
2975
+ __wbg_read_af39a65adb693c12: function(arg0) {
2976
+ const ret = arg0.read();
2977
+ return ret;
2978
+ },
2979
+ __wbg_releaseLock_d3d7bbf2efd5c049: function(arg0) {
2980
+ arg0.releaseLock();
2981
+ },
2982
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
2983
+ const ret = module.require;
2984
+ return ret;
2985
+ }, arguments); },
2986
+ __wbg_resolve_d170483d75a2c8a1: function(arg0) {
2987
+ const ret = Promise.resolve(arg0);
2988
+ return ret;
2989
+ },
2990
+ __wbg_respond_0beb7807b2a4bc16: function() { return handleError(function (arg0, arg1) {
2991
+ arg0.respond(arg1 >>> 0);
2992
+ }, arguments); },
2993
+ __wbg_session_new: function(arg0) {
2994
+ const ret = Session.__wrap(arg0);
2995
+ return ret;
2996
+ },
2997
+ __wbg_setTimeout_b188b3bcc8977c7d: function(arg0, arg1) {
2998
+ const ret = setTimeout(arg0, arg1);
2999
+ return ret;
3000
+ },
3001
+ __wbg_set_3ba5af57f57f831c: function(arg0, arg1, arg2) {
3002
+ const ret = arg0.set(arg1, arg2);
3003
+ return ret;
3004
+ },
3005
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
3006
+ arg0[arg1] = arg2;
3007
+ },
3008
+ __wbg_set_7bf9e2df46e7632c: function(arg0, arg1, arg2) {
3009
+ arg0[arg1 >>> 0] = arg2;
3010
+ },
3011
+ __wbg_set_8326741805409e83: function() { return handleError(function (arg0, arg1, arg2) {
3012
+ const ret = Reflect.set(arg0, arg1, arg2);
3013
+ return ret;
3014
+ }, arguments); },
3015
+ __wbg_set_8540e567c8d5d225: function(arg0, arg1, arg2) {
3016
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
3017
+ },
3018
+ __wbg_set_body_d3bfb0ba84038563: function(arg0, arg1) {
3019
+ arg0.body = arg1;
3020
+ },
3021
+ __wbg_set_cache_d7fd96d5c85d5834: function(arg0, arg1) {
3022
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
3023
+ },
3024
+ __wbg_set_credentials_75d65e7cc277aad0: function(arg0, arg1) {
3025
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
3026
+ },
3027
+ __wbg_set_db2c2258160ed058: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3028
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
3029
+ }, arguments); },
3030
+ __wbg_set_headers_dc82e2bf93dcda1f: function(arg0, arg1) {
3031
+ arg0.headers = arg1;
3032
+ },
3033
+ __wbg_set_headers_e4e56fe005f0b5c9: function(arg0, arg1) {
3034
+ arg0.headers = arg1;
3035
+ },
3036
+ __wbg_set_high_water_mark_bede7db72aae0904: function(arg0, arg1) {
3037
+ arg0.highWaterMark = arg1;
3038
+ },
3039
+ __wbg_set_method_e1291768ddb1e35e: function(arg0, arg1, arg2) {
3040
+ arg0.method = getStringFromWasm0(arg1, arg2);
3041
+ },
3042
+ __wbg_set_mode_1fcb26983836e884: function(arg0, arg1) {
3043
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
3044
+ },
3045
+ __wbg_set_name_280167a140c1fb41: function(arg0, arg1, arg2) {
3046
+ arg0.name = getStringFromWasm0(arg1, arg2);
3047
+ },
3048
+ __wbg_set_signal_4e03877dd7f2cd34: function(arg0, arg1) {
3049
+ arg0.signal = arg1;
3050
+ },
3051
+ __wbg_set_status_b9add1436f357a74: function(arg0, arg1) {
3052
+ arg0.status = arg1;
3053
+ },
3054
+ __wbg_set_status_text_8c6fbf561566cfb8: function(arg0, arg1, arg2) {
3055
+ arg0.statusText = getStringFromWasm0(arg1, arg2);
3056
+ },
3057
+ __wbg_signal_065197e577ceaa9e: function(arg0) {
3058
+ const ret = arg0.signal;
3059
+ return ret;
3060
+ },
3061
+ __wbg_static_accessor_GLOBAL_THIS_6614f2f4998e3c4c: function() {
3062
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
3063
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3064
+ },
3065
+ __wbg_static_accessor_GLOBAL_d8e8a2fefe80bc1d: function() {
3066
+ const ret = typeof global === 'undefined' ? null : global;
3067
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3068
+ },
3069
+ __wbg_static_accessor_SELF_e29eaf7c465526b1: function() {
3070
+ const ret = typeof self === 'undefined' ? null : self;
3071
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3072
+ },
3073
+ __wbg_static_accessor_WINDOW_66e7ca3eef30585a: function() {
3074
+ const ret = typeof window === 'undefined' ? null : window;
3075
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3076
+ },
3077
+ __wbg_status_3a65028f4384d918: function(arg0) {
3078
+ const ret = arg0.status;
3079
+ return ret;
3080
+ },
3081
+ __wbg_stringify_c585a2d825a78689: function() { return handleError(function (arg0) {
3082
+ const ret = JSON.stringify(arg0);
3083
+ return ret;
3084
+ }, arguments); },
3085
+ __wbg_subarray_f36da54ffa7114f5: function(arg0, arg1, arg2) {
3086
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3087
+ return ret;
3088
+ },
3089
+ __wbg_text_96bbece7b1823162: function() { return handleError(function (arg0) {
3090
+ const ret = arg0.text();
3091
+ return ret;
3092
+ }, arguments); },
3093
+ __wbg_then_1170ade08ea65bc7: function(arg0, arg1, arg2) {
3094
+ const ret = arg0.then(arg1, arg2);
3095
+ return ret;
3096
+ },
3097
+ __wbg_then_fdc17de424bf508a: function(arg0, arg1) {
3098
+ const ret = arg0.then(arg1);
3099
+ return ret;
3100
+ },
3101
+ __wbg_toString_a22faf60361782a5: function(arg0) {
3102
+ const ret = arg0.toString();
3103
+ return ret;
3104
+ },
3105
+ __wbg_url_f73e822379c5f00c: function(arg0, arg1) {
3106
+ const ret = arg1.url;
3107
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3108
+ const len1 = WASM_VECTOR_LEN;
3109
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3110
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3111
+ },
3112
+ __wbg_value_414b42ce7b3eca22: function(arg0) {
3113
+ const ret = arg0.value;
3114
+ return ret;
3115
+ },
3116
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
3117
+ const ret = arg0.versions;
3118
+ return ret;
3119
+ },
3120
+ __wbg_view_3120c63593e25b87: function(arg0) {
3121
+ const ret = arg0.view;
3122
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3123
+ },
3124
+ __wbg_warn_b4702bd741d1b96e: function(arg0, arg1, arg2, arg3) {
3125
+ console.warn(arg0, arg1, arg2, arg3);
3126
+ },
3127
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
3128
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 198, function: Function { arguments: [], shim_idx: 199, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3129
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h58cb744c6dbe38df, wasm_bindgen__convert__closures_____invoke__h87777aac4a35a114);
3130
+ return ret;
3131
+ },
3132
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
3133
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 202, function: Function { arguments: [Externref], shim_idx: 100, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3134
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h5fe3bbd9cd01a9bd, wasm_bindgen__convert__closures_____invoke__h466de037074efd73);
3135
+ return ret;
3136
+ },
3137
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
3138
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 202, function: Function { arguments: [Externref], shim_idx: 203, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3139
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h5fe3bbd9cd01a9bd, wasm_bindgen__convert__closures_____invoke__h94cf5291c982569e);
3140
+ return ret;
3141
+ },
3142
+ __wbindgen_cast_0000000000000004: function(arg0) {
3143
+ // Cast intrinsic for `F64 -> Externref`.
3144
+ const ret = arg0;
3145
+ return ret;
3146
+ },
3147
+ __wbindgen_cast_0000000000000005: function(arg0) {
3148
+ // Cast intrinsic for `I64 -> Externref`.
3149
+ const ret = arg0;
3150
+ return ret;
3151
+ },
3152
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
3153
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
3154
+ const ret = getArrayU8FromWasm0(arg0, arg1);
3155
+ return ret;
3156
+ },
3157
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
3158
+ // Cast intrinsic for `Ref(String) -> Externref`.
3159
+ const ret = getStringFromWasm0(arg0, arg1);
3160
+ return ret;
3161
+ },
3162
+ __wbindgen_cast_0000000000000008: function(arg0) {
3163
+ // Cast intrinsic for `U64 -> Externref`.
3164
+ const ret = BigInt.asUintN(64, arg0);
3165
+ return ret;
3166
+ },
3167
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
3168
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3169
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
3170
+ // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
3171
+ const ret = v0;
3172
+ return ret;
3173
+ },
3174
+ __wbindgen_init_externref_table: function() {
3175
+ const table = wasm.__wbindgen_externrefs;
3176
+ const offset = table.grow(4);
3177
+ table.set(0, undefined);
3178
+ table.set(offset + 0, undefined);
3179
+ table.set(offset + 1, null);
3180
+ table.set(offset + 2, true);
3181
+ table.set(offset + 3, false);
3182
+ },
3183
+ };
3184
+ return {
3185
+ __proto__: null,
3186
+ "./pubky_bg.js": import0,
3187
+ };
3188
+ }
3189
+
3190
+ function wasm_bindgen__convert__closures_____invoke__h87777aac4a35a114(arg0, arg1) {
3191
+ wasm.wasm_bindgen__convert__closures_____invoke__h87777aac4a35a114(arg0, arg1);
3192
+ }
3193
+
3194
+ function wasm_bindgen__convert__closures_____invoke__h94cf5291c982569e(arg0, arg1, arg2) {
3195
+ wasm.wasm_bindgen__convert__closures_____invoke__h94cf5291c982569e(arg0, arg1, arg2);
3196
+ }
3197
+
3198
+ function wasm_bindgen__convert__closures_____invoke__h466de037074efd73(arg0, arg1, arg2) {
3199
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h466de037074efd73(arg0, arg1, arg2);
3200
+ if (ret[1]) {
3201
+ throw takeFromExternrefTable0(ret[0]);
2242
3202
  }
2243
3203
  }
2244
- if (Symbol.dispose) Signer.prototype[Symbol.dispose] = Signer.prototype.free;
2245
3204
 
2246
- exports.Signer = Signer;
3205
+ function wasm_bindgen__convert__closures_____invoke__h2ffe4d8ada5ad683(arg0, arg1, arg2, arg3) {
3206
+ wasm.wasm_bindgen__convert__closures_____invoke__h2ffe4d8ada5ad683(arg0, arg1, arg2, arg3);
3207
+ }
3208
+
3209
+
3210
+ const __wbindgen_enum_Level = ["error", "warn", "info", "debug", "trace"];
3211
+
2247
3212
 
3213
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
3214
+
3215
+
3216
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
3217
+
3218
+
3219
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
3220
+
3221
+
3222
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
3223
+ const AuthFlowFinalization = (typeof FinalizationRegistry === 'undefined')
3224
+ ? { register: () => {}, unregister: () => {} }
3225
+ : new FinalizationRegistry(ptr => wasm.__wbg_authflow_free(ptr >>> 0, 1));
3226
+ const AuthFlowKindFinalization = (typeof FinalizationRegistry === 'undefined')
3227
+ ? { register: () => {}, unregister: () => {} }
3228
+ : new FinalizationRegistry(ptr => wasm.__wbg_authflowkind_free(ptr >>> 0, 1));
3229
+ const AuthTokenFinalization = (typeof FinalizationRegistry === 'undefined')
3230
+ ? { register: () => {}, unregister: () => {} }
3231
+ : new FinalizationRegistry(ptr => wasm.__wbg_authtoken_free(ptr >>> 0, 1));
3232
+ const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
3233
+ ? { register: () => {}, unregister: () => {} }
3234
+ : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
3235
+ const EventFinalization = (typeof FinalizationRegistry === 'undefined')
3236
+ ? { register: () => {}, unregister: () => {} }
3237
+ : new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr >>> 0, 1));
3238
+ const EventStreamBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
3239
+ ? { register: () => {}, unregister: () => {} }
3240
+ : new FinalizationRegistry(ptr => wasm.__wbg_eventstreambuilder_free(ptr >>> 0, 1));
3241
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
3242
+ ? { register: () => {}, unregister: () => {} }
3243
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
3244
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
3245
+ ? { register: () => {}, unregister: () => {} }
3246
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
3247
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
3248
+ ? { register: () => {}, unregister: () => {} }
3249
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
3250
+ const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
3251
+ ? { register: () => {}, unregister: () => {} }
3252
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
3253
+ const PkdnsFinalization = (typeof FinalizationRegistry === 'undefined')
3254
+ ? { register: () => {}, unregister: () => {} }
3255
+ : new FinalizationRegistry(ptr => wasm.__wbg_pkdns_free(ptr >>> 0, 1));
3256
+ const PubkyFinalization = (typeof FinalizationRegistry === 'undefined')
3257
+ ? { register: () => {}, unregister: () => {} }
3258
+ : new FinalizationRegistry(ptr => wasm.__wbg_pubky_free(ptr >>> 0, 1));
3259
+ const PubkyResourceFinalization = (typeof FinalizationRegistry === 'undefined')
3260
+ ? { register: () => {}, unregister: () => {} }
3261
+ : new FinalizationRegistry(ptr => wasm.__wbg_pubkyresource_free(ptr >>> 0, 1));
3262
+ const PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
3263
+ ? { register: () => {}, unregister: () => {} }
3264
+ : new FinalizationRegistry(ptr => wasm.__wbg_publickey_free(ptr >>> 0, 1));
3265
+ const PublicStorageFinalization = (typeof FinalizationRegistry === 'undefined')
3266
+ ? { register: () => {}, unregister: () => {} }
3267
+ : new FinalizationRegistry(ptr => wasm.__wbg_publicstorage_free(ptr >>> 0, 1));
3268
+ const SeedExportDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
3269
+ ? { register: () => {}, unregister: () => {} }
3270
+ : new FinalizationRegistry(ptr => wasm.__wbg_seedexportdeeplink_free(ptr >>> 0, 1));
3271
+ const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
3272
+ ? { register: () => {}, unregister: () => {} }
3273
+ : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr >>> 0, 1));
3274
+ const SessionInfoFinalization = (typeof FinalizationRegistry === 'undefined')
3275
+ ? { register: () => {}, unregister: () => {} }
3276
+ : new FinalizationRegistry(ptr => wasm.__wbg_sessioninfo_free(ptr >>> 0, 1));
3277
+ const SessionStorageFinalization = (typeof FinalizationRegistry === 'undefined')
3278
+ ? { register: () => {}, unregister: () => {} }
3279
+ : new FinalizationRegistry(ptr => wasm.__wbg_sessionstorage_free(ptr >>> 0, 1));
3280
+ const SignerFinalization = (typeof FinalizationRegistry === 'undefined')
3281
+ ? { register: () => {}, unregister: () => {} }
3282
+ : new FinalizationRegistry(ptr => wasm.__wbg_signer_free(ptr >>> 0, 1));
2248
3283
  const SigninDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
2249
3284
  ? { register: () => {}, unregister: () => {} }
2250
3285
  : new FinalizationRegistry(ptr => wasm.__wbg_signindeeplink_free(ptr >>> 0, 1));
3286
+ const SignupDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
3287
+ ? { register: () => {}, unregister: () => {} }
3288
+ : new FinalizationRegistry(ptr => wasm.__wbg_signupdeeplink_free(ptr >>> 0, 1));
2251
3289
 
2252
- class SigninDeepLink {
3290
+ function addToExternrefTable0(obj) {
3291
+ const idx = wasm.__externref_table_alloc();
3292
+ wasm.__wbindgen_externrefs.set(idx, obj);
3293
+ return idx;
3294
+ }
2253
3295
 
2254
- static __wrap(ptr) {
2255
- ptr = ptr >>> 0;
2256
- const obj = Object.create(SigninDeepLink.prototype);
2257
- obj.__wbg_ptr = ptr;
2258
- SigninDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
2259
- return obj;
3296
+ function _assertClass(instance, klass) {
3297
+ if (!(instance instanceof klass)) {
3298
+ throw new Error(`expected instance of ${klass.name}`);
2260
3299
  }
3300
+ }
2261
3301
 
2262
- __destroy_into_raw() {
2263
- const ptr = this.__wbg_ptr;
2264
- this.__wbg_ptr = 0;
2265
- SigninDeepLinkFinalization.unregister(this);
2266
- return ptr;
2267
- }
3302
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
3303
+ ? { register: () => {}, unregister: () => {} }
3304
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
2268
3305
 
2269
- free() {
2270
- const ptr = this.__destroy_into_raw();
2271
- wasm.__wbg_signindeeplink_free(ptr, 0);
3306
+ function debugString(val) {
3307
+ // primitive types
3308
+ const type = typeof val;
3309
+ if (type == 'number' || type == 'boolean' || val == null) {
3310
+ return `${val}`;
2272
3311
  }
2273
- /**
2274
- * @param {string} url
2275
- * @returns {SigninDeepLink}
2276
- */
2277
- static parse(url) {
2278
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2279
- const len0 = WASM_VECTOR_LEN;
2280
- const ret = wasm.signindeeplink_parse(ptr0, len0);
2281
- if (ret[2]) {
2282
- throw takeFromExternrefTable0(ret[1]);
3312
+ if (type == 'string') {
3313
+ return `"${val}"`;
3314
+ }
3315
+ if (type == 'symbol') {
3316
+ const description = val.description;
3317
+ if (description == null) {
3318
+ return 'Symbol';
3319
+ } else {
3320
+ return `Symbol(${description})`;
2283
3321
  }
2284
- return SigninDeepLink.__wrap(ret[0]);
2285
3322
  }
2286
- /**
2287
- * @returns {string}
2288
- */
2289
- get capabilities() {
2290
- let deferred1_0;
2291
- let deferred1_1;
2292
- try {
2293
- const ret = wasm.signindeeplink_capabilities(this.__wbg_ptr);
2294
- deferred1_0 = ret[0];
2295
- deferred1_1 = ret[1];
2296
- return getStringFromWasm0(ret[0], ret[1]);
2297
- } finally {
2298
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3323
+ if (type == 'function') {
3324
+ const name = val.name;
3325
+ if (typeof name == 'string' && name.length > 0) {
3326
+ return `Function(${name})`;
3327
+ } else {
3328
+ return 'Function';
2299
3329
  }
2300
3330
  }
2301
- /**
2302
- * @returns {string}
2303
- */
2304
- get baseRelayUrl() {
2305
- let deferred1_0;
2306
- let deferred1_1;
2307
- try {
2308
- const ret = wasm.signindeeplink_baseRelayUrl(this.__wbg_ptr);
2309
- deferred1_0 = ret[0];
2310
- deferred1_1 = ret[1];
2311
- return getStringFromWasm0(ret[0], ret[1]);
2312
- } finally {
2313
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3331
+ // objects
3332
+ if (Array.isArray(val)) {
3333
+ const length = val.length;
3334
+ let debug = '[';
3335
+ if (length > 0) {
3336
+ debug += debugString(val[0]);
3337
+ }
3338
+ for(let i = 1; i < length; i++) {
3339
+ debug += ', ' + debugString(val[i]);
2314
3340
  }
3341
+ debug += ']';
3342
+ return debug;
2315
3343
  }
2316
- /**
2317
- * @returns {Uint8Array}
2318
- */
2319
- get secret() {
2320
- const ret = wasm.signindeeplink_secret(this.__wbg_ptr);
2321
- return ret;
3344
+ // Test for built-in
3345
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
3346
+ let className;
3347
+ if (builtInMatches && builtInMatches.length > 1) {
3348
+ className = builtInMatches[1];
3349
+ } else {
3350
+ // Failed to match the standard '[object ClassName]'
3351
+ return toString.call(val);
2322
3352
  }
2323
- /**
2324
- * @returns {string}
2325
- */
2326
- toString() {
2327
- let deferred1_0;
2328
- let deferred1_1;
2329
- try {
2330
- const ret = wasm.signindeeplink_toString(this.__wbg_ptr);
2331
- deferred1_0 = ret[0];
2332
- deferred1_1 = ret[1];
2333
- return getStringFromWasm0(ret[0], ret[1]);
2334
- } finally {
2335
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3353
+ if (className == 'Object') {
3354
+ // we're a user defined class or Object
3355
+ // JSON.stringify avoids problems with cycles, and is generally much
3356
+ // easier than looping through ownProperties of `val`.
3357
+ try {
3358
+ return 'Object(' + JSON.stringify(val) + ')';
3359
+ } catch (_) {
3360
+ return 'Object';
2336
3361
  }
2337
3362
  }
3363
+ // errors
3364
+ if (val instanceof Error) {
3365
+ return `${val.name}: ${val.message}\n${val.stack}`;
3366
+ }
3367
+ // TODO we could test for more things here, like `Set`s and `Map`s.
3368
+ return className;
2338
3369
  }
2339
- if (Symbol.dispose) SigninDeepLink.prototype[Symbol.dispose] = SigninDeepLink.prototype.free;
2340
-
2341
- exports.SigninDeepLink = SigninDeepLink;
2342
3370
 
2343
- const SignupDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
2344
- ? { register: () => {}, unregister: () => {} }
2345
- : new FinalizationRegistry(ptr => wasm.__wbg_signupdeeplink_free(ptr >>> 0, 1));
3371
+ function getArrayJsValueFromWasm0(ptr, len) {
3372
+ ptr = ptr >>> 0;
3373
+ const mem = getDataViewMemory0();
3374
+ const result = [];
3375
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
3376
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
3377
+ }
3378
+ wasm.__externref_drop_slice(ptr, len);
3379
+ return result;
3380
+ }
2346
3381
 
2347
- class SignupDeepLink {
3382
+ function getArrayU8FromWasm0(ptr, len) {
3383
+ ptr = ptr >>> 0;
3384
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
3385
+ }
2348
3386
 
2349
- static __wrap(ptr) {
2350
- ptr = ptr >>> 0;
2351
- const obj = Object.create(SignupDeepLink.prototype);
2352
- obj.__wbg_ptr = ptr;
2353
- SignupDeepLinkFinalization.register(obj, obj.__wbg_ptr, obj);
2354
- return obj;
3387
+ let cachedDataViewMemory0 = null;
3388
+ function getDataViewMemory0() {
3389
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
3390
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
2355
3391
  }
3392
+ return cachedDataViewMemory0;
3393
+ }
2356
3394
 
2357
- __destroy_into_raw() {
2358
- const ptr = this.__wbg_ptr;
2359
- this.__wbg_ptr = 0;
2360
- SignupDeepLinkFinalization.unregister(this);
2361
- return ptr;
2362
- }
3395
+ function getStringFromWasm0(ptr, len) {
3396
+ ptr = ptr >>> 0;
3397
+ return decodeText(ptr, len);
3398
+ }
2363
3399
 
2364
- free() {
2365
- const ptr = this.__destroy_into_raw();
2366
- wasm.__wbg_signupdeeplink_free(ptr, 0);
2367
- }
2368
- /**
2369
- * @param {string} url
2370
- * @returns {SignupDeepLink}
2371
- */
2372
- static parse(url) {
2373
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2374
- const len0 = WASM_VECTOR_LEN;
2375
- const ret = wasm.signupdeeplink_parse(ptr0, len0);
2376
- if (ret[2]) {
2377
- throw takeFromExternrefTable0(ret[1]);
2378
- }
2379
- return SignupDeepLink.__wrap(ret[0]);
3400
+ let cachedUint8ArrayMemory0 = null;
3401
+ function getUint8ArrayMemory0() {
3402
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
3403
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
2380
3404
  }
2381
- /**
2382
- * @returns {string}
2383
- */
2384
- get capabilities() {
2385
- let deferred1_0;
2386
- let deferred1_1;
2387
- try {
2388
- const ret = wasm.signupdeeplink_capabilities(this.__wbg_ptr);
2389
- deferred1_0 = ret[0];
2390
- deferred1_1 = ret[1];
2391
- return getStringFromWasm0(ret[0], ret[1]);
2392
- } finally {
2393
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2394
- }
3405
+ return cachedUint8ArrayMemory0;
3406
+ }
3407
+
3408
+ function handleError(f, args) {
3409
+ try {
3410
+ return f.apply(this, args);
3411
+ } catch (e) {
3412
+ const idx = addToExternrefTable0(e);
3413
+ wasm.__wbindgen_exn_store(idx);
2395
3414
  }
2396
- /**
2397
- * @returns {string}
2398
- */
2399
- get baseRelayUrl() {
2400
- let deferred1_0;
2401
- let deferred1_1;
3415
+ }
3416
+
3417
+ function isLikeNone(x) {
3418
+ return x === undefined || x === null;
3419
+ }
3420
+
3421
+ function makeMutClosure(arg0, arg1, dtor, f) {
3422
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
3423
+ const real = (...args) => {
3424
+
3425
+ // First up with a closure we increment the internal reference
3426
+ // count. This ensures that the Rust closure environment won't
3427
+ // be deallocated while we're invoking it.
3428
+ state.cnt++;
3429
+ const a = state.a;
3430
+ state.a = 0;
2402
3431
  try {
2403
- const ret = wasm.signupdeeplink_baseRelayUrl(this.__wbg_ptr);
2404
- deferred1_0 = ret[0];
2405
- deferred1_1 = ret[1];
2406
- return getStringFromWasm0(ret[0], ret[1]);
3432
+ return f(a, state.b, ...args);
2407
3433
  } finally {
2408
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2409
- }
2410
- }
2411
- /**
2412
- * @returns {Uint8Array}
2413
- */
2414
- get secret() {
2415
- const ret = wasm.signupdeeplink_secret(this.__wbg_ptr);
2416
- return ret;
2417
- }
2418
- /**
2419
- * @returns {PublicKey}
2420
- */
2421
- get homeserver() {
2422
- const ret = wasm.signupdeeplink_homeserver(this.__wbg_ptr);
2423
- return PublicKey.__wrap(ret);
2424
- }
2425
- /**
2426
- * @returns {string | undefined}
2427
- */
2428
- get signupToken() {
2429
- const ret = wasm.signupdeeplink_signupToken(this.__wbg_ptr);
2430
- let v1;
2431
- if (ret[0] !== 0) {
2432
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2433
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3434
+ state.a = a;
3435
+ real._wbg_cb_unref();
2434
3436
  }
2435
- return v1;
2436
- }
2437
- /**
2438
- * @returns {string}
2439
- */
2440
- toString() {
2441
- let deferred1_0;
2442
- let deferred1_1;
2443
- try {
2444
- const ret = wasm.signupdeeplink_toString(this.__wbg_ptr);
2445
- deferred1_0 = ret[0];
2446
- deferred1_1 = ret[1];
2447
- return getStringFromWasm0(ret[0], ret[1]);
2448
- } finally {
2449
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3437
+ };
3438
+ real._wbg_cb_unref = () => {
3439
+ if (--state.cnt === 0) {
3440
+ state.dtor(state.a, state.b);
3441
+ state.a = 0;
3442
+ CLOSURE_DTORS.unregister(state);
2450
3443
  }
2451
- }
3444
+ };
3445
+ CLOSURE_DTORS.register(real, state, state);
3446
+ return real;
2452
3447
  }
2453
- if (Symbol.dispose) SignupDeepLink.prototype[Symbol.dispose] = SignupDeepLink.prototype.free;
2454
3448
 
2455
- exports.SignupDeepLink = SignupDeepLink;
3449
+ function passArray8ToWasm0(arg, malloc) {
3450
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
3451
+ getUint8ArrayMemory0().set(arg, ptr / 1);
3452
+ WASM_VECTOR_LEN = arg.length;
3453
+ return ptr;
3454
+ }
2456
3455
 
2457
- exports.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
2458
- const ret = Error(getStringFromWasm0(arg0, arg1));
2459
- return ret;
2460
- };
2461
-
2462
- exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
2463
- const ret = String(arg1);
2464
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2465
- const len1 = WASM_VECTOR_LEN;
2466
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2467
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2468
- };
2469
-
2470
- exports.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
2471
- const v = arg1;
2472
- const ret = typeof(v) === 'bigint' ? v : undefined;
2473
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2474
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2475
- };
2476
-
2477
- exports.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
2478
- const v = arg0;
2479
- const ret = typeof(v) === 'boolean' ? v : undefined;
2480
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2481
- };
2482
-
2483
- exports.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
2484
- const ret = debugString(arg1);
2485
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2486
- const len1 = WASM_VECTOR_LEN;
2487
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2488
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2489
- };
2490
-
2491
- exports.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
2492
- const ret = arg0 in arg1;
2493
- return ret;
2494
- };
2495
-
2496
- exports.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
2497
- const ret = typeof(arg0) === 'bigint';
2498
- return ret;
2499
- };
2500
-
2501
- exports.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
2502
- const ret = typeof(arg0) === 'function';
2503
- return ret;
2504
- };
2505
-
2506
- exports.__wbg___wbindgen_is_null_5e69f72e906cc57c = function(arg0) {
2507
- const ret = arg0 === null;
2508
- return ret;
2509
- };
2510
-
2511
- exports.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
2512
- const val = arg0;
2513
- const ret = typeof(val) === 'object' && val !== null;
2514
- return ret;
2515
- };
2516
-
2517
- exports.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
2518
- const ret = typeof(arg0) === 'string';
2519
- return ret;
2520
- };
2521
-
2522
- exports.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
2523
- const ret = arg0 === undefined;
2524
- return ret;
2525
- };
2526
-
2527
- exports.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
2528
- const ret = arg0 === arg1;
2529
- return ret;
2530
- };
2531
-
2532
- exports.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
2533
- const ret = arg0 == arg1;
2534
- return ret;
2535
- };
2536
-
2537
- exports.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
2538
- const obj = arg1;
2539
- const ret = typeof(obj) === 'number' ? obj : undefined;
2540
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2541
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2542
- };
2543
-
2544
- exports.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
2545
- const obj = arg1;
2546
- const ret = typeof(obj) === 'string' ? obj : undefined;
2547
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2548
- var len1 = WASM_VECTOR_LEN;
2549
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2550
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2551
- };
2552
-
2553
- exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
2554
- throw new Error(getStringFromWasm0(arg0, arg1));
2555
- };
2556
-
2557
- exports.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
2558
- arg0._wbg_cb_unref();
2559
- };
2560
-
2561
- exports.__wbg_abort_28ad55c5825b004d = function(arg0, arg1) {
2562
- arg0.abort(arg1);
2563
- };
2564
-
2565
- exports.__wbg_abort_e7eb059f72f9ed0c = function(arg0) {
2566
- arg0.abort();
2567
- };
2568
-
2569
- exports.__wbg_append_b577eb3a177bc0fa = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2570
- arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2571
- }, arguments) };
2572
-
2573
- exports.__wbg_arrayBuffer_b375eccb84b4ddf3 = function() { return handleError(function (arg0) {
2574
- const ret = arg0.arrayBuffer();
2575
- return ret;
2576
- }, arguments) };
2577
-
2578
- exports.__wbg_authtoken_new = function(arg0) {
2579
- const ret = AuthToken.__wrap(arg0);
2580
- return ret;
2581
- };
2582
-
2583
- exports.__wbg_body_587542b2fd8e06c0 = function(arg0) {
2584
- const ret = arg0.body;
2585
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2586
- };
2587
-
2588
- exports.__wbg_buffer_ccc4520b36d3ccf4 = function(arg0) {
2589
- const ret = arg0.buffer;
2590
- return ret;
2591
- };
2592
-
2593
- exports.__wbg_byobRequest_2344e6975f27456e = function(arg0) {
2594
- const ret = arg0.byobRequest;
2595
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2596
- };
2597
-
2598
- exports.__wbg_byteLength_bcd42e4025299788 = function(arg0) {
2599
- const ret = arg0.byteLength;
2600
- return ret;
2601
- };
2602
-
2603
- exports.__wbg_byteOffset_ca3a6cf7944b364b = function(arg0) {
2604
- const ret = arg0.byteOffset;
2605
- return ret;
2606
- };
2607
-
2608
- exports.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
2609
- const ret = arg0.call(arg1, arg2);
2610
- return ret;
2611
- }, arguments) };
2612
-
2613
- exports.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
2614
- const ret = arg0.call(arg1);
2615
- return ret;
2616
- }, arguments) };
2617
-
2618
- exports.__wbg_cancel_48ab6f9dc366e369 = function(arg0) {
2619
- const ret = arg0.cancel();
2620
- return ret;
2621
- };
2622
-
2623
- exports.__wbg_catch_943836faa5d29bfb = function(arg0, arg1) {
2624
- const ret = arg0.catch(arg1);
2625
- return ret;
2626
- };
2627
-
2628
- exports.__wbg_clearTimeout_7a42b49784aea641 = function(arg0) {
2629
- const ret = clearTimeout(arg0);
2630
- return ret;
2631
- };
2632
-
2633
- exports.__wbg_close_5a6caed3231b68cd = function() { return handleError(function (arg0) {
2634
- arg0.close();
2635
- }, arguments) };
2636
-
2637
- exports.__wbg_close_6956df845478561a = function() { return handleError(function (arg0) {
2638
- arg0.close();
2639
- }, arguments) };
2640
-
2641
- exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
2642
- const ret = arg0.crypto;
2643
- return ret;
2644
- };
2645
-
2646
- exports.__wbg_debug_e55e1461940eb14d = function(arg0, arg1, arg2, arg3) {
2647
- console.debug(arg0, arg1, arg2, arg3);
2648
- };
2649
-
2650
- exports.__wbg_done_2042aa2670fb1db1 = function(arg0) {
2651
- const ret = arg0.done;
2652
- return ret;
2653
- };
2654
-
2655
- exports.__wbg_enqueue_7b18a650aec77898 = function() { return handleError(function (arg0, arg1) {
2656
- arg0.enqueue(arg1);
2657
- }, arguments) };
2658
-
2659
- exports.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
2660
- const ret = Object.entries(arg0);
2661
- return ret;
2662
- };
2663
-
2664
- exports.__wbg_error_d8b22cf4e59a6791 = function(arg0, arg1, arg2, arg3) {
2665
- console.error(arg0, arg1, arg2, arg3);
2666
- };
2667
-
2668
- exports.__wbg_fetch_013f0d75d4254327 = function(arg0) {
2669
- const ret = fetch(arg0);
2670
- return ret;
2671
- };
2672
-
2673
- exports.__wbg_fetch_74a3e84ebd2c9a0e = function(arg0) {
2674
- const ret = fetch(arg0);
2675
- return ret;
2676
- };
2677
-
2678
- exports.__wbg_fetch_f8ba0e29a9d6de0d = function(arg0, arg1) {
2679
- const ret = arg0.fetch(arg1);
2680
- return ret;
2681
- };
2682
-
2683
- exports.__wbg_from_a4ad7cbddd0d7135 = function(arg0) {
2684
- const ret = Array.from(arg0);
2685
- return ret;
2686
- };
2687
-
2688
- exports.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
2689
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2690
- }, arguments) };
2691
-
2692
- exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
2693
- arg0.getRandomValues(arg1);
2694
- }, arguments) };
2695
-
2696
- exports.__wbg_getReader_48e00749fe3f6089 = function() { return handleError(function (arg0) {
2697
- const ret = arg0.getReader();
2698
- return ret;
2699
- }, arguments) };
2700
-
2701
- exports.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
2702
- const ret = arg0[arg1 >>> 0];
2703
- return ret;
2704
- };
2705
-
2706
- exports.__wbg_get_done_a0463af43a1fc764 = function(arg0) {
2707
- const ret = arg0.done;
2708
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2709
- };
2710
-
2711
- exports.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
2712
- const ret = Reflect.get(arg0, arg1);
2713
- return ret;
2714
- }, arguments) };
2715
-
2716
- exports.__wbg_get_value_5ce96c9f81ce7398 = function(arg0) {
2717
- const ret = arg0.value;
2718
- return ret;
2719
- };
2720
-
2721
- exports.__wbg_has_787fafc980c3ccdb = function() { return handleError(function (arg0, arg1) {
2722
- const ret = Reflect.has(arg0, arg1);
2723
- return ret;
2724
- }, arguments) };
2725
-
2726
- exports.__wbg_headers_b87d7eaba61c3278 = function(arg0) {
2727
- const ret = arg0.headers;
2728
- return ret;
2729
- };
2730
-
2731
- exports.__wbg_info_68cd5b51ef7e5137 = function(arg0, arg1, arg2, arg3) {
2732
- console.info(arg0, arg1, arg2, arg3);
2733
- };
2734
-
2735
- exports.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
2736
- let result;
2737
- try {
2738
- result = arg0 instanceof ArrayBuffer;
2739
- } catch (_) {
2740
- result = false;
3456
+ function passStringToWasm0(arg, malloc, realloc) {
3457
+ if (realloc === undefined) {
3458
+ const buf = cachedTextEncoder.encode(arg);
3459
+ const ptr = malloc(buf.length, 1) >>> 0;
3460
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
3461
+ WASM_VECTOR_LEN = buf.length;
3462
+ return ptr;
2741
3463
  }
2742
- const ret = result;
2743
- return ret;
2744
- };
2745
3464
 
2746
- exports.__wbg_instanceof_Error_a944ec10920129e2 = function(arg0) {
2747
- let result;
2748
- try {
2749
- result = arg0 instanceof Error;
2750
- } catch (_) {
2751
- result = false;
2752
- }
2753
- const ret = result;
2754
- return ret;
2755
- };
3465
+ let len = arg.length;
3466
+ let ptr = malloc(len, 1) >>> 0;
2756
3467
 
2757
- exports.__wbg_instanceof_Headers_e1daf97ed6a469e9 = function(arg0) {
2758
- let result;
2759
- try {
2760
- result = arg0 instanceof Headers;
2761
- } catch (_) {
2762
- result = false;
2763
- }
2764
- const ret = result;
2765
- return ret;
2766
- };
3468
+ const mem = getUint8ArrayMemory0();
2767
3469
 
2768
- exports.__wbg_instanceof_Map_8579b5e2ab5437c7 = function(arg0) {
2769
- let result;
2770
- try {
2771
- result = arg0 instanceof Map;
2772
- } catch (_) {
2773
- result = false;
3470
+ let offset = 0;
3471
+
3472
+ for (; offset < len; offset++) {
3473
+ const code = arg.charCodeAt(offset);
3474
+ if (code > 0x7F) break;
3475
+ mem[ptr + offset] = code;
2774
3476
  }
2775
- const ret = result;
2776
- return ret;
2777
- };
3477
+ if (offset !== len) {
3478
+ if (offset !== 0) {
3479
+ arg = arg.slice(offset);
3480
+ }
3481
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
3482
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
3483
+ const ret = cachedTextEncoder.encodeInto(arg, view);
2778
3484
 
2779
- exports.__wbg_instanceof_Response_f4f3e87e07f3135c = function(arg0) {
2780
- let result;
2781
- try {
2782
- result = arg0 instanceof Response;
2783
- } catch (_) {
2784
- result = false;
3485
+ offset += ret.written;
3486
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
2785
3487
  }
2786
- const ret = result;
2787
- return ret;
2788
- };
2789
3488
 
2790
- exports.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
2791
- let result;
2792
- try {
2793
- result = arg0 instanceof Uint8Array;
2794
- } catch (_) {
2795
- result = false;
2796
- }
2797
- const ret = result;
2798
- return ret;
2799
- };
2800
-
2801
- exports.__wbg_isArray_96e0af9891d0945d = function(arg0) {
2802
- const ret = Array.isArray(arg0);
2803
- return ret;
2804
- };
2805
-
2806
- exports.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
2807
- const ret = Number.isSafeInteger(arg0);
2808
- return ret;
2809
- };
2810
-
2811
- exports.__wbg_iterator_e5822695327a3c39 = function() {
2812
- const ret = Symbol.iterator;
2813
- return ret;
2814
- };
2815
-
2816
- exports.__wbg_length_69bca3cb64fc8748 = function(arg0) {
2817
- const ret = arg0.length;
2818
- return ret;
2819
- };
2820
-
2821
- exports.__wbg_length_cdd215e10d9dd507 = function(arg0) {
2822
- const ret = arg0.length;
2823
- return ret;
2824
- };
2825
-
2826
- exports.__wbg_log_45eb3a49e7cdcb64 = function(arg0, arg1, arg2, arg3) {
2827
- console.log(arg0, arg1, arg2, arg3);
2828
- };
2829
-
2830
- exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
2831
- const ret = arg0.msCrypto;
2832
- return ret;
2833
- };
2834
-
2835
- exports.__wbg_new_1acc0b6eea89d040 = function() {
2836
- const ret = new Object();
2837
- return ret;
2838
- };
2839
-
2840
- exports.__wbg_new_2531773dac38ebb3 = function() { return handleError(function () {
2841
- const ret = new AbortController();
2842
- return ret;
2843
- }, arguments) };
2844
-
2845
- exports.__wbg_new_3c3d849046688a66 = function(arg0, arg1) {
2846
- try {
2847
- var state0 = {a: arg0, b: arg1};
2848
- var cb0 = (arg0, arg1) => {
2849
- const a = state0.a;
2850
- state0.a = 0;
2851
- try {
2852
- return wasm_bindgen__convert__closures_____invoke__h07d45d2c9c5e1bbe(a, state0.b, arg0, arg1);
2853
- } finally {
2854
- state0.a = a;
2855
- }
3489
+ WASM_VECTOR_LEN = offset;
3490
+ return ptr;
3491
+ }
3492
+
3493
+ function takeFromExternrefTable0(idx) {
3494
+ const value = wasm.__wbindgen_externrefs.get(idx);
3495
+ wasm.__externref_table_dealloc(idx);
3496
+ return value;
3497
+ }
3498
+
3499
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
3500
+ cachedTextDecoder.decode();
3501
+ function decodeText(ptr, len) {
3502
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
3503
+ }
3504
+
3505
+ const cachedTextEncoder = new TextEncoder();
3506
+
3507
+ if (!('encodeInto' in cachedTextEncoder)) {
3508
+ cachedTextEncoder.encodeInto = function (arg, view) {
3509
+ const buf = cachedTextEncoder.encode(arg);
3510
+ view.set(buf);
3511
+ return {
3512
+ read: arg.length,
3513
+ written: buf.length
2856
3514
  };
2857
- const ret = new Promise(cb0);
2858
- return ret;
2859
- } finally {
2860
- state0.a = state0.b = 0;
2861
- }
2862
- };
2863
-
2864
- exports.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
2865
- const ret = new Uint8Array(arg0);
2866
- return ret;
2867
- };
2868
-
2869
- exports.__wbg_new_68651c719dcda04e = function() {
2870
- const ret = new Map();
2871
- return ret;
2872
- };
2873
-
2874
- exports.__wbg_new_9edf9838a2def39c = function() { return handleError(function () {
2875
- const ret = new Headers();
2876
- return ret;
2877
- }, arguments) };
2878
-
2879
- exports.__wbg_new_a7442b4b19c1a356 = function(arg0, arg1) {
2880
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2881
- return ret;
2882
- };
2883
-
2884
- exports.__wbg_new_e17d9f43105b08be = function() {
2885
- const ret = new Array();
2886
- return ret;
2887
- };
2888
-
2889
- exports.__wbg_new_from_slice_92f4d78ca282a2d2 = function(arg0, arg1) {
2890
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2891
- return ret;
2892
- };
2893
-
2894
- exports.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
2895
- const ret = new Function(getStringFromWasm0(arg0, arg1));
2896
- return ret;
2897
- };
2898
-
2899
- exports.__wbg_new_with_byte_offset_and_length_46e3e6a5e9f9e89b = function(arg0, arg1, arg2) {
2900
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
2901
- return ret;
2902
- };
2903
-
2904
- exports.__wbg_new_with_into_underlying_source_b47f6a6a596a7f24 = function(arg0, arg1) {
2905
- const ret = new ReadableStream(IntoUnderlyingSource.__wrap(arg0), arg1);
2906
- return ret;
2907
- };
2908
-
2909
- exports.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
2910
- const ret = new Uint8Array(arg0 >>> 0);
2911
- return ret;
2912
- };
2913
-
2914
- exports.__wbg_new_with_opt_readable_stream_and_init_b3dac7204db32cac = function() { return handleError(function (arg0, arg1) {
2915
- const ret = new Response(arg0, arg1);
2916
- return ret;
2917
- }, arguments) };
2918
-
2919
- exports.__wbg_new_with_str_and_init_0ae7728b6ec367b1 = function() { return handleError(function (arg0, arg1, arg2) {
2920
- const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
2921
- return ret;
2922
- }, arguments) };
2923
-
2924
- exports.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
2925
- const ret = arg0.next();
2926
- return ret;
2927
- }, arguments) };
2928
-
2929
- exports.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
2930
- const ret = arg0.next;
2931
- return ret;
2932
- };
2933
-
2934
- exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
2935
- const ret = arg0.node;
2936
- return ret;
2937
- };
2938
-
2939
- exports.__wbg_now_2c95c9de01293173 = function(arg0) {
2940
- const ret = arg0.now();
2941
- return ret;
2942
- };
2943
-
2944
- exports.__wbg_now_793306c526e2e3b6 = function() {
2945
- const ret = Date.now();
2946
- return ret;
2947
- };
2948
-
2949
- exports.__wbg_parse_2a704d6b78abb2b8 = function() { return handleError(function (arg0, arg1) {
2950
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
2951
- return ret;
2952
- }, arguments) };
2953
-
2954
- exports.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
2955
- const ret = arg0.performance;
2956
- return ret;
2957
- };
2958
-
2959
- exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
2960
- const ret = arg0.process;
2961
- return ret;
2962
- };
2963
-
2964
- exports.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
2965
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2966
- };
2967
-
2968
- exports.__wbg_publickey_new = function(arg0) {
2969
- const ret = PublicKey.__wrap(arg0);
2970
- return ret;
2971
- };
2972
-
2973
- exports.__wbg_queueMicrotask_34d692c25c47d05b = function(arg0) {
2974
- const ret = arg0.queueMicrotask;
2975
- return ret;
2976
- };
2977
-
2978
- exports.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
2979
- queueMicrotask(arg0);
2980
- };
2981
-
2982
- exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
2983
- arg0.randomFillSync(arg1);
2984
- }, arguments) };
2985
-
2986
- exports.__wbg_read_48f1593df542f968 = function(arg0) {
2987
- const ret = arg0.read();
2988
- return ret;
2989
- };
2990
-
2991
- exports.__wbg_releaseLock_5d0b5a68887b891d = function(arg0) {
2992
- arg0.releaseLock();
2993
- };
2994
-
2995
- exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
2996
- const ret = module.require;
2997
- return ret;
2998
- }, arguments) };
2999
-
3000
- exports.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
3001
- const ret = Promise.resolve(arg0);
3002
- return ret;
3003
- };
3004
-
3005
- exports.__wbg_respond_0f4dbf5386f5c73e = function() { return handleError(function (arg0, arg1) {
3006
- arg0.respond(arg1 >>> 0);
3007
- }, arguments) };
3008
-
3009
- exports.__wbg_session_new = function(arg0) {
3010
- const ret = Session.__wrap(arg0);
3011
- return ret;
3012
- };
3013
-
3014
- exports.__wbg_setTimeout_7bb3429662ab1e70 = function(arg0, arg1) {
3015
- const ret = setTimeout(arg0, arg1);
3016
- return ret;
3017
- };
3018
-
3019
- exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
3020
- arg0[arg1] = arg2;
3021
- };
3022
-
3023
- exports.__wbg_set_8b342d8cd9d2a02c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3024
- arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
3025
- }, arguments) };
3026
-
3027
- exports.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
3028
- const ret = arg0.set(arg1, arg2);
3029
- return ret;
3030
- };
3031
-
3032
- exports.__wbg_set_9e6516df7b7d0f19 = function(arg0, arg1, arg2) {
3033
- arg0.set(getArrayU8FromWasm0(arg1, arg2));
3034
- };
3035
-
3036
- exports.__wbg_set_body_3c365989753d61f4 = function(arg0, arg1) {
3037
- arg0.body = arg1;
3038
- };
3039
-
3040
- exports.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
3041
- arg0[arg1 >>> 0] = arg2;
3042
- };
3043
-
3044
- exports.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
3045
- const ret = Reflect.set(arg0, arg1, arg2);
3046
- return ret;
3047
- }, arguments) };
3048
-
3049
- exports.__wbg_set_cache_2f9deb19b92b81e3 = function(arg0, arg1) {
3050
- arg0.cache = __wbindgen_enum_RequestCache[arg1];
3051
- };
3052
-
3053
- exports.__wbg_set_credentials_f621cd2d85c0c228 = function(arg0, arg1) {
3054
- arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
3055
- };
3056
-
3057
- exports.__wbg_set_headers_107379072e02fee5 = function(arg0, arg1) {
3058
- arg0.headers = arg1;
3059
- };
3060
-
3061
- exports.__wbg_set_headers_6926da238cd32ee4 = function(arg0, arg1) {
3062
- arg0.headers = arg1;
3063
- };
3064
-
3065
- exports.__wbg_set_high_water_mark_5142ac1d2fb46365 = function(arg0, arg1) {
3066
- arg0.highWaterMark = arg1;
3067
- };
3068
-
3069
- exports.__wbg_set_method_c02d8cbbe204ac2d = function(arg0, arg1, arg2) {
3070
- arg0.method = getStringFromWasm0(arg1, arg2);
3071
- };
3072
-
3073
- exports.__wbg_set_mode_52ef73cfa79639cb = function(arg0, arg1) {
3074
- arg0.mode = __wbindgen_enum_RequestMode[arg1];
3075
- };
3076
-
3077
- exports.__wbg_set_name_d94846a29e626702 = function(arg0, arg1, arg2) {
3078
- arg0.name = getStringFromWasm0(arg1, arg2);
3079
- };
3080
-
3081
- exports.__wbg_set_signal_dda2cf7ccb6bee0f = function(arg0, arg1) {
3082
- arg0.signal = arg1;
3083
- };
3084
-
3085
- exports.__wbg_set_status_886bf143c25d0706 = function(arg0, arg1) {
3086
- arg0.status = arg1;
3087
- };
3088
-
3089
- exports.__wbg_set_status_text_3d83b7e559c076b2 = function(arg0, arg1, arg2) {
3090
- arg0.statusText = getStringFromWasm0(arg1, arg2);
3091
- };
3092
-
3093
- exports.__wbg_signal_4db5aa055bf9eb9a = function(arg0) {
3094
- const ret = arg0.signal;
3095
- return ret;
3096
- };
3097
-
3098
- exports.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
3099
- const ret = typeof global === 'undefined' ? null : global;
3100
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3101
- };
3102
-
3103
- exports.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
3104
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
3105
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3106
- };
3107
-
3108
- exports.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
3109
- const ret = typeof self === 'undefined' ? null : self;
3110
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3111
- };
3112
-
3113
- exports.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
3114
- const ret = typeof window === 'undefined' ? null : window;
3115
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3116
- };
3117
-
3118
- exports.__wbg_status_de7eed5a7a5bfd5d = function(arg0) {
3119
- const ret = arg0.status;
3120
- return ret;
3121
- };
3122
-
3123
- exports.__wbg_stringify_b5fb28f6465d9c3e = function() { return handleError(function (arg0) {
3124
- const ret = JSON.stringify(arg0);
3125
- return ret;
3126
- }, arguments) };
3127
-
3128
- exports.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
3129
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3130
- return ret;
3131
- };
3132
-
3133
- exports.__wbg_text_dc33c15c17bdfb52 = function() { return handleError(function (arg0) {
3134
- const ret = arg0.text();
3135
- return ret;
3136
- }, arguments) };
3137
-
3138
- exports.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
3139
- const ret = arg0.then(arg1);
3140
- return ret;
3141
- };
3142
-
3143
- exports.__wbg_then_70d05cf780a18d77 = function(arg0, arg1, arg2) {
3144
- const ret = arg0.then(arg1, arg2);
3145
- return ret;
3146
- };
3147
-
3148
- exports.__wbg_toString_8eec07f6f4c057e4 = function(arg0) {
3149
- const ret = arg0.toString();
3150
- return ret;
3151
- };
3152
-
3153
- exports.__wbg_url_b36d2a5008eb056f = function(arg0, arg1) {
3154
- const ret = arg1.url;
3155
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3156
- const len1 = WASM_VECTOR_LEN;
3157
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3158
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3159
- };
3160
-
3161
- exports.__wbg_value_692627309814bb8c = function(arg0) {
3162
- const ret = arg0.value;
3163
- return ret;
3164
- };
3165
-
3166
- exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
3167
- const ret = arg0.versions;
3168
- return ret;
3169
- };
3170
-
3171
- exports.__wbg_view_f6c15ac9fed63bbd = function(arg0) {
3172
- const ret = arg0.view;
3173
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3174
- };
3175
-
3176
- exports.__wbg_warn_8f5b5437666d0885 = function(arg0, arg1, arg2, arg3) {
3177
- console.warn(arg0, arg1, arg2, arg3);
3178
- };
3179
-
3180
- exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
3181
- // Cast intrinsic for `Ref(String) -> Externref`.
3182
- const ret = getStringFromWasm0(arg0, arg1);
3183
- return ret;
3184
- };
3185
-
3186
- exports.__wbindgen_cast_236fa6323a6eeed0 = function(arg0, arg1) {
3187
- // Cast intrinsic for `Closure(Closure { dtor_idx: 175, function: Function { arguments: [], shim_idx: 176, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3188
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h762d1c23bf8139ea, wasm_bindgen__convert__closures_____invoke__h13019d5ee70bd6b6);
3189
- return ret;
3190
- };
3191
-
3192
- exports.__wbindgen_cast_25a0a844437d0e92 = function(arg0, arg1) {
3193
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3194
- wasm.__wbindgen_free(arg0, arg1 * 4, 4);
3195
- // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
3196
- const ret = v0;
3197
- return ret;
3198
- };
3199
-
3200
- exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
3201
- // Cast intrinsic for `U64 -> Externref`.
3202
- const ret = BigInt.asUintN(64, arg0);
3203
- return ret;
3204
- };
3205
-
3206
- exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
3207
- // Cast intrinsic for `I64 -> Externref`.
3208
- const ret = arg0;
3209
- return ret;
3210
- };
3211
-
3212
- exports.__wbindgen_cast_c389e99dd7b90da6 = function(arg0, arg1) {
3213
- // Cast intrinsic for `Closure(Closure { dtor_idx: 175, function: Function { arguments: [Externref], shim_idx: 193, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3214
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h762d1c23bf8139ea, wasm_bindgen__convert__closures_____invoke__h69202035a90512ea);
3215
- return ret;
3216
- };
3217
-
3218
- exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
3219
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
3220
- const ret = getArrayU8FromWasm0(arg0, arg1);
3221
- return ret;
3222
- };
3223
-
3224
- exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
3225
- // Cast intrinsic for `F64 -> Externref`.
3226
- const ret = arg0;
3227
- return ret;
3228
- };
3229
-
3230
- exports.__wbindgen_init_externref_table = function() {
3231
- const table = wasm.__wbindgen_externrefs;
3232
- const offset = table.grow(4);
3233
- table.set(0, undefined);
3234
- table.set(offset + 0, undefined);
3235
- table.set(offset + 1, null);
3236
- table.set(offset + 2, true);
3237
- table.set(offset + 3, false);
3238
- ;
3239
- };
3515
+ };
3516
+ }
3517
+
3518
+ let WASM_VECTOR_LEN = 0;
3240
3519
 
3241
3520
  const wasmPath = `${__dirname}/pubky_bg.wasm`;
3242
3521
  const wasmBytes = require('fs').readFileSync(wasmPath);
3243
3522
  const wasmModule = new WebAssembly.Module(wasmBytes);
3244
- const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
3245
-
3523
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
3246
3524
  wasm.__wbindgen_start();
3247
-