@synonymdev/pubky 0.1.14 → 0.1.15

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
@@ -1,3 +1,4 @@
1
+
1
2
  let imports = {};
2
3
  imports['__wbindgen_placeholder__'] = module.exports;
3
4
  let wasm;
@@ -7,18 +8,18 @@ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true
7
8
 
8
9
  cachedTextDecoder.decode();
9
10
 
10
- let cachedUint8Memory0 = null;
11
+ let cachedUint8ArrayMemory0 = null;
11
12
 
12
- function getUint8Memory0() {
13
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
14
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
13
+ function getUint8ArrayMemory0() {
14
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
15
16
  }
16
- return cachedUint8Memory0;
17
+ return cachedUint8ArrayMemory0;
17
18
  }
18
19
 
19
20
  function getStringFromWasm0(ptr, len) {
20
21
  ptr = ptr >>> 0;
21
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
22
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
22
23
  }
23
24
 
24
25
  const heap = new Array(128).fill(undefined);
@@ -72,7 +73,7 @@ function passStringToWasm0(arg, malloc, realloc) {
72
73
  if (realloc === undefined) {
73
74
  const buf = cachedTextEncoder.encode(arg);
74
75
  const ptr = malloc(buf.length, 1) >>> 0;
75
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
76
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
76
77
  WASM_VECTOR_LEN = buf.length;
77
78
  return ptr;
78
79
  }
@@ -80,7 +81,7 @@ function passStringToWasm0(arg, malloc, realloc) {
80
81
  let len = arg.length;
81
82
  let ptr = malloc(len, 1) >>> 0;
82
83
 
83
- const mem = getUint8Memory0();
84
+ const mem = getUint8ArrayMemory0();
84
85
 
85
86
  let offset = 0;
86
87
 
@@ -95,7 +96,7 @@ function passStringToWasm0(arg, malloc, realloc) {
95
96
  arg = arg.slice(offset);
96
97
  }
97
98
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
98
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
99
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
99
100
  const ret = encodeString(arg, view);
100
101
 
101
102
  offset += ret.written;
@@ -110,13 +111,13 @@ function isLikeNone(x) {
110
111
  return x === undefined || x === null;
111
112
  }
112
113
 
113
- let cachedInt32Memory0 = null;
114
+ let cachedDataViewMemory0 = null;
114
115
 
115
- function getInt32Memory0() {
116
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
117
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
116
+ function getDataViewMemory0() {
117
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
118
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
118
119
  }
119
- return cachedInt32Memory0;
120
+ return cachedDataViewMemory0;
120
121
  }
121
122
 
122
123
  function debugString(val) {
@@ -215,7 +216,27 @@ function makeMutClosure(arg0, arg1, dtor, f) {
215
216
  return real;
216
217
  }
217
218
  function __wbg_adapter_26(arg0, arg1, arg2) {
218
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha5424c6cb7b1ff0d(arg0, arg1, addHeapObject(arg2));
219
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h319ede9bf10254b2(arg0, arg1, addHeapObject(arg2));
220
+ }
221
+
222
+ function passArrayJsValueToWasm0(array, malloc) {
223
+ const ptr = malloc(array.length * 4, 4) >>> 0;
224
+ const mem = getDataViewMemory0();
225
+ for (let i = 0; i < array.length; i++) {
226
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
227
+ }
228
+ WASM_VECTOR_LEN = array.length;
229
+ return ptr;
230
+ }
231
+
232
+ function getArrayJsValueFromWasm0(ptr, len) {
233
+ ptr = ptr >>> 0;
234
+ const mem = getDataViewMemory0();
235
+ const result = [];
236
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
237
+ result.push(takeObject(mem.getUint32(i, true)));
238
+ }
239
+ return result;
219
240
  }
220
241
 
221
242
  function _assertClass(instance, klass) {
@@ -227,40 +248,62 @@ function _assertClass(instance, klass) {
227
248
 
228
249
  function passArray8ToWasm0(arg, malloc) {
229
250
  const ptr = malloc(arg.length * 1, 1) >>> 0;
230
- getUint8Memory0().set(arg, ptr / 1);
251
+ getUint8ArrayMemory0().set(arg, ptr / 1);
231
252
  WASM_VECTOR_LEN = arg.length;
232
253
  return ptr;
233
254
  }
234
-
235
- let cachedUint32Memory0 = null;
236
-
237
- function getUint32Memory0() {
238
- if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
239
- cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
240
- }
241
- return cachedUint32Memory0;
242
- }
243
-
244
- function passArrayJsValueToWasm0(array, malloc) {
245
- const ptr = malloc(array.length * 4, 4) >>> 0;
246
- const mem = getUint32Memory0();
247
- for (let i = 0; i < array.length; i++) {
248
- mem[ptr / 4 + i] = addHeapObject(array[i]);
255
+ /**
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
+ */
262
+ module.exports.createRecoveryFile = function(keypair, passphrase) {
263
+ try {
264
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
+ _assertClass(keypair, Keypair);
266
+ const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ wasm.createRecoveryFile(retptr, keypair.__wbg_ptr, ptr0, len0);
269
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
270
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
271
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
272
+ if (r2) {
273
+ throw takeObject(r1);
274
+ }
275
+ return takeObject(r0);
276
+ } finally {
277
+ wasm.__wbindgen_add_to_stack_pointer(16);
249
278
  }
250
- WASM_VECTOR_LEN = array.length;
251
- return ptr;
252
- }
279
+ };
253
280
 
254
- function getArrayJsValueFromWasm0(ptr, len) {
255
- ptr = ptr >>> 0;
256
- const mem = getUint32Memory0();
257
- const slice = mem.subarray(ptr / 4, ptr / 4 + len);
258
- const result = [];
259
- for (let i = 0; i < slice.length; i++) {
260
- result.push(takeObject(slice[i]));
281
+ /**
282
+ * Create a recovery file of the `keypair`, containing the secret key encrypted
283
+ * using the `passphrase`.
284
+ * @param {Uint8Array} recovery_file
285
+ * @param {string} passphrase
286
+ * @returns {Keypair}
287
+ */
288
+ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
289
+ try {
290
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
291
+ const ptr0 = passArray8ToWasm0(recovery_file, wasm.__wbindgen_malloc);
292
+ const len0 = WASM_VECTOR_LEN;
293
+ const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
294
+ const len1 = WASM_VECTOR_LEN;
295
+ wasm.decryptRecoveryFile(retptr, ptr0, len0, ptr1, len1);
296
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
297
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
298
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
299
+ if (r2) {
300
+ throw takeObject(r1);
301
+ }
302
+ return Keypair.__wrap(r0);
303
+ } finally {
304
+ wasm.__wbindgen_add_to_stack_pointer(16);
261
305
  }
262
- return result;
263
- }
306
+ };
264
307
 
265
308
  function handleError(f, args) {
266
309
  try {
@@ -269,13 +312,13 @@ function handleError(f, args) {
269
312
  wasm.__wbindgen_exn_store(addHeapObject(e));
270
313
  }
271
314
  }
272
- function __wbg_adapter_122(arg0, arg1, arg2, arg3) {
273
- wasm.wasm_bindgen__convert__closures__invoke2_mut__hcef77123246c6bdb(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
315
+ function __wbg_adapter_138(arg0, arg1, arg2, arg3) {
316
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h53759509a0f0816b(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
274
317
  }
275
318
 
276
319
  const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
277
320
  ? { register: () => {}, unregister: () => {} }
278
- : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0));
321
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
279
322
  /**
280
323
  */
281
324
  class Keypair {
@@ -297,7 +340,7 @@ class Keypair {
297
340
 
298
341
  free() {
299
342
  const ptr = this.__destroy_into_raw();
300
- wasm.__wbg_keypair_free(ptr);
343
+ wasm.__wbg_keypair_free(ptr, 0);
301
344
  }
302
345
  /**
303
346
  * Generate a random [Keypair]
@@ -316,9 +359,9 @@ class Keypair {
316
359
  try {
317
360
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
318
361
  wasm.keypair_fromSecretKey(retptr, addHeapObject(secret_key));
319
- var r0 = getInt32Memory0()[retptr / 4 + 0];
320
- var r1 = getInt32Memory0()[retptr / 4 + 1];
321
- var r2 = getInt32Memory0()[retptr / 4 + 2];
362
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
363
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
364
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
322
365
  if (r2) {
323
366
  throw takeObject(r1);
324
367
  }
@@ -348,7 +391,7 @@ module.exports.Keypair = Keypair;
348
391
 
349
392
  const PubkyClientFinalization = (typeof FinalizationRegistry === 'undefined')
350
393
  ? { register: () => {}, unregister: () => {} }
351
- : new FinalizationRegistry(ptr => wasm.__wbg_pubkyclient_free(ptr >>> 0));
394
+ : new FinalizationRegistry(ptr => wasm.__wbg_pubkyclient_free(ptr >>> 0, 1));
352
395
  /**
353
396
  */
354
397
  class PubkyClient {
@@ -370,13 +413,14 @@ class PubkyClient {
370
413
 
371
414
  free() {
372
415
  const ptr = this.__destroy_into_raw();
373
- wasm.__wbg_pubkyclient_free(ptr);
416
+ wasm.__wbg_pubkyclient_free(ptr, 0);
374
417
  }
375
418
  /**
376
419
  */
377
420
  constructor() {
378
421
  const ret = wasm.pubkyclient_new();
379
422
  this.__wbg_ptr = ret >>> 0;
423
+ PubkyClientFinalization.register(this, this.__wbg_ptr, this);
380
424
  return this;
381
425
  }
382
426
  /**
@@ -389,57 +433,6 @@ class PubkyClient {
389
433
  return PubkyClient.__wrap(ret);
390
434
  }
391
435
  /**
392
- * Create a recovery file of the `keypair`, containing the secret key encrypted
393
- * using the `passphrase`.
394
- * @param {Keypair} keypair
395
- * @param {string} passphrase
396
- * @returns {Uint8Array}
397
- */
398
- static createRecoveryFile(keypair, passphrase) {
399
- try {
400
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
401
- _assertClass(keypair, Keypair);
402
- const ptr0 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
403
- const len0 = WASM_VECTOR_LEN;
404
- wasm.pubkyclient_createRecoveryFile(retptr, keypair.__wbg_ptr, ptr0, len0);
405
- var r0 = getInt32Memory0()[retptr / 4 + 0];
406
- var r1 = getInt32Memory0()[retptr / 4 + 1];
407
- var r2 = getInt32Memory0()[retptr / 4 + 2];
408
- if (r2) {
409
- throw takeObject(r1);
410
- }
411
- return takeObject(r0);
412
- } finally {
413
- wasm.__wbindgen_add_to_stack_pointer(16);
414
- }
415
- }
416
- /**
417
- * Create a recovery file of the `keypair`, containing the secret key encrypted
418
- * using the `passphrase`.
419
- * @param {Uint8Array} recovery_file
420
- * @param {string} passphrase
421
- * @returns {Keypair}
422
- */
423
- static decryptRecoveryFile(recovery_file, passphrase) {
424
- try {
425
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
426
- const ptr0 = passArray8ToWasm0(recovery_file, wasm.__wbindgen_malloc);
427
- const len0 = WASM_VECTOR_LEN;
428
- const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
- const len1 = WASM_VECTOR_LEN;
430
- wasm.pubkyclient_decryptRecoveryFile(retptr, ptr0, len0, ptr1, len1);
431
- var r0 = getInt32Memory0()[retptr / 4 + 0];
432
- var r1 = getInt32Memory0()[retptr / 4 + 1];
433
- var r2 = getInt32Memory0()[retptr / 4 + 2];
434
- if (r2) {
435
- throw takeObject(r1);
436
- }
437
- return Keypair.__wrap(r0);
438
- } finally {
439
- wasm.__wbindgen_add_to_stack_pointer(16);
440
- }
441
- }
442
- /**
443
436
  * Set Pkarr relays used for publishing and resolving Pkarr packets.
444
437
  *
445
438
  * By default, [PubkyClient] will use `["https://relay.pkarr.org"]`
@@ -460,8 +453,8 @@ class PubkyClient {
460
453
  try {
461
454
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
462
455
  wasm.pubkyclient_getPkarrRelays(retptr, this.__wbg_ptr);
463
- var r0 = getInt32Memory0()[retptr / 4 + 0];
464
- var r1 = getInt32Memory0()[retptr / 4 + 1];
456
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
457
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
465
458
  var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
466
459
  wasm.__wbindgen_free(r0, r1 * 4, 4);
467
460
  return v1;
@@ -476,7 +469,7 @@ class PubkyClient {
476
469
  * for example "pubky.o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy"
477
470
  * @param {Keypair} keypair
478
471
  * @param {PublicKey} homeserver
479
- * @returns {Promise<void>}
472
+ * @returns {Promise<Session>}
480
473
  */
481
474
  signup(keypair, homeserver) {
482
475
  _assertClass(keypair, Keypair);
@@ -508,7 +501,7 @@ class PubkyClient {
508
501
  return takeObject(ret);
509
502
  }
510
503
  /**
511
- * Signin to a homeserver.
504
+ * Signin to a homeserver using the root Keypair.
512
505
  * @param {Keypair} keypair
513
506
  * @returns {Promise<void>}
514
507
  */
@@ -518,6 +511,49 @@ class PubkyClient {
518
511
  return takeObject(ret);
519
512
  }
520
513
  /**
514
+ * Return `pubkyauth://` url and wait for the incoming [AuthToken]
515
+ * verifying that AuthToken, and if capabilities were requested, signing in to
516
+ * the Pubky's homeserver and returning the [Session] information.
517
+ *
518
+ * Returns a tuple of [pubkyAuthUrl, Promise<Session>]
519
+ * @param {string} relay
520
+ * @param {string} capabilities
521
+ * @returns {Array<any>}
522
+ */
523
+ authRequest(relay, capabilities) {
524
+ try {
525
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
526
+ const ptr0 = passStringToWasm0(relay, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
527
+ const len0 = WASM_VECTOR_LEN;
528
+ const ptr1 = passStringToWasm0(capabilities, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
529
+ const len1 = WASM_VECTOR_LEN;
530
+ wasm.pubkyclient_authRequest(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
531
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
532
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
533
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
534
+ if (r2) {
535
+ throw takeObject(r1);
536
+ }
537
+ return takeObject(r0);
538
+ } finally {
539
+ wasm.__wbindgen_add_to_stack_pointer(16);
540
+ }
541
+ }
542
+ /**
543
+ * Sign an [pubky_common::auth::AuthToken], encrypt it and send it to the
544
+ * source of the pubkyauth request url.
545
+ * @param {Keypair} keypair
546
+ * @param {string} pubkyauth_url
547
+ * @returns {Promise<void>}
548
+ */
549
+ sendAuthToken(keypair, pubkyauth_url) {
550
+ _assertClass(keypair, Keypair);
551
+ const ptr0 = passStringToWasm0(pubkyauth_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
552
+ const len0 = WASM_VECTOR_LEN;
553
+ const ret = wasm.pubkyclient_sendAuthToken(this.__wbg_ptr, keypair.__wbg_ptr, ptr0, len0);
554
+ return takeObject(ret);
555
+ }
556
+ /**
521
557
  * Upload a small payload to a given path.
522
558
  * @param {string} url
523
559
  * @param {Uint8Array} content
@@ -582,7 +618,7 @@ module.exports.PubkyClient = PubkyClient;
582
618
 
583
619
  const PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
584
620
  ? { register: () => {}, unregister: () => {} }
585
- : new FinalizationRegistry(ptr => wasm.__wbg_publickey_free(ptr >>> 0));
621
+ : new FinalizationRegistry(ptr => wasm.__wbg_publickey_free(ptr >>> 0, 1));
586
622
  /**
587
623
  */
588
624
  class PublicKey {
@@ -604,7 +640,7 @@ class PublicKey {
604
640
 
605
641
  free() {
606
642
  const ptr = this.__destroy_into_raw();
607
- wasm.__wbg_publickey_free(ptr);
643
+ wasm.__wbg_publickey_free(ptr, 0);
608
644
  }
609
645
  /**
610
646
  * Convert the PublicKey to Uint8Array
@@ -624,8 +660,8 @@ class PublicKey {
624
660
  try {
625
661
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
626
662
  wasm.publickey_z32(retptr, this.__wbg_ptr);
627
- var r0 = getInt32Memory0()[retptr / 4 + 0];
628
- var r1 = getInt32Memory0()[retptr / 4 + 1];
663
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
664
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
629
665
  deferred1_0 = r0;
630
666
  deferred1_1 = r1;
631
667
  return getStringFromWasm0(r0, r1);
@@ -643,9 +679,9 @@ class PublicKey {
643
679
  try {
644
680
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
645
681
  wasm.publickey_from(retptr, addHeapObject(value));
646
- var r0 = getInt32Memory0()[retptr / 4 + 0];
647
- var r1 = getInt32Memory0()[retptr / 4 + 1];
648
- var r2 = getInt32Memory0()[retptr / 4 + 2];
682
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
683
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
684
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
649
685
  if (r2) {
650
686
  throw takeObject(r1);
651
687
  }
@@ -659,7 +695,7 @@ module.exports.PublicKey = PublicKey;
659
695
 
660
696
  const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
661
697
  ? { register: () => {}, unregister: () => {} }
662
- : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr >>> 0));
698
+ : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr >>> 0, 1));
663
699
  /**
664
700
  */
665
701
  class Session {
@@ -681,7 +717,32 @@ class Session {
681
717
 
682
718
  free() {
683
719
  const ptr = this.__destroy_into_raw();
684
- wasm.__wbg_session_free(ptr);
720
+ wasm.__wbg_session_free(ptr, 0);
721
+ }
722
+ /**
723
+ * Return the [PublicKey] of this session
724
+ * @returns {PublicKey}
725
+ */
726
+ pubky() {
727
+ const ret = wasm.session_pubky(this.__wbg_ptr);
728
+ return PublicKey.__wrap(ret);
729
+ }
730
+ /**
731
+ * Return the capabilities that this session has.
732
+ * @returns {(string)[]}
733
+ */
734
+ capabilities() {
735
+ try {
736
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
737
+ wasm.session_capabilities(retptr, this.__wbg_ptr);
738
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
739
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
740
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
741
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
742
+ return v1;
743
+ } finally {
744
+ wasm.__wbindgen_add_to_stack_pointer(16);
745
+ }
685
746
  }
686
747
  }
687
748
  module.exports.Session = Session;
@@ -695,18 +756,18 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
695
756
  takeObject(arg0);
696
757
  };
697
758
 
759
+ module.exports.__wbg_session_new = function(arg0) {
760
+ const ret = Session.__wrap(arg0);
761
+ return addHeapObject(ret);
762
+ };
763
+
698
764
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
699
765
  const obj = getObject(arg1);
700
766
  const ret = typeof(obj) === 'string' ? obj : undefined;
701
767
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
702
768
  var len1 = WASM_VECTOR_LEN;
703
- getInt32Memory0()[arg0 / 4 + 1] = len1;
704
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
705
- };
706
-
707
- module.exports.__wbg_session_new = function(arg0) {
708
- const ret = Session.__wrap(arg0);
709
- return addHeapObject(ret);
769
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
770
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
710
771
  };
711
772
 
712
773
  module.exports.__wbg_fetch_1e4e8ed1f64c7e28 = function(arg0) {
@@ -719,31 +780,64 @@ module.exports.__wbindgen_object_clone_ref = function(arg0) {
719
780
  return addHeapObject(ret);
720
781
  };
721
782
 
722
- module.exports.__wbg_fetch_921fad6ef9e883dd = function(arg0, arg1) {
783
+ module.exports.__wbg_fetch_ba7fe179e527d942 = function(arg0, arg1) {
723
784
  const ret = getObject(arg0).fetch(getObject(arg1));
724
785
  return addHeapObject(ret);
725
786
  };
726
787
 
727
- module.exports.__wbg_signal_a61f78a3478fd9bc = function(arg0) {
788
+ module.exports.__wbg_signal_41e46ccad44bb5e2 = function(arg0) {
728
789
  const ret = getObject(arg0).signal;
729
790
  return addHeapObject(ret);
730
791
  };
731
792
 
732
- module.exports.__wbg_new_0d76b0581eca6298 = function() { return handleError(function () {
793
+ module.exports.__wbg_new_ebf2727385ee825c = function() { return handleError(function () {
733
794
  const ret = new AbortController();
734
795
  return addHeapObject(ret);
735
796
  }, arguments) };
736
797
 
737
- module.exports.__wbg_abort_2aa7521d5690750e = function(arg0) {
798
+ module.exports.__wbg_abort_8659d889a7877ae3 = function(arg0) {
738
799
  getObject(arg0).abort();
739
800
  };
740
801
 
741
- module.exports.__wbg_newwithstrandinit_3fd6fba4083ff2d0 = function() { return handleError(function (arg0, arg1, arg2) {
802
+ module.exports.__wbg_newwithstrandinit_a31c69e4cc337183 = function() { return handleError(function (arg0, arg1, arg2) {
742
803
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
743
804
  return addHeapObject(ret);
744
805
  }, arguments) };
745
806
 
746
- module.exports.__wbg_instanceof_Response_849eb93e75734b6e = function(arg0) {
807
+ module.exports.__wbg_setbody_734cb3d7ee8e6e96 = function(arg0, arg1) {
808
+ getObject(arg0).body = getObject(arg1);
809
+ };
810
+
811
+ module.exports.__wbg_setcredentials_2b67800db3f7b621 = function(arg0, arg1) {
812
+ getObject(arg0).credentials = ["omit","same-origin","include",][arg1];
813
+ };
814
+
815
+ module.exports.__wbg_setheaders_be10a5ab566fd06f = function(arg0, arg1) {
816
+ getObject(arg0).headers = getObject(arg1);
817
+ };
818
+
819
+ module.exports.__wbg_setmethod_dc68a742c2db5c6a = function(arg0, arg1, arg2) {
820
+ getObject(arg0).method = getStringFromWasm0(arg1, arg2);
821
+ };
822
+
823
+ module.exports.__wbg_setmode_a781aae2bd3df202 = function(arg0, arg1) {
824
+ getObject(arg0).mode = ["same-origin","no-cors","cors","navigate",][arg1];
825
+ };
826
+
827
+ module.exports.__wbg_setsignal_91c4e8ebd04eb935 = function(arg0, arg1) {
828
+ getObject(arg0).signal = getObject(arg1);
829
+ };
830
+
831
+ module.exports.__wbg_new_e27c93803e1acc42 = function() { return handleError(function () {
832
+ const ret = new Headers();
833
+ return addHeapObject(ret);
834
+ }, arguments) };
835
+
836
+ module.exports.__wbg_append_f3a4426bb50622c5 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
837
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
838
+ }, arguments) };
839
+
840
+ module.exports.__wbg_instanceof_Response_e91b7eb7c611a9ae = function(arg0) {
747
841
  let result;
748
842
  try {
749
843
  result = getObject(arg0) instanceof Response;
@@ -754,38 +848,29 @@ module.exports.__wbg_instanceof_Response_849eb93e75734b6e = function(arg0) {
754
848
  return ret;
755
849
  };
756
850
 
757
- module.exports.__wbg_url_5f6dc4009ac5f99d = function(arg0, arg1) {
851
+ module.exports.__wbg_url_1bf85c8abeb8c92d = function(arg0, arg1) {
758
852
  const ret = getObject(arg1).url;
759
853
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
760
854
  const len1 = WASM_VECTOR_LEN;
761
- getInt32Memory0()[arg0 / 4 + 1] = len1;
762
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
855
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
856
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
763
857
  };
764
858
 
765
- module.exports.__wbg_status_61a01141acd3cf74 = function(arg0) {
859
+ module.exports.__wbg_status_ae8de515694c5c7c = function(arg0) {
766
860
  const ret = getObject(arg0).status;
767
861
  return ret;
768
862
  };
769
863
 
770
- module.exports.__wbg_headers_9620bfada380764a = function(arg0) {
864
+ module.exports.__wbg_headers_5e283e8345689121 = function(arg0) {
771
865
  const ret = getObject(arg0).headers;
772
866
  return addHeapObject(ret);
773
867
  };
774
868
 
775
- module.exports.__wbg_arrayBuffer_29931d52c7206b02 = function() { return handleError(function (arg0) {
869
+ module.exports.__wbg_arrayBuffer_a5fbad63cc7e663b = function() { return handleError(function (arg0) {
776
870
  const ret = getObject(arg0).arrayBuffer();
777
871
  return addHeapObject(ret);
778
872
  }, arguments) };
779
873
 
780
- module.exports.__wbg_new_ab6fd82b10560829 = function() { return handleError(function () {
781
- const ret = new Headers();
782
- return addHeapObject(ret);
783
- }, arguments) };
784
-
785
- module.exports.__wbg_append_7bfcb4937d1d5e29 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
786
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
787
- }, arguments) };
788
-
789
874
  module.exports.__wbindgen_cb_drop = function(arg0) {
790
875
  const obj = takeObject(arg0).original;
791
876
  if (obj.cnt-- == 1) {
@@ -859,52 +944,52 @@ module.exports.__wbg_getRandomValues_3aa56aa6edec874c = function() { return hand
859
944
  getObject(arg0).getRandomValues(getObject(arg1));
860
945
  }, arguments) };
861
946
 
862
- module.exports.__wbg_new_16b304a2cfa7ff4a = function() {
947
+ module.exports.__wbg_new_a220cf903aa02ca2 = function() {
863
948
  const ret = new Array();
864
949
  return addHeapObject(ret);
865
950
  };
866
951
 
867
- module.exports.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
952
+ module.exports.__wbg_newnoargs_76313bd6ff35d0f2 = function(arg0, arg1) {
868
953
  const ret = new Function(getStringFromWasm0(arg0, arg1));
869
954
  return addHeapObject(ret);
870
955
  };
871
956
 
872
- module.exports.__wbg_next_40fc327bfc8770e6 = function(arg0) {
957
+ module.exports.__wbg_next_de3e9db4440638b2 = function(arg0) {
873
958
  const ret = getObject(arg0).next;
874
959
  return addHeapObject(ret);
875
960
  };
876
961
 
877
- module.exports.__wbg_value_d93c65011f51a456 = function(arg0) {
962
+ module.exports.__wbg_value_6d39332ab4788d86 = function(arg0) {
878
963
  const ret = getObject(arg0).value;
879
964
  return addHeapObject(ret);
880
965
  };
881
966
 
882
- module.exports.__wbg_iterator_2cee6dadfd956dfa = function() {
967
+ module.exports.__wbg_iterator_888179a48810a9fe = function() {
883
968
  const ret = Symbol.iterator;
884
969
  return addHeapObject(ret);
885
970
  };
886
971
 
887
- module.exports.__wbg_new_72fb9a18b5ae2624 = function() {
972
+ module.exports.__wbg_new_525245e2b9901204 = function() {
888
973
  const ret = new Object();
889
974
  return addHeapObject(ret);
890
975
  };
891
976
 
892
- module.exports.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
977
+ module.exports.__wbg_self_3093d5d1f7bcb682 = function() { return handleError(function () {
893
978
  const ret = self.self;
894
979
  return addHeapObject(ret);
895
980
  }, arguments) };
896
981
 
897
- module.exports.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
982
+ module.exports.__wbg_window_3bcfc4d31bc012f8 = function() { return handleError(function () {
898
983
  const ret = window.window;
899
984
  return addHeapObject(ret);
900
985
  }, arguments) };
901
986
 
902
- module.exports.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
987
+ module.exports.__wbg_globalThis_86b222e13bdf32ed = function() { return handleError(function () {
903
988
  const ret = globalThis.globalThis;
904
989
  return addHeapObject(ret);
905
990
  }, arguments) };
906
991
 
907
- module.exports.__wbg_global_207b558942527489 = function() { return handleError(function () {
992
+ module.exports.__wbg_global_e5a3fe56f8be9485 = function() { return handleError(function () {
908
993
  const ret = global.global;
909
994
  return addHeapObject(ret);
910
995
  }, arguments) };
@@ -914,49 +999,49 @@ module.exports.__wbindgen_is_undefined = function(arg0) {
914
999
  return ret;
915
1000
  };
916
1001
 
917
- module.exports.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
1002
+ module.exports.__wbg_push_37c89022f34c01ca = function(arg0, arg1) {
918
1003
  const ret = getObject(arg0).push(getObject(arg1));
919
1004
  return ret;
920
1005
  };
921
1006
 
922
- module.exports.__wbg_new_28c511d9baebfa89 = function(arg0, arg1) {
1007
+ module.exports.__wbg_new_796382978dfd4fb0 = function(arg0, arg1) {
923
1008
  const ret = new Error(getStringFromWasm0(arg0, arg1));
924
1009
  return addHeapObject(ret);
925
1010
  };
926
1011
 
927
- module.exports.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
1012
+ module.exports.__wbg_call_1084a111329e68ce = function() { return handleError(function (arg0, arg1) {
928
1013
  const ret = getObject(arg0).call(getObject(arg1));
929
1014
  return addHeapObject(ret);
930
1015
  }, arguments) };
931
1016
 
932
- module.exports.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
1017
+ module.exports.__wbg_call_89af060b4e1523f2 = function() { return handleError(function (arg0, arg1, arg2) {
933
1018
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
934
1019
  return addHeapObject(ret);
935
1020
  }, arguments) };
936
1021
 
937
- module.exports.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
1022
+ module.exports.__wbg_next_f9cb570345655b9a = function() { return handleError(function (arg0) {
938
1023
  const ret = getObject(arg0).next();
939
1024
  return addHeapObject(ret);
940
1025
  }, arguments) };
941
1026
 
942
- module.exports.__wbg_done_298b57d23c0fc80c = function(arg0) {
1027
+ module.exports.__wbg_done_bfda7aa8f252b39f = function(arg0) {
943
1028
  const ret = getObject(arg0).done;
944
1029
  return ret;
945
1030
  };
946
1031
 
947
- module.exports.__wbg_now_3014639a94423537 = function() {
1032
+ module.exports.__wbg_now_b7a162010a9e75b4 = function() {
948
1033
  const ret = Date.now();
949
1034
  return ret;
950
1035
  };
951
1036
 
952
- module.exports.__wbg_new_81740750da40724f = function(arg0, arg1) {
1037
+ module.exports.__wbg_new_b85e72ed1bfd57f9 = function(arg0, arg1) {
953
1038
  try {
954
1039
  var state0 = {a: arg0, b: arg1};
955
1040
  var cb0 = (arg0, arg1) => {
956
1041
  const a = state0.a;
957
1042
  state0.a = 0;
958
1043
  try {
959
- return __wbg_adapter_122(a, state0.b, arg0, arg1);
1044
+ return __wbg_adapter_138(a, state0.b, arg0, arg1);
960
1045
  } finally {
961
1046
  state0.a = a;
962
1047
  }
@@ -968,37 +1053,37 @@ module.exports.__wbg_new_81740750da40724f = function(arg0, arg1) {
968
1053
  }
969
1054
  };
970
1055
 
971
- module.exports.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
1056
+ module.exports.__wbg_resolve_570458cb99d56a43 = function(arg0) {
972
1057
  const ret = Promise.resolve(getObject(arg0));
973
1058
  return addHeapObject(ret);
974
1059
  };
975
1060
 
976
- module.exports.__wbg_then_0c86a60e8fcfe9f6 = function(arg0, arg1) {
1061
+ module.exports.__wbg_then_95e6edc0f89b73b1 = function(arg0, arg1) {
977
1062
  const ret = getObject(arg0).then(getObject(arg1));
978
1063
  return addHeapObject(ret);
979
1064
  };
980
1065
 
981
- module.exports.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
1066
+ module.exports.__wbg_then_876bb3c633745cc6 = function(arg0, arg1, arg2) {
982
1067
  const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
983
1068
  return addHeapObject(ret);
984
1069
  };
985
1070
 
986
- module.exports.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
1071
+ module.exports.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
987
1072
  const ret = getObject(arg0).buffer;
988
1073
  return addHeapObject(ret);
989
1074
  };
990
1075
 
991
- module.exports.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
1076
+ module.exports.__wbg_newwithbyteoffsetandlength_8a2cb9ca96b27ec9 = function(arg0, arg1, arg2) {
992
1077
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
993
1078
  return addHeapObject(ret);
994
1079
  };
995
1080
 
996
- module.exports.__wbg_new_63b92bc8671ed464 = function(arg0) {
1081
+ module.exports.__wbg_new_ea1883e1e5e86686 = function(arg0) {
997
1082
  const ret = new Uint8Array(getObject(arg0));
998
1083
  return addHeapObject(ret);
999
1084
  };
1000
1085
 
1001
- module.exports.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
1086
+ module.exports.__wbg_instanceof_Uint8Array_247a91427532499e = function(arg0) {
1002
1087
  let result;
1003
1088
  try {
1004
1089
  result = getObject(arg0) instanceof Uint8Array;
@@ -1009,46 +1094,41 @@ module.exports.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
1009
1094
  return ret;
1010
1095
  };
1011
1096
 
1012
- module.exports.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
1097
+ module.exports.__wbg_newwithlength_ec548f448387c968 = function(arg0) {
1013
1098
  const ret = new Uint8Array(arg0 >>> 0);
1014
1099
  return addHeapObject(ret);
1015
1100
  };
1016
1101
 
1017
- module.exports.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
1102
+ module.exports.__wbg_subarray_7c2e3576afe181d1 = function(arg0, arg1, arg2) {
1018
1103
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1019
1104
  return addHeapObject(ret);
1020
1105
  };
1021
1106
 
1022
- module.exports.__wbg_length_c20a40f15020d68a = function(arg0) {
1107
+ module.exports.__wbg_length_8339fcf5d8ecd12e = function(arg0) {
1023
1108
  const ret = getObject(arg0).length;
1024
1109
  return ret;
1025
1110
  };
1026
1111
 
1027
- module.exports.__wbg_byteLength_58f7b4fab1919d44 = function(arg0) {
1112
+ module.exports.__wbg_byteLength_850664ef28f3e42f = function(arg0) {
1028
1113
  const ret = getObject(arg0).byteLength;
1029
1114
  return ret;
1030
1115
  };
1031
1116
 
1032
- module.exports.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
1117
+ module.exports.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) {
1033
1118
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1034
1119
  };
1035
1120
 
1036
- module.exports.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
1121
+ module.exports.__wbg_get_224d16597dbbfd96 = function() { return handleError(function (arg0, arg1) {
1037
1122
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
1038
1123
  return addHeapObject(ret);
1039
1124
  }, arguments) };
1040
1125
 
1041
- module.exports.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
1126
+ module.exports.__wbg_has_4bfbc01db38743f7 = function() { return handleError(function (arg0, arg1) {
1042
1127
  const ret = Reflect.has(getObject(arg0), getObject(arg1));
1043
1128
  return ret;
1044
1129
  }, arguments) };
1045
1130
 
1046
- module.exports.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
1047
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1048
- return ret;
1049
- }, arguments) };
1050
-
1051
- module.exports.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
1131
+ module.exports.__wbg_stringify_bbf45426c92a6bf5 = function() { return handleError(function (arg0) {
1052
1132
  const ret = JSON.stringify(getObject(arg0));
1053
1133
  return addHeapObject(ret);
1054
1134
  }, arguments) };
@@ -1057,8 +1137,8 @@ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1057
1137
  const ret = debugString(getObject(arg1));
1058
1138
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1059
1139
  const len1 = WASM_VECTOR_LEN;
1060
- getInt32Memory0()[arg0 / 4 + 1] = len1;
1061
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1140
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1141
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1062
1142
  };
1063
1143
 
1064
1144
  module.exports.__wbindgen_throw = function(arg0, arg1) {
@@ -1070,8 +1150,8 @@ module.exports.__wbindgen_memory = function() {
1070
1150
  return addHeapObject(ret);
1071
1151
  };
1072
1152
 
1073
- module.exports.__wbindgen_closure_wrapper1801 = function(arg0, arg1, arg2) {
1074
- const ret = makeMutClosure(arg0, arg1, 295, __wbg_adapter_26);
1153
+ module.exports.__wbindgen_closure_wrapper2072 = function(arg0, arg1, arg2) {
1154
+ const ret = makeMutClosure(arg0, arg1, 357, __wbg_adapter_26);
1075
1155
  return addHeapObject(ret);
1076
1156
  };
1077
1157