@synonymdev/pubky 0.2.1 → 0.4.0-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -9,6 +9,12 @@ imports['__wbindgen_placeholder__'] = module.exports;
9
9
  let wasm;
10
10
  const { TextDecoder, TextEncoder } = require(`util`);
11
11
 
12
+ const heap = new Array(128).fill(undefined);
13
+
14
+ heap.push(undefined, null, true, false);
15
+
16
+ function getObject(idx) { return heap[idx]; }
17
+
12
18
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
19
 
14
20
  cachedTextDecoder.decode();
@@ -27,10 +33,6 @@ function getStringFromWasm0(ptr, len) {
27
33
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
28
34
  }
29
35
 
30
- const heap = new Array(128).fill(undefined);
31
-
32
- heap.push(undefined, null, true, false);
33
-
34
36
  let heap_next = heap.length;
35
37
 
36
38
  function addHeapObject(obj) {
@@ -42,7 +44,13 @@ function addHeapObject(obj) {
42
44
  return idx;
43
45
  }
44
46
 
45
- function getObject(idx) { return heap[idx]; }
47
+ function handleError(f, args) {
48
+ try {
49
+ return f.apply(this, args);
50
+ } catch (e) {
51
+ wasm.__wbindgen_exn_store(addHeapObject(e));
52
+ }
53
+ }
46
54
 
47
55
  function dropObject(idx) {
48
56
  if (idx < 132) return;
@@ -56,6 +64,10 @@ function takeObject(idx) {
56
64
  return ret;
57
65
  }
58
66
 
67
+ function isLikeNone(x) {
68
+ return x === undefined || x === null;
69
+ }
70
+
59
71
  let WASM_VECTOR_LEN = 0;
60
72
 
61
73
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -112,10 +124,6 @@ function passStringToWasm0(arg, malloc, realloc) {
112
124
  return ptr;
113
125
  }
114
126
 
115
- function isLikeNone(x) {
116
- return x === undefined || x === null;
117
- }
118
-
119
127
  let cachedDataViewMemory0 = null;
120
128
 
121
129
  function getDataViewMemory0() {
@@ -125,6 +133,37 @@ function getDataViewMemory0() {
125
133
  return cachedDataViewMemory0;
126
134
  }
127
135
 
136
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
137
+ ? { register: () => {}, unregister: () => {} }
138
+ : new FinalizationRegistry(state => {
139
+ wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b)
140
+ });
141
+
142
+ function makeMutClosure(arg0, arg1, dtor, f) {
143
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
144
+ const real = (...args) => {
145
+ // First up with a closure we increment the internal reference
146
+ // count. This ensures that the Rust closure environment won't
147
+ // be deallocated while we're invoking it.
148
+ state.cnt++;
149
+ const a = state.a;
150
+ state.a = 0;
151
+ try {
152
+ return f(a, state.b, ...args);
153
+ } finally {
154
+ if (--state.cnt === 0) {
155
+ wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
156
+ CLOSURE_DTORS.unregister(state);
157
+ } else {
158
+ state.a = a;
159
+ }
160
+ }
161
+ };
162
+ real.original = state;
163
+ CLOSURE_DTORS.register(real, state, state);
164
+ return real;
165
+ }
166
+
128
167
  function debugString(val) {
129
168
  // primitive types
130
169
  const type = typeof val;
@@ -166,7 +205,7 @@ function debugString(val) {
166
205
  // Test for built-in
167
206
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
168
207
  let className;
169
- if (builtInMatches.length > 1) {
208
+ if (builtInMatches && builtInMatches.length > 1) {
170
209
  className = builtInMatches[1];
171
210
  } else {
172
211
  // Failed to match the standard '[object ClassName]'
@@ -189,54 +228,37 @@ function debugString(val) {
189
228
  // TODO we could test for more things here, like `Set`s and `Map`s.
190
229
  return className;
191
230
  }
192
-
193
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
194
- ? { register: () => {}, unregister: () => {} }
195
- : new FinalizationRegistry(state => {
196
- wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
197
- });
198
-
199
- function makeMutClosure(arg0, arg1, dtor, f) {
200
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
201
- const real = (...args) => {
202
- // First up with a closure we increment the internal reference
203
- // count. This ensures that the Rust closure environment won't
204
- // be deallocated while we're invoking it.
205
- state.cnt++;
206
- const a = state.a;
207
- state.a = 0;
208
- try {
209
- return f(a, state.b, ...args);
210
- } finally {
211
- if (--state.cnt === 0) {
212
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
213
- CLOSURE_DTORS.unregister(state);
214
- } else {
215
- state.a = a;
216
- }
231
+ /**
232
+ * @param {string} level
233
+ */
234
+ module.exports.setLogLevel = function(level) {
235
+ try {
236
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
237
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
238
+ const len0 = WASM_VECTOR_LEN;
239
+ wasm.setLogLevel(retptr, ptr0, len0);
240
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
241
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
242
+ if (r1) {
243
+ throw takeObject(r0);
217
244
  }
218
- };
219
- real.original = state;
220
- CLOSURE_DTORS.register(real, state, state);
221
- return real;
222
- }
223
- function __wbg_adapter_26(arg0, arg1, arg2) {
224
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf3abd8d2e3570b7c(arg0, arg1, addHeapObject(arg2));
225
- }
245
+ } finally {
246
+ wasm.__wbindgen_add_to_stack_pointer(16);
247
+ }
248
+ };
226
249
 
227
250
  function _assertClass(instance, klass) {
228
251
  if (!(instance instanceof klass)) {
229
252
  throw new Error(`expected instance of ${klass.name}`);
230
253
  }
231
- return instance.ptr;
232
254
  }
233
255
  /**
234
- * Create a recovery file of the `keypair`, containing the secret key encrypted
235
- * using the `passphrase`.
236
- * @param {Keypair} keypair
237
- * @param {string} passphrase
238
- * @returns {Uint8Array}
239
- */
256
+ * Create a recovery file of the `keypair`, containing the secret key encrypted
257
+ * using the `passphrase`.
258
+ * @param {Keypair} keypair
259
+ * @param {string} passphrase
260
+ * @returns {Uint8Array}
261
+ */
240
262
  module.exports.createRecoveryFile = function(keypair, passphrase) {
241
263
  try {
242
264
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -263,12 +285,12 @@ function passArray8ToWasm0(arg, malloc) {
263
285
  return ptr;
264
286
  }
265
287
  /**
266
- * Create a recovery file of the `keypair`, containing the secret key encrypted
267
- * using the `passphrase`.
268
- * @param {Uint8Array} recovery_file
269
- * @param {string} passphrase
270
- * @returns {Keypair}
271
- */
288
+ * Create a recovery file of the `keypair`, containing the secret key encrypted
289
+ * using the `passphrase`.
290
+ * @param {Uint8Array} recovery_file
291
+ * @param {string} passphrase
292
+ * @returns {Keypair}
293
+ */
272
294
  module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
273
295
  try {
274
296
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -298,175 +320,123 @@ function getArrayJsValueFromWasm0(ptr, len) {
298
320
  }
299
321
  return result;
300
322
  }
301
-
302
- function handleError(f, args) {
303
- try {
304
- return f.apply(this, args);
305
- } catch (e) {
306
- wasm.__wbindgen_exn_store(addHeapObject(e));
307
- }
323
+ function __wbg_adapter_28(arg0, arg1, arg2) {
324
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6aa613d03ec1284e(arg0, arg1, addHeapObject(arg2));
308
325
  }
309
- function __wbg_adapter_141(arg0, arg1, arg2, arg3) {
310
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h6757e2d3bad4487e(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
326
+
327
+ function __wbg_adapter_153(arg0, arg1, arg2, arg3) {
328
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h2095b693172537bf(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
311
329
  }
312
330
 
313
- const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
331
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
332
+
333
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
334
+
335
+ const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
314
336
  ? { register: () => {}, unregister: () => {} }
315
- : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
337
+ : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
316
338
  /**
317
- */
318
- class Keypair {
339
+ * A client for Pubky homeserver API, as well as generic HTTP requests to Pubky urls.
340
+ */
341
+ class Client {
319
342
 
320
343
  static __wrap(ptr) {
321
344
  ptr = ptr >>> 0;
322
- const obj = Object.create(Keypair.prototype);
345
+ const obj = Object.create(Client.prototype);
323
346
  obj.__wbg_ptr = ptr;
324
- KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
347
+ ClientFinalization.register(obj, obj.__wbg_ptr, obj);
325
348
  return obj;
326
349
  }
327
350
 
328
351
  __destroy_into_raw() {
329
352
  const ptr = this.__wbg_ptr;
330
353
  this.__wbg_ptr = 0;
331
- KeypairFinalization.unregister(this);
354
+ ClientFinalization.unregister(this);
332
355
  return ptr;
333
356
  }
334
357
 
335
358
  free() {
336
359
  const ptr = this.__destroy_into_raw();
337
- wasm.__wbg_keypair_free(ptr, 0);
338
- }
339
- /**
340
- * Generate a random [Keypair]
341
- * @returns {Keypair}
342
- */
343
- static random() {
344
- const ret = wasm.keypair_random();
345
- return Keypair.__wrap(ret);
346
- }
347
- /**
348
- * Generate a [Keypair] from a secret key.
349
- * @param {Uint8Array} secret_key
350
- * @returns {Keypair}
351
- */
352
- static fromSecretKey(secret_key) {
353
- try {
354
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
355
- wasm.keypair_fromSecretKey(retptr, addHeapObject(secret_key));
356
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
357
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
358
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
359
- if (r2) {
360
- throw takeObject(r1);
361
- }
362
- return Keypair.__wrap(r0);
363
- } finally {
364
- wasm.__wbindgen_add_to_stack_pointer(16);
365
- }
360
+ wasm.__wbg_client_free(ptr, 0);
366
361
  }
367
362
  /**
368
- * Returns the secret key of this keypair.
369
- * @returns {Uint8Array}
370
- */
371
- secretKey() {
372
- const ret = wasm.keypair_secretKey(this.__wbg_ptr);
373
- return takeObject(ret);
363
+ * Create Client with default Settings including default relays
364
+ */
365
+ constructor() {
366
+ const ret = wasm.client_new();
367
+ this.__wbg_ptr = ret >>> 0;
368
+ ClientFinalization.register(this, this.__wbg_ptr, this);
369
+ return this;
374
370
  }
375
371
  /**
376
- * Returns the [PublicKey] of this keypair.
377
- * @returns {PublicKey}
378
- */
379
- publicKey() {
380
- const ret = wasm.keypair_publicKey(this.__wbg_ptr);
381
- return PublicKey.__wrap(ret);
382
- }
383
- }
384
- module.exports.Keypair = Keypair;
385
-
386
- const PubkyClientFinalization = (typeof FinalizationRegistry === 'undefined')
387
- ? { register: () => {}, unregister: () => {} }
388
- : new FinalizationRegistry(ptr => wasm.__wbg_pubkyclient_free(ptr >>> 0, 1));
389
- /**
390
- */
391
- class PubkyClient {
392
-
393
- static __wrap(ptr) {
394
- ptr = ptr >>> 0;
395
- const obj = Object.create(PubkyClient.prototype);
396
- obj.__wbg_ptr = ptr;
397
- PubkyClientFinalization.register(obj, obj.__wbg_ptr, obj);
398
- return obj;
399
- }
400
-
401
- __destroy_into_raw() {
402
- const ptr = this.__wbg_ptr;
403
- this.__wbg_ptr = 0;
404
- PubkyClientFinalization.unregister(this);
405
- return ptr;
406
- }
407
-
408
- free() {
409
- const ptr = this.__destroy_into_raw();
410
- wasm.__wbg_pubkyclient_free(ptr, 0);
372
+ * Create a client with with configurations appropriate for local testing:
373
+ * - set Pkarr relays to `["http://localhost:15411"]` instead of default relay.
374
+ * - transform `pubky://<pkarr public key>` to `http://<pkarr public key` instead of `https:`
375
+ * and read the homeserver HTTP port from the [reserved service parameter key](pubky_common::constants::reserved_param_keys::HTTP_PORT)
376
+ * @returns {Client}
377
+ */
378
+ static testnet() {
379
+ const ret = wasm.client_testnet();
380
+ return Client.__wrap(ret);
411
381
  }
412
382
  /**
413
- * Signup to a homeserver and update Pkarr accordingly.
414
- *
415
- * The homeserver is a Pkarr domain name, where the TLD is a Pkarr public key
416
- * for example "pubky.o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy"
417
- * @param {Keypair} keypair
418
- * @param {PublicKey} homeserver
419
- * @returns {Promise<Session>}
420
- */
383
+ * Signup to a homeserver and update Pkarr accordingly.
384
+ *
385
+ * The homeserver is a Pkarr domain name, where the TLD is a Pkarr public key
386
+ * for example "pubky.o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy"
387
+ * @param {Keypair} keypair
388
+ * @param {PublicKey} homeserver
389
+ * @returns {Promise<Session>}
390
+ */
421
391
  signup(keypair, homeserver) {
422
392
  _assertClass(keypair, Keypair);
423
393
  _assertClass(homeserver, PublicKey);
424
- const ret = wasm.pubkyclient_signup(this.__wbg_ptr, keypair.__wbg_ptr, homeserver.__wbg_ptr);
394
+ const ret = wasm.client_signup(this.__wbg_ptr, keypair.__wbg_ptr, homeserver.__wbg_ptr);
425
395
  return takeObject(ret);
426
396
  }
427
397
  /**
428
- * Check the current sesison for a given Pubky in its homeserver.
429
- *
430
- * Returns [Session] or `None` (if recieved `404 NOT_FOUND`),
431
- * or throws the recieved error if the response has any other `>=400` status code.
432
- * @param {PublicKey} pubky
433
- * @returns {Promise<Session | undefined>}
434
- */
398
+ * Check the current sesison for a given Pubky in its homeserver.
399
+ *
400
+ * Returns [Session] or `None` (if recieved `404 NOT_FOUND`),
401
+ * or throws the recieved error if the response has any other `>=400` status code.
402
+ * @param {PublicKey} pubky
403
+ * @returns {Promise<Session | undefined>}
404
+ */
435
405
  session(pubky) {
436
406
  _assertClass(pubky, PublicKey);
437
- const ret = wasm.pubkyclient_session(this.__wbg_ptr, pubky.__wbg_ptr);
407
+ const ret = wasm.client_session(this.__wbg_ptr, pubky.__wbg_ptr);
438
408
  return takeObject(ret);
439
409
  }
440
410
  /**
441
- * Signout from a homeserver.
442
- * @param {PublicKey} pubky
443
- * @returns {Promise<void>}
444
- */
411
+ * Signout from a homeserver.
412
+ * @param {PublicKey} pubky
413
+ * @returns {Promise<void>}
414
+ */
445
415
  signout(pubky) {
446
416
  _assertClass(pubky, PublicKey);
447
- const ret = wasm.pubkyclient_signout(this.__wbg_ptr, pubky.__wbg_ptr);
417
+ const ret = wasm.client_signout(this.__wbg_ptr, pubky.__wbg_ptr);
448
418
  return takeObject(ret);
449
419
  }
450
420
  /**
451
- * Signin to a homeserver using the root Keypair.
452
- * @param {Keypair} keypair
453
- * @returns {Promise<void>}
454
- */
421
+ * Signin to a homeserver using the root Keypair.
422
+ * @param {Keypair} keypair
423
+ * @returns {Promise<void>}
424
+ */
455
425
  signin(keypair) {
456
426
  _assertClass(keypair, Keypair);
457
- const ret = wasm.pubkyclient_signin(this.__wbg_ptr, keypair.__wbg_ptr);
427
+ const ret = wasm.client_signin(this.__wbg_ptr, keypair.__wbg_ptr);
458
428
  return takeObject(ret);
459
429
  }
460
430
  /**
461
- * Return `pubkyauth://` url and wait for the incoming [AuthToken]
462
- * verifying that AuthToken, and if capabilities were requested, signing in to
463
- * the Pubky's homeserver and returning the [Session] information.
464
- *
465
- * Returns a tuple of [pubkyAuthUrl, Promise<Session>]
466
- * @param {string} relay
467
- * @param {string} capabilities
468
- * @returns {Array<any>}
469
- */
431
+ * Return `pubkyauth://` url and wait for the incoming [AuthToken]
432
+ * verifying that AuthToken, and if capabilities were requested, signing in to
433
+ * the Pubky's homeserver and returning the [Session] information.
434
+ *
435
+ * Returns a tuple of [pubkyAuthUrl, Promise<Session>]
436
+ * @param {string} relay
437
+ * @param {string} capabilities
438
+ * @returns {Array<any>}
439
+ */
470
440
  authRequest(relay, capabilities) {
471
441
  try {
472
442
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -474,7 +444,7 @@ class PubkyClient {
474
444
  const len0 = WASM_VECTOR_LEN;
475
445
  const ptr1 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
446
  const len1 = WASM_VECTOR_LEN;
477
- wasm.pubkyclient_authRequest(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
447
+ wasm.client_authRequest(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
478
448
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
479
449
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
480
450
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -487,116 +457,133 @@ class PubkyClient {
487
457
  }
488
458
  }
489
459
  /**
490
- * Sign an [pubky_common::auth::AuthToken], encrypt it and send it to the
491
- * source of the pubkyauth request url.
492
- * @param {Keypair} keypair
493
- * @param {string} pubkyauth_url
494
- * @returns {Promise<void>}
495
- */
460
+ * Sign an [pubky_common::auth::AuthToken], encrypt it and send it to the
461
+ * source of the pubkyauth request url.
462
+ * @param {Keypair} keypair
463
+ * @param {string} pubkyauth_url
464
+ * @returns {Promise<void>}
465
+ */
496
466
  sendAuthToken(keypair, pubkyauth_url) {
497
467
  _assertClass(keypair, Keypair);
498
468
  const ptr0 = passStringToWasm0(pubkyauth_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
499
469
  const len0 = WASM_VECTOR_LEN;
500
- const ret = wasm.pubkyclient_sendAuthToken(this.__wbg_ptr, keypair.__wbg_ptr, ptr0, len0);
470
+ const ret = wasm.client_sendAuthToken(this.__wbg_ptr, keypair.__wbg_ptr, ptr0, len0);
501
471
  return takeObject(ret);
502
472
  }
503
473
  /**
504
- * Upload a small payload to a given path.
505
- * @param {string} url
506
- * @param {Uint8Array} content
507
- * @returns {Promise<void>}
508
- */
509
- put(url, content) {
474
+ * Returns a list of Pubky urls (as strings).
475
+ *
476
+ * - `url`: The Pubky url (string) to the directory you want to list its content.
477
+ * - `cursor`: Either a full `pubky://` Url (from previous list response),
478
+ * or a path (to a file or directory) relative to the `url`
479
+ * - `reverse`: List in reverse order
480
+ * - `limit` Limit the number of urls in the response
481
+ * - `shallow`: List directories and files, instead of flat list of files.
482
+ * @param {string} url
483
+ * @param {string | undefined} [cursor]
484
+ * @param {boolean | undefined} [reverse]
485
+ * @param {number | undefined} [limit]
486
+ * @param {boolean | undefined} [shallow]
487
+ * @returns {Promise<Array<any>>}
488
+ */
489
+ list(url, cursor, reverse, limit, shallow) {
510
490
  const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
511
491
  const len0 = WASM_VECTOR_LEN;
512
- const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
513
- const len1 = WASM_VECTOR_LEN;
514
- const ret = wasm.pubkyclient_put(this.__wbg_ptr, ptr0, len0, ptr1, len1);
492
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
493
+ var len1 = WASM_VECTOR_LEN;
494
+ const ret = wasm.client_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
515
495
  return takeObject(ret);
516
496
  }
517
497
  /**
518
- * Download a small payload from a given path relative to a pubky author.
519
- * @param {string} url
520
- * @returns {Promise<Uint8Array | undefined>}
521
- */
522
- get(url) {
498
+ * @param {string} url
499
+ * @param {any | undefined} [request_init]
500
+ * @returns {Promise<Promise<any>>}
501
+ */
502
+ fetch(url, request_init) {
523
503
  const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
524
504
  const len0 = WASM_VECTOR_LEN;
525
- const ret = wasm.pubkyclient_get(this.__wbg_ptr, ptr0, len0);
505
+ const ret = wasm.client_fetch(this.__wbg_ptr, ptr0, len0, isLikeNone(request_init) ? 0 : addHeapObject(request_init));
526
506
  return takeObject(ret);
527
507
  }
528
- /**
529
- * Delete a file at a path relative to a pubky author.
530
- * @param {string} url
531
- * @returns {Promise<void>}
532
- */
533
- delete(url) {
534
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
535
- const len0 = WASM_VECTOR_LEN;
536
- const ret = wasm.pubkyclient_delete(this.__wbg_ptr, ptr0, len0);
537
- return takeObject(ret);
508
+ }
509
+ module.exports.Client = Client;
510
+
511
+ const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
512
+ ? { register: () => {}, unregister: () => {} }
513
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
514
+
515
+ class Keypair {
516
+
517
+ static __wrap(ptr) {
518
+ ptr = ptr >>> 0;
519
+ const obj = Object.create(Keypair.prototype);
520
+ obj.__wbg_ptr = ptr;
521
+ KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
522
+ return obj;
538
523
  }
539
- /**
540
- * Returns a list of Pubky urls (as strings).
541
- *
542
- * - `url`: The Pubky url (string) to the directory you want to list its content.
543
- * - `cursor`: Either a full `pubky://` Url (from previous list response),
544
- * or a path (to a file or directory) relative to the `url`
545
- * - `reverse`: List in reverse order
546
- * - `limit` Limit the number of urls in the response
547
- * - `shallow`: List directories and files, instead of flat list of files.
548
- * @param {string} url
549
- * @param {string | undefined} [cursor]
550
- * @param {boolean | undefined} [reverse]
551
- * @param {number | undefined} [limit]
552
- * @param {boolean | undefined} [shallow]
553
- * @returns {Promise<Array<any>>}
554
- */
555
- list(url, cursor, reverse, limit, shallow) {
556
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
557
- const len0 = WASM_VECTOR_LEN;
558
- var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
559
- var len1 = WASM_VECTOR_LEN;
560
- const ret = wasm.pubkyclient_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
561
- return takeObject(ret);
524
+
525
+ __destroy_into_raw() {
526
+ const ptr = this.__wbg_ptr;
527
+ this.__wbg_ptr = 0;
528
+ KeypairFinalization.unregister(this);
529
+ return ptr;
530
+ }
531
+
532
+ free() {
533
+ const ptr = this.__destroy_into_raw();
534
+ wasm.__wbg_keypair_free(ptr, 0);
562
535
  }
563
536
  /**
564
- * Create PubkyClient with default Settings including default relays
565
- */
566
- constructor() {
567
- const ret = wasm.pubkyclient_new();
568
- this.__wbg_ptr = ret >>> 0;
569
- PubkyClientFinalization.register(this, this.__wbg_ptr, this);
570
- return this;
537
+ * Generate a random [Keypair]
538
+ * @returns {Keypair}
539
+ */
540
+ static random() {
541
+ const ret = wasm.keypair_random();
542
+ return Keypair.__wrap(ret);
571
543
  }
572
544
  /**
573
- * Create a client with with configurations appropriate for local testing:
574
- * - set Pkarr relays to `["http://localhost:15411/pkarr"]` instead of default relay.
575
- * @returns {PubkyClient}
576
- */
577
- static testnet() {
578
- const ret = wasm.pubkyclient_testnet();
579
- return PubkyClient.__wrap(ret);
545
+ * Generate a [Keypair] from a secret key.
546
+ * @param {Uint8Array} secret_key
547
+ * @returns {Keypair}
548
+ */
549
+ static fromSecretKey(secret_key) {
550
+ try {
551
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
552
+ wasm.keypair_fromSecretKey(retptr, addHeapObject(secret_key));
553
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
554
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
555
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
556
+ if (r2) {
557
+ throw takeObject(r1);
558
+ }
559
+ return Keypair.__wrap(r0);
560
+ } finally {
561
+ wasm.__wbindgen_add_to_stack_pointer(16);
562
+ }
580
563
  }
581
564
  /**
582
- * @param {string} url
583
- * @param {any} init
584
- * @returns {Promise<Promise<any>>}
585
- */
586
- fetch(url, init) {
587
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
588
- const len0 = WASM_VECTOR_LEN;
589
- const ret = wasm.pubkyclient_fetch(this.__wbg_ptr, ptr0, len0, addHeapObject(init));
565
+ * Returns the secret key of this keypair.
566
+ * @returns {Uint8Array}
567
+ */
568
+ secretKey() {
569
+ const ret = wasm.keypair_secretKey(this.__wbg_ptr);
590
570
  return takeObject(ret);
591
571
  }
572
+ /**
573
+ * Returns the [PublicKey] of this keypair.
574
+ * @returns {PublicKey}
575
+ */
576
+ publicKey() {
577
+ const ret = wasm.keypair_publicKey(this.__wbg_ptr);
578
+ return PublicKey.__wrap(ret);
579
+ }
592
580
  }
593
- module.exports.PubkyClient = PubkyClient;
581
+ module.exports.Keypair = Keypair;
594
582
 
595
583
  const PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
596
584
  ? { register: () => {}, unregister: () => {} }
597
585
  : new FinalizationRegistry(ptr => wasm.__wbg_publickey_free(ptr >>> 0, 1));
598
- /**
599
- */
586
+
600
587
  class PublicKey {
601
588
 
602
589
  static __wrap(ptr) {
@@ -619,17 +606,17 @@ class PublicKey {
619
606
  wasm.__wbg_publickey_free(ptr, 0);
620
607
  }
621
608
  /**
622
- * Convert the PublicKey to Uint8Array
623
- * @returns {Uint8Array}
624
- */
609
+ * Convert the PublicKey to Uint8Array
610
+ * @returns {Uint8Array}
611
+ */
625
612
  to_uint8array() {
626
613
  const ret = wasm.publickey_to_uint8array(this.__wbg_ptr);
627
614
  return takeObject(ret);
628
615
  }
629
616
  /**
630
- * Returns the z-base32 encoding of this public key
631
- * @returns {string}
632
- */
617
+ * Returns the z-base32 encoding of this public key
618
+ * @returns {string}
619
+ */
633
620
  z32() {
634
621
  let deferred1_0;
635
622
  let deferred1_1;
@@ -647,10 +634,10 @@ class PublicKey {
647
634
  }
648
635
  }
649
636
  /**
650
- * @throws
651
- * @param {any} value
652
- * @returns {PublicKey}
653
- */
637
+ * @throws
638
+ * @param {any} value
639
+ * @returns {PublicKey}
640
+ */
654
641
  static from(value) {
655
642
  try {
656
643
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -672,8 +659,7 @@ module.exports.PublicKey = PublicKey;
672
659
  const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
673
660
  ? { register: () => {}, unregister: () => {} }
674
661
  : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr >>> 0, 1));
675
- /**
676
- */
662
+
677
663
  class Session {
678
664
 
679
665
  static __wrap(ptr) {
@@ -696,17 +682,17 @@ class Session {
696
682
  wasm.__wbg_session_free(ptr, 0);
697
683
  }
698
684
  /**
699
- * Return the [PublicKey] of this session
700
- * @returns {PublicKey}
701
- */
685
+ * Return the [PublicKey] of this session
686
+ * @returns {PublicKey}
687
+ */
702
688
  pubky() {
703
689
  const ret = wasm.session_pubky(this.__wbg_ptr);
704
690
  return PublicKey.__wrap(ret);
705
691
  }
706
692
  /**
707
- * Return the capabilities that this session has.
708
- * @returns {(string)[]}
709
- */
693
+ * Return the capabilities that this session has.
694
+ * @returns {(string)[]}
695
+ */
710
696
  capabilities() {
711
697
  try {
712
698
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -723,131 +709,101 @@ class Session {
723
709
  }
724
710
  module.exports.Session = Session;
725
711
 
726
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
727
- const ret = getStringFromWasm0(arg0, arg1);
728
- return addHeapObject(ret);
712
+ module.exports.__wbg_abort_05026c983d86824c = function(arg0) {
713
+ getObject(arg0).abort();
729
714
  };
730
715
 
731
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
732
- takeObject(arg0);
733
- };
716
+ module.exports.__wbg_append_72d1635ad8643998 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
717
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
718
+ }, arguments) };
734
719
 
735
- module.exports.__wbg_publickey_new = function(arg0) {
736
- const ret = PublicKey.__wrap(arg0);
720
+ module.exports.__wbg_arrayBuffer_d0ca2ad8bda0039b = function() { return handleError(function (arg0) {
721
+ const ret = getObject(arg0).arrayBuffer();
737
722
  return addHeapObject(ret);
738
- };
723
+ }, arguments) };
739
724
 
740
- module.exports.__wbg_session_new = function(arg0) {
741
- const ret = Session.__wrap(arg0);
725
+ module.exports.__wbg_buffer_61b7ce01341d7f88 = function(arg0) {
726
+ const ret = getObject(arg0).buffer;
742
727
  return addHeapObject(ret);
743
728
  };
744
729
 
745
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
746
- const obj = getObject(arg1);
747
- const ret = typeof(obj) === 'string' ? obj : undefined;
748
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
749
- var len1 = WASM_VECTOR_LEN;
750
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
751
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
730
+ module.exports.__wbg_byteLength_1b2d953758afc500 = function(arg0) {
731
+ const ret = getObject(arg0).byteLength;
732
+ return ret;
752
733
  };
753
734
 
754
- module.exports.__wbg_fetch_f7009dcc8692ba82 = function(arg0) {
755
- const ret = fetch(getObject(arg0));
735
+ module.exports.__wbg_call_500db948e69c7330 = function() { return handleError(function (arg0, arg1, arg2) {
736
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
756
737
  return addHeapObject(ret);
757
- };
738
+ }, arguments) };
758
739
 
759
- module.exports.__wbg_fetch_f8d735ba6fe1b719 = function(arg0) {
760
- const ret = fetch(getObject(arg0));
740
+ module.exports.__wbg_call_b0d8e36992d9900d = function() { return handleError(function (arg0, arg1) {
741
+ const ret = getObject(arg0).call(getObject(arg1));
761
742
  return addHeapObject(ret);
762
- };
743
+ }, arguments) };
763
744
 
764
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
765
- const ret = getObject(arg0);
745
+ module.exports.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
746
+ const ret = getObject(arg0).crypto;
766
747
  return addHeapObject(ret);
767
748
  };
768
749
 
769
- module.exports.__wbindgen_cb_drop = function(arg0) {
770
- const obj = takeObject(arg0).original;
771
- if (obj.cnt-- == 1) {
772
- obj.a = 0;
773
- return true;
774
- }
775
- const ret = false;
776
- return ret;
777
- };
778
-
779
- module.exports.__wbg_queueMicrotask_12a30234db4045d3 = function(arg0) {
780
- queueMicrotask(getObject(arg0));
750
+ module.exports.__wbg_debug_19114f11037e4658 = function(arg0, arg1, arg2, arg3) {
751
+ console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
781
752
  };
782
753
 
783
- module.exports.__wbg_queueMicrotask_48421b3cc9052b68 = function(arg0) {
784
- const ret = getObject(arg0).queueMicrotask;
785
- return addHeapObject(ret);
754
+ module.exports.__wbg_done_f22c1561fa919baa = function(arg0) {
755
+ const ret = getObject(arg0).done;
756
+ return ret;
786
757
  };
787
758
 
788
- module.exports.__wbindgen_is_function = function(arg0) {
789
- const ret = typeof(getObject(arg0)) === 'function';
790
- return ret;
759
+ module.exports.__wbg_error_483d659117b6f3f6 = function(arg0, arg1, arg2, arg3) {
760
+ console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
791
761
  };
792
762
 
793
- module.exports.__wbg_fetch_ba7fe179e527d942 = function(arg0, arg1) {
763
+ module.exports.__wbg_fetch_229368eecee9d217 = function(arg0, arg1) {
794
764
  const ret = getObject(arg0).fetch(getObject(arg1));
795
765
  return addHeapObject(ret);
796
766
  };
797
767
 
798
- module.exports.__wbg_newwithstrandinit_a31c69e4cc337183 = function() { return handleError(function (arg0, arg1, arg2) {
799
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
768
+ module.exports.__wbg_fetch_408fc9f7fddb9d4e = function(arg0) {
769
+ const ret = fetch(getObject(arg0));
800
770
  return addHeapObject(ret);
801
- }, arguments) };
802
-
803
- module.exports.__wbg_setbody_734cb3d7ee8e6e96 = function(arg0, arg1) {
804
- getObject(arg0).body = getObject(arg1);
805
771
  };
806
772
 
807
- module.exports.__wbg_setcredentials_2b67800db3f7b621 = function(arg0, arg1) {
808
- getObject(arg0).credentials = ["omit","same-origin","include",][arg1];
809
- };
810
-
811
- module.exports.__wbg_setheaders_be10a5ab566fd06f = function(arg0, arg1) {
812
- getObject(arg0).headers = getObject(arg1);
813
- };
814
-
815
- module.exports.__wbg_setmethod_dc68a742c2db5c6a = function(arg0, arg1, arg2) {
816
- getObject(arg0).method = getStringFromWasm0(arg1, arg2);
773
+ module.exports.__wbg_fetch_4465c2b10f21a927 = function(arg0) {
774
+ const ret = fetch(getObject(arg0));
775
+ return addHeapObject(ret);
817
776
  };
818
777
 
819
- module.exports.__wbg_setmode_a781aae2bd3df202 = function(arg0, arg1) {
820
- getObject(arg0).mode = ["same-origin","no-cors","cors","navigate",][arg1];
821
- };
778
+ module.exports.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) {
779
+ getObject(arg0).getRandomValues(getObject(arg1));
780
+ }, arguments) };
822
781
 
823
- module.exports.__wbg_setsignal_91c4e8ebd04eb935 = function(arg0, arg1) {
824
- getObject(arg0).signal = getObject(arg1);
825
- };
782
+ module.exports.__wbg_get_bbccf8970793c087 = function() { return handleError(function (arg0, arg1) {
783
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
784
+ return addHeapObject(ret);
785
+ }, arguments) };
826
786
 
827
- module.exports.__wbg_signal_41e46ccad44bb5e2 = function(arg0) {
828
- const ret = getObject(arg0).signal;
787
+ module.exports.__wbg_getheaders_82a20f9b60524a86 = function(arg0) {
788
+ const ret = getObject(arg0).headers;
829
789
  return addHeapObject(ret);
830
790
  };
831
791
 
832
- module.exports.__wbg_new_ebf2727385ee825c = function() { return handleError(function () {
833
- const ret = new AbortController();
834
- return addHeapObject(ret);
792
+ module.exports.__wbg_has_94c2fc1d261bbfe9 = function() { return handleError(function (arg0, arg1) {
793
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
794
+ return ret;
835
795
  }, arguments) };
836
796
 
837
- module.exports.__wbg_abort_8659d889a7877ae3 = function(arg0) {
838
- getObject(arg0).abort();
839
- };
840
-
841
- module.exports.__wbg_new_e27c93803e1acc42 = function() { return handleError(function () {
842
- const ret = new Headers();
797
+ module.exports.__wbg_headers_24e3e19fe3f187c0 = function(arg0) {
798
+ const ret = getObject(arg0).headers;
843
799
  return addHeapObject(ret);
844
- }, arguments) };
800
+ };
845
801
 
846
- module.exports.__wbg_append_f3a4426bb50622c5 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
847
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
848
- }, arguments) };
802
+ module.exports.__wbg_info_18e75e6ce8a36a90 = function(arg0, arg1, arg2, arg3) {
803
+ console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
804
+ };
849
805
 
850
- module.exports.__wbg_instanceof_Response_e91b7eb7c611a9ae = function(arg0) {
806
+ module.exports.__wbg_instanceof_Response_d3453657e10c4300 = function(arg0) {
851
807
  let result;
852
808
  try {
853
809
  result = getObject(arg0) instanceof Response;
@@ -858,289 +814,349 @@ module.exports.__wbg_instanceof_Response_e91b7eb7c611a9ae = function(arg0) {
858
814
  return ret;
859
815
  };
860
816
 
861
- module.exports.__wbg_url_1bf85c8abeb8c92d = function(arg0, arg1) {
862
- const ret = getObject(arg1).url;
863
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
864
- const len1 = WASM_VECTOR_LEN;
865
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
866
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
817
+ module.exports.__wbg_instanceof_Uint8Array_28af5bc19d6acad8 = function(arg0) {
818
+ let result;
819
+ try {
820
+ result = getObject(arg0) instanceof Uint8Array;
821
+ } catch (_) {
822
+ result = false;
823
+ }
824
+ const ret = result;
825
+ return ret;
867
826
  };
868
827
 
869
- module.exports.__wbg_status_ae8de515694c5c7c = function(arg0) {
870
- const ret = getObject(arg0).status;
828
+ module.exports.__wbg_iterator_23604bb983791576 = function() {
829
+ const ret = Symbol.iterator;
830
+ return addHeapObject(ret);
831
+ };
832
+
833
+ module.exports.__wbg_length_65d1cd11729ced11 = function(arg0) {
834
+ const ret = getObject(arg0).length;
871
835
  return ret;
872
836
  };
873
837
 
874
- module.exports.__wbg_headers_5e283e8345689121 = function(arg0) {
875
- const ret = getObject(arg0).headers;
876
- return addHeapObject(ret);
838
+ module.exports.__wbg_log_bc77772961bf21bb = function(arg0, arg1, arg2, arg3) {
839
+ console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
877
840
  };
878
841
 
879
- module.exports.__wbg_arrayBuffer_a5fbad63cc7e663b = function() { return handleError(function (arg0) {
880
- const ret = getObject(arg0).arrayBuffer();
842
+ module.exports.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
843
+ const ret = getObject(arg0).msCrypto;
881
844
  return addHeapObject(ret);
882
- }, arguments) };
883
-
884
- module.exports.__wbindgen_is_object = function(arg0) {
885
- const val = getObject(arg0);
886
- const ret = typeof(val) === 'object' && val !== null;
887
- return ret;
888
845
  };
889
846
 
890
- module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
891
- const ret = getObject(arg0).crypto;
847
+ module.exports.__wbg_new_254fa9eac11932ae = function() {
848
+ const ret = new Array();
892
849
  return addHeapObject(ret);
893
850
  };
894
851
 
895
- module.exports.__wbg_process_4a72847cc503995b = function(arg0) {
896
- const ret = getObject(arg0).process;
852
+ module.exports.__wbg_new_35d748855c4620b9 = function() { return handleError(function () {
853
+ const ret = new Headers();
897
854
  return addHeapObject(ret);
855
+ }, arguments) };
856
+
857
+ module.exports.__wbg_new_3d446df9155128ef = function(arg0, arg1) {
858
+ try {
859
+ var state0 = {a: arg0, b: arg1};
860
+ var cb0 = (arg0, arg1) => {
861
+ const a = state0.a;
862
+ state0.a = 0;
863
+ try {
864
+ return __wbg_adapter_153(a, state0.b, arg0, arg1);
865
+ } finally {
866
+ state0.a = a;
867
+ }
868
+ };
869
+ const ret = new Promise(cb0);
870
+ return addHeapObject(ret);
871
+ } finally {
872
+ state0.a = state0.b = 0;
873
+ }
898
874
  };
899
875
 
900
- module.exports.__wbg_versions_f686565e586dd935 = function(arg0) {
901
- const ret = getObject(arg0).versions;
876
+ module.exports.__wbg_new_3ff5b33b1ce712df = function(arg0) {
877
+ const ret = new Uint8Array(getObject(arg0));
902
878
  return addHeapObject(ret);
903
879
  };
904
880
 
905
- module.exports.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
906
- const ret = getObject(arg0).node;
881
+ module.exports.__wbg_new_5f48f21d4be11586 = function() { return handleError(function () {
882
+ const ret = new AbortController();
883
+ return addHeapObject(ret);
884
+ }, arguments) };
885
+
886
+ module.exports.__wbg_new_688846f374351c92 = function() {
887
+ const ret = new Object();
907
888
  return addHeapObject(ret);
908
889
  };
909
890
 
910
- module.exports.__wbindgen_is_string = function(arg0) {
911
- const ret = typeof(getObject(arg0)) === 'string';
912
- return ret;
891
+ module.exports.__wbg_newnoargs_fd9e4bf8be2bc16d = function(arg0, arg1) {
892
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
893
+ return addHeapObject(ret);
913
894
  };
914
895
 
915
- module.exports.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
916
- const ret = module.require;
896
+ module.exports.__wbg_newwithbyteoffsetandlength_ba35896968751d91 = function(arg0, arg1, arg2) {
897
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
917
898
  return addHeapObject(ret);
918
- }, arguments) };
899
+ };
919
900
 
920
- module.exports.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
921
- const ret = getObject(arg0).msCrypto;
901
+ module.exports.__wbg_newwithlength_34ce8f1051e74449 = function(arg0) {
902
+ const ret = new Uint8Array(arg0 >>> 0);
922
903
  return addHeapObject(ret);
923
904
  };
924
905
 
925
- module.exports.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
926
- getObject(arg0).randomFillSync(takeObject(arg1));
906
+ module.exports.__wbg_newwithstrandinit_a1f6583f20e4faff = function() { return handleError(function (arg0, arg1, arg2) {
907
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
908
+ return addHeapObject(ret);
927
909
  }, arguments) };
928
910
 
929
- module.exports.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
930
- getObject(arg0).getRandomValues(getObject(arg1));
911
+ module.exports.__wbg_next_01dd9234a5bf6d05 = function() { return handleError(function (arg0) {
912
+ const ret = getObject(arg0).next();
913
+ return addHeapObject(ret);
931
914
  }, arguments) };
932
915
 
933
- module.exports.__wbg_new_a220cf903aa02ca2 = function() {
934
- const ret = new Array();
916
+ module.exports.__wbg_next_137428deb98342b0 = function(arg0) {
917
+ const ret = getObject(arg0).next;
935
918
  return addHeapObject(ret);
936
919
  };
937
920
 
938
- module.exports.__wbg_newnoargs_76313bd6ff35d0f2 = function(arg0, arg1) {
939
- const ret = new Function(getStringFromWasm0(arg0, arg1));
921
+ module.exports.__wbg_node_02999533c4ea02e3 = function(arg0) {
922
+ const ret = getObject(arg0).node;
940
923
  return addHeapObject(ret);
941
924
  };
942
925
 
943
- module.exports.__wbg_next_de3e9db4440638b2 = function(arg0) {
944
- const ret = getObject(arg0).next;
945
- return addHeapObject(ret);
926
+ module.exports.__wbg_now_64d0bb151e5d3889 = function() {
927
+ const ret = Date.now();
928
+ return ret;
946
929
  };
947
930
 
948
- module.exports.__wbg_value_6d39332ab4788d86 = function(arg0) {
949
- const ret = getObject(arg0).value;
931
+ module.exports.__wbg_process_5c1d670bc53614b8 = function(arg0) {
932
+ const ret = getObject(arg0).process;
950
933
  return addHeapObject(ret);
951
934
  };
952
935
 
953
- module.exports.__wbg_iterator_888179a48810a9fe = function() {
954
- const ret = Symbol.iterator;
936
+ module.exports.__wbg_publickey_new = function(arg0) {
937
+ const ret = PublicKey.__wrap(arg0);
955
938
  return addHeapObject(ret);
956
939
  };
957
940
 
958
- module.exports.__wbg_new_525245e2b9901204 = function() {
959
- const ret = new Object();
960
- return addHeapObject(ret);
941
+ module.exports.__wbg_push_6edad0df4b546b2c = function(arg0, arg1) {
942
+ const ret = getObject(arg0).push(getObject(arg1));
943
+ return ret;
961
944
  };
962
945
 
963
- module.exports.__wbg_self_3093d5d1f7bcb682 = function() { return handleError(function () {
964
- const ret = self.self;
946
+ module.exports.__wbg_queueMicrotask_2181040e064c0dc8 = function(arg0) {
947
+ queueMicrotask(getObject(arg0));
948
+ };
949
+
950
+ module.exports.__wbg_queueMicrotask_ef9ac43769cbcc4f = function(arg0) {
951
+ const ret = getObject(arg0).queueMicrotask;
965
952
  return addHeapObject(ret);
953
+ };
954
+
955
+ module.exports.__wbg_randomFillSync_ab2cfe79ebbf2740 = function() { return handleError(function (arg0, arg1) {
956
+ getObject(arg0).randomFillSync(takeObject(arg1));
966
957
  }, arguments) };
967
958
 
968
- module.exports.__wbg_window_3bcfc4d31bc012f8 = function() { return handleError(function () {
969
- const ret = window.window;
959
+ module.exports.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () {
960
+ const ret = module.require;
970
961
  return addHeapObject(ret);
971
962
  }, arguments) };
972
963
 
973
- module.exports.__wbg_globalThis_86b222e13bdf32ed = function() { return handleError(function () {
974
- const ret = globalThis.globalThis;
964
+ module.exports.__wbg_resolve_0bf7c44d641804f9 = function(arg0) {
965
+ const ret = Promise.resolve(getObject(arg0));
975
966
  return addHeapObject(ret);
976
- }, arguments) };
967
+ };
977
968
 
978
- module.exports.__wbg_global_e5a3fe56f8be9485 = function() { return handleError(function () {
979
- const ret = global.global;
969
+ module.exports.__wbg_session_new = function(arg0) {
970
+ const ret = Session.__wrap(arg0);
980
971
  return addHeapObject(ret);
981
- }, arguments) };
972
+ };
982
973
 
983
- module.exports.__wbindgen_is_undefined = function(arg0) {
984
- const ret = getObject(arg0) === undefined;
985
- return ret;
974
+ module.exports.__wbg_set_23d69db4e5c66a6e = function(arg0, arg1, arg2) {
975
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
986
976
  };
987
977
 
988
- module.exports.__wbg_push_37c89022f34c01ca = function(arg0, arg1) {
989
- const ret = getObject(arg0).push(getObject(arg1));
990
- return ret;
978
+ module.exports.__wbg_setbody_64920df008e48adc = function(arg0, arg1) {
979
+ getObject(arg0).body = getObject(arg1);
991
980
  };
992
981
 
993
- module.exports.__wbg_new_796382978dfd4fb0 = function(arg0, arg1) {
994
- const ret = new Error(getStringFromWasm0(arg0, arg1));
995
- return addHeapObject(ret);
982
+ module.exports.__wbg_setcredentials_cfc15e48e3a3a535 = function(arg0, arg1) {
983
+ getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
996
984
  };
997
985
 
998
- module.exports.__wbg_call_1084a111329e68ce = function() { return handleError(function (arg0, arg1) {
999
- const ret = getObject(arg0).call(getObject(arg1));
1000
- return addHeapObject(ret);
1001
- }, arguments) };
986
+ module.exports.__wbg_setheaders_4c921e8e226bdfa7 = function(arg0, arg1) {
987
+ getObject(arg0).headers = getObject(arg1);
988
+ };
1002
989
 
1003
- module.exports.__wbg_call_89af060b4e1523f2 = function() { return handleError(function (arg0, arg1, arg2) {
1004
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1005
- return addHeapObject(ret);
1006
- }, arguments) };
990
+ module.exports.__wbg_setmethod_cfc7f688ba46a6be = function(arg0, arg1, arg2) {
991
+ getObject(arg0).method = getStringFromWasm0(arg1, arg2);
992
+ };
1007
993
 
1008
- module.exports.__wbg_next_f9cb570345655b9a = function() { return handleError(function (arg0) {
1009
- const ret = getObject(arg0).next();
994
+ module.exports.__wbg_setmode_cd03637eb7da01e0 = function(arg0, arg1) {
995
+ getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
996
+ };
997
+
998
+ module.exports.__wbg_setsignal_f766190d206f09e5 = function(arg0, arg1) {
999
+ getObject(arg0).signal = getObject(arg1);
1000
+ };
1001
+
1002
+ module.exports.__wbg_signal_1fdadeba2d04660e = function(arg0) {
1003
+ const ret = getObject(arg0).signal;
1010
1004
  return addHeapObject(ret);
1011
- }, arguments) };
1005
+ };
1012
1006
 
1013
- module.exports.__wbg_done_bfda7aa8f252b39f = function(arg0) {
1014
- const ret = getObject(arg0).done;
1015
- return ret;
1007
+ module.exports.__wbg_static_accessor_GLOBAL_0be7472e492ad3e3 = function() {
1008
+ const ret = typeof global === 'undefined' ? null : global;
1009
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1016
1010
  };
1017
1011
 
1018
- module.exports.__wbg_now_b7a162010a9e75b4 = function() {
1019
- const ret = Date.now();
1020
- return ret;
1012
+ module.exports.__wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb = function() {
1013
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1014
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1021
1015
  };
1022
1016
 
1023
- module.exports.__wbg_new_b85e72ed1bfd57f9 = function(arg0, arg1) {
1024
- try {
1025
- var state0 = {a: arg0, b: arg1};
1026
- var cb0 = (arg0, arg1) => {
1027
- const a = state0.a;
1028
- state0.a = 0;
1029
- try {
1030
- return __wbg_adapter_141(a, state0.b, arg0, arg1);
1031
- } finally {
1032
- state0.a = a;
1033
- }
1034
- };
1035
- const ret = new Promise(cb0);
1036
- return addHeapObject(ret);
1037
- } finally {
1038
- state0.a = state0.b = 0;
1039
- }
1017
+ module.exports.__wbg_static_accessor_SELF_1dc398a895c82351 = function() {
1018
+ const ret = typeof self === 'undefined' ? null : self;
1019
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1040
1020
  };
1041
1021
 
1042
- module.exports.__wbg_resolve_570458cb99d56a43 = function(arg0) {
1043
- const ret = Promise.resolve(getObject(arg0));
1022
+ module.exports.__wbg_static_accessor_WINDOW_ae1c80c7eea8d64a = function() {
1023
+ const ret = typeof window === 'undefined' ? null : window;
1024
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1025
+ };
1026
+
1027
+ module.exports.__wbg_status_317f53bc4c7638df = function(arg0) {
1028
+ const ret = getObject(arg0).status;
1029
+ return ret;
1030
+ };
1031
+
1032
+ module.exports.__wbg_stringify_f4f701bc34ceda61 = function() { return handleError(function (arg0) {
1033
+ const ret = JSON.stringify(getObject(arg0));
1034
+ return addHeapObject(ret);
1035
+ }, arguments) };
1036
+
1037
+ module.exports.__wbg_subarray_46adeb9b86949d12 = function(arg0, arg1, arg2) {
1038
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1044
1039
  return addHeapObject(ret);
1045
1040
  };
1046
1041
 
1047
- module.exports.__wbg_then_95e6edc0f89b73b1 = function(arg0, arg1) {
1042
+ module.exports.__wbg_text_dfc4cb7631d2eb34 = function() { return handleError(function (arg0) {
1043
+ const ret = getObject(arg0).text();
1044
+ return addHeapObject(ret);
1045
+ }, arguments) };
1046
+
1047
+ module.exports.__wbg_then_0438fad860fe38e1 = function(arg0, arg1) {
1048
1048
  const ret = getObject(arg0).then(getObject(arg1));
1049
1049
  return addHeapObject(ret);
1050
1050
  };
1051
1051
 
1052
- module.exports.__wbg_then_876bb3c633745cc6 = function(arg0, arg1, arg2) {
1052
+ module.exports.__wbg_then_0ffafeddf0e182a4 = function(arg0, arg1, arg2) {
1053
1053
  const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1054
1054
  return addHeapObject(ret);
1055
1055
  };
1056
1056
 
1057
- module.exports.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
1058
- const ret = getObject(arg0).buffer;
1059
- return addHeapObject(ret);
1057
+ module.exports.__wbg_url_5327bc0a41a9b085 = function(arg0, arg1) {
1058
+ const ret = getObject(arg1).url;
1059
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1060
+ const len1 = WASM_VECTOR_LEN;
1061
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1062
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1060
1063
  };
1061
1064
 
1062
- module.exports.__wbg_newwithbyteoffsetandlength_8a2cb9ca96b27ec9 = function(arg0, arg1, arg2) {
1063
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
1065
+ module.exports.__wbg_value_4c32fd138a88eee2 = function(arg0) {
1066
+ const ret = getObject(arg0).value;
1064
1067
  return addHeapObject(ret);
1065
1068
  };
1066
1069
 
1067
- module.exports.__wbg_new_ea1883e1e5e86686 = function(arg0) {
1068
- const ret = new Uint8Array(getObject(arg0));
1070
+ module.exports.__wbg_versions_c71aa1626a93e0a1 = function(arg0) {
1071
+ const ret = getObject(arg0).versions;
1069
1072
  return addHeapObject(ret);
1070
1073
  };
1071
1074
 
1072
- module.exports.__wbg_instanceof_Uint8Array_247a91427532499e = function(arg0) {
1073
- let result;
1074
- try {
1075
- result = getObject(arg0) instanceof Uint8Array;
1076
- } catch (_) {
1077
- result = false;
1075
+ module.exports.__wbg_warn_cb8be8bbf790a5d6 = function(arg0, arg1, arg2, arg3) {
1076
+ console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1077
+ };
1078
+
1079
+ module.exports.__wbindgen_cb_drop = function(arg0) {
1080
+ const obj = takeObject(arg0).original;
1081
+ if (obj.cnt-- == 1) {
1082
+ obj.a = 0;
1083
+ return true;
1078
1084
  }
1079
- const ret = result;
1085
+ const ret = false;
1080
1086
  return ret;
1081
1087
  };
1082
1088
 
1083
- module.exports.__wbg_newwithlength_ec548f448387c968 = function(arg0) {
1084
- const ret = new Uint8Array(arg0 >>> 0);
1089
+ module.exports.__wbindgen_closure_wrapper2714 = function(arg0, arg1, arg2) {
1090
+ const ret = makeMutClosure(arg0, arg1, 539, __wbg_adapter_28);
1085
1091
  return addHeapObject(ret);
1086
1092
  };
1087
1093
 
1088
- module.exports.__wbg_subarray_7c2e3576afe181d1 = function(arg0, arg1, arg2) {
1089
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1090
- return addHeapObject(ret);
1094
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1095
+ const ret = debugString(getObject(arg1));
1096
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1097
+ const len1 = WASM_VECTOR_LEN;
1098
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1099
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1091
1100
  };
1092
1101
 
1093
- module.exports.__wbg_length_8339fcf5d8ecd12e = function(arg0) {
1094
- const ret = getObject(arg0).length;
1102
+ module.exports.__wbindgen_is_function = function(arg0) {
1103
+ const ret = typeof(getObject(arg0)) === 'function';
1095
1104
  return ret;
1096
1105
  };
1097
1106
 
1098
- module.exports.__wbg_byteLength_850664ef28f3e42f = function(arg0) {
1099
- const ret = getObject(arg0).byteLength;
1107
+ module.exports.__wbindgen_is_null = function(arg0) {
1108
+ const ret = getObject(arg0) === null;
1100
1109
  return ret;
1101
1110
  };
1102
1111
 
1103
- module.exports.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) {
1104
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1112
+ module.exports.__wbindgen_is_object = function(arg0) {
1113
+ const val = getObject(arg0);
1114
+ const ret = typeof(val) === 'object' && val !== null;
1115
+ return ret;
1105
1116
  };
1106
1117
 
1107
- module.exports.__wbg_get_224d16597dbbfd96 = function() { return handleError(function (arg0, arg1) {
1108
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1109
- return addHeapObject(ret);
1110
- }, arguments) };
1118
+ module.exports.__wbindgen_is_string = function(arg0) {
1119
+ const ret = typeof(getObject(arg0)) === 'string';
1120
+ return ret;
1121
+ };
1111
1122
 
1112
- module.exports.__wbg_has_4bfbc01db38743f7 = function() { return handleError(function (arg0, arg1) {
1113
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
1123
+ module.exports.__wbindgen_is_undefined = function(arg0) {
1124
+ const ret = getObject(arg0) === undefined;
1114
1125
  return ret;
1115
- }, arguments) };
1126
+ };
1116
1127
 
1117
- module.exports.__wbg_stringify_bbf45426c92a6bf5 = function() { return handleError(function (arg0) {
1118
- const ret = JSON.stringify(getObject(arg0));
1128
+ module.exports.__wbindgen_memory = function() {
1129
+ const ret = wasm.memory;
1119
1130
  return addHeapObject(ret);
1120
- }, arguments) };
1131
+ };
1121
1132
 
1122
- module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1123
- const ret = debugString(getObject(arg1));
1124
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1125
- const len1 = WASM_VECTOR_LEN;
1126
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1127
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1133
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
1134
+ const ret = getObject(arg0);
1135
+ return addHeapObject(ret);
1128
1136
  };
1129
1137
 
1130
- module.exports.__wbindgen_throw = function(arg0, arg1) {
1131
- throw new Error(getStringFromWasm0(arg0, arg1));
1138
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
1139
+ takeObject(arg0);
1132
1140
  };
1133
1141
 
1134
- module.exports.__wbindgen_memory = function() {
1135
- const ret = wasm.memory;
1136
- return addHeapObject(ret);
1142
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
1143
+ const obj = getObject(arg1);
1144
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1145
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1146
+ var len1 = WASM_VECTOR_LEN;
1147
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1148
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1137
1149
  };
1138
1150
 
1139
- module.exports.__wbindgen_closure_wrapper1476 = function(arg0, arg1, arg2) {
1140
- const ret = makeMutClosure(arg0, arg1, 284, __wbg_adapter_26);
1151
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
1152
+ const ret = getStringFromWasm0(arg0, arg1);
1141
1153
  return addHeapObject(ret);
1142
1154
  };
1143
1155
 
1156
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
1157
+ throw new Error(getStringFromWasm0(arg0, arg1));
1158
+ };
1159
+
1144
1160
  const path = require('path').join(__dirname, 'pubky_bg.wasm');
1145
1161
  const bytes = require('fs').readFileSync(path);
1146
1162