@synonymdev/pubky 0.2.1 → 0.4.0-rc1

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