@bitwarden/sdk-internal 0.2.0-main.36 → 0.2.0-main.361

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.
@@ -92,15 +92,6 @@ function getDataViewMemory0() {
92
92
  return cachedDataViewMemory0;
93
93
  }
94
94
 
95
- let cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
96
-
97
- cachedTextDecoder.decode();
98
-
99
- function getStringFromWasm0(ptr, len) {
100
- ptr = ptr >>> 0;
101
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
102
- }
103
-
104
95
  let heap_next = heap.length;
105
96
 
106
97
  function addHeapObject(obj) {
@@ -120,6 +111,19 @@ function handleError(f, args) {
120
111
  }
121
112
  }
122
113
 
114
+ let cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
115
+
116
+ cachedTextDecoder.decode();
117
+
118
+ function getStringFromWasm0(ptr, len) {
119
+ ptr = ptr >>> 0;
120
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
121
+ }
122
+
123
+ function isLikeNone(x) {
124
+ return x === undefined || x === null;
125
+ }
126
+
123
127
  function dropObject(idx) {
124
128
  if (idx < 132) return;
125
129
  heap[idx] = heap_next;
@@ -132,8 +136,9 @@ function takeObject(idx) {
132
136
  return ret;
133
137
  }
134
138
 
135
- function isLikeNone(x) {
136
- return x === undefined || x === null;
139
+ function getArrayU8FromWasm0(ptr, len) {
140
+ ptr = ptr >>> 0;
141
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
137
142
  }
138
143
 
139
144
  const CLOSURE_DTORS =
@@ -232,6 +237,93 @@ function debugString(val) {
232
237
  // TODO we could test for more things here, like `Set`s and `Map`s.
233
238
  return className;
234
239
  }
240
+ /**
241
+ * @param {LogLevel} level
242
+ */
243
+ module.exports.set_log_level = function (level) {
244
+ wasm.set_log_level(level);
245
+ };
246
+
247
+ /**
248
+ * @param {LogLevel | null} [log_level]
249
+ */
250
+ module.exports.init_sdk = function (log_level) {
251
+ wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
252
+ };
253
+
254
+ function passArray8ToWasm0(arg, malloc) {
255
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
256
+ getUint8ArrayMemory0().set(arg, ptr / 1);
257
+ WASM_VECTOR_LEN = arg.length;
258
+ return ptr;
259
+ }
260
+ /**
261
+ * Generate a new SSH key pair
262
+ *
263
+ * # Arguments
264
+ * - `key_algorithm` - The algorithm to use for the key pair
265
+ *
266
+ * # Returns
267
+ * - `Ok(SshKey)` if the key was successfully generated
268
+ * - `Err(KeyGenerationError)` if the key could not be generated
269
+ * @param {KeyAlgorithm} key_algorithm
270
+ * @returns {SshKeyView}
271
+ */
272
+ module.exports.generate_ssh_key = function (key_algorithm) {
273
+ try {
274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
275
+ wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
276
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
277
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
278
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
279
+ if (r2) {
280
+ throw takeObject(r1);
281
+ }
282
+ return takeObject(r0);
283
+ } finally {
284
+ wasm.__wbindgen_add_to_stack_pointer(16);
285
+ }
286
+ };
287
+
288
+ /**
289
+ * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
290
+ * to an OpenSSH private key with public key and fingerprint
291
+ *
292
+ * # Arguments
293
+ * - `imported_key` - The private key to convert
294
+ * - `password` - The password to use for decrypting the key
295
+ *
296
+ * # Returns
297
+ * - `Ok(SshKey)` if the key was successfully coneverted
298
+ * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
299
+ * - `Err(WrongPassword)` if the password provided is incorrect
300
+ * - `Err(ParsingError)` if the key could not be parsed
301
+ * - `Err(UnsupportedKeyType)` if the key type is not supported
302
+ * @param {string} imported_key
303
+ * @param {string | null} [password]
304
+ * @returns {SshKeyView}
305
+ */
306
+ module.exports.import_ssh_key = function (imported_key, password) {
307
+ try {
308
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
309
+ const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
310
+ const len0 = WASM_VECTOR_LEN;
311
+ var ptr1 = isLikeNone(password)
312
+ ? 0
313
+ : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
+ var len1 = WASM_VECTOR_LEN;
315
+ wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
316
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
317
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
318
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
319
+ if (r2) {
320
+ throw takeObject(r1);
321
+ }
322
+ return takeObject(r0);
323
+ } finally {
324
+ wasm.__wbindgen_add_to_stack_pointer(16);
325
+ }
326
+ };
235
327
 
236
328
  let stack_pointer = 128;
237
329
 
@@ -244,9 +336,87 @@ function addBorrowedObject(obj) {
244
336
  * @param {any} error
245
337
  * @returns {boolean}
246
338
  */
247
- module.exports.isCoreError = function (error) {
339
+ module.exports.isTestError = function (error) {
340
+ try {
341
+ const ret = wasm.isTestError(addBorrowedObject(error));
342
+ return ret !== 0;
343
+ } finally {
344
+ heap[stack_pointer++] = undefined;
345
+ }
346
+ };
347
+
348
+ /**
349
+ * @param {any} error
350
+ * @returns {boolean}
351
+ */
352
+ module.exports.isCollectionDecryptError = function (error) {
353
+ try {
354
+ const ret = wasm.isCollectionDecryptError(addBorrowedObject(error));
355
+ return ret !== 0;
356
+ } finally {
357
+ heap[stack_pointer++] = undefined;
358
+ }
359
+ };
360
+
361
+ /**
362
+ * @param {any} error
363
+ * @returns {boolean}
364
+ */
365
+ module.exports.isMasterPasswordError = function (error) {
366
+ try {
367
+ const ret = wasm.isMasterPasswordError(addBorrowedObject(error));
368
+ return ret !== 0;
369
+ } finally {
370
+ heap[stack_pointer++] = undefined;
371
+ }
372
+ };
373
+
374
+ /**
375
+ * @param {any} error
376
+ * @returns {boolean}
377
+ */
378
+ module.exports.isDeriveKeyConnectorError = function (error) {
379
+ try {
380
+ const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
381
+ return ret !== 0;
382
+ } finally {
383
+ heap[stack_pointer++] = undefined;
384
+ }
385
+ };
386
+
387
+ /**
388
+ * @param {any} error
389
+ * @returns {boolean}
390
+ */
391
+ module.exports.isEnrollAdminPasswordResetError = function (error) {
392
+ try {
393
+ const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
394
+ return ret !== 0;
395
+ } finally {
396
+ heap[stack_pointer++] = undefined;
397
+ }
398
+ };
399
+
400
+ /**
401
+ * @param {any} error
402
+ * @returns {boolean}
403
+ */
404
+ module.exports.isCryptoClientError = function (error) {
405
+ try {
406
+ const ret = wasm.isCryptoClientError(addBorrowedObject(error));
407
+ return ret !== 0;
408
+ } finally {
409
+ heap[stack_pointer++] = undefined;
410
+ }
411
+ };
412
+
413
+ /**
414
+ * @param {any} error
415
+ * @returns {boolean}
416
+ */
417
+ module.exports.isStatefulCryptoError = function (error) {
248
418
  try {
249
- const ret = wasm.isCoreError(addBorrowedObject(error));
419
+ const ret = wasm.isStatefulCryptoError(addBorrowedObject(error));
250
420
  return ret !== 0;
251
421
  } finally {
252
422
  heap[stack_pointer++] = undefined;
@@ -270,22 +440,41 @@ module.exports.isEncryptionSettingsError = function (error) {
270
440
  * @param {any} error
271
441
  * @returns {boolean}
272
442
  */
273
- module.exports.isKeyGenerationError = function (error) {
443
+ module.exports.isCryptoError = function (error) {
274
444
  try {
275
- const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
445
+ const ret = wasm.isCryptoError(addBorrowedObject(error));
276
446
  return ret !== 0;
277
447
  } finally {
278
448
  heap[stack_pointer++] = undefined;
279
449
  }
280
450
  };
281
451
 
452
+ function passArrayJsValueToWasm0(array, malloc) {
453
+ const ptr = malloc(array.length * 4, 4) >>> 0;
454
+ const mem = getDataViewMemory0();
455
+ for (let i = 0; i < array.length; i++) {
456
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
457
+ }
458
+ WASM_VECTOR_LEN = array.length;
459
+ return ptr;
460
+ }
461
+
462
+ function getArrayJsValueFromWasm0(ptr, len) {
463
+ ptr = ptr >>> 0;
464
+ const mem = getDataViewMemory0();
465
+ const result = [];
466
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
467
+ result.push(takeObject(mem.getUint32(i, true)));
468
+ }
469
+ return result;
470
+ }
282
471
  /**
283
472
  * @param {any} error
284
473
  * @returns {boolean}
285
474
  */
286
- module.exports.isTestError = function (error) {
475
+ module.exports.isExportError = function (error) {
287
476
  try {
288
- const ret = wasm.isTestError(addBorrowedObject(error));
477
+ const ret = wasm.isExportError(addBorrowedObject(error));
289
478
  return ret !== 0;
290
479
  } finally {
291
480
  heap[stack_pointer++] = undefined;
@@ -293,254 +482,3483 @@ module.exports.isTestError = function (error) {
293
482
  };
294
483
 
295
484
  /**
296
- * @param {KeyAlgorithm} key_algorithm
297
- * @returns {GenerateSshKeyResult}
485
+ * @param {any} error
486
+ * @returns {boolean}
298
487
  */
299
- module.exports.generate_ssh_key = function (key_algorithm) {
488
+ module.exports.isUsernameError = function (error) {
300
489
  try {
301
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
302
- wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
303
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
304
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
305
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
306
- if (r2) {
307
- throw takeObject(r1);
308
- }
309
- return takeObject(r0);
490
+ const ret = wasm.isUsernameError(addBorrowedObject(error));
491
+ return ret !== 0;
310
492
  } finally {
311
- wasm.__wbindgen_add_to_stack_pointer(16);
493
+ heap[stack_pointer++] = undefined;
312
494
  }
313
495
  };
314
496
 
315
- function __wbg_adapter_38(arg0, arg1, arg2) {
316
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb80710307d9edf75(
317
- arg0,
318
- arg1,
319
- addHeapObject(arg2),
320
- );
321
- }
497
+ /**
498
+ * @param {any} error
499
+ * @returns {boolean}
500
+ */
501
+ module.exports.isPasswordError = function (error) {
502
+ try {
503
+ const ret = wasm.isPasswordError(addBorrowedObject(error));
504
+ return ret !== 0;
505
+ } finally {
506
+ heap[stack_pointer++] = undefined;
507
+ }
508
+ };
322
509
 
323
- function __wbg_adapter_125(arg0, arg1, arg2, arg3) {
324
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h1aea760ed40205bc(
325
- arg0,
326
- arg1,
327
- addHeapObject(arg2),
328
- addHeapObject(arg3),
329
- );
510
+ function _assertClass(instance, klass) {
511
+ if (!(instance instanceof klass)) {
512
+ throw new Error(`expected instance of ${klass.name}`);
513
+ }
330
514
  }
515
+ /**
516
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
517
+ * @param {IpcClient} ipc_client
518
+ * @param {DiscoverResponse} response
519
+ * @returns {Promise<void>}
520
+ */
521
+ module.exports.ipcRegisterDiscoverHandler = function (ipc_client, response) {
522
+ _assertClass(ipc_client, IpcClient);
523
+ const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
524
+ return takeObject(ret);
525
+ };
331
526
 
332
527
  /**
333
- * @enum {0 | 1 | 2 | 3 | 4}
528
+ * Sends a DiscoverRequest to the specified destination and returns the response.
529
+ * @param {IpcClient} ipc_client
530
+ * @param {Endpoint} destination
531
+ * @param {AbortSignal | null} [abort_signal]
532
+ * @returns {Promise<DiscoverResponse>}
334
533
  */
335
- module.exports.LogLevel = Object.freeze({
336
- Trace: 0,
337
- 0: "Trace",
338
- Debug: 1,
339
- 1: "Debug",
340
- Info: 2,
341
- 2: "Info",
342
- Warn: 3,
343
- 3: "Warn",
344
- Error: 4,
345
- 4: "Error",
346
- });
534
+ module.exports.ipcRequestDiscover = function (ipc_client, destination, abort_signal) {
535
+ _assertClass(ipc_client, IpcClient);
536
+ const ret = wasm.ipcRequestDiscover(
537
+ ipc_client.__wbg_ptr,
538
+ addHeapObject(destination),
539
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
540
+ );
541
+ return takeObject(ret);
542
+ };
347
543
 
348
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
544
+ /**
545
+ * @param {any} error
546
+ * @returns {boolean}
547
+ */
548
+ module.exports.isChannelError = function (error) {
549
+ try {
550
+ const ret = wasm.isChannelError(addBorrowedObject(error));
551
+ return ret !== 0;
552
+ } finally {
553
+ heap[stack_pointer++] = undefined;
554
+ }
555
+ };
349
556
 
350
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
557
+ /**
558
+ * @param {any} error
559
+ * @returns {boolean}
560
+ */
561
+ module.exports.isDeserializeError = function (error) {
562
+ try {
563
+ const ret = wasm.isDeserializeError(addBorrowedObject(error));
564
+ return ret !== 0;
565
+ } finally {
566
+ heap[stack_pointer++] = undefined;
567
+ }
568
+ };
351
569
 
352
- const BitwardenClientFinalization =
353
- typeof FinalizationRegistry === "undefined"
354
- ? { register: () => {}, unregister: () => {} }
355
- : new FinalizationRegistry((ptr) => wasm.__wbg_bitwardenclient_free(ptr >>> 0, 1));
570
+ /**
571
+ * @param {any} error
572
+ * @returns {boolean}
573
+ */
574
+ module.exports.isRequestError = function (error) {
575
+ try {
576
+ const ret = wasm.isRequestError(addBorrowedObject(error));
577
+ return ret !== 0;
578
+ } finally {
579
+ heap[stack_pointer++] = undefined;
580
+ }
581
+ };
356
582
 
357
- class BitwardenClient {
358
- __destroy_into_raw() {
359
- const ptr = this.__wbg_ptr;
360
- this.__wbg_ptr = 0;
361
- BitwardenClientFinalization.unregister(this);
362
- return ptr;
583
+ /**
584
+ * @param {any} error
585
+ * @returns {boolean}
586
+ */
587
+ module.exports.isTypedReceiveError = function (error) {
588
+ try {
589
+ const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
590
+ return ret !== 0;
591
+ } finally {
592
+ heap[stack_pointer++] = undefined;
363
593
  }
594
+ };
364
595
 
365
- free() {
596
+ /**
597
+ * @param {any} error
598
+ * @returns {boolean}
599
+ */
600
+ module.exports.isReceiveError = function (error) {
601
+ try {
602
+ const ret = wasm.isReceiveError(addBorrowedObject(error));
603
+ return ret !== 0;
604
+ } finally {
605
+ heap[stack_pointer++] = undefined;
606
+ }
607
+ };
608
+
609
+ /**
610
+ * @param {any} error
611
+ * @returns {boolean}
612
+ */
613
+ module.exports.isSubscribeError = function (error) {
614
+ try {
615
+ const ret = wasm.isSubscribeError(addBorrowedObject(error));
616
+ return ret !== 0;
617
+ } finally {
618
+ heap[stack_pointer++] = undefined;
619
+ }
620
+ };
621
+
622
+ /**
623
+ * @param {any} error
624
+ * @returns {boolean}
625
+ */
626
+ module.exports.isSshKeyExportError = function (error) {
627
+ try {
628
+ const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
629
+ return ret !== 0;
630
+ } finally {
631
+ heap[stack_pointer++] = undefined;
632
+ }
633
+ };
634
+
635
+ /**
636
+ * @param {any} error
637
+ * @returns {boolean}
638
+ */
639
+ module.exports.isSshKeyImportError = function (error) {
640
+ try {
641
+ const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
642
+ return ret !== 0;
643
+ } finally {
644
+ heap[stack_pointer++] = undefined;
645
+ }
646
+ };
647
+
648
+ /**
649
+ * @param {any} error
650
+ * @returns {boolean}
651
+ */
652
+ module.exports.isKeyGenerationError = function (error) {
653
+ try {
654
+ const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
655
+ return ret !== 0;
656
+ } finally {
657
+ heap[stack_pointer++] = undefined;
658
+ }
659
+ };
660
+
661
+ /**
662
+ * @param {any} error
663
+ * @returns {boolean}
664
+ */
665
+ module.exports.isDatabaseError = function (error) {
666
+ try {
667
+ const ret = wasm.isDatabaseError(addBorrowedObject(error));
668
+ return ret !== 0;
669
+ } finally {
670
+ heap[stack_pointer++] = undefined;
671
+ }
672
+ };
673
+
674
+ /**
675
+ * @param {any} error
676
+ * @returns {boolean}
677
+ */
678
+ module.exports.isStateRegistryError = function (error) {
679
+ try {
680
+ const ret = wasm.isStateRegistryError(addBorrowedObject(error));
681
+ return ret !== 0;
682
+ } finally {
683
+ heap[stack_pointer++] = undefined;
684
+ }
685
+ };
686
+
687
+ /**
688
+ * @param {any} error
689
+ * @returns {boolean}
690
+ */
691
+ module.exports.isCallError = function (error) {
692
+ try {
693
+ const ret = wasm.isCallError(addBorrowedObject(error));
694
+ return ret !== 0;
695
+ } finally {
696
+ heap[stack_pointer++] = undefined;
697
+ }
698
+ };
699
+
700
+ /**
701
+ * @param {any} error
702
+ * @returns {boolean}
703
+ */
704
+ module.exports.isDecryptError = function (error) {
705
+ try {
706
+ const ret = wasm.isDecryptError(addBorrowedObject(error));
707
+ return ret !== 0;
708
+ } finally {
709
+ heap[stack_pointer++] = undefined;
710
+ }
711
+ };
712
+
713
+ /**
714
+ * @param {any} error
715
+ * @returns {boolean}
716
+ */
717
+ module.exports.isEncryptError = function (error) {
718
+ try {
719
+ const ret = wasm.isEncryptError(addBorrowedObject(error));
720
+ return ret !== 0;
721
+ } finally {
722
+ heap[stack_pointer++] = undefined;
723
+ }
724
+ };
725
+
726
+ /**
727
+ * @param {any} error
728
+ * @returns {boolean}
729
+ */
730
+ module.exports.isTotpError = function (error) {
731
+ try {
732
+ const ret = wasm.isTotpError(addBorrowedObject(error));
733
+ return ret !== 0;
734
+ } finally {
735
+ heap[stack_pointer++] = undefined;
736
+ }
737
+ };
738
+
739
+ /**
740
+ * @param {any} error
741
+ * @returns {boolean}
742
+ */
743
+ module.exports.isGetFolderError = function (error) {
744
+ try {
745
+ const ret = wasm.isGetFolderError(addBorrowedObject(error));
746
+ return ret !== 0;
747
+ } finally {
748
+ heap[stack_pointer++] = undefined;
749
+ }
750
+ };
751
+
752
+ /**
753
+ * @param {any} error
754
+ * @returns {boolean}
755
+ */
756
+ module.exports.isEditFolderError = function (error) {
757
+ try {
758
+ const ret = wasm.isEditFolderError(addBorrowedObject(error));
759
+ return ret !== 0;
760
+ } finally {
761
+ heap[stack_pointer++] = undefined;
762
+ }
763
+ };
764
+
765
+ /**
766
+ * @param {any} error
767
+ * @returns {boolean}
768
+ */
769
+ module.exports.isCreateFolderError = function (error) {
770
+ try {
771
+ const ret = wasm.isCreateFolderError(addBorrowedObject(error));
772
+ return ret !== 0;
773
+ } finally {
774
+ heap[stack_pointer++] = undefined;
775
+ }
776
+ };
777
+
778
+ /**
779
+ * @param {any} error
780
+ * @returns {boolean}
781
+ */
782
+ module.exports.isGetCipherError = function (error) {
783
+ try {
784
+ const ret = wasm.isGetCipherError(addBorrowedObject(error));
785
+ return ret !== 0;
786
+ } finally {
787
+ heap[stack_pointer++] = undefined;
788
+ }
789
+ };
790
+
791
+ /**
792
+ * @param {any} error
793
+ * @returns {boolean}
794
+ */
795
+ module.exports.isEditCipherError = function (error) {
796
+ try {
797
+ const ret = wasm.isEditCipherError(addBorrowedObject(error));
798
+ return ret !== 0;
799
+ } finally {
800
+ heap[stack_pointer++] = undefined;
801
+ }
802
+ };
803
+
804
+ /**
805
+ * @param {any} error
806
+ * @returns {boolean}
807
+ */
808
+ module.exports.isCreateCipherError = function (error) {
809
+ try {
810
+ const ret = wasm.isCreateCipherError(addBorrowedObject(error));
811
+ return ret !== 0;
812
+ } finally {
813
+ heap[stack_pointer++] = undefined;
814
+ }
815
+ };
816
+
817
+ /**
818
+ * @param {any} error
819
+ * @returns {boolean}
820
+ */
821
+ module.exports.isCipherError = function (error) {
822
+ try {
823
+ const ret = wasm.isCipherError(addBorrowedObject(error));
824
+ return ret !== 0;
825
+ } finally {
826
+ heap[stack_pointer++] = undefined;
827
+ }
828
+ };
829
+
830
+ /**
831
+ * @param {any} error
832
+ * @returns {boolean}
833
+ */
834
+ module.exports.isDecryptFileError = function (error) {
835
+ try {
836
+ const ret = wasm.isDecryptFileError(addBorrowedObject(error));
837
+ return ret !== 0;
838
+ } finally {
839
+ heap[stack_pointer++] = undefined;
840
+ }
841
+ };
842
+
843
+ /**
844
+ * @param {any} error
845
+ * @returns {boolean}
846
+ */
847
+ module.exports.isEncryptFileError = function (error) {
848
+ try {
849
+ const ret = wasm.isEncryptFileError(addBorrowedObject(error));
850
+ return ret !== 0;
851
+ } finally {
852
+ heap[stack_pointer++] = undefined;
853
+ }
854
+ };
855
+
856
+ function __wbg_adapter_54(arg0, arg1, arg2) {
857
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h73da98aaeb1dd73e(
858
+ arg0,
859
+ arg1,
860
+ addHeapObject(arg2),
861
+ );
862
+ }
863
+
864
+ function __wbg_adapter_57(arg0, arg1, arg2) {
865
+ try {
866
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
867
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8ea2596275819f2b(
868
+ retptr,
869
+ arg0,
870
+ arg1,
871
+ addHeapObject(arg2),
872
+ );
873
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
874
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
875
+ if (r1) {
876
+ throw takeObject(r0);
877
+ }
878
+ } finally {
879
+ wasm.__wbindgen_add_to_stack_pointer(16);
880
+ }
881
+ }
882
+
883
+ function __wbg_adapter_60(arg0, arg1) {
884
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h091423ccfc08366e(
885
+ arg0,
886
+ arg1,
887
+ );
888
+ }
889
+
890
+ function __wbg_adapter_346(arg0, arg1, arg2, arg3) {
891
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
892
+ arg0,
893
+ arg1,
894
+ addHeapObject(arg2),
895
+ addHeapObject(arg3),
896
+ );
897
+ }
898
+
899
+ /**
900
+ * @enum {300 | 301 | 302 | 303 | 304 | 305}
901
+ */
902
+ module.exports.CardLinkedIdType = Object.freeze({
903
+ CardholderName: 300,
904
+ 300: "CardholderName",
905
+ ExpMonth: 301,
906
+ 301: "ExpMonth",
907
+ ExpYear: 302,
908
+ 302: "ExpYear",
909
+ Code: 303,
910
+ 303: "Code",
911
+ Brand: 304,
912
+ 304: "Brand",
913
+ Number: 305,
914
+ 305: "Number",
915
+ });
916
+ /**
917
+ * @enum {0 | 1}
918
+ */
919
+ module.exports.CipherRepromptType = Object.freeze({
920
+ None: 0,
921
+ 0: "None",
922
+ Password: 1,
923
+ 1: "Password",
924
+ });
925
+ /**
926
+ * @enum {1 | 2 | 3 | 4 | 5}
927
+ */
928
+ module.exports.CipherType = Object.freeze({
929
+ Login: 1,
930
+ 1: "Login",
931
+ SecureNote: 2,
932
+ 2: "SecureNote",
933
+ Card: 3,
934
+ 3: "Card",
935
+ Identity: 4,
936
+ 4: "Identity",
937
+ SshKey: 5,
938
+ 5: "SshKey",
939
+ });
940
+ /**
941
+ * Represents the type of a [FieldView].
942
+ * @enum {0 | 1 | 2 | 3}
943
+ */
944
+ module.exports.FieldType = Object.freeze({
945
+ /**
946
+ * Text field
947
+ */
948
+ Text: 0,
949
+ 0: "Text",
950
+ /**
951
+ * Hidden text field
952
+ */
953
+ Hidden: 1,
954
+ 1: "Hidden",
955
+ /**
956
+ * Boolean field
957
+ */
958
+ Boolean: 2,
959
+ 2: "Boolean",
960
+ /**
961
+ * Linked field
962
+ */
963
+ Linked: 3,
964
+ 3: "Linked",
965
+ });
966
+ /**
967
+ * @enum {400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418}
968
+ */
969
+ module.exports.IdentityLinkedIdType = Object.freeze({
970
+ Title: 400,
971
+ 400: "Title",
972
+ MiddleName: 401,
973
+ 401: "MiddleName",
974
+ Address1: 402,
975
+ 402: "Address1",
976
+ Address2: 403,
977
+ 403: "Address2",
978
+ Address3: 404,
979
+ 404: "Address3",
980
+ City: 405,
981
+ 405: "City",
982
+ State: 406,
983
+ 406: "State",
984
+ PostalCode: 407,
985
+ 407: "PostalCode",
986
+ Country: 408,
987
+ 408: "Country",
988
+ Company: 409,
989
+ 409: "Company",
990
+ Email: 410,
991
+ 410: "Email",
992
+ Phone: 411,
993
+ 411: "Phone",
994
+ Ssn: 412,
995
+ 412: "Ssn",
996
+ Username: 413,
997
+ 413: "Username",
998
+ PassportNumber: 414,
999
+ 414: "PassportNumber",
1000
+ LicenseNumber: 415,
1001
+ 415: "LicenseNumber",
1002
+ FirstName: 416,
1003
+ 416: "FirstName",
1004
+ LastName: 417,
1005
+ 417: "LastName",
1006
+ FullName: 418,
1007
+ 418: "FullName",
1008
+ });
1009
+ /**
1010
+ * @enum {0 | 1 | 2 | 3 | 4}
1011
+ */
1012
+ module.exports.LogLevel = Object.freeze({
1013
+ Trace: 0,
1014
+ 0: "Trace",
1015
+ Debug: 1,
1016
+ 1: "Debug",
1017
+ Info: 2,
1018
+ 2: "Info",
1019
+ Warn: 3,
1020
+ 3: "Warn",
1021
+ Error: 4,
1022
+ 4: "Error",
1023
+ });
1024
+ /**
1025
+ * @enum {100 | 101}
1026
+ */
1027
+ module.exports.LoginLinkedIdType = Object.freeze({
1028
+ Username: 100,
1029
+ 100: "Username",
1030
+ Password: 101,
1031
+ 101: "Password",
1032
+ });
1033
+ /**
1034
+ * @enum {0}
1035
+ */
1036
+ module.exports.SecureNoteType = Object.freeze({
1037
+ Generic: 0,
1038
+ 0: "Generic",
1039
+ });
1040
+ /**
1041
+ * @enum {0 | 1 | 2 | 3 | 4 | 5}
1042
+ */
1043
+ module.exports.UriMatchType = Object.freeze({
1044
+ Domain: 0,
1045
+ 0: "Domain",
1046
+ Host: 1,
1047
+ 1: "Host",
1048
+ StartsWith: 2,
1049
+ 2: "StartsWith",
1050
+ Exact: 3,
1051
+ 3: "Exact",
1052
+ RegularExpression: 4,
1053
+ 4: "RegularExpression",
1054
+ Never: 5,
1055
+ 5: "Never",
1056
+ });
1057
+
1058
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
1059
+
1060
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
1061
+
1062
+ const AttachmentsClientFinalization =
1063
+ typeof FinalizationRegistry === "undefined"
1064
+ ? { register: () => {}, unregister: () => {} }
1065
+ : new FinalizationRegistry((ptr) => wasm.__wbg_attachmentsclient_free(ptr >>> 0, 1));
1066
+
1067
+ class AttachmentsClient {
1068
+ static __wrap(ptr) {
1069
+ ptr = ptr >>> 0;
1070
+ const obj = Object.create(AttachmentsClient.prototype);
1071
+ obj.__wbg_ptr = ptr;
1072
+ AttachmentsClientFinalization.register(obj, obj.__wbg_ptr, obj);
1073
+ return obj;
1074
+ }
1075
+
1076
+ __destroy_into_raw() {
1077
+ const ptr = this.__wbg_ptr;
1078
+ this.__wbg_ptr = 0;
1079
+ AttachmentsClientFinalization.unregister(this);
1080
+ return ptr;
1081
+ }
1082
+
1083
+ free() {
1084
+ const ptr = this.__destroy_into_raw();
1085
+ wasm.__wbg_attachmentsclient_free(ptr, 0);
1086
+ }
1087
+ /**
1088
+ * @param {Cipher} cipher
1089
+ * @param {AttachmentView} attachment
1090
+ * @param {Uint8Array} encrypted_buffer
1091
+ * @returns {Uint8Array}
1092
+ */
1093
+ decrypt_buffer(cipher, attachment, encrypted_buffer) {
1094
+ try {
1095
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1096
+ const ptr0 = passArray8ToWasm0(encrypted_buffer, wasm.__wbindgen_malloc);
1097
+ const len0 = WASM_VECTOR_LEN;
1098
+ wasm.attachmentsclient_decrypt_buffer(
1099
+ retptr,
1100
+ this.__wbg_ptr,
1101
+ addHeapObject(cipher),
1102
+ addHeapObject(attachment),
1103
+ ptr0,
1104
+ len0,
1105
+ );
1106
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1107
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1108
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1109
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1110
+ if (r3) {
1111
+ throw takeObject(r2);
1112
+ }
1113
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
1114
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
1115
+ return v2;
1116
+ } finally {
1117
+ wasm.__wbindgen_add_to_stack_pointer(16);
1118
+ }
1119
+ }
1120
+ }
1121
+ module.exports.AttachmentsClient = AttachmentsClient;
1122
+
1123
+ const AuthClientFinalization =
1124
+ typeof FinalizationRegistry === "undefined"
1125
+ ? { register: () => {}, unregister: () => {} }
1126
+ : new FinalizationRegistry((ptr) => wasm.__wbg_authclient_free(ptr >>> 0, 1));
1127
+ /**
1128
+ * Subclient containing auth functionality.
1129
+ */
1130
+ class AuthClient {
1131
+ static __wrap(ptr) {
1132
+ ptr = ptr >>> 0;
1133
+ const obj = Object.create(AuthClient.prototype);
1134
+ obj.__wbg_ptr = ptr;
1135
+ AuthClientFinalization.register(obj, obj.__wbg_ptr, obj);
1136
+ return obj;
1137
+ }
1138
+
1139
+ __destroy_into_raw() {
1140
+ const ptr = this.__wbg_ptr;
1141
+ this.__wbg_ptr = 0;
1142
+ AuthClientFinalization.unregister(this);
1143
+ return ptr;
1144
+ }
1145
+
1146
+ free() {
1147
+ const ptr = this.__destroy_into_raw();
1148
+ wasm.__wbg_authclient_free(ptr, 0);
1149
+ }
1150
+ /**
1151
+ * Client for send access functionality
1152
+ * @returns {SendAccessClient}
1153
+ */
1154
+ send_access() {
1155
+ const ret = wasm.authclient_send_access(this.__wbg_ptr);
1156
+ return SendAccessClient.__wrap(ret);
1157
+ }
1158
+ }
1159
+ module.exports.AuthClient = AuthClient;
1160
+
1161
+ const BitwardenClientFinalization =
1162
+ typeof FinalizationRegistry === "undefined"
1163
+ ? { register: () => {}, unregister: () => {} }
1164
+ : new FinalizationRegistry((ptr) => wasm.__wbg_bitwardenclient_free(ptr >>> 0, 1));
1165
+ /**
1166
+ * The main entry point for the Bitwarden SDK in WebAssembly environments
1167
+ */
1168
+ class BitwardenClient {
1169
+ __destroy_into_raw() {
1170
+ const ptr = this.__wbg_ptr;
1171
+ this.__wbg_ptr = 0;
1172
+ BitwardenClientFinalization.unregister(this);
1173
+ return ptr;
1174
+ }
1175
+
1176
+ free() {
1177
+ const ptr = this.__destroy_into_raw();
1178
+ wasm.__wbg_bitwardenclient_free(ptr, 0);
1179
+ }
1180
+ /**
1181
+ * Initialize a new instance of the SDK client
1182
+ * @param {any} token_provider
1183
+ * @param {ClientSettings | null} [settings]
1184
+ */
1185
+ constructor(token_provider, settings) {
1186
+ const ret = wasm.bitwardenclient_new(
1187
+ addHeapObject(token_provider),
1188
+ isLikeNone(settings) ? 0 : addHeapObject(settings),
1189
+ );
1190
+ this.__wbg_ptr = ret >>> 0;
1191
+ BitwardenClientFinalization.register(this, this.__wbg_ptr, this);
1192
+ return this;
1193
+ }
1194
+ /**
1195
+ * Test method, echoes back the input
1196
+ * @param {string} msg
1197
+ * @returns {string}
1198
+ */
1199
+ echo(msg) {
1200
+ let deferred2_0;
1201
+ let deferred2_1;
1202
+ try {
1203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1204
+ const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1205
+ const len0 = WASM_VECTOR_LEN;
1206
+ wasm.bitwardenclient_echo(retptr, this.__wbg_ptr, ptr0, len0);
1207
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1208
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1209
+ deferred2_0 = r0;
1210
+ deferred2_1 = r1;
1211
+ return getStringFromWasm0(r0, r1);
1212
+ } finally {
1213
+ wasm.__wbindgen_add_to_stack_pointer(16);
1214
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1215
+ }
1216
+ }
1217
+ /**
1218
+ * Returns the current SDK version
1219
+ * @returns {string}
1220
+ */
1221
+ version() {
1222
+ let deferred1_0;
1223
+ let deferred1_1;
1224
+ try {
1225
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1226
+ wasm.bitwardenclient_version(retptr, this.__wbg_ptr);
1227
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1228
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1229
+ deferred1_0 = r0;
1230
+ deferred1_1 = r1;
1231
+ return getStringFromWasm0(r0, r1);
1232
+ } finally {
1233
+ wasm.__wbindgen_add_to_stack_pointer(16);
1234
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1235
+ }
1236
+ }
1237
+ /**
1238
+ * Test method, always throws an error
1239
+ * @param {string} msg
1240
+ */
1241
+ throw(msg) {
1242
+ try {
1243
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1244
+ const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1245
+ const len0 = WASM_VECTOR_LEN;
1246
+ wasm.bitwardenclient_throw(retptr, this.__wbg_ptr, ptr0, len0);
1247
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1248
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1249
+ if (r1) {
1250
+ throw takeObject(r0);
1251
+ }
1252
+ } finally {
1253
+ wasm.__wbindgen_add_to_stack_pointer(16);
1254
+ }
1255
+ }
1256
+ /**
1257
+ * Test method, calls http endpoint
1258
+ * @param {string} url
1259
+ * @returns {Promise<string>}
1260
+ */
1261
+ http_get(url) {
1262
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1263
+ const len0 = WASM_VECTOR_LEN;
1264
+ const ret = wasm.bitwardenclient_http_get(this.__wbg_ptr, ptr0, len0);
1265
+ return takeObject(ret);
1266
+ }
1267
+ /**
1268
+ * Auth related operations.
1269
+ * @returns {AuthClient}
1270
+ */
1271
+ auth() {
1272
+ const ret = wasm.bitwardenclient_auth(this.__wbg_ptr);
1273
+ return AuthClient.__wrap(ret);
1274
+ }
1275
+ /**
1276
+ * Crypto related operations.
1277
+ * @returns {CryptoClient}
1278
+ */
1279
+ crypto() {
1280
+ const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1281
+ return CryptoClient.__wrap(ret);
1282
+ }
1283
+ /**
1284
+ * Vault item related operations.
1285
+ * @returns {VaultClient}
1286
+ */
1287
+ vault() {
1288
+ const ret = wasm.bitwardenclient_vault(this.__wbg_ptr);
1289
+ return VaultClient.__wrap(ret);
1290
+ }
1291
+ /**
1292
+ * Constructs a specific client for platform-specific functionality
1293
+ * @returns {PlatformClient}
1294
+ */
1295
+ platform() {
1296
+ const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
1297
+ return PlatformClient.__wrap(ret);
1298
+ }
1299
+ /**
1300
+ * Constructs a specific client for generating passwords and passphrases
1301
+ * @returns {GeneratorClient}
1302
+ */
1303
+ generator() {
1304
+ const ret = wasm.bitwardenclient_generator(this.__wbg_ptr);
1305
+ return GeneratorClient.__wrap(ret);
1306
+ }
1307
+ /**
1308
+ * Exporter related operations.
1309
+ * @returns {ExporterClient}
1310
+ */
1311
+ exporters() {
1312
+ const ret = wasm.bitwardenclient_exporters(this.__wbg_ptr);
1313
+ return ExporterClient.__wrap(ret);
1314
+ }
1315
+ }
1316
+ module.exports.BitwardenClient = BitwardenClient;
1317
+
1318
+ const CiphersClientFinalization =
1319
+ typeof FinalizationRegistry === "undefined"
1320
+ ? { register: () => {}, unregister: () => {} }
1321
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ciphersclient_free(ptr >>> 0, 1));
1322
+
1323
+ class CiphersClient {
1324
+ static __wrap(ptr) {
1325
+ ptr = ptr >>> 0;
1326
+ const obj = Object.create(CiphersClient.prototype);
1327
+ obj.__wbg_ptr = ptr;
1328
+ CiphersClientFinalization.register(obj, obj.__wbg_ptr, obj);
1329
+ return obj;
1330
+ }
1331
+
1332
+ __destroy_into_raw() {
1333
+ const ptr = this.__wbg_ptr;
1334
+ this.__wbg_ptr = 0;
1335
+ CiphersClientFinalization.unregister(this);
1336
+ return ptr;
1337
+ }
1338
+
1339
+ free() {
1340
+ const ptr = this.__destroy_into_raw();
1341
+ wasm.__wbg_ciphersclient_free(ptr, 0);
1342
+ }
1343
+ /**
1344
+ * Create a new [Cipher] and save it to the server.
1345
+ * @param {CipherCreateRequest} request
1346
+ * @returns {Promise<CipherView>}
1347
+ */
1348
+ create(request) {
1349
+ const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1350
+ return takeObject(ret);
1351
+ }
1352
+ /**
1353
+ * Edit an existing [Cipher] and save it to the server.
1354
+ * @param {CipherEditRequest} request
1355
+ * @returns {Promise<CipherView>}
1356
+ */
1357
+ edit(request) {
1358
+ const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1359
+ return takeObject(ret);
1360
+ }
1361
+ /**
1362
+ * @param {CipherView} cipher_view
1363
+ * @returns {EncryptionContext}
1364
+ */
1365
+ encrypt(cipher_view) {
1366
+ try {
1367
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1368
+ wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1369
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1370
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1371
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1372
+ if (r2) {
1373
+ throw takeObject(r1);
1374
+ }
1375
+ return takeObject(r0);
1376
+ } finally {
1377
+ wasm.__wbindgen_add_to_stack_pointer(16);
1378
+ }
1379
+ }
1380
+ /**
1381
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1382
+ * keys in the Web client.
1383
+ *
1384
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1385
+ * symmetric key in base64 format. See PM-23084
1386
+ *
1387
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1388
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1389
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1390
+ * key directly.
1391
+ * @param {CipherView} cipher_view
1392
+ * @param {B64} new_key
1393
+ * @returns {EncryptionContext}
1394
+ */
1395
+ encrypt_cipher_for_rotation(cipher_view, new_key) {
1396
+ try {
1397
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1398
+ wasm.ciphersclient_encrypt_cipher_for_rotation(
1399
+ retptr,
1400
+ this.__wbg_ptr,
1401
+ addHeapObject(cipher_view),
1402
+ addHeapObject(new_key),
1403
+ );
1404
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1405
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1406
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1407
+ if (r2) {
1408
+ throw takeObject(r1);
1409
+ }
1410
+ return takeObject(r0);
1411
+ } finally {
1412
+ wasm.__wbindgen_add_to_stack_pointer(16);
1413
+ }
1414
+ }
1415
+ /**
1416
+ * @param {Cipher} cipher
1417
+ * @returns {CipherView}
1418
+ */
1419
+ decrypt(cipher) {
1420
+ try {
1421
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1422
+ wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1423
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1424
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1425
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1426
+ if (r2) {
1427
+ throw takeObject(r1);
1428
+ }
1429
+ return takeObject(r0);
1430
+ } finally {
1431
+ wasm.__wbindgen_add_to_stack_pointer(16);
1432
+ }
1433
+ }
1434
+ /**
1435
+ * @param {Cipher[]} ciphers
1436
+ * @returns {CipherListView[]}
1437
+ */
1438
+ decrypt_list(ciphers) {
1439
+ try {
1440
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1441
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1442
+ const len0 = WASM_VECTOR_LEN;
1443
+ wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1444
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1445
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1446
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1447
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1448
+ if (r3) {
1449
+ throw takeObject(r2);
1450
+ }
1451
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1452
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1453
+ return v2;
1454
+ } finally {
1455
+ wasm.__wbindgen_add_to_stack_pointer(16);
1456
+ }
1457
+ }
1458
+ /**
1459
+ * Decrypt cipher list with failures
1460
+ * Returns both successfully decrypted ciphers and any that failed to decrypt
1461
+ * @param {Cipher[]} ciphers
1462
+ * @returns {DecryptCipherListResult}
1463
+ */
1464
+ decrypt_list_with_failures(ciphers) {
1465
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1466
+ const len0 = WASM_VECTOR_LEN;
1467
+ const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1468
+ return takeObject(ret);
1469
+ }
1470
+ /**
1471
+ * @param {CipherView} cipher_view
1472
+ * @returns {Fido2CredentialView[]}
1473
+ */
1474
+ decrypt_fido2_credentials(cipher_view) {
1475
+ try {
1476
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1477
+ wasm.ciphersclient_decrypt_fido2_credentials(
1478
+ retptr,
1479
+ this.__wbg_ptr,
1480
+ addHeapObject(cipher_view),
1481
+ );
1482
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1483
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1484
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1485
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1486
+ if (r3) {
1487
+ throw takeObject(r2);
1488
+ }
1489
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1490
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1491
+ return v1;
1492
+ } finally {
1493
+ wasm.__wbindgen_add_to_stack_pointer(16);
1494
+ }
1495
+ }
1496
+ /**
1497
+ * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1498
+ * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1499
+ * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1500
+ * encrypting the rest of the CipherView.
1501
+ * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1502
+ * @param {CipherView} cipher_view
1503
+ * @param {Fido2CredentialFullView[]} fido2_credentials
1504
+ * @returns {CipherView}
1505
+ */
1506
+ set_fido2_credentials(cipher_view, fido2_credentials) {
1507
+ try {
1508
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1509
+ const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1510
+ const len0 = WASM_VECTOR_LEN;
1511
+ wasm.ciphersclient_set_fido2_credentials(
1512
+ retptr,
1513
+ this.__wbg_ptr,
1514
+ addHeapObject(cipher_view),
1515
+ ptr0,
1516
+ len0,
1517
+ );
1518
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1519
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1520
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1521
+ if (r2) {
1522
+ throw takeObject(r1);
1523
+ }
1524
+ return takeObject(r0);
1525
+ } finally {
1526
+ wasm.__wbindgen_add_to_stack_pointer(16);
1527
+ }
1528
+ }
1529
+ /**
1530
+ * @param {CipherView} cipher_view
1531
+ * @param {OrganizationId} organization_id
1532
+ * @returns {CipherView}
1533
+ */
1534
+ move_to_organization(cipher_view, organization_id) {
1535
+ try {
1536
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1537
+ wasm.ciphersclient_move_to_organization(
1538
+ retptr,
1539
+ this.__wbg_ptr,
1540
+ addHeapObject(cipher_view),
1541
+ addHeapObject(organization_id),
1542
+ );
1543
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1544
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1545
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1546
+ if (r2) {
1547
+ throw takeObject(r1);
1548
+ }
1549
+ return takeObject(r0);
1550
+ } finally {
1551
+ wasm.__wbindgen_add_to_stack_pointer(16);
1552
+ }
1553
+ }
1554
+ /**
1555
+ * @param {CipherView} cipher_view
1556
+ * @returns {string}
1557
+ */
1558
+ decrypt_fido2_private_key(cipher_view) {
1559
+ let deferred2_0;
1560
+ let deferred2_1;
1561
+ try {
1562
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1563
+ wasm.ciphersclient_decrypt_fido2_private_key(
1564
+ retptr,
1565
+ this.__wbg_ptr,
1566
+ addHeapObject(cipher_view),
1567
+ );
1568
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1569
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1570
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1571
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1572
+ var ptr1 = r0;
1573
+ var len1 = r1;
1574
+ if (r3) {
1575
+ ptr1 = 0;
1576
+ len1 = 0;
1577
+ throw takeObject(r2);
1578
+ }
1579
+ deferred2_0 = ptr1;
1580
+ deferred2_1 = len1;
1581
+ return getStringFromWasm0(ptr1, len1);
1582
+ } finally {
1583
+ wasm.__wbindgen_add_to_stack_pointer(16);
1584
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1585
+ }
1586
+ }
1587
+ }
1588
+ module.exports.CiphersClient = CiphersClient;
1589
+
1590
+ const CollectionViewNodeItemFinalization =
1591
+ typeof FinalizationRegistry === "undefined"
1592
+ ? { register: () => {}, unregister: () => {} }
1593
+ : new FinalizationRegistry((ptr) => wasm.__wbg_collectionviewnodeitem_free(ptr >>> 0, 1));
1594
+
1595
+ class CollectionViewNodeItem {
1596
+ static __wrap(ptr) {
1597
+ ptr = ptr >>> 0;
1598
+ const obj = Object.create(CollectionViewNodeItem.prototype);
1599
+ obj.__wbg_ptr = ptr;
1600
+ CollectionViewNodeItemFinalization.register(obj, obj.__wbg_ptr, obj);
1601
+ return obj;
1602
+ }
1603
+
1604
+ __destroy_into_raw() {
1605
+ const ptr = this.__wbg_ptr;
1606
+ this.__wbg_ptr = 0;
1607
+ CollectionViewNodeItemFinalization.unregister(this);
1608
+ return ptr;
1609
+ }
1610
+
1611
+ free() {
1612
+ const ptr = this.__destroy_into_raw();
1613
+ wasm.__wbg_collectionviewnodeitem_free(ptr, 0);
1614
+ }
1615
+ /**
1616
+ * @returns {CollectionView}
1617
+ */
1618
+ get_item() {
1619
+ const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1620
+ return takeObject(ret);
1621
+ }
1622
+ /**
1623
+ * @returns {CollectionView | undefined}
1624
+ */
1625
+ get_parent() {
1626
+ const ret = wasm.collectionviewnodeitem_get_parent(this.__wbg_ptr);
1627
+ return takeObject(ret);
1628
+ }
1629
+ /**
1630
+ * @returns {CollectionView[]}
1631
+ */
1632
+ get_children() {
1633
+ try {
1634
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1635
+ wasm.collectionviewnodeitem_get_children(retptr, this.__wbg_ptr);
1636
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1637
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1638
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1639
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1640
+ return v1;
1641
+ } finally {
1642
+ wasm.__wbindgen_add_to_stack_pointer(16);
1643
+ }
1644
+ }
1645
+ /**
1646
+ * @returns {AncestorMap}
1647
+ */
1648
+ get_ancestors() {
1649
+ const ret = wasm.collectionviewnodeitem_get_ancestors(this.__wbg_ptr);
1650
+ return takeObject(ret);
1651
+ }
1652
+ }
1653
+ module.exports.CollectionViewNodeItem = CollectionViewNodeItem;
1654
+
1655
+ const CollectionViewTreeFinalization =
1656
+ typeof FinalizationRegistry === "undefined"
1657
+ ? { register: () => {}, unregister: () => {} }
1658
+ : new FinalizationRegistry((ptr) => wasm.__wbg_collectionviewtree_free(ptr >>> 0, 1));
1659
+
1660
+ class CollectionViewTree {
1661
+ static __wrap(ptr) {
1662
+ ptr = ptr >>> 0;
1663
+ const obj = Object.create(CollectionViewTree.prototype);
1664
+ obj.__wbg_ptr = ptr;
1665
+ CollectionViewTreeFinalization.register(obj, obj.__wbg_ptr, obj);
1666
+ return obj;
1667
+ }
1668
+
1669
+ __destroy_into_raw() {
1670
+ const ptr = this.__wbg_ptr;
1671
+ this.__wbg_ptr = 0;
1672
+ CollectionViewTreeFinalization.unregister(this);
1673
+ return ptr;
1674
+ }
1675
+
1676
+ free() {
1677
+ const ptr = this.__destroy_into_raw();
1678
+ wasm.__wbg_collectionviewtree_free(ptr, 0);
1679
+ }
1680
+ /**
1681
+ * @param {CollectionView} collection_view
1682
+ * @returns {CollectionViewNodeItem | undefined}
1683
+ */
1684
+ get_item_for_view(collection_view) {
1685
+ const ret = wasm.collectionviewtree_get_item_for_view(
1686
+ this.__wbg_ptr,
1687
+ addHeapObject(collection_view),
1688
+ );
1689
+ return ret === 0 ? undefined : CollectionViewNodeItem.__wrap(ret);
1690
+ }
1691
+ /**
1692
+ * @returns {CollectionViewNodeItem[]}
1693
+ */
1694
+ get_root_items() {
1695
+ try {
1696
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1697
+ wasm.collectionviewtree_get_root_items(retptr, this.__wbg_ptr);
1698
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1699
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1700
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1701
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1702
+ return v1;
1703
+ } finally {
1704
+ wasm.__wbindgen_add_to_stack_pointer(16);
1705
+ }
1706
+ }
1707
+ /**
1708
+ * @returns {CollectionViewNodeItem[]}
1709
+ */
1710
+ get_flat_items() {
1711
+ try {
1712
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1713
+ wasm.collectionviewtree_get_flat_items(retptr, this.__wbg_ptr);
1714
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1715
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1716
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1717
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1718
+ return v1;
1719
+ } finally {
1720
+ wasm.__wbindgen_add_to_stack_pointer(16);
1721
+ }
1722
+ }
1723
+ }
1724
+ module.exports.CollectionViewTree = CollectionViewTree;
1725
+
1726
+ const CollectionsClientFinalization =
1727
+ typeof FinalizationRegistry === "undefined"
1728
+ ? { register: () => {}, unregister: () => {} }
1729
+ : new FinalizationRegistry((ptr) => wasm.__wbg_collectionsclient_free(ptr >>> 0, 1));
1730
+
1731
+ class CollectionsClient {
1732
+ static __wrap(ptr) {
1733
+ ptr = ptr >>> 0;
1734
+ const obj = Object.create(CollectionsClient.prototype);
1735
+ obj.__wbg_ptr = ptr;
1736
+ CollectionsClientFinalization.register(obj, obj.__wbg_ptr, obj);
1737
+ return obj;
1738
+ }
1739
+
1740
+ __destroy_into_raw() {
1741
+ const ptr = this.__wbg_ptr;
1742
+ this.__wbg_ptr = 0;
1743
+ CollectionsClientFinalization.unregister(this);
1744
+ return ptr;
1745
+ }
1746
+
1747
+ free() {
1748
+ const ptr = this.__destroy_into_raw();
1749
+ wasm.__wbg_collectionsclient_free(ptr, 0);
1750
+ }
1751
+ /**
1752
+ * @param {Collection} collection
1753
+ * @returns {CollectionView}
1754
+ */
1755
+ decrypt(collection) {
1756
+ try {
1757
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1758
+ wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1759
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1760
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1761
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1762
+ if (r2) {
1763
+ throw takeObject(r1);
1764
+ }
1765
+ return takeObject(r0);
1766
+ } finally {
1767
+ wasm.__wbindgen_add_to_stack_pointer(16);
1768
+ }
1769
+ }
1770
+ /**
1771
+ * @param {Collection[]} collections
1772
+ * @returns {CollectionView[]}
1773
+ */
1774
+ decrypt_list(collections) {
1775
+ try {
1776
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1777
+ const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
1778
+ const len0 = WASM_VECTOR_LEN;
1779
+ wasm.collectionsclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1780
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1781
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1782
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1783
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1784
+ if (r3) {
1785
+ throw takeObject(r2);
1786
+ }
1787
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1788
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1789
+ return v2;
1790
+ } finally {
1791
+ wasm.__wbindgen_add_to_stack_pointer(16);
1792
+ }
1793
+ }
1794
+ /**
1795
+ *
1796
+ * Returns the vector of CollectionView objects in a tree structure based on its implemented
1797
+ * path().
1798
+ * @param {CollectionView[]} collections
1799
+ * @returns {CollectionViewTree}
1800
+ */
1801
+ get_collection_tree(collections) {
1802
+ const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
1803
+ const len0 = WASM_VECTOR_LEN;
1804
+ const ret = wasm.collectionsclient_get_collection_tree(this.__wbg_ptr, ptr0, len0);
1805
+ return CollectionViewTree.__wrap(ret);
1806
+ }
1807
+ }
1808
+ module.exports.CollectionsClient = CollectionsClient;
1809
+
1810
+ const CryptoClientFinalization =
1811
+ typeof FinalizationRegistry === "undefined"
1812
+ ? { register: () => {}, unregister: () => {} }
1813
+ : new FinalizationRegistry((ptr) => wasm.__wbg_cryptoclient_free(ptr >>> 0, 1));
1814
+ /**
1815
+ * A client for the crypto operations.
1816
+ */
1817
+ class CryptoClient {
1818
+ static __wrap(ptr) {
1819
+ ptr = ptr >>> 0;
1820
+ const obj = Object.create(CryptoClient.prototype);
1821
+ obj.__wbg_ptr = ptr;
1822
+ CryptoClientFinalization.register(obj, obj.__wbg_ptr, obj);
1823
+ return obj;
1824
+ }
1825
+
1826
+ __destroy_into_raw() {
1827
+ const ptr = this.__wbg_ptr;
1828
+ this.__wbg_ptr = 0;
1829
+ CryptoClientFinalization.unregister(this);
1830
+ return ptr;
1831
+ }
1832
+
1833
+ free() {
1834
+ const ptr = this.__destroy_into_raw();
1835
+ wasm.__wbg_cryptoclient_free(ptr, 0);
1836
+ }
1837
+ /**
1838
+ * Initialization method for the user crypto. Needs to be called before any other crypto
1839
+ * operations.
1840
+ * @param {InitUserCryptoRequest} req
1841
+ * @returns {Promise<void>}
1842
+ */
1843
+ initialize_user_crypto(req) {
1844
+ const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1845
+ return takeObject(ret);
1846
+ }
1847
+ /**
1848
+ * Initialization method for the organization crypto. Needs to be called after
1849
+ * `initialize_user_crypto` but before any other crypto operations.
1850
+ * @param {InitOrgCryptoRequest} req
1851
+ * @returns {Promise<void>}
1852
+ */
1853
+ initialize_org_crypto(req) {
1854
+ const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1855
+ return takeObject(ret);
1856
+ }
1857
+ /**
1858
+ * Generates a new key pair and encrypts the private key with the provided user key.
1859
+ * Crypto initialization not required.
1860
+ * @param {B64} user_key
1861
+ * @returns {MakeKeyPairResponse}
1862
+ */
1863
+ make_key_pair(user_key) {
1864
+ try {
1865
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1866
+ wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1867
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1868
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1869
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1870
+ if (r2) {
1871
+ throw takeObject(r1);
1872
+ }
1873
+ return takeObject(r0);
1874
+ } finally {
1875
+ wasm.__wbindgen_add_to_stack_pointer(16);
1876
+ }
1877
+ }
1878
+ /**
1879
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1880
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
1881
+ * Crypto initialization not required.
1882
+ * @param {VerifyAsymmetricKeysRequest} request
1883
+ * @returns {VerifyAsymmetricKeysResponse}
1884
+ */
1885
+ verify_asymmetric_keys(request) {
1886
+ try {
1887
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1888
+ wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1889
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1890
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1891
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1892
+ if (r2) {
1893
+ throw takeObject(r1);
1894
+ }
1895
+ return takeObject(r0);
1896
+ } finally {
1897
+ wasm.__wbindgen_add_to_stack_pointer(16);
1898
+ }
1899
+ }
1900
+ /**
1901
+ * Makes a new signing key pair and signs the public key for the user
1902
+ * @returns {UserCryptoV2KeysResponse}
1903
+ */
1904
+ make_keys_for_user_crypto_v2() {
1905
+ try {
1906
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1907
+ wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
1908
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1909
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1910
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1911
+ if (r2) {
1912
+ throw takeObject(r1);
1913
+ }
1914
+ return takeObject(r0);
1915
+ } finally {
1916
+ wasm.__wbindgen_add_to_stack_pointer(16);
1917
+ }
1918
+ }
1919
+ /**
1920
+ * Creates a rotated set of account keys for the current state
1921
+ * @returns {UserCryptoV2KeysResponse}
1922
+ */
1923
+ get_v2_rotated_account_keys() {
1924
+ try {
1925
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1926
+ wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
1927
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1928
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1929
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1930
+ if (r2) {
1931
+ throw takeObject(r1);
1932
+ }
1933
+ return takeObject(r0);
1934
+ } finally {
1935
+ wasm.__wbindgen_add_to_stack_pointer(16);
1936
+ }
1937
+ }
1938
+ /**
1939
+ * Create the data necessary to update the user's kdf settings. The user's encryption key is
1940
+ * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1941
+ * user key and the new password hash but does not update sdk state.
1942
+ * @param {string} password
1943
+ * @param {Kdf} kdf
1944
+ * @returns {UpdateKdfResponse}
1945
+ */
1946
+ make_update_kdf(password, kdf) {
1947
+ try {
1948
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1949
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1950
+ const len0 = WASM_VECTOR_LEN;
1951
+ wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
1952
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1953
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1954
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1955
+ if (r2) {
1956
+ throw takeObject(r1);
1957
+ }
1958
+ return takeObject(r0);
1959
+ } finally {
1960
+ wasm.__wbindgen_add_to_stack_pointer(16);
1961
+ }
1962
+ }
1963
+ /**
1964
+ * Protects the current user key with the provided PIN. The result can be stored and later
1965
+ * used to initialize another client instance by using the PIN and the PIN key with
1966
+ * `initialize_user_crypto`.
1967
+ * @param {string} pin
1968
+ * @returns {EnrollPinResponse}
1969
+ */
1970
+ enroll_pin(pin) {
1971
+ try {
1972
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1973
+ const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1974
+ const len0 = WASM_VECTOR_LEN;
1975
+ wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
1976
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1977
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1978
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1979
+ if (r2) {
1980
+ throw takeObject(r1);
1981
+ }
1982
+ return takeObject(r0);
1983
+ } finally {
1984
+ wasm.__wbindgen_add_to_stack_pointer(16);
1985
+ }
1986
+ }
1987
+ /**
1988
+ * Protects the current user key with the provided PIN. The result can be stored and later
1989
+ * used to initialize another client instance by using the PIN and the PIN key with
1990
+ * `initialize_user_crypto`. The provided pin is encrypted with the user key.
1991
+ * @param {string} encrypted_pin
1992
+ * @returns {EnrollPinResponse}
1993
+ */
1994
+ enroll_pin_with_encrypted_pin(encrypted_pin) {
1995
+ try {
1996
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1997
+ const ptr0 = passStringToWasm0(
1998
+ encrypted_pin,
1999
+ wasm.__wbindgen_malloc,
2000
+ wasm.__wbindgen_realloc,
2001
+ );
2002
+ const len0 = WASM_VECTOR_LEN;
2003
+ wasm.cryptoclient_enroll_pin_with_encrypted_pin(retptr, this.__wbg_ptr, ptr0, len0);
2004
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2005
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2006
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2007
+ if (r2) {
2008
+ throw takeObject(r1);
2009
+ }
2010
+ return takeObject(r0);
2011
+ } finally {
2012
+ wasm.__wbindgen_add_to_stack_pointer(16);
2013
+ }
2014
+ }
2015
+ /**
2016
+ * Decrypts a `PasswordProtectedKeyEnvelope`, returning the user key, if successful.
2017
+ * This is a stop-gap solution, until initialization of the SDK is used.
2018
+ * @param {string} pin
2019
+ * @param {string} envelope
2020
+ * @returns {Uint8Array}
2021
+ */
2022
+ unseal_password_protected_key_envelope(pin, envelope) {
2023
+ try {
2024
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2025
+ const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2026
+ const len0 = WASM_VECTOR_LEN;
2027
+ const ptr1 = passStringToWasm0(envelope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2028
+ const len1 = WASM_VECTOR_LEN;
2029
+ wasm.cryptoclient_unseal_password_protected_key_envelope(
2030
+ retptr,
2031
+ this.__wbg_ptr,
2032
+ ptr0,
2033
+ len0,
2034
+ ptr1,
2035
+ len1,
2036
+ );
2037
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2038
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2039
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2040
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2041
+ if (r3) {
2042
+ throw takeObject(r2);
2043
+ }
2044
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2045
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2046
+ return v3;
2047
+ } finally {
2048
+ wasm.__wbindgen_add_to_stack_pointer(16);
2049
+ }
2050
+ }
2051
+ }
2052
+ module.exports.CryptoClient = CryptoClient;
2053
+
2054
+ const ExporterClientFinalization =
2055
+ typeof FinalizationRegistry === "undefined"
2056
+ ? { register: () => {}, unregister: () => {} }
2057
+ : new FinalizationRegistry((ptr) => wasm.__wbg_exporterclient_free(ptr >>> 0, 1));
2058
+
2059
+ class ExporterClient {
2060
+ static __wrap(ptr) {
2061
+ ptr = ptr >>> 0;
2062
+ const obj = Object.create(ExporterClient.prototype);
2063
+ obj.__wbg_ptr = ptr;
2064
+ ExporterClientFinalization.register(obj, obj.__wbg_ptr, obj);
2065
+ return obj;
2066
+ }
2067
+
2068
+ __destroy_into_raw() {
2069
+ const ptr = this.__wbg_ptr;
2070
+ this.__wbg_ptr = 0;
2071
+ ExporterClientFinalization.unregister(this);
2072
+ return ptr;
2073
+ }
2074
+
2075
+ free() {
2076
+ const ptr = this.__destroy_into_raw();
2077
+ wasm.__wbg_exporterclient_free(ptr, 0);
2078
+ }
2079
+ /**
2080
+ * @param {Folder[]} folders
2081
+ * @param {Cipher[]} ciphers
2082
+ * @param {ExportFormat} format
2083
+ * @returns {string}
2084
+ */
2085
+ export_vault(folders, ciphers, format) {
2086
+ let deferred4_0;
2087
+ let deferred4_1;
2088
+ try {
2089
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2090
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2091
+ const len0 = WASM_VECTOR_LEN;
2092
+ const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2093
+ const len1 = WASM_VECTOR_LEN;
2094
+ wasm.exporterclient_export_vault(
2095
+ retptr,
2096
+ this.__wbg_ptr,
2097
+ ptr0,
2098
+ len0,
2099
+ ptr1,
2100
+ len1,
2101
+ addHeapObject(format),
2102
+ );
2103
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2104
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2105
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2106
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2107
+ var ptr3 = r0;
2108
+ var len3 = r1;
2109
+ if (r3) {
2110
+ ptr3 = 0;
2111
+ len3 = 0;
2112
+ throw takeObject(r2);
2113
+ }
2114
+ deferred4_0 = ptr3;
2115
+ deferred4_1 = len3;
2116
+ return getStringFromWasm0(ptr3, len3);
2117
+ } finally {
2118
+ wasm.__wbindgen_add_to_stack_pointer(16);
2119
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2120
+ }
2121
+ }
2122
+ /**
2123
+ * @param {Collection[]} collections
2124
+ * @param {Cipher[]} ciphers
2125
+ * @param {ExportFormat} format
2126
+ * @returns {string}
2127
+ */
2128
+ export_organization_vault(collections, ciphers, format) {
2129
+ let deferred4_0;
2130
+ let deferred4_1;
2131
+ try {
2132
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2133
+ const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
2134
+ const len0 = WASM_VECTOR_LEN;
2135
+ const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2136
+ const len1 = WASM_VECTOR_LEN;
2137
+ wasm.exporterclient_export_organization_vault(
2138
+ retptr,
2139
+ this.__wbg_ptr,
2140
+ ptr0,
2141
+ len0,
2142
+ ptr1,
2143
+ len1,
2144
+ addHeapObject(format),
2145
+ );
2146
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2147
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2148
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2149
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2150
+ var ptr3 = r0;
2151
+ var len3 = r1;
2152
+ if (r3) {
2153
+ ptr3 = 0;
2154
+ len3 = 0;
2155
+ throw takeObject(r2);
2156
+ }
2157
+ deferred4_0 = ptr3;
2158
+ deferred4_1 = len3;
2159
+ return getStringFromWasm0(ptr3, len3);
2160
+ } finally {
2161
+ wasm.__wbindgen_add_to_stack_pointer(16);
2162
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2163
+ }
2164
+ }
2165
+ /**
2166
+ * Credential Exchange Format (CXF)
2167
+ *
2168
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2169
+ *
2170
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2171
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2172
+ * @param {Account} account
2173
+ * @param {Cipher[]} ciphers
2174
+ * @returns {string}
2175
+ */
2176
+ export_cxf(account, ciphers) {
2177
+ let deferred3_0;
2178
+ let deferred3_1;
2179
+ try {
2180
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2181
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2182
+ const len0 = WASM_VECTOR_LEN;
2183
+ wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2184
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2185
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2186
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2187
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2188
+ var ptr2 = r0;
2189
+ var len2 = r1;
2190
+ if (r3) {
2191
+ ptr2 = 0;
2192
+ len2 = 0;
2193
+ throw takeObject(r2);
2194
+ }
2195
+ deferred3_0 = ptr2;
2196
+ deferred3_1 = len2;
2197
+ return getStringFromWasm0(ptr2, len2);
2198
+ } finally {
2199
+ wasm.__wbindgen_add_to_stack_pointer(16);
2200
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2201
+ }
2202
+ }
2203
+ /**
2204
+ * Credential Exchange Format (CXF)
2205
+ *
2206
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2207
+ *
2208
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2209
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2210
+ * @param {string} payload
2211
+ * @returns {Cipher[]}
2212
+ */
2213
+ import_cxf(payload) {
2214
+ try {
2215
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2216
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2217
+ const len0 = WASM_VECTOR_LEN;
2218
+ wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2219
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2220
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2221
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2222
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2223
+ if (r3) {
2224
+ throw takeObject(r2);
2225
+ }
2226
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2227
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2228
+ return v2;
2229
+ } finally {
2230
+ wasm.__wbindgen_add_to_stack_pointer(16);
2231
+ }
2232
+ }
2233
+ }
2234
+ module.exports.ExporterClient = ExporterClient;
2235
+
2236
+ const FoldersClientFinalization =
2237
+ typeof FinalizationRegistry === "undefined"
2238
+ ? { register: () => {}, unregister: () => {} }
2239
+ : new FinalizationRegistry((ptr) => wasm.__wbg_foldersclient_free(ptr >>> 0, 1));
2240
+ /**
2241
+ * Wrapper for folder specific functionality.
2242
+ */
2243
+ class FoldersClient {
2244
+ static __wrap(ptr) {
2245
+ ptr = ptr >>> 0;
2246
+ const obj = Object.create(FoldersClient.prototype);
2247
+ obj.__wbg_ptr = ptr;
2248
+ FoldersClientFinalization.register(obj, obj.__wbg_ptr, obj);
2249
+ return obj;
2250
+ }
2251
+
2252
+ __destroy_into_raw() {
2253
+ const ptr = this.__wbg_ptr;
2254
+ this.__wbg_ptr = 0;
2255
+ FoldersClientFinalization.unregister(this);
2256
+ return ptr;
2257
+ }
2258
+
2259
+ free() {
2260
+ const ptr = this.__destroy_into_raw();
2261
+ wasm.__wbg_foldersclient_free(ptr, 0);
2262
+ }
2263
+ /**
2264
+ * Encrypt a [FolderView] to a [Folder].
2265
+ * @param {FolderView} folder_view
2266
+ * @returns {Folder}
2267
+ */
2268
+ encrypt(folder_view) {
2269
+ try {
2270
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2271
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2272
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2273
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2274
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2275
+ if (r2) {
2276
+ throw takeObject(r1);
2277
+ }
2278
+ return takeObject(r0);
2279
+ } finally {
2280
+ wasm.__wbindgen_add_to_stack_pointer(16);
2281
+ }
2282
+ }
2283
+ /**
2284
+ * Encrypt a [Folder] to [FolderView].
2285
+ * @param {Folder} folder
2286
+ * @returns {FolderView}
2287
+ */
2288
+ decrypt(folder) {
2289
+ try {
2290
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2291
+ wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2292
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2293
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2294
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2295
+ if (r2) {
2296
+ throw takeObject(r1);
2297
+ }
2298
+ return takeObject(r0);
2299
+ } finally {
2300
+ wasm.__wbindgen_add_to_stack_pointer(16);
2301
+ }
2302
+ }
2303
+ /**
2304
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
2305
+ * @param {Folder[]} folders
2306
+ * @returns {FolderView[]}
2307
+ */
2308
+ decrypt_list(folders) {
2309
+ try {
2310
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2311
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2312
+ const len0 = WASM_VECTOR_LEN;
2313
+ wasm.foldersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
2314
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2315
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2316
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2317
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2318
+ if (r3) {
2319
+ throw takeObject(r2);
2320
+ }
2321
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2322
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2323
+ return v2;
2324
+ } finally {
2325
+ wasm.__wbindgen_add_to_stack_pointer(16);
2326
+ }
2327
+ }
2328
+ /**
2329
+ * Get all folders from state and decrypt them to a list of [FolderView].
2330
+ * @returns {Promise<FolderView[]>}
2331
+ */
2332
+ list() {
2333
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
2334
+ return takeObject(ret);
2335
+ }
2336
+ /**
2337
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
2338
+ * @param {FolderId} folder_id
2339
+ * @returns {Promise<FolderView>}
2340
+ */
2341
+ get(folder_id) {
2342
+ const ret = wasm.foldersclient_get(this.__wbg_ptr, addHeapObject(folder_id));
2343
+ return takeObject(ret);
2344
+ }
2345
+ /**
2346
+ * Create a new [Folder] and save it to the server.
2347
+ * @param {FolderAddEditRequest} request
2348
+ * @returns {Promise<FolderView>}
2349
+ */
2350
+ create(request) {
2351
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2352
+ return takeObject(ret);
2353
+ }
2354
+ /**
2355
+ * Edit the [Folder] and save it to the server.
2356
+ * @param {FolderId} folder_id
2357
+ * @param {FolderAddEditRequest} request
2358
+ * @returns {Promise<FolderView>}
2359
+ */
2360
+ edit(folder_id, request) {
2361
+ const ret = wasm.foldersclient_edit(
2362
+ this.__wbg_ptr,
2363
+ addHeapObject(folder_id),
2364
+ addHeapObject(request),
2365
+ );
2366
+ return takeObject(ret);
2367
+ }
2368
+ }
2369
+ module.exports.FoldersClient = FoldersClient;
2370
+
2371
+ const GeneratorClientFinalization =
2372
+ typeof FinalizationRegistry === "undefined"
2373
+ ? { register: () => {}, unregister: () => {} }
2374
+ : new FinalizationRegistry((ptr) => wasm.__wbg_generatorclient_free(ptr >>> 0, 1));
2375
+
2376
+ class GeneratorClient {
2377
+ static __wrap(ptr) {
2378
+ ptr = ptr >>> 0;
2379
+ const obj = Object.create(GeneratorClient.prototype);
2380
+ obj.__wbg_ptr = ptr;
2381
+ GeneratorClientFinalization.register(obj, obj.__wbg_ptr, obj);
2382
+ return obj;
2383
+ }
2384
+
2385
+ __destroy_into_raw() {
2386
+ const ptr = this.__wbg_ptr;
2387
+ this.__wbg_ptr = 0;
2388
+ GeneratorClientFinalization.unregister(this);
2389
+ return ptr;
2390
+ }
2391
+
2392
+ free() {
2393
+ const ptr = this.__destroy_into_raw();
2394
+ wasm.__wbg_generatorclient_free(ptr, 0);
2395
+ }
2396
+ /**
2397
+ * Generates a random password.
2398
+ *
2399
+ * The character sets and password length can be customized using the `input` parameter.
2400
+ *
2401
+ * # Examples
2402
+ *
2403
+ * ```
2404
+ * use bitwarden_core::Client;
2405
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2406
+ *
2407
+ * async fn test() -> Result<(), PassphraseError> {
2408
+ * let input = PasswordGeneratorRequest {
2409
+ * lowercase: true,
2410
+ * uppercase: true,
2411
+ * numbers: true,
2412
+ * length: 20,
2413
+ * ..Default::default()
2414
+ * };
2415
+ * let password = Client::new(None).generator().password(input).unwrap();
2416
+ * println!("{}", password);
2417
+ * Ok(())
2418
+ * }
2419
+ * ```
2420
+ * @param {PasswordGeneratorRequest} input
2421
+ * @returns {string}
2422
+ */
2423
+ password(input) {
2424
+ let deferred2_0;
2425
+ let deferred2_1;
2426
+ try {
2427
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2428
+ wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2429
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2430
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2431
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2432
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2433
+ var ptr1 = r0;
2434
+ var len1 = r1;
2435
+ if (r3) {
2436
+ ptr1 = 0;
2437
+ len1 = 0;
2438
+ throw takeObject(r2);
2439
+ }
2440
+ deferred2_0 = ptr1;
2441
+ deferred2_1 = len1;
2442
+ return getStringFromWasm0(ptr1, len1);
2443
+ } finally {
2444
+ wasm.__wbindgen_add_to_stack_pointer(16);
2445
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2446
+ }
2447
+ }
2448
+ /**
2449
+ * Generates a random passphrase.
2450
+ * A passphrase is a combination of random words separated by a character.
2451
+ * An example of passphrase is `correct horse battery staple`.
2452
+ *
2453
+ * The number of words and their case, the word separator, and the inclusion of
2454
+ * a number in the passphrase can be customized using the `input` parameter.
2455
+ *
2456
+ * # Examples
2457
+ *
2458
+ * ```
2459
+ * use bitwarden_core::Client;
2460
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2461
+ *
2462
+ * async fn test() -> Result<(), PassphraseError> {
2463
+ * let input = PassphraseGeneratorRequest {
2464
+ * num_words: 4,
2465
+ * ..Default::default()
2466
+ * };
2467
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2468
+ * println!("{}", passphrase);
2469
+ * Ok(())
2470
+ * }
2471
+ * ```
2472
+ * @param {PassphraseGeneratorRequest} input
2473
+ * @returns {string}
2474
+ */
2475
+ passphrase(input) {
2476
+ let deferred2_0;
2477
+ let deferred2_1;
2478
+ try {
2479
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2480
+ wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2481
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2482
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2483
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2484
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2485
+ var ptr1 = r0;
2486
+ var len1 = r1;
2487
+ if (r3) {
2488
+ ptr1 = 0;
2489
+ len1 = 0;
2490
+ throw takeObject(r2);
2491
+ }
2492
+ deferred2_0 = ptr1;
2493
+ deferred2_1 = len1;
2494
+ return getStringFromWasm0(ptr1, len1);
2495
+ } finally {
2496
+ wasm.__wbindgen_add_to_stack_pointer(16);
2497
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2498
+ }
2499
+ }
2500
+ }
2501
+ module.exports.GeneratorClient = GeneratorClient;
2502
+
2503
+ const IncomingMessageFinalization =
2504
+ typeof FinalizationRegistry === "undefined"
2505
+ ? { register: () => {}, unregister: () => {} }
2506
+ : new FinalizationRegistry((ptr) => wasm.__wbg_incomingmessage_free(ptr >>> 0, 1));
2507
+
2508
+ class IncomingMessage {
2509
+ static __wrap(ptr) {
2510
+ ptr = ptr >>> 0;
2511
+ const obj = Object.create(IncomingMessage.prototype);
2512
+ obj.__wbg_ptr = ptr;
2513
+ IncomingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2514
+ return obj;
2515
+ }
2516
+
2517
+ __destroy_into_raw() {
2518
+ const ptr = this.__wbg_ptr;
2519
+ this.__wbg_ptr = 0;
2520
+ IncomingMessageFinalization.unregister(this);
2521
+ return ptr;
2522
+ }
2523
+
2524
+ free() {
2525
+ const ptr = this.__destroy_into_raw();
2526
+ wasm.__wbg_incomingmessage_free(ptr, 0);
2527
+ }
2528
+ /**
2529
+ * @returns {Uint8Array}
2530
+ */
2531
+ get payload() {
2532
+ try {
2533
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2534
+ wasm.__wbg_get_incomingmessage_payload(retptr, this.__wbg_ptr);
2535
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2536
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2537
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2538
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2539
+ return v1;
2540
+ } finally {
2541
+ wasm.__wbindgen_add_to_stack_pointer(16);
2542
+ }
2543
+ }
2544
+ /**
2545
+ * @param {Uint8Array} arg0
2546
+ */
2547
+ set payload(arg0) {
2548
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
2549
+ const len0 = WASM_VECTOR_LEN;
2550
+ wasm.__wbg_set_incomingmessage_payload(this.__wbg_ptr, ptr0, len0);
2551
+ }
2552
+ /**
2553
+ * @returns {Endpoint}
2554
+ */
2555
+ get destination() {
2556
+ const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
2557
+ return takeObject(ret);
2558
+ }
2559
+ /**
2560
+ * @param {Endpoint} arg0
2561
+ */
2562
+ set destination(arg0) {
2563
+ wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
2564
+ }
2565
+ /**
2566
+ * @returns {Endpoint}
2567
+ */
2568
+ get source() {
2569
+ const ret = wasm.__wbg_get_incomingmessage_source(this.__wbg_ptr);
2570
+ return takeObject(ret);
2571
+ }
2572
+ /**
2573
+ * @param {Endpoint} arg0
2574
+ */
2575
+ set source(arg0) {
2576
+ wasm.__wbg_set_incomingmessage_source(this.__wbg_ptr, addHeapObject(arg0));
2577
+ }
2578
+ /**
2579
+ * @returns {string | undefined}
2580
+ */
2581
+ get topic() {
2582
+ try {
2583
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2584
+ wasm.__wbg_get_incomingmessage_topic(retptr, this.__wbg_ptr);
2585
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2586
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2587
+ let v1;
2588
+ if (r0 !== 0) {
2589
+ v1 = getStringFromWasm0(r0, r1).slice();
2590
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2591
+ }
2592
+ return v1;
2593
+ } finally {
2594
+ wasm.__wbindgen_add_to_stack_pointer(16);
2595
+ }
2596
+ }
2597
+ /**
2598
+ * @param {string | null} [arg0]
2599
+ */
2600
+ set topic(arg0) {
2601
+ var ptr0 = isLikeNone(arg0)
2602
+ ? 0
2603
+ : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2604
+ var len0 = WASM_VECTOR_LEN;
2605
+ wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
2606
+ }
2607
+ /**
2608
+ * @param {Uint8Array} payload
2609
+ * @param {Endpoint} destination
2610
+ * @param {Endpoint} source
2611
+ * @param {string | null} [topic]
2612
+ */
2613
+ constructor(payload, destination, source, topic) {
2614
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2615
+ const len0 = WASM_VECTOR_LEN;
2616
+ var ptr1 = isLikeNone(topic)
2617
+ ? 0
2618
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2619
+ var len1 = WASM_VECTOR_LEN;
2620
+ const ret = wasm.incomingmessage_new(
2621
+ ptr0,
2622
+ len0,
2623
+ addHeapObject(destination),
2624
+ addHeapObject(source),
2625
+ ptr1,
2626
+ len1,
2627
+ );
2628
+ this.__wbg_ptr = ret >>> 0;
2629
+ IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2630
+ return this;
2631
+ }
2632
+ /**
2633
+ * Try to parse the payload as JSON.
2634
+ * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2635
+ */
2636
+ parse_payload_as_json() {
2637
+ const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2638
+ return takeObject(ret);
2639
+ }
2640
+ }
2641
+ module.exports.IncomingMessage = IncomingMessage;
2642
+
2643
+ const IpcClientFinalization =
2644
+ typeof FinalizationRegistry === "undefined"
2645
+ ? { register: () => {}, unregister: () => {} }
2646
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclient_free(ptr >>> 0, 1));
2647
+ /**
2648
+ * JavaScript wrapper around the IPC client. For more information, see the
2649
+ * [IpcClient] documentation.
2650
+ */
2651
+ class IpcClient {
2652
+ __destroy_into_raw() {
2653
+ const ptr = this.__wbg_ptr;
2654
+ this.__wbg_ptr = 0;
2655
+ IpcClientFinalization.unregister(this);
2656
+ return ptr;
2657
+ }
2658
+
2659
+ free() {
2660
+ const ptr = this.__destroy_into_raw();
2661
+ wasm.__wbg_ipcclient_free(ptr, 0);
2662
+ }
2663
+ /**
2664
+ * @param {IpcCommunicationBackend} communication_provider
2665
+ */
2666
+ constructor(communication_provider) {
2667
+ _assertClass(communication_provider, IpcCommunicationBackend);
2668
+ const ret = wasm.ipcclient_new(communication_provider.__wbg_ptr);
2669
+ this.__wbg_ptr = ret >>> 0;
2670
+ IpcClientFinalization.register(this, this.__wbg_ptr, this);
2671
+ return this;
2672
+ }
2673
+ /**
2674
+ * @returns {Promise<void>}
2675
+ */
2676
+ start() {
2677
+ const ret = wasm.ipcclient_start(this.__wbg_ptr);
2678
+ return takeObject(ret);
2679
+ }
2680
+ /**
2681
+ * @returns {Promise<boolean>}
2682
+ */
2683
+ isRunning() {
2684
+ const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2685
+ return takeObject(ret);
2686
+ }
2687
+ /**
2688
+ * @param {OutgoingMessage} message
2689
+ * @returns {Promise<void>}
2690
+ */
2691
+ send(message) {
2692
+ _assertClass(message, OutgoingMessage);
2693
+ var ptr0 = message.__destroy_into_raw();
2694
+ const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2695
+ return takeObject(ret);
2696
+ }
2697
+ /**
2698
+ * @returns {Promise<IpcClientSubscription>}
2699
+ */
2700
+ subscribe() {
2701
+ const ret = wasm.ipcclient_subscribe(this.__wbg_ptr);
2702
+ return takeObject(ret);
2703
+ }
2704
+ }
2705
+ module.exports.IpcClient = IpcClient;
2706
+
2707
+ const IpcClientSubscriptionFinalization =
2708
+ typeof FinalizationRegistry === "undefined"
2709
+ ? { register: () => {}, unregister: () => {} }
2710
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclientsubscription_free(ptr >>> 0, 1));
2711
+ /**
2712
+ * JavaScript wrapper around the IPC client subscription. For more information, see the
2713
+ * [IpcClientSubscription](crate::IpcClientSubscription) documentation.
2714
+ */
2715
+ class IpcClientSubscription {
2716
+ static __wrap(ptr) {
2717
+ ptr = ptr >>> 0;
2718
+ const obj = Object.create(IpcClientSubscription.prototype);
2719
+ obj.__wbg_ptr = ptr;
2720
+ IpcClientSubscriptionFinalization.register(obj, obj.__wbg_ptr, obj);
2721
+ return obj;
2722
+ }
2723
+
2724
+ __destroy_into_raw() {
2725
+ const ptr = this.__wbg_ptr;
2726
+ this.__wbg_ptr = 0;
2727
+ IpcClientSubscriptionFinalization.unregister(this);
2728
+ return ptr;
2729
+ }
2730
+
2731
+ free() {
2732
+ const ptr = this.__destroy_into_raw();
2733
+ wasm.__wbg_ipcclientsubscription_free(ptr, 0);
2734
+ }
2735
+ /**
2736
+ * @param {AbortSignal | null} [abort_signal]
2737
+ * @returns {Promise<IncomingMessage>}
2738
+ */
2739
+ receive(abort_signal) {
2740
+ const ret = wasm.ipcclientsubscription_receive(
2741
+ this.__wbg_ptr,
2742
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
2743
+ );
2744
+ return takeObject(ret);
2745
+ }
2746
+ }
2747
+ module.exports.IpcClientSubscription = IpcClientSubscription;
2748
+
2749
+ const IpcCommunicationBackendFinalization =
2750
+ typeof FinalizationRegistry === "undefined"
2751
+ ? { register: () => {}, unregister: () => {} }
2752
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipccommunicationbackend_free(ptr >>> 0, 1));
2753
+ /**
2754
+ * JavaScript implementation of the `CommunicationBackend` trait for IPC communication.
2755
+ */
2756
+ class IpcCommunicationBackend {
2757
+ __destroy_into_raw() {
2758
+ const ptr = this.__wbg_ptr;
2759
+ this.__wbg_ptr = 0;
2760
+ IpcCommunicationBackendFinalization.unregister(this);
2761
+ return ptr;
2762
+ }
2763
+
2764
+ free() {
2765
+ const ptr = this.__destroy_into_raw();
2766
+ wasm.__wbg_ipccommunicationbackend_free(ptr, 0);
2767
+ }
2768
+ /**
2769
+ * Creates a new instance of the JavaScript communication backend.
2770
+ * @param {IpcCommunicationBackendSender} sender
2771
+ */
2772
+ constructor(sender) {
2773
+ const ret = wasm.ipccommunicationbackend_new(addHeapObject(sender));
2774
+ this.__wbg_ptr = ret >>> 0;
2775
+ IpcCommunicationBackendFinalization.register(this, this.__wbg_ptr, this);
2776
+ return this;
2777
+ }
2778
+ /**
2779
+ * Used by JavaScript to provide an incoming message to the IPC framework.
2780
+ * @param {IncomingMessage} message
2781
+ */
2782
+ receive(message) {
2783
+ try {
2784
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2785
+ _assertClass(message, IncomingMessage);
2786
+ var ptr0 = message.__destroy_into_raw();
2787
+ wasm.ipccommunicationbackend_receive(retptr, this.__wbg_ptr, ptr0);
2788
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2789
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2790
+ if (r1) {
2791
+ throw takeObject(r0);
2792
+ }
2793
+ } finally {
2794
+ wasm.__wbindgen_add_to_stack_pointer(16);
2795
+ }
2796
+ }
2797
+ }
2798
+ module.exports.IpcCommunicationBackend = IpcCommunicationBackend;
2799
+
2800
+ const OutgoingMessageFinalization =
2801
+ typeof FinalizationRegistry === "undefined"
2802
+ ? { register: () => {}, unregister: () => {} }
2803
+ : new FinalizationRegistry((ptr) => wasm.__wbg_outgoingmessage_free(ptr >>> 0, 1));
2804
+
2805
+ class OutgoingMessage {
2806
+ static __wrap(ptr) {
2807
+ ptr = ptr >>> 0;
2808
+ const obj = Object.create(OutgoingMessage.prototype);
2809
+ obj.__wbg_ptr = ptr;
2810
+ OutgoingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2811
+ return obj;
2812
+ }
2813
+
2814
+ __destroy_into_raw() {
2815
+ const ptr = this.__wbg_ptr;
2816
+ this.__wbg_ptr = 0;
2817
+ OutgoingMessageFinalization.unregister(this);
2818
+ return ptr;
2819
+ }
2820
+
2821
+ free() {
2822
+ const ptr = this.__destroy_into_raw();
2823
+ wasm.__wbg_outgoingmessage_free(ptr, 0);
2824
+ }
2825
+ /**
2826
+ * @returns {Uint8Array}
2827
+ */
2828
+ get payload() {
2829
+ try {
2830
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2831
+ wasm.__wbg_get_outgoingmessage_payload(retptr, this.__wbg_ptr);
2832
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2833
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2834
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2835
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2836
+ return v1;
2837
+ } finally {
2838
+ wasm.__wbindgen_add_to_stack_pointer(16);
2839
+ }
2840
+ }
2841
+ /**
2842
+ * @param {Uint8Array} arg0
2843
+ */
2844
+ set payload(arg0) {
2845
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
2846
+ const len0 = WASM_VECTOR_LEN;
2847
+ wasm.__wbg_set_outgoingmessage_payload(this.__wbg_ptr, ptr0, len0);
2848
+ }
2849
+ /**
2850
+ * @returns {Endpoint}
2851
+ */
2852
+ get destination() {
2853
+ const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
2854
+ return takeObject(ret);
2855
+ }
2856
+ /**
2857
+ * @param {Endpoint} arg0
2858
+ */
2859
+ set destination(arg0) {
2860
+ wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
2861
+ }
2862
+ /**
2863
+ * @returns {string | undefined}
2864
+ */
2865
+ get topic() {
2866
+ try {
2867
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2868
+ wasm.__wbg_get_outgoingmessage_topic(retptr, this.__wbg_ptr);
2869
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2870
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2871
+ let v1;
2872
+ if (r0 !== 0) {
2873
+ v1 = getStringFromWasm0(r0, r1).slice();
2874
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2875
+ }
2876
+ return v1;
2877
+ } finally {
2878
+ wasm.__wbindgen_add_to_stack_pointer(16);
2879
+ }
2880
+ }
2881
+ /**
2882
+ * @param {string | null} [arg0]
2883
+ */
2884
+ set topic(arg0) {
2885
+ var ptr0 = isLikeNone(arg0)
2886
+ ? 0
2887
+ : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2888
+ var len0 = WASM_VECTOR_LEN;
2889
+ wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
2890
+ }
2891
+ /**
2892
+ * @param {Uint8Array} payload
2893
+ * @param {Endpoint} destination
2894
+ * @param {string | null} [topic]
2895
+ */
2896
+ constructor(payload, destination, topic) {
2897
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2898
+ const len0 = WASM_VECTOR_LEN;
2899
+ var ptr1 = isLikeNone(topic)
2900
+ ? 0
2901
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2902
+ var len1 = WASM_VECTOR_LEN;
2903
+ const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
2904
+ this.__wbg_ptr = ret >>> 0;
2905
+ OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
2906
+ return this;
2907
+ }
2908
+ /**
2909
+ * Create a new message and encode the payload as JSON.
2910
+ * @param {any} payload
2911
+ * @param {Endpoint} destination
2912
+ * @param {string | null} [topic]
2913
+ * @returns {OutgoingMessage}
2914
+ */
2915
+ static new_json_payload(payload, destination, topic) {
2916
+ try {
2917
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2918
+ var ptr0 = isLikeNone(topic)
2919
+ ? 0
2920
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2921
+ var len0 = WASM_VECTOR_LEN;
2922
+ wasm.outgoingmessage_new_json_payload(
2923
+ retptr,
2924
+ addHeapObject(payload),
2925
+ addHeapObject(destination),
2926
+ ptr0,
2927
+ len0,
2928
+ );
2929
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2930
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2931
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2932
+ if (r2) {
2933
+ throw takeObject(r1);
2934
+ }
2935
+ return OutgoingMessage.__wrap(r0);
2936
+ } finally {
2937
+ wasm.__wbindgen_add_to_stack_pointer(16);
2938
+ }
2939
+ }
2940
+ }
2941
+ module.exports.OutgoingMessage = OutgoingMessage;
2942
+
2943
+ const PlatformClientFinalization =
2944
+ typeof FinalizationRegistry === "undefined"
2945
+ ? { register: () => {}, unregister: () => {} }
2946
+ : new FinalizationRegistry((ptr) => wasm.__wbg_platformclient_free(ptr >>> 0, 1));
2947
+
2948
+ class PlatformClient {
2949
+ static __wrap(ptr) {
2950
+ ptr = ptr >>> 0;
2951
+ const obj = Object.create(PlatformClient.prototype);
2952
+ obj.__wbg_ptr = ptr;
2953
+ PlatformClientFinalization.register(obj, obj.__wbg_ptr, obj);
2954
+ return obj;
2955
+ }
2956
+
2957
+ __destroy_into_raw() {
2958
+ const ptr = this.__wbg_ptr;
2959
+ this.__wbg_ptr = 0;
2960
+ PlatformClientFinalization.unregister(this);
2961
+ return ptr;
2962
+ }
2963
+
2964
+ free() {
366
2965
  const ptr = this.__destroy_into_raw();
367
- wasm.__wbg_bitwardenclient_free(ptr, 0);
2966
+ wasm.__wbg_platformclient_free(ptr, 0);
2967
+ }
2968
+ /**
2969
+ * @returns {StateClient}
2970
+ */
2971
+ state() {
2972
+ const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
2973
+ return StateClient.__wrap(ret);
2974
+ }
2975
+ /**
2976
+ * Load feature flags into the client
2977
+ * @param {FeatureFlags} flags
2978
+ */
2979
+ load_flags(flags) {
2980
+ try {
2981
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2982
+ wasm.platformclient_load_flags(retptr, this.__wbg_ptr, addHeapObject(flags));
2983
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2984
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2985
+ if (r1) {
2986
+ throw takeObject(r0);
2987
+ }
2988
+ } finally {
2989
+ wasm.__wbindgen_add_to_stack_pointer(16);
2990
+ }
2991
+ }
2992
+ }
2993
+ module.exports.PlatformClient = PlatformClient;
2994
+
2995
+ const PureCryptoFinalization =
2996
+ typeof FinalizationRegistry === "undefined"
2997
+ ? { register: () => {}, unregister: () => {} }
2998
+ : new FinalizationRegistry((ptr) => wasm.__wbg_purecrypto_free(ptr >>> 0, 1));
2999
+ /**
3000
+ * This module represents a stopgap solution to provide access to primitive crypto functions for JS
3001
+ * clients. It is not intended to be used outside of the JS clients and this pattern should not be
3002
+ * proliferated. It is necessary because we want to use SDK crypto prior to the SDK being fully
3003
+ * responsible for state and keys.
3004
+ */
3005
+ class PureCrypto {
3006
+ __destroy_into_raw() {
3007
+ const ptr = this.__wbg_ptr;
3008
+ this.__wbg_ptr = 0;
3009
+ PureCryptoFinalization.unregister(this);
3010
+ return ptr;
3011
+ }
3012
+
3013
+ free() {
3014
+ const ptr = this.__destroy_into_raw();
3015
+ wasm.__wbg_purecrypto_free(ptr, 0);
3016
+ }
3017
+ /**
3018
+ * DEPRECATED: Use `symmetric_decrypt_string` instead.
3019
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3020
+ * @param {string} enc_string
3021
+ * @param {Uint8Array} key
3022
+ * @returns {string}
3023
+ */
3024
+ static symmetric_decrypt(enc_string, key) {
3025
+ let deferred4_0;
3026
+ let deferred4_1;
3027
+ try {
3028
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3029
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3030
+ const len0 = WASM_VECTOR_LEN;
3031
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3032
+ const len1 = WASM_VECTOR_LEN;
3033
+ wasm.purecrypto_symmetric_decrypt(retptr, ptr0, len0, ptr1, len1);
3034
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3035
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3036
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3037
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3038
+ var ptr3 = r0;
3039
+ var len3 = r1;
3040
+ if (r3) {
3041
+ ptr3 = 0;
3042
+ len3 = 0;
3043
+ throw takeObject(r2);
3044
+ }
3045
+ deferred4_0 = ptr3;
3046
+ deferred4_1 = len3;
3047
+ return getStringFromWasm0(ptr3, len3);
3048
+ } finally {
3049
+ wasm.__wbindgen_add_to_stack_pointer(16);
3050
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3051
+ }
3052
+ }
3053
+ /**
3054
+ * @param {string} enc_string
3055
+ * @param {Uint8Array} key
3056
+ * @returns {string}
3057
+ */
3058
+ static symmetric_decrypt_string(enc_string, key) {
3059
+ let deferred4_0;
3060
+ let deferred4_1;
3061
+ try {
3062
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3063
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3064
+ const len0 = WASM_VECTOR_LEN;
3065
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3066
+ const len1 = WASM_VECTOR_LEN;
3067
+ wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3068
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3069
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3070
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3071
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3072
+ var ptr3 = r0;
3073
+ var len3 = r1;
3074
+ if (r3) {
3075
+ ptr3 = 0;
3076
+ len3 = 0;
3077
+ throw takeObject(r2);
3078
+ }
3079
+ deferred4_0 = ptr3;
3080
+ deferred4_1 = len3;
3081
+ return getStringFromWasm0(ptr3, len3);
3082
+ } finally {
3083
+ wasm.__wbindgen_add_to_stack_pointer(16);
3084
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3085
+ }
3086
+ }
3087
+ /**
3088
+ * @param {string} enc_string
3089
+ * @param {Uint8Array} key
3090
+ * @returns {Uint8Array}
3091
+ */
3092
+ static symmetric_decrypt_bytes(enc_string, key) {
3093
+ try {
3094
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3095
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3096
+ const len0 = WASM_VECTOR_LEN;
3097
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3098
+ const len1 = WASM_VECTOR_LEN;
3099
+ wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3100
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3101
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3102
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3103
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3104
+ if (r3) {
3105
+ throw takeObject(r2);
3106
+ }
3107
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3108
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3109
+ return v3;
3110
+ } finally {
3111
+ wasm.__wbindgen_add_to_stack_pointer(16);
3112
+ }
3113
+ }
3114
+ /**
3115
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3116
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3117
+ * @param {Uint8Array} enc_bytes
3118
+ * @param {Uint8Array} key
3119
+ * @returns {Uint8Array}
3120
+ */
3121
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
3122
+ try {
3123
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3124
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3125
+ const len0 = WASM_VECTOR_LEN;
3126
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3127
+ const len1 = WASM_VECTOR_LEN;
3128
+ wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
3129
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3130
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3131
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3132
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3133
+ if (r3) {
3134
+ throw takeObject(r2);
3135
+ }
3136
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3137
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3138
+ return v3;
3139
+ } finally {
3140
+ wasm.__wbindgen_add_to_stack_pointer(16);
3141
+ }
3142
+ }
3143
+ /**
3144
+ * @param {Uint8Array} enc_bytes
3145
+ * @param {Uint8Array} key
3146
+ * @returns {Uint8Array}
3147
+ */
3148
+ static symmetric_decrypt_filedata(enc_bytes, key) {
3149
+ try {
3150
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3151
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3152
+ const len0 = WASM_VECTOR_LEN;
3153
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3154
+ const len1 = WASM_VECTOR_LEN;
3155
+ wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3156
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3157
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3158
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3159
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3160
+ if (r3) {
3161
+ throw takeObject(r2);
3162
+ }
3163
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3164
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3165
+ return v3;
3166
+ } finally {
3167
+ wasm.__wbindgen_add_to_stack_pointer(16);
3168
+ }
3169
+ }
3170
+ /**
3171
+ * @param {string} plain
3172
+ * @param {Uint8Array} key
3173
+ * @returns {string}
3174
+ */
3175
+ static symmetric_encrypt_string(plain, key) {
3176
+ let deferred4_0;
3177
+ let deferred4_1;
3178
+ try {
3179
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3180
+ const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3181
+ const len0 = WASM_VECTOR_LEN;
3182
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3183
+ const len1 = WASM_VECTOR_LEN;
3184
+ wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3185
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3186
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3187
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3188
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3189
+ var ptr3 = r0;
3190
+ var len3 = r1;
3191
+ if (r3) {
3192
+ ptr3 = 0;
3193
+ len3 = 0;
3194
+ throw takeObject(r2);
3195
+ }
3196
+ deferred4_0 = ptr3;
3197
+ deferred4_1 = len3;
3198
+ return getStringFromWasm0(ptr3, len3);
3199
+ } finally {
3200
+ wasm.__wbindgen_add_to_stack_pointer(16);
3201
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3202
+ }
3203
+ }
3204
+ /**
3205
+ * DEPRECATED: Only used by send keys
3206
+ * @param {Uint8Array} plain
3207
+ * @param {Uint8Array} key
3208
+ * @returns {string}
3209
+ */
3210
+ static symmetric_encrypt_bytes(plain, key) {
3211
+ let deferred4_0;
3212
+ let deferred4_1;
3213
+ try {
3214
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3215
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3216
+ const len0 = WASM_VECTOR_LEN;
3217
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3218
+ const len1 = WASM_VECTOR_LEN;
3219
+ wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3220
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3221
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3222
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3223
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3224
+ var ptr3 = r0;
3225
+ var len3 = r1;
3226
+ if (r3) {
3227
+ ptr3 = 0;
3228
+ len3 = 0;
3229
+ throw takeObject(r2);
3230
+ }
3231
+ deferred4_0 = ptr3;
3232
+ deferred4_1 = len3;
3233
+ return getStringFromWasm0(ptr3, len3);
3234
+ } finally {
3235
+ wasm.__wbindgen_add_to_stack_pointer(16);
3236
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3237
+ }
3238
+ }
3239
+ /**
3240
+ * @param {Uint8Array} plain
3241
+ * @param {Uint8Array} key
3242
+ * @returns {Uint8Array}
3243
+ */
3244
+ static symmetric_encrypt_filedata(plain, key) {
3245
+ try {
3246
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3247
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3248
+ const len0 = WASM_VECTOR_LEN;
3249
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3250
+ const len1 = WASM_VECTOR_LEN;
3251
+ wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3252
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3253
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3254
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3255
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3256
+ if (r3) {
3257
+ throw takeObject(r2);
3258
+ }
3259
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3260
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3261
+ return v3;
3262
+ } finally {
3263
+ wasm.__wbindgen_add_to_stack_pointer(16);
3264
+ }
3265
+ }
3266
+ /**
3267
+ * @param {string} encrypted_user_key
3268
+ * @param {string} master_password
3269
+ * @param {string} email
3270
+ * @param {Kdf} kdf
3271
+ * @returns {Uint8Array}
3272
+ */
3273
+ static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
3274
+ try {
3275
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3276
+ const ptr0 = passStringToWasm0(
3277
+ encrypted_user_key,
3278
+ wasm.__wbindgen_malloc,
3279
+ wasm.__wbindgen_realloc,
3280
+ );
3281
+ const len0 = WASM_VECTOR_LEN;
3282
+ const ptr1 = passStringToWasm0(
3283
+ master_password,
3284
+ wasm.__wbindgen_malloc,
3285
+ wasm.__wbindgen_realloc,
3286
+ );
3287
+ const len1 = WASM_VECTOR_LEN;
3288
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3289
+ const len2 = WASM_VECTOR_LEN;
3290
+ wasm.purecrypto_decrypt_user_key_with_master_password(
3291
+ retptr,
3292
+ ptr0,
3293
+ len0,
3294
+ ptr1,
3295
+ len1,
3296
+ ptr2,
3297
+ len2,
3298
+ addHeapObject(kdf),
3299
+ );
3300
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3301
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3302
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3303
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3304
+ if (r3) {
3305
+ throw takeObject(r2);
3306
+ }
3307
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
3308
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3309
+ return v4;
3310
+ } finally {
3311
+ wasm.__wbindgen_add_to_stack_pointer(16);
3312
+ }
3313
+ }
3314
+ /**
3315
+ * @param {Uint8Array} user_key
3316
+ * @param {string} master_password
3317
+ * @param {string} email
3318
+ * @param {Kdf} kdf
3319
+ * @returns {string}
3320
+ */
3321
+ static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
3322
+ let deferred5_0;
3323
+ let deferred5_1;
3324
+ try {
3325
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3326
+ const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
3327
+ const len0 = WASM_VECTOR_LEN;
3328
+ const ptr1 = passStringToWasm0(
3329
+ master_password,
3330
+ wasm.__wbindgen_malloc,
3331
+ wasm.__wbindgen_realloc,
3332
+ );
3333
+ const len1 = WASM_VECTOR_LEN;
3334
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3335
+ const len2 = WASM_VECTOR_LEN;
3336
+ wasm.purecrypto_encrypt_user_key_with_master_password(
3337
+ retptr,
3338
+ ptr0,
3339
+ len0,
3340
+ ptr1,
3341
+ len1,
3342
+ ptr2,
3343
+ len2,
3344
+ addHeapObject(kdf),
3345
+ );
3346
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3347
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3348
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3349
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3350
+ var ptr4 = r0;
3351
+ var len4 = r1;
3352
+ if (r3) {
3353
+ ptr4 = 0;
3354
+ len4 = 0;
3355
+ throw takeObject(r2);
3356
+ }
3357
+ deferred5_0 = ptr4;
3358
+ deferred5_1 = len4;
3359
+ return getStringFromWasm0(ptr4, len4);
3360
+ } finally {
3361
+ wasm.__wbindgen_add_to_stack_pointer(16);
3362
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3363
+ }
3364
+ }
3365
+ /**
3366
+ * @returns {Uint8Array}
3367
+ */
3368
+ static make_user_key_aes256_cbc_hmac() {
3369
+ try {
3370
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3371
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3372
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3373
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3374
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3375
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3376
+ return v1;
3377
+ } finally {
3378
+ wasm.__wbindgen_add_to_stack_pointer(16);
3379
+ }
3380
+ }
3381
+ /**
3382
+ * @returns {Uint8Array}
3383
+ */
3384
+ static make_user_key_xchacha20_poly1305() {
3385
+ try {
3386
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3387
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
3388
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3389
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3390
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3391
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3392
+ return v1;
3393
+ } finally {
3394
+ wasm.__wbindgen_add_to_stack_pointer(16);
3395
+ }
3396
+ }
3397
+ /**
3398
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3399
+ * as an EncString.
3400
+ * @param {Uint8Array} key_to_be_wrapped
3401
+ * @param {Uint8Array} wrapping_key
3402
+ * @returns {string}
3403
+ */
3404
+ static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3405
+ let deferred4_0;
3406
+ let deferred4_1;
3407
+ try {
3408
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3409
+ const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3410
+ const len0 = WASM_VECTOR_LEN;
3411
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3412
+ const len1 = WASM_VECTOR_LEN;
3413
+ wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3414
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3415
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3416
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3417
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3418
+ var ptr3 = r0;
3419
+ var len3 = r1;
3420
+ if (r3) {
3421
+ ptr3 = 0;
3422
+ len3 = 0;
3423
+ throw takeObject(r2);
3424
+ }
3425
+ deferred4_0 = ptr3;
3426
+ deferred4_1 = len3;
3427
+ return getStringFromWasm0(ptr3, len3);
3428
+ } finally {
3429
+ wasm.__wbindgen_add_to_stack_pointer(16);
3430
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3431
+ }
3432
+ }
3433
+ /**
3434
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3435
+ * unwrapped key as a serialized byte array.
3436
+ * @param {string} wrapped_key
3437
+ * @param {Uint8Array} wrapping_key
3438
+ * @returns {Uint8Array}
3439
+ */
3440
+ static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3441
+ try {
3442
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3443
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3444
+ const len0 = WASM_VECTOR_LEN;
3445
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3446
+ const len1 = WASM_VECTOR_LEN;
3447
+ wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3450
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3451
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3452
+ if (r3) {
3453
+ throw takeObject(r2);
3454
+ }
3455
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3456
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3457
+ return v3;
3458
+ } finally {
3459
+ wasm.__wbindgen_add_to_stack_pointer(16);
3460
+ }
3461
+ }
3462
+ /**
3463
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3464
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
3465
+ * used. The specific use-case for this function is to enable rotateable key sets, where
3466
+ * the "public key" is not public, with the intent of preventing the server from being able
3467
+ * to overwrite the user key unlocked by the rotateable keyset.
3468
+ * @param {Uint8Array} encapsulation_key
3469
+ * @param {Uint8Array} wrapping_key
3470
+ * @returns {string}
3471
+ */
3472
+ static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3473
+ let deferred4_0;
3474
+ let deferred4_1;
3475
+ try {
3476
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3477
+ const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3478
+ const len0 = WASM_VECTOR_LEN;
3479
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3480
+ const len1 = WASM_VECTOR_LEN;
3481
+ wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3482
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3483
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3484
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3485
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3486
+ var ptr3 = r0;
3487
+ var len3 = r1;
3488
+ if (r3) {
3489
+ ptr3 = 0;
3490
+ len3 = 0;
3491
+ throw takeObject(r2);
3492
+ }
3493
+ deferred4_0 = ptr3;
3494
+ deferred4_1 = len3;
3495
+ return getStringFromWasm0(ptr3, len3);
3496
+ } finally {
3497
+ wasm.__wbindgen_add_to_stack_pointer(16);
3498
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3499
+ }
3500
+ }
3501
+ /**
3502
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3503
+ * wrapping key.
3504
+ * @param {string} wrapped_key
3505
+ * @param {Uint8Array} wrapping_key
3506
+ * @returns {Uint8Array}
3507
+ */
3508
+ static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3509
+ try {
3510
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3511
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3512
+ const len0 = WASM_VECTOR_LEN;
3513
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3514
+ const len1 = WASM_VECTOR_LEN;
3515
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3516
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3517
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3518
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3519
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3520
+ if (r3) {
3521
+ throw takeObject(r2);
3522
+ }
3523
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3524
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3525
+ return v3;
3526
+ } finally {
3527
+ wasm.__wbindgen_add_to_stack_pointer(16);
3528
+ }
3529
+ }
3530
+ /**
3531
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3532
+ * key,
3533
+ * @param {Uint8Array} decapsulation_key
3534
+ * @param {Uint8Array} wrapping_key
3535
+ * @returns {string}
3536
+ */
3537
+ static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3538
+ let deferred4_0;
3539
+ let deferred4_1;
3540
+ try {
3541
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3542
+ const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3543
+ const len0 = WASM_VECTOR_LEN;
3544
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3545
+ const len1 = WASM_VECTOR_LEN;
3546
+ wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3547
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3548
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3549
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3550
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3551
+ var ptr3 = r0;
3552
+ var len3 = r1;
3553
+ if (r3) {
3554
+ ptr3 = 0;
3555
+ len3 = 0;
3556
+ throw takeObject(r2);
3557
+ }
3558
+ deferred4_0 = ptr3;
3559
+ deferred4_1 = len3;
3560
+ return getStringFromWasm0(ptr3, len3);
3561
+ } finally {
3562
+ wasm.__wbindgen_add_to_stack_pointer(16);
3563
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3564
+ }
368
3565
  }
369
3566
  /**
370
- * @param {ClientSettings | undefined} [settings]
371
- * @param {LogLevel | undefined} [log_level]
3567
+ * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
3568
+ * wrapping key.
3569
+ * @param {string} wrapped_key
3570
+ * @param {Uint8Array} wrapping_key
3571
+ * @returns {Uint8Array}
372
3572
  */
373
- constructor(settings, log_level) {
374
- const ret = wasm.bitwardenclient_new(
375
- isLikeNone(settings) ? 0 : addHeapObject(settings),
376
- isLikeNone(log_level) ? 5 : log_level,
377
- );
378
- this.__wbg_ptr = ret >>> 0;
379
- BitwardenClientFinalization.register(this, this.__wbg_ptr, this);
380
- return this;
3573
+ static unwrap_decapsulation_key(wrapped_key, wrapping_key) {
3574
+ try {
3575
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3576
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3577
+ const len0 = WASM_VECTOR_LEN;
3578
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3579
+ const len1 = WASM_VECTOR_LEN;
3580
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3581
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3582
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3583
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3584
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3585
+ if (r3) {
3586
+ throw takeObject(r2);
3587
+ }
3588
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3589
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3590
+ return v3;
3591
+ } finally {
3592
+ wasm.__wbindgen_add_to_stack_pointer(16);
3593
+ }
381
3594
  }
382
3595
  /**
383
- * Test method, echoes back the input
384
- * @param {string} msg
3596
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3597
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3598
+ * the sender's authenticity cannot be verified by the recipient.
3599
+ * @param {Uint8Array} shared_key
3600
+ * @param {Uint8Array} encapsulation_key
385
3601
  * @returns {string}
386
3602
  */
387
- echo(msg) {
388
- let deferred2_0;
389
- let deferred2_1;
3603
+ static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3604
+ let deferred4_0;
3605
+ let deferred4_1;
390
3606
  try {
391
3607
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
392
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3608
+ const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
393
3609
  const len0 = WASM_VECTOR_LEN;
394
- wasm.bitwardenclient_echo(retptr, this.__wbg_ptr, ptr0, len0);
3610
+ const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3611
+ const len1 = WASM_VECTOR_LEN;
3612
+ wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
395
3613
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
396
3614
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
397
- deferred2_0 = r0;
398
- deferred2_1 = r1;
399
- return getStringFromWasm0(r0, r1);
3615
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3616
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3617
+ var ptr3 = r0;
3618
+ var len3 = r1;
3619
+ if (r3) {
3620
+ ptr3 = 0;
3621
+ len3 = 0;
3622
+ throw takeObject(r2);
3623
+ }
3624
+ deferred4_0 = ptr3;
3625
+ deferred4_1 = len3;
3626
+ return getStringFromWasm0(ptr3, len3);
400
3627
  } finally {
401
3628
  wasm.__wbindgen_add_to_stack_pointer(16);
402
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
3629
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
403
3630
  }
404
3631
  }
405
3632
  /**
406
- * @returns {string}
3633
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3634
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3635
+ * recipient.
3636
+ * @param {string} encapsulated_key
3637
+ * @param {Uint8Array} decapsulation_key
3638
+ * @returns {Uint8Array}
407
3639
  */
408
- version() {
409
- let deferred1_0;
410
- let deferred1_1;
3640
+ static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
411
3641
  try {
412
3642
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
413
- wasm.bitwardenclient_version(retptr, this.__wbg_ptr);
3643
+ const ptr0 = passStringToWasm0(
3644
+ encapsulated_key,
3645
+ wasm.__wbindgen_malloc,
3646
+ wasm.__wbindgen_realloc,
3647
+ );
3648
+ const len0 = WASM_VECTOR_LEN;
3649
+ const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3650
+ const len1 = WASM_VECTOR_LEN;
3651
+ wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
414
3652
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
415
3653
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
416
- deferred1_0 = r0;
417
- deferred1_1 = r1;
418
- return getStringFromWasm0(r0, r1);
3654
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3655
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3656
+ if (r3) {
3657
+ throw takeObject(r2);
3658
+ }
3659
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3660
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3661
+ return v3;
419
3662
  } finally {
420
3663
  wasm.__wbindgen_add_to_stack_pointer(16);
421
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
422
3664
  }
423
3665
  }
424
3666
  /**
425
- * @param {string} msg
426
- * @returns {Promise<void>}
3667
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3668
+ * the corresponding verifying key.
3669
+ * @param {string} signing_key
3670
+ * @param {Uint8Array} wrapping_key
3671
+ * @returns {Uint8Array}
427
3672
  */
428
- throw(msg) {
429
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
430
- const len0 = WASM_VECTOR_LEN;
431
- const ret = wasm.bitwardenclient_throw(this.__wbg_ptr, ptr0, len0);
432
- return takeObject(ret);
3673
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
3674
+ try {
3675
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3676
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3677
+ const len0 = WASM_VECTOR_LEN;
3678
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3679
+ const len1 = WASM_VECTOR_LEN;
3680
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3681
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3682
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3683
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3684
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3685
+ if (r3) {
3686
+ throw takeObject(r2);
3687
+ }
3688
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3689
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3690
+ return v3;
3691
+ } finally {
3692
+ wasm.__wbindgen_add_to_stack_pointer(16);
3693
+ }
433
3694
  }
434
3695
  /**
435
- * Test method, calls http endpoint
436
- * @param {string} url
437
- * @returns {Promise<string>}
3696
+ * Returns the algorithm used for the given verifying key.
3697
+ * @param {Uint8Array} verifying_key
3698
+ * @returns {SignatureAlgorithm}
438
3699
  */
439
- http_get(url) {
440
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
441
- const len0 = WASM_VECTOR_LEN;
442
- const ret = wasm.bitwardenclient_http_get(this.__wbg_ptr, ptr0, len0);
443
- return takeObject(ret);
3700
+ static key_algorithm_for_verifying_key(verifying_key) {
3701
+ try {
3702
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3703
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3704
+ const len0 = WASM_VECTOR_LEN;
3705
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3706
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3707
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3708
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3709
+ if (r2) {
3710
+ throw takeObject(r1);
3711
+ }
3712
+ return takeObject(r0);
3713
+ } finally {
3714
+ wasm.__wbindgen_add_to_stack_pointer(16);
3715
+ }
444
3716
  }
445
3717
  /**
446
- * @returns {ClientCrypto}
3718
+ * For a given signing identity (verifying key), this function verifies that the signing
3719
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
3720
+ * that the signing identity has the intent to receive messages encrypted to the public
3721
+ * key.
3722
+ * @param {Uint8Array} signed_public_key
3723
+ * @param {Uint8Array} verifying_key
3724
+ * @returns {Uint8Array}
447
3725
  */
448
- crypto() {
449
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
450
- return ClientCrypto.__wrap(ret);
3726
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
3727
+ try {
3728
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3729
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
3730
+ const len0 = WASM_VECTOR_LEN;
3731
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3732
+ const len1 = WASM_VECTOR_LEN;
3733
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
3734
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3735
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3736
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3737
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3738
+ if (r3) {
3739
+ throw takeObject(r2);
3740
+ }
3741
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3742
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3743
+ return v3;
3744
+ } finally {
3745
+ wasm.__wbindgen_add_to_stack_pointer(16);
3746
+ }
451
3747
  }
452
3748
  /**
453
- * @returns {ClientVault}
3749
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3750
+ * @param {Uint8Array} password
3751
+ * @param {Uint8Array} salt
3752
+ * @param {Kdf} kdf
3753
+ * @returns {Uint8Array}
454
3754
  */
455
- vault() {
456
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
457
- return ClientVault.__wrap(ret);
3755
+ static derive_kdf_material(password, salt, kdf) {
3756
+ try {
3757
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3758
+ const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3759
+ const len0 = WASM_VECTOR_LEN;
3760
+ const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3761
+ const len1 = WASM_VECTOR_LEN;
3762
+ wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3763
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3764
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3765
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3766
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3767
+ if (r3) {
3768
+ throw takeObject(r2);
3769
+ }
3770
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3771
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3772
+ return v3;
3773
+ } finally {
3774
+ wasm.__wbindgen_add_to_stack_pointer(16);
3775
+ }
3776
+ }
3777
+ /**
3778
+ * @param {string} encrypted_user_key
3779
+ * @param {Uint8Array} master_key
3780
+ * @returns {Uint8Array}
3781
+ */
3782
+ static decrypt_user_key_with_master_key(encrypted_user_key, master_key) {
3783
+ try {
3784
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3785
+ const ptr0 = passStringToWasm0(
3786
+ encrypted_user_key,
3787
+ wasm.__wbindgen_malloc,
3788
+ wasm.__wbindgen_realloc,
3789
+ );
3790
+ const len0 = WASM_VECTOR_LEN;
3791
+ const ptr1 = passArray8ToWasm0(master_key, wasm.__wbindgen_malloc);
3792
+ const len1 = WASM_VECTOR_LEN;
3793
+ wasm.purecrypto_decrypt_user_key_with_master_key(retptr, ptr0, len0, ptr1, len1);
3794
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3795
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3796
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3797
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3798
+ if (r3) {
3799
+ throw takeObject(r2);
3800
+ }
3801
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3802
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3803
+ return v3;
3804
+ } finally {
3805
+ wasm.__wbindgen_add_to_stack_pointer(16);
3806
+ }
458
3807
  }
459
3808
  }
460
- module.exports.BitwardenClient = BitwardenClient;
3809
+ module.exports.PureCrypto = PureCrypto;
461
3810
 
462
- const ClientCryptoFinalization =
3811
+ const SendAccessClientFinalization =
463
3812
  typeof FinalizationRegistry === "undefined"
464
3813
  ? { register: () => {}, unregister: () => {} }
465
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientcrypto_free(ptr >>> 0, 1));
466
-
467
- class ClientCrypto {
3814
+ : new FinalizationRegistry((ptr) => wasm.__wbg_sendaccessclient_free(ptr >>> 0, 1));
3815
+ /**
3816
+ * The `SendAccessClient` is used to interact with the Bitwarden API to get send access tokens.
3817
+ */
3818
+ class SendAccessClient {
468
3819
  static __wrap(ptr) {
469
3820
  ptr = ptr >>> 0;
470
- const obj = Object.create(ClientCrypto.prototype);
3821
+ const obj = Object.create(SendAccessClient.prototype);
471
3822
  obj.__wbg_ptr = ptr;
472
- ClientCryptoFinalization.register(obj, obj.__wbg_ptr, obj);
3823
+ SendAccessClientFinalization.register(obj, obj.__wbg_ptr, obj);
473
3824
  return obj;
474
3825
  }
475
3826
 
476
3827
  __destroy_into_raw() {
477
3828
  const ptr = this.__wbg_ptr;
478
3829
  this.__wbg_ptr = 0;
479
- ClientCryptoFinalization.unregister(this);
3830
+ SendAccessClientFinalization.unregister(this);
480
3831
  return ptr;
481
3832
  }
482
3833
 
483
3834
  free() {
484
3835
  const ptr = this.__destroy_into_raw();
485
- wasm.__wbg_clientcrypto_free(ptr, 0);
3836
+ wasm.__wbg_sendaccessclient_free(ptr, 0);
486
3837
  }
487
3838
  /**
488
- * Initialization method for the user crypto. Needs to be called before any other crypto
489
- * operations.
490
- * @param {InitUserCryptoRequest} req
491
- * @returns {Promise<void>}
3839
+ * Requests a new send access token.
3840
+ * @param {SendAccessTokenRequest} request
3841
+ * @returns {Promise<SendAccessTokenResponse>}
492
3842
  */
493
- initialize_user_crypto(req) {
494
- const ret = wasm.clientcrypto_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
3843
+ request_send_access_token(request) {
3844
+ const ret = wasm.sendaccessclient_request_send_access_token(
3845
+ this.__wbg_ptr,
3846
+ addHeapObject(request),
3847
+ );
495
3848
  return takeObject(ret);
496
3849
  }
3850
+ }
3851
+ module.exports.SendAccessClient = SendAccessClient;
3852
+
3853
+ const StateClientFinalization =
3854
+ typeof FinalizationRegistry === "undefined"
3855
+ ? { register: () => {}, unregister: () => {} }
3856
+ : new FinalizationRegistry((ptr) => wasm.__wbg_stateclient_free(ptr >>> 0, 1));
3857
+
3858
+ class StateClient {
3859
+ static __wrap(ptr) {
3860
+ ptr = ptr >>> 0;
3861
+ const obj = Object.create(StateClient.prototype);
3862
+ obj.__wbg_ptr = ptr;
3863
+ StateClientFinalization.register(obj, obj.__wbg_ptr, obj);
3864
+ return obj;
3865
+ }
3866
+
3867
+ __destroy_into_raw() {
3868
+ const ptr = this.__wbg_ptr;
3869
+ this.__wbg_ptr = 0;
3870
+ StateClientFinalization.unregister(this);
3871
+ return ptr;
3872
+ }
3873
+
3874
+ free() {
3875
+ const ptr = this.__destroy_into_raw();
3876
+ wasm.__wbg_stateclient_free(ptr, 0);
3877
+ }
497
3878
  /**
498
- * Initialization method for the organization crypto. Needs to be called after
499
- * `initialize_user_crypto` but before any other crypto operations.
500
- * @param {InitOrgCryptoRequest} req
3879
+ * @param {any} cipher_repository
3880
+ */
3881
+ register_cipher_repository(cipher_repository) {
3882
+ wasm.stateclient_register_cipher_repository(this.__wbg_ptr, addHeapObject(cipher_repository));
3883
+ }
3884
+ /**
3885
+ * @param {any} store
3886
+ */
3887
+ register_folder_repository(store) {
3888
+ wasm.stateclient_register_folder_repository(this.__wbg_ptr, addHeapObject(store));
3889
+ }
3890
+ /**
3891
+ * @param {Repositories} repositories
3892
+ */
3893
+ register_client_managed_repositories(repositories) {
3894
+ wasm.stateclient_register_client_managed_repositories(
3895
+ this.__wbg_ptr,
3896
+ addHeapObject(repositories),
3897
+ );
3898
+ }
3899
+ /**
3900
+ * Initialize the database for SDK managed repositories.
3901
+ * @param {IndexedDbConfiguration} configuration
501
3902
  * @returns {Promise<void>}
502
3903
  */
503
- initialize_org_crypto(req) {
504
- const ret = wasm.clientcrypto_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
3904
+ initialize_state(configuration) {
3905
+ const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
505
3906
  return takeObject(ret);
506
3907
  }
507
3908
  }
508
- module.exports.ClientCrypto = ClientCrypto;
3909
+ module.exports.StateClient = StateClient;
509
3910
 
510
- const ClientFoldersFinalization =
3911
+ const TotpClientFinalization =
511
3912
  typeof FinalizationRegistry === "undefined"
512
3913
  ? { register: () => {}, unregister: () => {} }
513
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientfolders_free(ptr >>> 0, 1));
3914
+ : new FinalizationRegistry((ptr) => wasm.__wbg_totpclient_free(ptr >>> 0, 1));
514
3915
 
515
- class ClientFolders {
3916
+ class TotpClient {
516
3917
  static __wrap(ptr) {
517
3918
  ptr = ptr >>> 0;
518
- const obj = Object.create(ClientFolders.prototype);
3919
+ const obj = Object.create(TotpClient.prototype);
519
3920
  obj.__wbg_ptr = ptr;
520
- ClientFoldersFinalization.register(obj, obj.__wbg_ptr, obj);
3921
+ TotpClientFinalization.register(obj, obj.__wbg_ptr, obj);
521
3922
  return obj;
522
3923
  }
523
3924
 
524
3925
  __destroy_into_raw() {
525
3926
  const ptr = this.__wbg_ptr;
526
3927
  this.__wbg_ptr = 0;
527
- ClientFoldersFinalization.unregister(this);
3928
+ TotpClientFinalization.unregister(this);
528
3929
  return ptr;
529
3930
  }
530
3931
 
531
3932
  free() {
532
3933
  const ptr = this.__destroy_into_raw();
533
- wasm.__wbg_clientfolders_free(ptr, 0);
3934
+ wasm.__wbg_totpclient_free(ptr, 0);
534
3935
  }
535
3936
  /**
536
- * Decrypt folder
537
- * @param {Folder} folder
538
- * @returns {FolderView}
3937
+ * Generates a TOTP code from a provided key
3938
+ *
3939
+ * # Arguments
3940
+ * - `key` - Can be:
3941
+ * - A base32 encoded string
3942
+ * - OTP Auth URI
3943
+ * - Steam URI
3944
+ * - `time_ms` - Optional timestamp in milliseconds
3945
+ * @param {string} key
3946
+ * @param {number | null} [time_ms]
3947
+ * @returns {TotpResponse}
539
3948
  */
540
- decrypt(folder) {
3949
+ generate_totp(key, time_ms) {
541
3950
  try {
542
3951
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
543
- wasm.clientfolders_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
3952
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3953
+ const len0 = WASM_VECTOR_LEN;
3954
+ wasm.totpclient_generate_totp(
3955
+ retptr,
3956
+ this.__wbg_ptr,
3957
+ ptr0,
3958
+ len0,
3959
+ !isLikeNone(time_ms),
3960
+ isLikeNone(time_ms) ? 0 : time_ms,
3961
+ );
544
3962
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
545
3963
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
546
3964
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -553,42 +3971,75 @@ class ClientFolders {
553
3971
  }
554
3972
  }
555
3973
  }
556
- module.exports.ClientFolders = ClientFolders;
3974
+ module.exports.TotpClient = TotpClient;
557
3975
 
558
- const ClientVaultFinalization =
3976
+ const VaultClientFinalization =
559
3977
  typeof FinalizationRegistry === "undefined"
560
3978
  ? { register: () => {}, unregister: () => {} }
561
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientvault_free(ptr >>> 0, 1));
3979
+ : new FinalizationRegistry((ptr) => wasm.__wbg_vaultclient_free(ptr >>> 0, 1));
562
3980
 
563
- class ClientVault {
3981
+ class VaultClient {
564
3982
  static __wrap(ptr) {
565
3983
  ptr = ptr >>> 0;
566
- const obj = Object.create(ClientVault.prototype);
3984
+ const obj = Object.create(VaultClient.prototype);
567
3985
  obj.__wbg_ptr = ptr;
568
- ClientVaultFinalization.register(obj, obj.__wbg_ptr, obj);
3986
+ VaultClientFinalization.register(obj, obj.__wbg_ptr, obj);
569
3987
  return obj;
570
3988
  }
571
3989
 
572
3990
  __destroy_into_raw() {
573
3991
  const ptr = this.__wbg_ptr;
574
3992
  this.__wbg_ptr = 0;
575
- ClientVaultFinalization.unregister(this);
3993
+ VaultClientFinalization.unregister(this);
576
3994
  return ptr;
577
3995
  }
578
3996
 
579
3997
  free() {
580
3998
  const ptr = this.__destroy_into_raw();
581
- wasm.__wbg_clientvault_free(ptr, 0);
3999
+ wasm.__wbg_vaultclient_free(ptr, 0);
4000
+ }
4001
+ /**
4002
+ * Attachment related operations.
4003
+ * @returns {AttachmentsClient}
4004
+ */
4005
+ attachments() {
4006
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4007
+ return AttachmentsClient.__wrap(ret);
4008
+ }
4009
+ /**
4010
+ * Cipher related operations.
4011
+ * @returns {CiphersClient}
4012
+ */
4013
+ ciphers() {
4014
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4015
+ return CiphersClient.__wrap(ret);
582
4016
  }
583
4017
  /**
584
- * @returns {ClientFolders}
4018
+ * Folder related operations.
4019
+ * @returns {FoldersClient}
585
4020
  */
586
4021
  folders() {
587
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
588
- return ClientFolders.__wrap(ret);
4022
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4023
+ return FoldersClient.__wrap(ret);
4024
+ }
4025
+ /**
4026
+ * TOTP related operations.
4027
+ * @returns {TotpClient}
4028
+ */
4029
+ totp() {
4030
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4031
+ return TotpClient.__wrap(ret);
4032
+ }
4033
+ /**
4034
+ * Collection related operations.
4035
+ * @returns {CollectionsClient}
4036
+ */
4037
+ collections() {
4038
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4039
+ return CollectionsClient.__wrap(ret);
589
4040
  }
590
4041
  }
591
- module.exports.ClientVault = ClientVault;
4042
+ module.exports.VaultClient = VaultClient;
592
4043
 
593
4044
  module.exports.__wbg_String_8f0eb39a4a4c2f66 = function (arg0, arg1) {
594
4045
  const ret = String(getObject(arg1));
@@ -598,23 +4049,37 @@ module.exports.__wbg_String_8f0eb39a4a4c2f66 = function (arg0, arg1) {
598
4049
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
599
4050
  };
600
4051
 
601
- module.exports.__wbg_abort_05026c983d86824c = function (arg0) {
4052
+ module.exports.__wbg_abort_410ec47a64ac6117 = function (arg0, arg1) {
4053
+ getObject(arg0).abort(getObject(arg1));
4054
+ };
4055
+
4056
+ module.exports.__wbg_abort_775ef1d17fc65868 = function (arg0) {
602
4057
  getObject(arg0).abort();
603
4058
  };
604
4059
 
605
- module.exports.__wbg_append_66f7cb821a84ee22 = function () {
4060
+ module.exports.__wbg_abort_99fc644e2c79c9fb = function () {
4061
+ return handleError(function (arg0) {
4062
+ getObject(arg0).abort();
4063
+ }, arguments);
4064
+ };
4065
+
4066
+ module.exports.__wbg_addEventListener_dc3da056b615f634 = function (arg0, arg1, arg2, arg3) {
4067
+ getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
4068
+ };
4069
+
4070
+ module.exports.__wbg_append_299d5d48292c0495 = function () {
606
4071
  return handleError(function (arg0, arg1, arg2, arg3, arg4) {
607
4072
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
608
4073
  }, arguments);
609
4074
  };
610
4075
 
611
- module.exports.__wbg_append_72d1635ad8643998 = function () {
4076
+ module.exports.__wbg_append_8c7dd8d641a5f01b = function () {
612
4077
  return handleError(function (arg0, arg1, arg2, arg3, arg4) {
613
4078
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
614
4079
  }, arguments);
615
4080
  };
616
4081
 
617
- module.exports.__wbg_append_7606a4b52c36db7b = function () {
4082
+ module.exports.__wbg_append_b2d1fc16de2a0e81 = function () {
618
4083
  return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
619
4084
  getObject(arg0).append(
620
4085
  getStringFromWasm0(arg1, arg2),
@@ -624,54 +4089,85 @@ module.exports.__wbg_append_7606a4b52c36db7b = function () {
624
4089
  }, arguments);
625
4090
  };
626
4091
 
627
- module.exports.__wbg_append_f513a7a3683bdc23 = function () {
4092
+ module.exports.__wbg_append_b44785ebeb668479 = function () {
628
4093
  return handleError(function (arg0, arg1, arg2, arg3) {
629
4094
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getObject(arg3));
630
4095
  }, arguments);
631
4096
  };
632
4097
 
633
- module.exports.__wbg_buffer_61b7ce01341d7f88 = function (arg0) {
4098
+ module.exports.__wbg_arrayBuffer_d1b44c4390db422f = function () {
4099
+ return handleError(function (arg0) {
4100
+ const ret = getObject(arg0).arrayBuffer();
4101
+ return addHeapObject(ret);
4102
+ }, arguments);
4103
+ };
4104
+
4105
+ module.exports.__wbg_buffer_609cc3eee51ed158 = function (arg0) {
634
4106
  const ret = getObject(arg0).buffer;
635
4107
  return addHeapObject(ret);
636
4108
  };
637
4109
 
638
- module.exports.__wbg_call_500db948e69c7330 = function () {
4110
+ module.exports.__wbg_call_672a4d21634d4a24 = function () {
4111
+ return handleError(function (arg0, arg1) {
4112
+ const ret = getObject(arg0).call(getObject(arg1));
4113
+ return addHeapObject(ret);
4114
+ }, arguments);
4115
+ };
4116
+
4117
+ module.exports.__wbg_call_7cccdd69e0791ae2 = function () {
639
4118
  return handleError(function (arg0, arg1, arg2) {
640
4119
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
641
4120
  return addHeapObject(ret);
642
4121
  }, arguments);
643
4122
  };
644
4123
 
645
- module.exports.__wbg_call_b0d8e36992d9900d = function () {
646
- return handleError(function (arg0, arg1) {
647
- const ret = getObject(arg0).call(getObject(arg1));
4124
+ module.exports.__wbg_cipher_8d57d546ebd28feb = function (arg0) {
4125
+ const ret = getObject(arg0).cipher;
4126
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4127
+ };
4128
+
4129
+ module.exports.__wbg_clearTimeout_b1115618e821c3b2 = function (arg0) {
4130
+ const ret = clearTimeout(takeObject(arg0));
4131
+ return addHeapObject(ret);
4132
+ };
4133
+
4134
+ module.exports.__wbg_collectionviewnodeitem_new = function (arg0) {
4135
+ const ret = CollectionViewNodeItem.__wrap(arg0);
4136
+ return addHeapObject(ret);
4137
+ };
4138
+
4139
+ module.exports.__wbg_createObjectStore_d2f9e1016f4d81b9 = function () {
4140
+ return handleError(function (arg0, arg1, arg2, arg3) {
4141
+ const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2), getObject(arg3));
648
4142
  return addHeapObject(ret);
649
4143
  }, arguments);
650
4144
  };
651
4145
 
652
- module.exports.__wbg_crypto_ed58b8e10a292839 = function (arg0) {
4146
+ module.exports.__wbg_crypto_574e78ad8b13b65f = function (arg0) {
653
4147
  const ret = getObject(arg0).crypto;
654
4148
  return addHeapObject(ret);
655
4149
  };
656
4150
 
657
- module.exports.__wbg_debug_19114f11037e4658 = function (arg0, arg1, arg2, arg3) {
4151
+ module.exports.__wbg_debug_e17b51583ca6a632 = function (arg0, arg1, arg2, arg3) {
658
4152
  console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
659
4153
  };
660
4154
 
661
- module.exports.__wbg_done_f22c1561fa919baa = function (arg0) {
4155
+ module.exports.__wbg_deleteObjectStore_3f08ae00cd288224 = function () {
4156
+ return handleError(function (arg0, arg1, arg2) {
4157
+ getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
4158
+ }, arguments);
4159
+ };
4160
+
4161
+ module.exports.__wbg_done_769e5ede4b31c67b = function (arg0) {
662
4162
  const ret = getObject(arg0).done;
663
4163
  return ret;
664
4164
  };
665
4165
 
666
- module.exports.__wbg_entries_4f2bb9b0d701c0f6 = function (arg0) {
4166
+ module.exports.__wbg_entries_3265d4158b33e5dc = function (arg0) {
667
4167
  const ret = Object.entries(getObject(arg0));
668
4168
  return addHeapObject(ret);
669
4169
  };
670
4170
 
671
- module.exports.__wbg_error_483d659117b6f3f6 = function (arg0, arg1, arg2, arg3) {
672
- console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
673
- };
674
-
675
4171
  module.exports.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
676
4172
  let deferred0_0;
677
4173
  let deferred0_1;
@@ -684,32 +4180,94 @@ module.exports.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
684
4180
  }
685
4181
  };
686
4182
 
687
- module.exports.__wbg_fetch_229368eecee9d217 = function (arg0, arg1) {
4183
+ module.exports.__wbg_error_80de38b3f7cc3c3c = function (arg0, arg1, arg2, arg3) {
4184
+ console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4185
+ };
4186
+
4187
+ module.exports.__wbg_error_ff4ddaabdfc5dbb3 = function () {
4188
+ return handleError(function (arg0) {
4189
+ const ret = getObject(arg0).error;
4190
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4191
+ }, arguments);
4192
+ };
4193
+
4194
+ module.exports.__wbg_fetch_3afbdcc7ddbf16fe = function (arg0) {
4195
+ const ret = fetch(getObject(arg0));
4196
+ return addHeapObject(ret);
4197
+ };
4198
+
4199
+ module.exports.__wbg_fetch_509096533071c657 = function (arg0, arg1) {
688
4200
  const ret = getObject(arg0).fetch(getObject(arg1));
689
4201
  return addHeapObject(ret);
690
4202
  };
691
4203
 
692
- module.exports.__wbg_fetch_b335d17f45a8b5a1 = function (arg0) {
693
- const ret = fetch(getObject(arg0));
694
- return addHeapObject(ret);
4204
+ module.exports.__wbg_folder_e7b703a9574b8633 = function (arg0) {
4205
+ const ret = getObject(arg0).folder;
4206
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4207
+ };
4208
+
4209
+ module.exports.__wbg_getRandomValues_38097e921c2494c3 = function () {
4210
+ return handleError(function (arg0, arg1) {
4211
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
4212
+ }, arguments);
4213
+ };
4214
+
4215
+ module.exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function () {
4216
+ return handleError(function (arg0, arg1) {
4217
+ getObject(arg0).getRandomValues(getObject(arg1));
4218
+ }, arguments);
4219
+ };
4220
+
4221
+ module.exports.__wbg_getTime_46267b1c24877e30 = function (arg0) {
4222
+ const ret = getObject(arg0).getTime();
4223
+ return ret;
4224
+ };
4225
+
4226
+ module.exports.__wbg_get_0fe8cec0c515874b = function () {
4227
+ return handleError(function (arg0, arg1, arg2) {
4228
+ let deferred0_0;
4229
+ let deferred0_1;
4230
+ try {
4231
+ deferred0_0 = arg1;
4232
+ deferred0_1 = arg2;
4233
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
4234
+ return addHeapObject(ret);
4235
+ } finally {
4236
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4237
+ }
4238
+ }, arguments);
4239
+ };
4240
+
4241
+ module.exports.__wbg_get_67b2ba62fc30de12 = function () {
4242
+ return handleError(function (arg0, arg1) {
4243
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
4244
+ return addHeapObject(ret);
4245
+ }, arguments);
695
4246
  };
696
4247
 
697
- module.exports.__wbg_getRandomValues_bcb4912f16000dc4 = function () {
698
- return handleError(function (arg0, arg1) {
699
- getObject(arg0).getRandomValues(getObject(arg1));
4248
+ module.exports.__wbg_get_68689cff5a27a4e3 = function () {
4249
+ return handleError(function (arg0, arg1, arg2) {
4250
+ let deferred0_0;
4251
+ let deferred0_1;
4252
+ try {
4253
+ deferred0_0 = arg1;
4254
+ deferred0_1 = arg2;
4255
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
4256
+ return addHeapObject(ret);
4257
+ } finally {
4258
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4259
+ }
700
4260
  }, arguments);
701
4261
  };
702
4262
 
703
- module.exports.__wbg_get_9aa3dff3f0266054 = function (arg0, arg1) {
4263
+ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
704
4264
  const ret = getObject(arg0)[arg1 >>> 0];
705
4265
  return addHeapObject(ret);
706
4266
  };
707
4267
 
708
- module.exports.__wbg_get_bbccf8970793c087 = function () {
709
- return handleError(function (arg0, arg1) {
710
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
711
- return addHeapObject(ret);
712
- }, arguments);
4268
+ module.exports.__wbg_getaccesstoken_e19adb10f028d797 = function (arg0) {
4269
+ const ret = getObject(arg0).get_access_token();
4270
+ return addHeapObject(ret);
713
4271
  };
714
4272
 
715
4273
  module.exports.__wbg_getwithrefkey_1dc361bd10053bfe = function (arg0, arg1) {
@@ -717,23 +4275,42 @@ module.exports.__wbg_getwithrefkey_1dc361bd10053bfe = function (arg0, arg1) {
717
4275
  return addHeapObject(ret);
718
4276
  };
719
4277
 
720
- module.exports.__wbg_has_94c2fc1d261bbfe9 = function () {
4278
+ module.exports.__wbg_has_a5ea9117f258a0ec = function () {
721
4279
  return handleError(function (arg0, arg1) {
722
4280
  const ret = Reflect.has(getObject(arg0), getObject(arg1));
723
4281
  return ret;
724
4282
  }, arguments);
725
4283
  };
726
4284
 
727
- module.exports.__wbg_headers_24e3e19fe3f187c0 = function (arg0) {
4285
+ module.exports.__wbg_headers_9cb51cfd2ac780a4 = function (arg0) {
728
4286
  const ret = getObject(arg0).headers;
729
4287
  return addHeapObject(ret);
730
4288
  };
731
4289
 
732
- module.exports.__wbg_info_18e75e6ce8a36a90 = function (arg0, arg1, arg2, arg3) {
4290
+ module.exports.__wbg_incomingmessage_new = function (arg0) {
4291
+ const ret = IncomingMessage.__wrap(arg0);
4292
+ return addHeapObject(ret);
4293
+ };
4294
+
4295
+ module.exports.__wbg_indexedDB_b1f49280282046f8 = function () {
4296
+ return handleError(function (arg0) {
4297
+ const ret = getObject(arg0).indexedDB;
4298
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4299
+ }, arguments);
4300
+ };
4301
+
4302
+ module.exports.__wbg_indexedDB_f6b47b0dc333fd2f = function () {
4303
+ return handleError(function (arg0) {
4304
+ const ret = getObject(arg0).indexedDB;
4305
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4306
+ }, arguments);
4307
+ };
4308
+
4309
+ module.exports.__wbg_info_033d8b8a0838f1d3 = function (arg0, arg1, arg2, arg3) {
733
4310
  console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
734
4311
  };
735
4312
 
736
- module.exports.__wbg_instanceof_ArrayBuffer_670ddde44cdb2602 = function (arg0) {
4313
+ module.exports.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function (arg0) {
737
4314
  let result;
738
4315
  try {
739
4316
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -744,7 +4321,62 @@ module.exports.__wbg_instanceof_ArrayBuffer_670ddde44cdb2602 = function (arg0) {
744
4321
  return ret;
745
4322
  };
746
4323
 
747
- module.exports.__wbg_instanceof_Response_d3453657e10c4300 = function (arg0) {
4324
+ module.exports.__wbg_instanceof_DomException_ed1ccb7aaf39034c = function (arg0) {
4325
+ let result;
4326
+ try {
4327
+ result = getObject(arg0) instanceof DOMException;
4328
+ } catch (_) {
4329
+ result = false;
4330
+ }
4331
+ const ret = result;
4332
+ return ret;
4333
+ };
4334
+
4335
+ module.exports.__wbg_instanceof_IdbDatabase_a3ef009ca00059f9 = function (arg0) {
4336
+ let result;
4337
+ try {
4338
+ result = getObject(arg0) instanceof IDBDatabase;
4339
+ } catch (_) {
4340
+ result = false;
4341
+ }
4342
+ const ret = result;
4343
+ return ret;
4344
+ };
4345
+
4346
+ module.exports.__wbg_instanceof_IdbOpenDbRequest_a3416e156c9db893 = function (arg0) {
4347
+ let result;
4348
+ try {
4349
+ result = getObject(arg0) instanceof IDBOpenDBRequest;
4350
+ } catch (_) {
4351
+ result = false;
4352
+ }
4353
+ const ret = result;
4354
+ return ret;
4355
+ };
4356
+
4357
+ module.exports.__wbg_instanceof_IdbRequest_4813c3f207666aa4 = function (arg0) {
4358
+ let result;
4359
+ try {
4360
+ result = getObject(arg0) instanceof IDBRequest;
4361
+ } catch (_) {
4362
+ result = false;
4363
+ }
4364
+ const ret = result;
4365
+ return ret;
4366
+ };
4367
+
4368
+ module.exports.__wbg_instanceof_Map_f3469ce2244d2430 = function (arg0) {
4369
+ let result;
4370
+ try {
4371
+ result = getObject(arg0) instanceof Map;
4372
+ } catch (_) {
4373
+ result = false;
4374
+ }
4375
+ const ret = result;
4376
+ return ret;
4377
+ };
4378
+
4379
+ module.exports.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function (arg0) {
748
4380
  let result;
749
4381
  try {
750
4382
  result = getObject(arg0) instanceof Response;
@@ -755,7 +4387,7 @@ module.exports.__wbg_instanceof_Response_d3453657e10c4300 = function (arg0) {
755
4387
  return ret;
756
4388
  };
757
4389
 
758
- module.exports.__wbg_instanceof_Uint8Array_28af5bc19d6acad8 = function (arg0) {
4390
+ module.exports.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function (arg0) {
759
4391
  let result;
760
4392
  try {
761
4393
  result = getObject(arg0) instanceof Uint8Array;
@@ -766,62 +4398,109 @@ module.exports.__wbg_instanceof_Uint8Array_28af5bc19d6acad8 = function (arg0) {
766
4398
  return ret;
767
4399
  };
768
4400
 
769
- module.exports.__wbg_isSafeInteger_12f5549b2fca23f4 = function (arg0) {
4401
+ module.exports.__wbg_instanceof_Window_def73ea0955fc569 = function (arg0) {
4402
+ let result;
4403
+ try {
4404
+ result = getObject(arg0) instanceof Window;
4405
+ } catch (_) {
4406
+ result = false;
4407
+ }
4408
+ const ret = result;
4409
+ return ret;
4410
+ };
4411
+
4412
+ module.exports.__wbg_instanceof_WorkerGlobalScope_dbdbdea7e3b56493 = function (arg0) {
4413
+ let result;
4414
+ try {
4415
+ result = getObject(arg0) instanceof WorkerGlobalScope;
4416
+ } catch (_) {
4417
+ result = false;
4418
+ }
4419
+ const ret = result;
4420
+ return ret;
4421
+ };
4422
+
4423
+ module.exports.__wbg_ipcclientsubscription_new = function (arg0) {
4424
+ const ret = IpcClientSubscription.__wrap(arg0);
4425
+ return addHeapObject(ret);
4426
+ };
4427
+
4428
+ module.exports.__wbg_isArray_a1eab7e0d067391b = function (arg0) {
4429
+ const ret = Array.isArray(getObject(arg0));
4430
+ return ret;
4431
+ };
4432
+
4433
+ module.exports.__wbg_isSafeInteger_343e2beeeece1bb0 = function (arg0) {
770
4434
  const ret = Number.isSafeInteger(getObject(arg0));
771
4435
  return ret;
772
4436
  };
773
4437
 
774
- module.exports.__wbg_iterator_23604bb983791576 = function () {
4438
+ module.exports.__wbg_iterator_9a24c88df860dc65 = function () {
775
4439
  const ret = Symbol.iterator;
776
4440
  return addHeapObject(ret);
777
4441
  };
778
4442
 
779
- module.exports.__wbg_length_65d1cd11729ced11 = function (arg0) {
4443
+ module.exports.__wbg_length_a446193dc22c12f8 = function (arg0) {
780
4444
  const ret = getObject(arg0).length;
781
4445
  return ret;
782
4446
  };
783
4447
 
784
- module.exports.__wbg_length_d65cf0786bfc5739 = function (arg0) {
4448
+ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
785
4449
  const ret = getObject(arg0).length;
786
4450
  return ret;
787
4451
  };
788
4452
 
789
- module.exports.__wbg_log_bc77772961bf21bb = function (arg0, arg1, arg2, arg3) {
4453
+ module.exports.__wbg_list_4d7ad3b099048858 = function () {
4454
+ return handleError(function (arg0) {
4455
+ const ret = getObject(arg0).list();
4456
+ return addHeapObject(ret);
4457
+ }, arguments);
4458
+ };
4459
+
4460
+ module.exports.__wbg_list_58b48f9ba5ad52dc = function () {
4461
+ return handleError(function (arg0) {
4462
+ const ret = getObject(arg0).list();
4463
+ return addHeapObject(ret);
4464
+ }, arguments);
4465
+ };
4466
+
4467
+ module.exports.__wbg_log_cad59bb680daec67 = function (arg0, arg1, arg2, arg3) {
790
4468
  console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
791
4469
  };
792
4470
 
793
- module.exports.__wbg_msCrypto_0a36e2ec3a343d26 = function (arg0) {
4471
+ module.exports.__wbg_msCrypto_a61aeb35a24c1329 = function (arg0) {
794
4472
  const ret = getObject(arg0).msCrypto;
795
4473
  return addHeapObject(ret);
796
4474
  };
797
4475
 
798
- module.exports.__wbg_new_079af0206358fe9d = function () {
799
- return handleError(function () {
800
- const ret = new FormData();
801
- return addHeapObject(ret);
802
- }, arguments);
4476
+ module.exports.__wbg_name_f2d27098bfd843e7 = function (arg0, arg1) {
4477
+ const ret = getObject(arg1).name;
4478
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4479
+ const len1 = WASM_VECTOR_LEN;
4480
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4481
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
803
4482
  };
804
4483
 
805
- module.exports.__wbg_new_254fa9eac11932ae = function () {
806
- const ret = new Array();
4484
+ module.exports.__wbg_new0_f788a2397c7ca929 = function () {
4485
+ const ret = new Date();
807
4486
  return addHeapObject(ret);
808
4487
  };
809
4488
 
810
- module.exports.__wbg_new_35d748855c4620b9 = function () {
4489
+ module.exports.__wbg_new_018dcc2d6c8c2f6a = function () {
811
4490
  return handleError(function () {
812
4491
  const ret = new Headers();
813
4492
  return addHeapObject(ret);
814
4493
  }, arguments);
815
4494
  };
816
4495
 
817
- module.exports.__wbg_new_3d446df9155128ef = function (arg0, arg1) {
4496
+ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
818
4497
  try {
819
4498
  var state0 = { a: arg0, b: arg1 };
820
4499
  var cb0 = (arg0, arg1) => {
821
4500
  const a = state0.a;
822
4501
  state0.a = 0;
823
4502
  try {
824
- return __wbg_adapter_125(a, state0.b, arg0, arg1);
4503
+ return __wbg_adapter_346(a, state0.b, arg0, arg1);
825
4504
  } finally {
826
4505
  state0.a = a;
827
4506
  }
@@ -833,31 +4512,48 @@ module.exports.__wbg_new_3d446df9155128ef = function (arg0, arg1) {
833
4512
  }
834
4513
  };
835
4514
 
836
- module.exports.__wbg_new_3ff5b33b1ce712df = function (arg0) {
837
- const ret = new Uint8Array(getObject(arg0));
4515
+ module.exports.__wbg_new_405e22f390576ce2 = function () {
4516
+ const ret = new Object();
4517
+ return addHeapObject(ret);
4518
+ };
4519
+
4520
+ module.exports.__wbg_new_5e0be73521bc8c17 = function () {
4521
+ const ret = new Map();
4522
+ return addHeapObject(ret);
4523
+ };
4524
+
4525
+ module.exports.__wbg_new_78feb108b6472713 = function () {
4526
+ const ret = new Array();
4527
+ return addHeapObject(ret);
4528
+ };
4529
+
4530
+ module.exports.__wbg_new_8a6f238a6ece86ea = function () {
4531
+ const ret = new Error();
838
4532
  return addHeapObject(ret);
839
4533
  };
840
4534
 
841
- module.exports.__wbg_new_5f48f21d4be11586 = function () {
4535
+ module.exports.__wbg_new_9fd39a253424609a = function () {
842
4536
  return handleError(function () {
843
- const ret = new AbortController();
4537
+ const ret = new FormData();
844
4538
  return addHeapObject(ret);
845
4539
  }, arguments);
846
4540
  };
847
4541
 
848
- module.exports.__wbg_new_6799ef630abee97c = function (arg0, arg1) {
849
- const ret = new Error(getStringFromWasm0(arg0, arg1));
4542
+ module.exports.__wbg_new_a12002a7f91c75be = function (arg0) {
4543
+ const ret = new Uint8Array(getObject(arg0));
850
4544
  return addHeapObject(ret);
851
4545
  };
852
4546
 
853
- module.exports.__wbg_new_688846f374351c92 = function () {
854
- const ret = new Object();
4547
+ module.exports.__wbg_new_c68d7209be747379 = function (arg0, arg1) {
4548
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
855
4549
  return addHeapObject(ret);
856
4550
  };
857
4551
 
858
- module.exports.__wbg_new_8a6f238a6ece86ea = function () {
859
- const ret = new Error();
860
- return addHeapObject(ret);
4552
+ module.exports.__wbg_new_e25e5aab09ff45db = function () {
4553
+ return handleError(function () {
4554
+ const ret = new AbortController();
4555
+ return addHeapObject(ret);
4556
+ }, arguments);
861
4557
  };
862
4558
 
863
4559
  module.exports.__wbg_new_f24b6d53abe5bc82 = function (arg0, arg1) {
@@ -873,114 +4569,220 @@ module.exports.__wbg_new_f24b6d53abe5bc82 = function (arg0, arg1) {
873
4569
  }
874
4570
  };
875
4571
 
876
- module.exports.__wbg_newnoargs_fd9e4bf8be2bc16d = function (arg0, arg1) {
4572
+ module.exports.__wbg_newnoargs_105ed471475aaf50 = function (arg0, arg1) {
877
4573
  const ret = new Function(getStringFromWasm0(arg0, arg1));
878
4574
  return addHeapObject(ret);
879
4575
  };
880
4576
 
881
- module.exports.__wbg_newwithbyteoffsetandlength_ba35896968751d91 = function (arg0, arg1, arg2) {
4577
+ module.exports.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function (arg0, arg1, arg2) {
882
4578
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
883
4579
  return addHeapObject(ret);
884
4580
  };
885
4581
 
886
- module.exports.__wbg_newwithlength_34ce8f1051e74449 = function (arg0) {
4582
+ module.exports.__wbg_newwithlength_a381634e90c276d4 = function (arg0) {
887
4583
  const ret = new Uint8Array(arg0 >>> 0);
888
4584
  return addHeapObject(ret);
889
4585
  };
890
4586
 
891
- module.exports.__wbg_newwithstrandinit_a1f6583f20e4faff = function () {
4587
+ module.exports.__wbg_newwithstrandinit_06c535e0a867c635 = function () {
892
4588
  return handleError(function (arg0, arg1, arg2) {
893
4589
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
894
4590
  return addHeapObject(ret);
895
4591
  }, arguments);
896
4592
  };
897
4593
 
898
- module.exports.__wbg_newwithu8arraysequenceandoptions_75a3b40c32d6c988 = function () {
4594
+ module.exports.__wbg_newwithu8arraysequenceandoptions_068570c487f69127 = function () {
899
4595
  return handleError(function (arg0, arg1) {
900
4596
  const ret = new Blob(getObject(arg0), getObject(arg1));
901
4597
  return addHeapObject(ret);
902
4598
  }, arguments);
903
4599
  };
904
4600
 
905
- module.exports.__wbg_next_01dd9234a5bf6d05 = function () {
4601
+ module.exports.__wbg_next_25feadfc0913fea9 = function (arg0) {
4602
+ const ret = getObject(arg0).next;
4603
+ return addHeapObject(ret);
4604
+ };
4605
+
4606
+ module.exports.__wbg_next_6574e1a8a62d1055 = function () {
906
4607
  return handleError(function (arg0) {
907
4608
  const ret = getObject(arg0).next();
908
4609
  return addHeapObject(ret);
909
4610
  }, arguments);
910
4611
  };
911
4612
 
912
- module.exports.__wbg_next_137428deb98342b0 = function (arg0) {
913
- const ret = getObject(arg0).next;
4613
+ module.exports.__wbg_node_905d3e251edff8a2 = function (arg0) {
4614
+ const ret = getObject(arg0).node;
914
4615
  return addHeapObject(ret);
915
4616
  };
916
4617
 
917
- module.exports.__wbg_node_02999533c4ea02e3 = function (arg0) {
918
- const ret = getObject(arg0).node;
919
- return addHeapObject(ret);
4618
+ module.exports.__wbg_open_e0c0b2993eb596e1 = function () {
4619
+ return handleError(function (arg0, arg1, arg2, arg3) {
4620
+ const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
4621
+ return addHeapObject(ret);
4622
+ }, arguments);
4623
+ };
4624
+
4625
+ module.exports.__wbg_parse_def2e24ef1252aff = function () {
4626
+ return handleError(function (arg0, arg1) {
4627
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
4628
+ return addHeapObject(ret);
4629
+ }, arguments);
4630
+ };
4631
+
4632
+ module.exports.__wbg_preventDefault_c2314fd813c02b3c = function (arg0) {
4633
+ getObject(arg0).preventDefault();
920
4634
  };
921
4635
 
922
- module.exports.__wbg_process_5c1d670bc53614b8 = function (arg0) {
4636
+ module.exports.__wbg_process_dc0fbacc7c1c06f7 = function (arg0) {
923
4637
  const ret = getObject(arg0).process;
924
4638
  return addHeapObject(ret);
925
4639
  };
926
4640
 
927
- module.exports.__wbg_push_6edad0df4b546b2c = function (arg0, arg1) {
4641
+ module.exports.__wbg_push_737cfc8c1432c2c6 = function (arg0, arg1) {
928
4642
  const ret = getObject(arg0).push(getObject(arg1));
929
4643
  return ret;
930
4644
  };
931
4645
 
932
- module.exports.__wbg_queueMicrotask_2181040e064c0dc8 = function (arg0) {
4646
+ module.exports.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function (arg0) {
933
4647
  queueMicrotask(getObject(arg0));
934
4648
  };
935
4649
 
936
- module.exports.__wbg_queueMicrotask_ef9ac43769cbcc4f = function (arg0) {
4650
+ module.exports.__wbg_queueMicrotask_d3219def82552485 = function (arg0) {
937
4651
  const ret = getObject(arg0).queueMicrotask;
938
4652
  return addHeapObject(ret);
939
4653
  };
940
4654
 
941
- module.exports.__wbg_randomFillSync_ab2cfe79ebbf2740 = function () {
4655
+ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
942
4656
  return handleError(function (arg0, arg1) {
943
4657
  getObject(arg0).randomFillSync(takeObject(arg1));
944
4658
  }, arguments);
945
4659
  };
946
4660
 
947
- module.exports.__wbg_require_79b1e9274cde3c87 = function () {
4661
+ module.exports.__wbg_remove_3537743f8f56af1c = function () {
4662
+ return handleError(function (arg0, arg1, arg2) {
4663
+ let deferred0_0;
4664
+ let deferred0_1;
4665
+ try {
4666
+ deferred0_0 = arg1;
4667
+ deferred0_1 = arg2;
4668
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
4669
+ return addHeapObject(ret);
4670
+ } finally {
4671
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4672
+ }
4673
+ }, arguments);
4674
+ };
4675
+
4676
+ module.exports.__wbg_remove_588e522225864fee = function () {
4677
+ return handleError(function (arg0, arg1, arg2) {
4678
+ let deferred0_0;
4679
+ let deferred0_1;
4680
+ try {
4681
+ deferred0_0 = arg1;
4682
+ deferred0_1 = arg2;
4683
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
4684
+ return addHeapObject(ret);
4685
+ } finally {
4686
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4687
+ }
4688
+ }, arguments);
4689
+ };
4690
+
4691
+ module.exports.__wbg_require_60cc747a6bc5215a = function () {
948
4692
  return handleError(function () {
949
4693
  const ret = module.require;
950
4694
  return addHeapObject(ret);
951
4695
  }, arguments);
952
4696
  };
953
4697
 
954
- module.exports.__wbg_resolve_0bf7c44d641804f9 = function (arg0) {
4698
+ module.exports.__wbg_resolve_4851785c9c5f573d = function (arg0) {
955
4699
  const ret = Promise.resolve(getObject(arg0));
956
4700
  return addHeapObject(ret);
957
4701
  };
958
4702
 
959
- module.exports.__wbg_set_23d69db4e5c66a6e = function (arg0, arg1, arg2) {
960
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4703
+ module.exports.__wbg_result_f29afabdf2c05826 = function () {
4704
+ return handleError(function (arg0) {
4705
+ const ret = getObject(arg0).result;
4706
+ return addHeapObject(ret);
4707
+ }, arguments);
4708
+ };
4709
+
4710
+ module.exports.__wbg_send_9b8fc6bb517867dd = function () {
4711
+ return handleError(function (arg0, arg1) {
4712
+ const ret = getObject(arg0).send(OutgoingMessage.__wrap(arg1));
4713
+ return addHeapObject(ret);
4714
+ }, arguments);
4715
+ };
4716
+
4717
+ module.exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
4718
+ const ret = setTimeout(getObject(arg0), arg1);
4719
+ return addHeapObject(ret);
4720
+ };
4721
+
4722
+ module.exports.__wbg_set_37837023f3d740e8 = function (arg0, arg1, arg2) {
4723
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
961
4724
  };
962
4725
 
963
4726
  module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
964
4727
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
965
4728
  };
966
4729
 
967
- module.exports.__wbg_setbody_64920df008e48adc = function (arg0, arg1) {
4730
+ module.exports.__wbg_set_5d5d2f6723f9ec70 = function () {
4731
+ return handleError(function (arg0, arg1, arg2, arg3) {
4732
+ let deferred0_0;
4733
+ let deferred0_1;
4734
+ try {
4735
+ deferred0_0 = arg1;
4736
+ deferred0_1 = arg2;
4737
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
4738
+ return addHeapObject(ret);
4739
+ } finally {
4740
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4741
+ }
4742
+ }, arguments);
4743
+ };
4744
+
4745
+ module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
4746
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4747
+ };
4748
+
4749
+ module.exports.__wbg_set_8fc6bf8a5b1071d1 = function (arg0, arg1, arg2) {
4750
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4751
+ return addHeapObject(ret);
4752
+ };
4753
+
4754
+ module.exports.__wbg_set_d3e2a357bd7efe01 = function () {
4755
+ return handleError(function (arg0, arg1, arg2, arg3) {
4756
+ let deferred0_0;
4757
+ let deferred0_1;
4758
+ try {
4759
+ deferred0_0 = arg1;
4760
+ deferred0_1 = arg2;
4761
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
4762
+ return addHeapObject(ret);
4763
+ } finally {
4764
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4765
+ }
4766
+ }, arguments);
4767
+ };
4768
+
4769
+ module.exports.__wbg_setbody_5923b78a95eedf29 = function (arg0, arg1) {
968
4770
  getObject(arg0).body = getObject(arg1);
969
4771
  };
970
4772
 
971
- module.exports.__wbg_setcredentials_cfc15e48e3a3a535 = function (arg0, arg1) {
4773
+ module.exports.__wbg_setcredentials_c3a22f1cd105a2c6 = function (arg0, arg1) {
972
4774
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
973
4775
  };
974
4776
 
975
- module.exports.__wbg_setheaders_4c921e8e226bdfa7 = function (arg0, arg1) {
4777
+ module.exports.__wbg_setheaders_834c0bdb6a8949ad = function (arg0, arg1) {
976
4778
  getObject(arg0).headers = getObject(arg1);
977
4779
  };
978
4780
 
979
- module.exports.__wbg_setmethod_cfc7f688ba46a6be = function (arg0, arg1, arg2) {
4781
+ module.exports.__wbg_setmethod_3c5280fe5d890842 = function (arg0, arg1, arg2) {
980
4782
  getObject(arg0).method = getStringFromWasm0(arg1, arg2);
981
4783
  };
982
4784
 
983
- module.exports.__wbg_setmode_cd03637eb7da01e0 = function (arg0, arg1) {
4785
+ module.exports.__wbg_setmode_5dc300b865044b65 = function (arg0, arg1) {
984
4786
  getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
985
4787
  };
986
4788
 
@@ -996,11 +4798,23 @@ module.exports.__wbg_setname_c0e2d6f348c746f4 = function (arg0, arg1, arg2) {
996
4798
  }
997
4799
  };
998
4800
 
999
- module.exports.__wbg_setsignal_f766190d206f09e5 = function (arg0, arg1) {
4801
+ module.exports.__wbg_setonerror_d7e3056cc6e56085 = function (arg0, arg1) {
4802
+ getObject(arg0).onerror = getObject(arg1);
4803
+ };
4804
+
4805
+ module.exports.__wbg_setonsuccess_afa464ee777a396d = function (arg0, arg1) {
4806
+ getObject(arg0).onsuccess = getObject(arg1);
4807
+ };
4808
+
4809
+ module.exports.__wbg_setonupgradeneeded_fcf7ce4f2eb0cb5f = function (arg0, arg1) {
4810
+ getObject(arg0).onupgradeneeded = getObject(arg1);
4811
+ };
4812
+
4813
+ module.exports.__wbg_setsignal_75b21ef3a81de905 = function (arg0, arg1) {
1000
4814
  getObject(arg0).signal = getObject(arg1);
1001
4815
  };
1002
4816
 
1003
- module.exports.__wbg_settype_fd39465d237c2f36 = function (arg0, arg1, arg2) {
4817
+ module.exports.__wbg_settype_39ed370d3edd403c = function (arg0, arg1, arg2) {
1004
4818
  getObject(arg0).type = getStringFromWasm0(arg1, arg2);
1005
4819
  };
1006
4820
 
@@ -1016,7 +4830,7 @@ module.exports.__wbg_setvariant_d1d41b778dfe9c17 = function (arg0, arg1, arg2) {
1016
4830
  }
1017
4831
  };
1018
4832
 
1019
- module.exports.__wbg_signal_1fdadeba2d04660e = function (arg0) {
4833
+ module.exports.__wbg_signal_aaf9ad74119f20a4 = function (arg0) {
1020
4834
  const ret = getObject(arg0).signal;
1021
4835
  return addHeapObject(ret);
1022
4836
  };
@@ -1029,61 +4843,71 @@ module.exports.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
1029
4843
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1030
4844
  };
1031
4845
 
1032
- module.exports.__wbg_static_accessor_GLOBAL_0be7472e492ad3e3 = function () {
4846
+ module.exports.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function () {
1033
4847
  const ret = typeof global === "undefined" ? null : global;
1034
4848
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1035
4849
  };
1036
4850
 
1037
- module.exports.__wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb = function () {
4851
+ module.exports.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function () {
1038
4852
  const ret = typeof globalThis === "undefined" ? null : globalThis;
1039
4853
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1040
4854
  };
1041
4855
 
1042
- module.exports.__wbg_static_accessor_SELF_1dc398a895c82351 = function () {
4856
+ module.exports.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function () {
1043
4857
  const ret = typeof self === "undefined" ? null : self;
1044
4858
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1045
4859
  };
1046
4860
 
1047
- module.exports.__wbg_static_accessor_WINDOW_ae1c80c7eea8d64a = function () {
4861
+ module.exports.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function () {
1048
4862
  const ret = typeof window === "undefined" ? null : window;
1049
4863
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1050
4864
  };
1051
4865
 
1052
- module.exports.__wbg_status_317f53bc4c7638df = function (arg0) {
4866
+ module.exports.__wbg_status_f6360336ca686bf0 = function (arg0) {
1053
4867
  const ret = getObject(arg0).status;
1054
4868
  return ret;
1055
4869
  };
1056
4870
 
1057
- module.exports.__wbg_stringify_f4f701bc34ceda61 = function () {
4871
+ module.exports.__wbg_stringify_f7ed6987935b4a24 = function () {
1058
4872
  return handleError(function (arg0) {
1059
4873
  const ret = JSON.stringify(getObject(arg0));
1060
4874
  return addHeapObject(ret);
1061
4875
  }, arguments);
1062
4876
  };
1063
4877
 
1064
- module.exports.__wbg_subarray_46adeb9b86949d12 = function (arg0, arg1, arg2) {
4878
+ module.exports.__wbg_subarray_aa9065fa9dc5df96 = function (arg0, arg1, arg2) {
1065
4879
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1066
4880
  return addHeapObject(ret);
1067
4881
  };
1068
4882
 
1069
- module.exports.__wbg_text_dfc4cb7631d2eb34 = function () {
4883
+ module.exports.__wbg_target_0a62d9d79a2a1ede = function (arg0) {
4884
+ const ret = getObject(arg0).target;
4885
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4886
+ };
4887
+
4888
+ module.exports.__wbg_text_7805bea50de2af49 = function () {
1070
4889
  return handleError(function (arg0) {
1071
4890
  const ret = getObject(arg0).text();
1072
4891
  return addHeapObject(ret);
1073
4892
  }, arguments);
1074
4893
  };
1075
4894
 
1076
- module.exports.__wbg_then_0438fad860fe38e1 = function (arg0, arg1) {
4895
+ module.exports.__wbg_then_44b73946d2fb3e7d = function (arg0, arg1) {
1077
4896
  const ret = getObject(arg0).then(getObject(arg1));
1078
4897
  return addHeapObject(ret);
1079
4898
  };
1080
4899
 
1081
- module.exports.__wbg_then_0ffafeddf0e182a4 = function (arg0, arg1, arg2) {
4900
+ module.exports.__wbg_then_48b406749878a531 = function (arg0, arg1, arg2) {
1082
4901
  const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1083
4902
  return addHeapObject(ret);
1084
4903
  };
1085
4904
 
1086
- module.exports.__wbg_url_5327bc0a41a9b085 = function (arg0, arg1) {
4905
+ module.exports.__wbg_transaction_e713aa7b07ccaedd = function (arg0) {
4906
+ const ret = getObject(arg0).transaction;
4907
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4908
+ };
4909
+
4910
+ module.exports.__wbg_url_ae10c34ca209681d = function (arg0, arg1) {
1087
4911
  const ret = getObject(arg1).url;
1088
4912
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1089
4913
  const len1 = WASM_VECTOR_LEN;
@@ -1091,25 +4915,51 @@ module.exports.__wbg_url_5327bc0a41a9b085 = function (arg0, arg1) {
1091
4915
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1092
4916
  };
1093
4917
 
1094
- module.exports.__wbg_value_4c32fd138a88eee2 = function (arg0) {
4918
+ module.exports.__wbg_value_cd1ffa7b1ab794f1 = function (arg0) {
1095
4919
  const ret = getObject(arg0).value;
1096
4920
  return addHeapObject(ret);
1097
4921
  };
1098
4922
 
1099
- module.exports.__wbg_versions_c71aa1626a93e0a1 = function (arg0) {
4923
+ module.exports.__wbg_versions_c01dfd4722a88165 = function (arg0) {
1100
4924
  const ret = getObject(arg0).versions;
1101
4925
  return addHeapObject(ret);
1102
4926
  };
1103
4927
 
1104
- module.exports.__wbg_warn_cb8be8bbf790a5d6 = function (arg0, arg1, arg2, arg3) {
4928
+ module.exports.__wbg_warn_aaf1f4664a035bd6 = function (arg0, arg1, arg2, arg3) {
1105
4929
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1106
4930
  };
1107
4931
 
4932
+ module.exports.__wbindgen_array_new = function () {
4933
+ const ret = [];
4934
+ return addHeapObject(ret);
4935
+ };
4936
+
4937
+ module.exports.__wbindgen_array_push = function (arg0, arg1) {
4938
+ getObject(arg0).push(takeObject(arg1));
4939
+ };
4940
+
1108
4941
  module.exports.__wbindgen_as_number = function (arg0) {
1109
4942
  const ret = +getObject(arg0);
1110
4943
  return ret;
1111
4944
  };
1112
4945
 
4946
+ module.exports.__wbindgen_bigint_from_i64 = function (arg0) {
4947
+ const ret = arg0;
4948
+ return addHeapObject(ret);
4949
+ };
4950
+
4951
+ module.exports.__wbindgen_bigint_from_u64 = function (arg0) {
4952
+ const ret = BigInt.asUintN(64, arg0);
4953
+ return addHeapObject(ret);
4954
+ };
4955
+
4956
+ module.exports.__wbindgen_bigint_get_as_i64 = function (arg0, arg1) {
4957
+ const v = getObject(arg1);
4958
+ const ret = typeof v === "bigint" ? v : undefined;
4959
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
4960
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
4961
+ };
4962
+
1113
4963
  module.exports.__wbindgen_boolean_get = function (arg0) {
1114
4964
  const v = getObject(arg0);
1115
4965
  const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2;
@@ -1126,8 +4976,28 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
1126
4976
  return ret;
1127
4977
  };
1128
4978
 
1129
- module.exports.__wbindgen_closure_wrapper1832 = function (arg0, arg1, arg2) {
1130
- const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_38);
4979
+ module.exports.__wbindgen_closure_wrapper193 = function (arg0, arg1, arg2) {
4980
+ const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_54);
4981
+ return addHeapObject(ret);
4982
+ };
4983
+
4984
+ module.exports.__wbindgen_closure_wrapper195 = function (arg0, arg1, arg2) {
4985
+ const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_57);
4986
+ return addHeapObject(ret);
4987
+ };
4988
+
4989
+ module.exports.__wbindgen_closure_wrapper3915 = function (arg0, arg1, arg2) {
4990
+ const ret = makeMutClosure(arg0, arg1, 299, __wbg_adapter_60);
4991
+ return addHeapObject(ret);
4992
+ };
4993
+
4994
+ module.exports.__wbindgen_closure_wrapper6399 = function (arg0, arg1, arg2) {
4995
+ const ret = makeMutClosure(arg0, arg1, 325, __wbg_adapter_60);
4996
+ return addHeapObject(ret);
4997
+ };
4998
+
4999
+ module.exports.__wbindgen_closure_wrapper6779 = function (arg0, arg1, arg2) {
5000
+ const ret = makeMutClosure(arg0, arg1, 348, __wbg_adapter_54);
1131
5001
  return addHeapObject(ret);
1132
5002
  };
1133
5003
 
@@ -1149,6 +5019,11 @@ module.exports.__wbindgen_in = function (arg0, arg1) {
1149
5019
  return ret;
1150
5020
  };
1151
5021
 
5022
+ module.exports.__wbindgen_is_bigint = function (arg0) {
5023
+ const ret = typeof getObject(arg0) === "bigint";
5024
+ return ret;
5025
+ };
5026
+
1152
5027
  module.exports.__wbindgen_is_function = function (arg0) {
1153
5028
  const ret = typeof getObject(arg0) === "function";
1154
5029
  return ret;
@@ -1170,6 +5045,11 @@ module.exports.__wbindgen_is_undefined = function (arg0) {
1170
5045
  return ret;
1171
5046
  };
1172
5047
 
5048
+ module.exports.__wbindgen_jsval_eq = function (arg0, arg1) {
5049
+ const ret = getObject(arg0) === getObject(arg1);
5050
+ return ret;
5051
+ };
5052
+
1173
5053
  module.exports.__wbindgen_jsval_loose_eq = function (arg0, arg1) {
1174
5054
  const ret = getObject(arg0) == getObject(arg1);
1175
5055
  return ret;
@@ -1187,6 +5067,11 @@ module.exports.__wbindgen_number_get = function (arg0, arg1) {
1187
5067
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1188
5068
  };
1189
5069
 
5070
+ module.exports.__wbindgen_number_new = function (arg0) {
5071
+ const ret = arg0;
5072
+ return addHeapObject(ret);
5073
+ };
5074
+
1190
5075
  module.exports.__wbindgen_object_clone_ref = function (arg0) {
1191
5076
  const ret = getObject(arg0);
1192
5077
  return addHeapObject(ret);