@bitwarden/sdk-internal 0.2.0-main.23 → 0.2.0-main.230

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.
@@ -3,12 +3,15 @@ export function __wbg_set_wasm(val) {
3
3
  wasm = val;
4
4
  }
5
5
 
6
- const lTextDecoder =
7
- typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
6
+ const heap = new Array(128).fill(undefined);
8
7
 
9
- let cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
8
+ heap.push(undefined, null, true, false);
10
9
 
11
- cachedTextDecoder.decode();
10
+ function getObject(idx) {
11
+ return heap[idx];
12
+ }
13
+
14
+ let WASM_VECTOR_LEN = 0;
12
15
 
13
16
  let cachedUint8ArrayMemory0 = null;
14
17
 
@@ -19,44 +22,6 @@ function getUint8ArrayMemory0() {
19
22
  return cachedUint8ArrayMemory0;
20
23
  }
21
24
 
22
- function getStringFromWasm0(ptr, len) {
23
- ptr = ptr >>> 0;
24
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
25
- }
26
-
27
- const heap = new Array(128).fill(undefined);
28
-
29
- heap.push(undefined, null, true, false);
30
-
31
- let heap_next = heap.length;
32
-
33
- function addHeapObject(obj) {
34
- if (heap_next === heap.length) heap.push(heap.length + 1);
35
- const idx = heap_next;
36
- heap_next = heap[idx];
37
-
38
- heap[idx] = obj;
39
- return idx;
40
- }
41
-
42
- function getObject(idx) {
43
- return heap[idx];
44
- }
45
-
46
- function dropObject(idx) {
47
- if (idx < 132) return;
48
- heap[idx] = heap_next;
49
- heap_next = idx;
50
- }
51
-
52
- function takeObject(idx) {
53
- const ret = getObject(idx);
54
- dropObject(idx);
55
- return ret;
56
- }
57
-
58
- let WASM_VECTOR_LEN = 0;
59
-
60
25
  const lTextEncoder =
61
26
  typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
62
27
 
@@ -116,10 +81,6 @@ function passStringToWasm0(arg, malloc, realloc) {
116
81
  return ptr;
117
82
  }
118
83
 
119
- function isLikeNone(x) {
120
- return x === undefined || x === null;
121
- }
122
-
123
84
  let cachedDataViewMemory0 = null;
124
85
 
125
86
  function getDataViewMemory0() {
@@ -134,6 +95,90 @@ function getDataViewMemory0() {
134
95
  return cachedDataViewMemory0;
135
96
  }
136
97
 
98
+ const lTextDecoder =
99
+ typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
100
+
101
+ let cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
102
+
103
+ cachedTextDecoder.decode();
104
+
105
+ function getStringFromWasm0(ptr, len) {
106
+ ptr = ptr >>> 0;
107
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
108
+ }
109
+
110
+ let heap_next = heap.length;
111
+
112
+ function addHeapObject(obj) {
113
+ if (heap_next === heap.length) heap.push(heap.length + 1);
114
+ const idx = heap_next;
115
+ heap_next = heap[idx];
116
+
117
+ heap[idx] = obj;
118
+ return idx;
119
+ }
120
+
121
+ function handleError(f, args) {
122
+ try {
123
+ return f.apply(this, args);
124
+ } catch (e) {
125
+ wasm.__wbindgen_exn_store(addHeapObject(e));
126
+ }
127
+ }
128
+
129
+ function dropObject(idx) {
130
+ if (idx < 132) return;
131
+ heap[idx] = heap_next;
132
+ heap_next = idx;
133
+ }
134
+
135
+ function takeObject(idx) {
136
+ const ret = getObject(idx);
137
+ dropObject(idx);
138
+ return ret;
139
+ }
140
+
141
+ function getArrayU8FromWasm0(ptr, len) {
142
+ ptr = ptr >>> 0;
143
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
144
+ }
145
+
146
+ function isLikeNone(x) {
147
+ return x === undefined || x === null;
148
+ }
149
+
150
+ const CLOSURE_DTORS =
151
+ typeof FinalizationRegistry === "undefined"
152
+ ? { register: () => {}, unregister: () => {} }
153
+ : new FinalizationRegistry((state) => {
154
+ wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b);
155
+ });
156
+
157
+ function makeMutClosure(arg0, arg1, dtor, f) {
158
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
159
+ const real = (...args) => {
160
+ // First up with a closure we increment the internal reference
161
+ // count. This ensures that the Rust closure environment won't
162
+ // be deallocated while we're invoking it.
163
+ state.cnt++;
164
+ const a = state.a;
165
+ state.a = 0;
166
+ try {
167
+ return f(a, state.b, ...args);
168
+ } finally {
169
+ if (--state.cnt === 0) {
170
+ wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
171
+ CLOSURE_DTORS.unregister(state);
172
+ } else {
173
+ state.a = a;
174
+ }
175
+ }
176
+ };
177
+ real.original = state;
178
+ CLOSURE_DTORS.register(real, state, state);
179
+ return real;
180
+ }
181
+
137
182
  function debugString(val) {
138
183
  // primitive types
139
184
  const type = typeof val;
@@ -175,7 +220,7 @@ function debugString(val) {
175
220
  // Test for built-in
176
221
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
177
222
  let className;
178
- if (builtInMatches.length > 1) {
223
+ if (builtInMatches && builtInMatches.length > 1) {
179
224
  className = builtInMatches[1];
180
225
  } else {
181
226
  // Failed to match the standard '[object ClassName]'
@@ -199,45 +244,6 @@ function debugString(val) {
199
244
  return className;
200
245
  }
201
246
 
202
- const CLOSURE_DTORS =
203
- typeof FinalizationRegistry === "undefined"
204
- ? { register: () => {}, unregister: () => {} }
205
- : new FinalizationRegistry((state) => {
206
- wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
207
- });
208
-
209
- function makeMutClosure(arg0, arg1, dtor, f) {
210
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
211
- const real = (...args) => {
212
- // First up with a closure we increment the internal reference
213
- // count. This ensures that the Rust closure environment won't
214
- // be deallocated while we're invoking it.
215
- state.cnt++;
216
- const a = state.a;
217
- state.a = 0;
218
- try {
219
- return f(a, state.b, ...args);
220
- } finally {
221
- if (--state.cnt === 0) {
222
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
223
- CLOSURE_DTORS.unregister(state);
224
- } else {
225
- state.a = a;
226
- }
227
- }
228
- };
229
- real.original = state;
230
- CLOSURE_DTORS.register(real, state, state);
231
- return real;
232
- }
233
- function __wbg_adapter_38(arg0, arg1, arg2) {
234
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6bfa1aa5cb44e9c6(
235
- arg0,
236
- arg1,
237
- addHeapObject(arg2),
238
- );
239
- }
240
-
241
247
  let stack_pointer = 128;
242
248
 
243
249
  function addBorrowedObject(obj) {
@@ -249,9 +255,35 @@ function addBorrowedObject(obj) {
249
255
  * @param {any} error
250
256
  * @returns {boolean}
251
257
  */
252
- export function isCoreError(error) {
258
+ export function isDeriveKeyConnectorError(error) {
259
+ try {
260
+ const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
261
+ return ret !== 0;
262
+ } finally {
263
+ heap[stack_pointer++] = undefined;
264
+ }
265
+ }
266
+
267
+ /**
268
+ * @param {any} error
269
+ * @returns {boolean}
270
+ */
271
+ export function isEnrollAdminPasswordResetError(error) {
272
+ try {
273
+ const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
274
+ return ret !== 0;
275
+ } finally {
276
+ heap[stack_pointer++] = undefined;
277
+ }
278
+ }
279
+
280
+ /**
281
+ * @param {any} error
282
+ * @returns {boolean}
283
+ */
284
+ export function isCryptoClientError(error) {
253
285
  try {
254
- const ret = wasm.isCoreError(addBorrowedObject(error));
286
+ const ret = wasm.isCryptoClientError(addBorrowedObject(error));
255
287
  return ret !== 0;
256
288
  } finally {
257
289
  heap[stack_pointer++] = undefined;
@@ -275,22 +307,41 @@ export function isEncryptionSettingsError(error) {
275
307
  * @param {any} error
276
308
  * @returns {boolean}
277
309
  */
278
- export function isKeyGenerationError(error) {
310
+ export function isCryptoError(error) {
279
311
  try {
280
- const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
312
+ const ret = wasm.isCryptoError(addBorrowedObject(error));
281
313
  return ret !== 0;
282
314
  } finally {
283
315
  heap[stack_pointer++] = undefined;
284
316
  }
285
317
  }
286
318
 
319
+ function passArrayJsValueToWasm0(array, malloc) {
320
+ const ptr = malloc(array.length * 4, 4) >>> 0;
321
+ const mem = getDataViewMemory0();
322
+ for (let i = 0; i < array.length; i++) {
323
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
324
+ }
325
+ WASM_VECTOR_LEN = array.length;
326
+ return ptr;
327
+ }
328
+
329
+ function getArrayJsValueFromWasm0(ptr, len) {
330
+ ptr = ptr >>> 0;
331
+ const mem = getDataViewMemory0();
332
+ const result = [];
333
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
334
+ result.push(takeObject(mem.getUint32(i, true)));
335
+ }
336
+ return result;
337
+ }
287
338
  /**
288
339
  * @param {any} error
289
340
  * @returns {boolean}
290
341
  */
291
- export function isTestError(error) {
342
+ export function isExportError(error) {
292
343
  try {
293
- const ret = wasm.isTestError(addBorrowedObject(error));
344
+ const ret = wasm.isExportError(addBorrowedObject(error));
294
345
  return ret !== 0;
295
346
  } finally {
296
347
  heap[stack_pointer++] = undefined;
@@ -298,42 +349,520 @@ export function isTestError(error) {
298
349
  }
299
350
 
300
351
  /**
301
- * @param {KeyAlgorithm} key_algorithm
302
- * @returns {GenerateSshKeyResult}
352
+ * @param {any} error
353
+ * @returns {boolean}
303
354
  */
304
- export function generate_ssh_key(key_algorithm) {
355
+ export function isUsernameError(error) {
305
356
  try {
306
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
307
- wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
308
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
309
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
310
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
311
- if (r2) {
312
- throw takeObject(r1);
313
- }
314
- return takeObject(r0);
357
+ const ret = wasm.isUsernameError(addBorrowedObject(error));
358
+ return ret !== 0;
315
359
  } finally {
316
- wasm.__wbindgen_add_to_stack_pointer(16);
360
+ heap[stack_pointer++] = undefined;
317
361
  }
318
362
  }
319
363
 
320
- function handleError(f, args) {
364
+ /**
365
+ * @param {any} error
366
+ * @returns {boolean}
367
+ */
368
+ export function isPasswordError(error) {
321
369
  try {
322
- return f.apply(this, args);
323
- } catch (e) {
324
- wasm.__wbindgen_exn_store(addHeapObject(e));
370
+ const ret = wasm.isPasswordError(addBorrowedObject(error));
371
+ return ret !== 0;
372
+ } finally {
373
+ heap[stack_pointer++] = undefined;
325
374
  }
326
375
  }
327
- function __wbg_adapter_125(arg0, arg1, arg2, arg3) {
328
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h7117afb49db7a7fd(
329
- arg0,
330
- arg1,
331
- addHeapObject(arg2),
332
- addHeapObject(arg3),
376
+
377
+ /**
378
+ * @param {any} error
379
+ * @returns {boolean}
380
+ */
381
+ export function isPassphraseError(error) {
382
+ try {
383
+ const ret = wasm.isPassphraseError(addBorrowedObject(error));
384
+ return ret !== 0;
385
+ } finally {
386
+ heap[stack_pointer++] = undefined;
387
+ }
388
+ }
389
+
390
+ function passArray8ToWasm0(arg, malloc) {
391
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
392
+ getUint8ArrayMemory0().set(arg, ptr / 1);
393
+ WASM_VECTOR_LEN = arg.length;
394
+ return ptr;
395
+ }
396
+
397
+ function _assertClass(instance, klass) {
398
+ if (!(instance instanceof klass)) {
399
+ throw new Error(`expected instance of ${klass.name}`);
400
+ }
401
+ }
402
+ /**
403
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
404
+ * @param {IpcClient} ipc_client
405
+ * @param {DiscoverResponse} response
406
+ * @returns {Promise<void>}
407
+ */
408
+ export function ipcRegisterDiscoverHandler(ipc_client, response) {
409
+ _assertClass(ipc_client, IpcClient);
410
+ const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
411
+ return takeObject(ret);
412
+ }
413
+
414
+ /**
415
+ * Sends a DiscoverRequest to the specified destination and returns the response.
416
+ * @param {IpcClient} ipc_client
417
+ * @param {Endpoint} destination
418
+ * @param {AbortSignal | null} [abort_signal]
419
+ * @returns {Promise<DiscoverResponse>}
420
+ */
421
+ export function ipcRequestDiscover(ipc_client, destination, abort_signal) {
422
+ _assertClass(ipc_client, IpcClient);
423
+ const ret = wasm.ipcRequestDiscover(
424
+ ipc_client.__wbg_ptr,
425
+ addHeapObject(destination),
426
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
333
427
  );
428
+ return takeObject(ret);
334
429
  }
335
430
 
336
- export const LogLevel = Object.freeze({
431
+ /**
432
+ * @param {any} error
433
+ * @returns {boolean}
434
+ */
435
+ export function isChannelError(error) {
436
+ try {
437
+ const ret = wasm.isChannelError(addBorrowedObject(error));
438
+ return ret !== 0;
439
+ } finally {
440
+ heap[stack_pointer++] = undefined;
441
+ }
442
+ }
443
+
444
+ /**
445
+ * @param {any} error
446
+ * @returns {boolean}
447
+ */
448
+ export function isDeserializeError(error) {
449
+ try {
450
+ const ret = wasm.isDeserializeError(addBorrowedObject(error));
451
+ return ret !== 0;
452
+ } finally {
453
+ heap[stack_pointer++] = undefined;
454
+ }
455
+ }
456
+
457
+ /**
458
+ * @param {any} error
459
+ * @returns {boolean}
460
+ */
461
+ export function isRequestError(error) {
462
+ try {
463
+ const ret = wasm.isRequestError(addBorrowedObject(error));
464
+ return ret !== 0;
465
+ } finally {
466
+ heap[stack_pointer++] = undefined;
467
+ }
468
+ }
469
+
470
+ /**
471
+ * @param {any} error
472
+ * @returns {boolean}
473
+ */
474
+ export function isTypedReceiveError(error) {
475
+ try {
476
+ const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
477
+ return ret !== 0;
478
+ } finally {
479
+ heap[stack_pointer++] = undefined;
480
+ }
481
+ }
482
+
483
+ /**
484
+ * @param {any} error
485
+ * @returns {boolean}
486
+ */
487
+ export function isReceiveError(error) {
488
+ try {
489
+ const ret = wasm.isReceiveError(addBorrowedObject(error));
490
+ return ret !== 0;
491
+ } finally {
492
+ heap[stack_pointer++] = undefined;
493
+ }
494
+ }
495
+
496
+ /**
497
+ * @param {any} error
498
+ * @returns {boolean}
499
+ */
500
+ export function isSubscribeError(error) {
501
+ try {
502
+ const ret = wasm.isSubscribeError(addBorrowedObject(error));
503
+ return ret !== 0;
504
+ } finally {
505
+ heap[stack_pointer++] = undefined;
506
+ }
507
+ }
508
+
509
+ /**
510
+ * @param {any} error
511
+ * @returns {boolean}
512
+ */
513
+ export function isSshKeyExportError(error) {
514
+ try {
515
+ const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
516
+ return ret !== 0;
517
+ } finally {
518
+ heap[stack_pointer++] = undefined;
519
+ }
520
+ }
521
+
522
+ /**
523
+ * @param {any} error
524
+ * @returns {boolean}
525
+ */
526
+ export function isSshKeyImportError(error) {
527
+ try {
528
+ const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
529
+ return ret !== 0;
530
+ } finally {
531
+ heap[stack_pointer++] = undefined;
532
+ }
533
+ }
534
+
535
+ /**
536
+ * @param {any} error
537
+ * @returns {boolean}
538
+ */
539
+ export function isKeyGenerationError(error) {
540
+ try {
541
+ const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
542
+ return ret !== 0;
543
+ } finally {
544
+ heap[stack_pointer++] = undefined;
545
+ }
546
+ }
547
+
548
+ /**
549
+ * @param {any} error
550
+ * @returns {boolean}
551
+ */
552
+ export function isCallError(error) {
553
+ try {
554
+ const ret = wasm.isCallError(addBorrowedObject(error));
555
+ return ret !== 0;
556
+ } finally {
557
+ heap[stack_pointer++] = undefined;
558
+ }
559
+ }
560
+
561
+ /**
562
+ * @param {any} error
563
+ * @returns {boolean}
564
+ */
565
+ export function isDecryptError(error) {
566
+ try {
567
+ const ret = wasm.isDecryptError(addBorrowedObject(error));
568
+ return ret !== 0;
569
+ } finally {
570
+ heap[stack_pointer++] = undefined;
571
+ }
572
+ }
573
+
574
+ /**
575
+ * @param {any} error
576
+ * @returns {boolean}
577
+ */
578
+ export function isEncryptError(error) {
579
+ try {
580
+ const ret = wasm.isEncryptError(addBorrowedObject(error));
581
+ return ret !== 0;
582
+ } finally {
583
+ heap[stack_pointer++] = undefined;
584
+ }
585
+ }
586
+
587
+ /**
588
+ * @param {any} error
589
+ * @returns {boolean}
590
+ */
591
+ export function isTotpError(error) {
592
+ try {
593
+ const ret = wasm.isTotpError(addBorrowedObject(error));
594
+ return ret !== 0;
595
+ } finally {
596
+ heap[stack_pointer++] = undefined;
597
+ }
598
+ }
599
+
600
+ /**
601
+ * @param {any} error
602
+ * @returns {boolean}
603
+ */
604
+ export function isCipherError(error) {
605
+ try {
606
+ const ret = wasm.isCipherError(addBorrowedObject(error));
607
+ return ret !== 0;
608
+ } finally {
609
+ heap[stack_pointer++] = undefined;
610
+ }
611
+ }
612
+
613
+ /**
614
+ * @param {any} error
615
+ * @returns {boolean}
616
+ */
617
+ export function isDecryptFileError(error) {
618
+ try {
619
+ const ret = wasm.isDecryptFileError(addBorrowedObject(error));
620
+ return ret !== 0;
621
+ } finally {
622
+ heap[stack_pointer++] = undefined;
623
+ }
624
+ }
625
+
626
+ /**
627
+ * @param {any} error
628
+ * @returns {boolean}
629
+ */
630
+ export function isEncryptFileError(error) {
631
+ try {
632
+ const ret = wasm.isEncryptFileError(addBorrowedObject(error));
633
+ return ret !== 0;
634
+ } finally {
635
+ heap[stack_pointer++] = undefined;
636
+ }
637
+ }
638
+
639
+ /**
640
+ * @param {LogLevel} level
641
+ */
642
+ export function set_log_level(level) {
643
+ wasm.set_log_level(level);
644
+ }
645
+
646
+ /**
647
+ * @param {LogLevel | null} [log_level]
648
+ */
649
+ export function init_sdk(log_level) {
650
+ wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
651
+ }
652
+
653
+ /**
654
+ * Generate a new SSH key pair
655
+ *
656
+ * # Arguments
657
+ * - `key_algorithm` - The algorithm to use for the key pair
658
+ *
659
+ * # Returns
660
+ * - `Ok(SshKey)` if the key was successfully generated
661
+ * - `Err(KeyGenerationError)` if the key could not be generated
662
+ * @param {KeyAlgorithm} key_algorithm
663
+ * @returns {SshKeyView}
664
+ */
665
+ export function generate_ssh_key(key_algorithm) {
666
+ try {
667
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
668
+ wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
669
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
670
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
671
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
672
+ if (r2) {
673
+ throw takeObject(r1);
674
+ }
675
+ return takeObject(r0);
676
+ } finally {
677
+ wasm.__wbindgen_add_to_stack_pointer(16);
678
+ }
679
+ }
680
+
681
+ /**
682
+ * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
683
+ * to an OpenSSH private key with public key and fingerprint
684
+ *
685
+ * # Arguments
686
+ * - `imported_key` - The private key to convert
687
+ * - `password` - The password to use for decrypting the key
688
+ *
689
+ * # Returns
690
+ * - `Ok(SshKey)` if the key was successfully coneverted
691
+ * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
692
+ * - `Err(WrongPassword)` if the password provided is incorrect
693
+ * - `Err(ParsingError)` if the key could not be parsed
694
+ * - `Err(UnsupportedKeyType)` if the key type is not supported
695
+ * @param {string} imported_key
696
+ * @param {string | null} [password]
697
+ * @returns {SshKeyView}
698
+ */
699
+ export function import_ssh_key(imported_key, password) {
700
+ try {
701
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
702
+ const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
703
+ const len0 = WASM_VECTOR_LEN;
704
+ var ptr1 = isLikeNone(password)
705
+ ? 0
706
+ : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
707
+ var len1 = WASM_VECTOR_LEN;
708
+ wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
709
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
710
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
711
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
712
+ if (r2) {
713
+ throw takeObject(r1);
714
+ }
715
+ return takeObject(r0);
716
+ } finally {
717
+ wasm.__wbindgen_add_to_stack_pointer(16);
718
+ }
719
+ }
720
+
721
+ /**
722
+ * @param {any} error
723
+ * @returns {boolean}
724
+ */
725
+ export function isTestError(error) {
726
+ try {
727
+ const ret = wasm.isTestError(addBorrowedObject(error));
728
+ return ret !== 0;
729
+ } finally {
730
+ heap[stack_pointer++] = undefined;
731
+ }
732
+ }
733
+
734
+ function __wbg_adapter_50(arg0, arg1) {
735
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h31333524c3115e44(
736
+ arg0,
737
+ arg1,
738
+ );
739
+ }
740
+
741
+ function __wbg_adapter_53(arg0, arg1) {
742
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2b093e5f83b42fbd(
743
+ arg0,
744
+ arg1,
745
+ );
746
+ }
747
+
748
+ function __wbg_adapter_56(arg0, arg1, arg2) {
749
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb01d8be1001e4f40(
750
+ arg0,
751
+ arg1,
752
+ addHeapObject(arg2),
753
+ );
754
+ }
755
+
756
+ function __wbg_adapter_280(arg0, arg1, arg2, arg3) {
757
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h8776500d04a3e634(
758
+ arg0,
759
+ arg1,
760
+ addHeapObject(arg2),
761
+ addHeapObject(arg3),
762
+ );
763
+ }
764
+
765
+ /**
766
+ * @enum {300 | 301 | 302 | 303 | 304 | 305}
767
+ */
768
+ export const CardLinkedIdType = Object.freeze({
769
+ CardholderName: 300,
770
+ 300: "CardholderName",
771
+ ExpMonth: 301,
772
+ 301: "ExpMonth",
773
+ ExpYear: 302,
774
+ 302: "ExpYear",
775
+ Code: 303,
776
+ 303: "Code",
777
+ Brand: 304,
778
+ 304: "Brand",
779
+ Number: 305,
780
+ 305: "Number",
781
+ });
782
+ /**
783
+ * @enum {0 | 1}
784
+ */
785
+ export const CipherRepromptType = Object.freeze({
786
+ None: 0,
787
+ 0: "None",
788
+ Password: 1,
789
+ 1: "Password",
790
+ });
791
+ /**
792
+ * @enum {1 | 2 | 3 | 4 | 5}
793
+ */
794
+ export const CipherType = Object.freeze({
795
+ Login: 1,
796
+ 1: "Login",
797
+ SecureNote: 2,
798
+ 2: "SecureNote",
799
+ Card: 3,
800
+ 3: "Card",
801
+ Identity: 4,
802
+ 4: "Identity",
803
+ SshKey: 5,
804
+ 5: "SshKey",
805
+ });
806
+ /**
807
+ * @enum {0 | 1 | 2 | 3}
808
+ */
809
+ export const FieldType = Object.freeze({
810
+ Text: 0,
811
+ 0: "Text",
812
+ Hidden: 1,
813
+ 1: "Hidden",
814
+ Boolean: 2,
815
+ 2: "Boolean",
816
+ Linked: 3,
817
+ 3: "Linked",
818
+ });
819
+ /**
820
+ * @enum {400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418}
821
+ */
822
+ export const IdentityLinkedIdType = Object.freeze({
823
+ Title: 400,
824
+ 400: "Title",
825
+ MiddleName: 401,
826
+ 401: "MiddleName",
827
+ Address1: 402,
828
+ 402: "Address1",
829
+ Address2: 403,
830
+ 403: "Address2",
831
+ Address3: 404,
832
+ 404: "Address3",
833
+ City: 405,
834
+ 405: "City",
835
+ State: 406,
836
+ 406: "State",
837
+ PostalCode: 407,
838
+ 407: "PostalCode",
839
+ Country: 408,
840
+ 408: "Country",
841
+ Company: 409,
842
+ 409: "Company",
843
+ Email: 410,
844
+ 410: "Email",
845
+ Phone: 411,
846
+ 411: "Phone",
847
+ Ssn: 412,
848
+ 412: "Ssn",
849
+ Username: 413,
850
+ 413: "Username",
851
+ PassportNumber: 414,
852
+ 414: "PassportNumber",
853
+ LicenseNumber: 415,
854
+ 415: "LicenseNumber",
855
+ FirstName: 416,
856
+ 416: "FirstName",
857
+ LastName: 417,
858
+ 417: "LastName",
859
+ FullName: 418,
860
+ 418: "FullName",
861
+ });
862
+ /**
863
+ * @enum {0 | 1 | 2 | 3 | 4}
864
+ */
865
+ export const LogLevel = Object.freeze({
337
866
  Trace: 0,
338
867
  0: "Trace",
339
868
  Debug: 1,
@@ -345,201 +874,2335 @@ export const LogLevel = Object.freeze({
345
874
  Error: 4,
346
875
  4: "Error",
347
876
  });
877
+ /**
878
+ * @enum {100 | 101}
879
+ */
880
+ export const LoginLinkedIdType = Object.freeze({
881
+ Username: 100,
882
+ 100: "Username",
883
+ Password: 101,
884
+ 101: "Password",
885
+ });
886
+ /**
887
+ * @enum {0}
888
+ */
889
+ export const SecureNoteType = Object.freeze({
890
+ Generic: 0,
891
+ 0: "Generic",
892
+ });
893
+ /**
894
+ * @enum {0 | 1 | 2 | 3 | 4 | 5}
895
+ */
896
+ export const UriMatchType = Object.freeze({
897
+ Domain: 0,
898
+ 0: "Domain",
899
+ Host: 1,
900
+ 1: "Host",
901
+ StartsWith: 2,
902
+ 2: "StartsWith",
903
+ Exact: 3,
904
+ 3: "Exact",
905
+ RegularExpression: 4,
906
+ 4: "RegularExpression",
907
+ Never: 5,
908
+ 5: "Never",
909
+ });
910
+
911
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
912
+
913
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
914
+
915
+ const AttachmentsClientFinalization =
916
+ typeof FinalizationRegistry === "undefined"
917
+ ? { register: () => {}, unregister: () => {} }
918
+ : new FinalizationRegistry((ptr) => wasm.__wbg_attachmentsclient_free(ptr >>> 0, 1));
919
+
920
+ export class AttachmentsClient {
921
+ static __wrap(ptr) {
922
+ ptr = ptr >>> 0;
923
+ const obj = Object.create(AttachmentsClient.prototype);
924
+ obj.__wbg_ptr = ptr;
925
+ AttachmentsClientFinalization.register(obj, obj.__wbg_ptr, obj);
926
+ return obj;
927
+ }
928
+
929
+ __destroy_into_raw() {
930
+ const ptr = this.__wbg_ptr;
931
+ this.__wbg_ptr = 0;
932
+ AttachmentsClientFinalization.unregister(this);
933
+ return ptr;
934
+ }
935
+
936
+ free() {
937
+ const ptr = this.__destroy_into_raw();
938
+ wasm.__wbg_attachmentsclient_free(ptr, 0);
939
+ }
940
+ /**
941
+ * @param {Cipher} cipher
942
+ * @param {AttachmentView} attachment
943
+ * @param {Uint8Array} encrypted_buffer
944
+ * @returns {Uint8Array}
945
+ */
946
+ decrypt_buffer(cipher, attachment, encrypted_buffer) {
947
+ try {
948
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
949
+ const ptr0 = passArray8ToWasm0(encrypted_buffer, wasm.__wbindgen_malloc);
950
+ const len0 = WASM_VECTOR_LEN;
951
+ wasm.attachmentsclient_decrypt_buffer(
952
+ retptr,
953
+ this.__wbg_ptr,
954
+ addHeapObject(cipher),
955
+ addHeapObject(attachment),
956
+ ptr0,
957
+ len0,
958
+ );
959
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
960
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
961
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
962
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
963
+ if (r3) {
964
+ throw takeObject(r2);
965
+ }
966
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
967
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
968
+ return v2;
969
+ } finally {
970
+ wasm.__wbindgen_add_to_stack_pointer(16);
971
+ }
972
+ }
973
+ }
974
+
975
+ const BitwardenClientFinalization =
976
+ typeof FinalizationRegistry === "undefined"
977
+ ? { register: () => {}, unregister: () => {} }
978
+ : new FinalizationRegistry((ptr) => wasm.__wbg_bitwardenclient_free(ptr >>> 0, 1));
979
+
980
+ export class BitwardenClient {
981
+ __destroy_into_raw() {
982
+ const ptr = this.__wbg_ptr;
983
+ this.__wbg_ptr = 0;
984
+ BitwardenClientFinalization.unregister(this);
985
+ return ptr;
986
+ }
987
+
988
+ free() {
989
+ const ptr = this.__destroy_into_raw();
990
+ wasm.__wbg_bitwardenclient_free(ptr, 0);
991
+ }
992
+ /**
993
+ * @param {any} token_provider
994
+ * @param {ClientSettings | null} [settings]
995
+ */
996
+ constructor(token_provider, settings) {
997
+ const ret = wasm.bitwardenclient_new(
998
+ addHeapObject(token_provider),
999
+ isLikeNone(settings) ? 0 : addHeapObject(settings),
1000
+ );
1001
+ this.__wbg_ptr = ret >>> 0;
1002
+ BitwardenClientFinalization.register(this, this.__wbg_ptr, this);
1003
+ return this;
1004
+ }
1005
+ /**
1006
+ * Test method, echoes back the input
1007
+ * @param {string} msg
1008
+ * @returns {string}
1009
+ */
1010
+ echo(msg) {
1011
+ let deferred2_0;
1012
+ let deferred2_1;
1013
+ try {
1014
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1015
+ const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1016
+ const len0 = WASM_VECTOR_LEN;
1017
+ wasm.bitwardenclient_echo(retptr, this.__wbg_ptr, ptr0, len0);
1018
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1019
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1020
+ deferred2_0 = r0;
1021
+ deferred2_1 = r1;
1022
+ return getStringFromWasm0(r0, r1);
1023
+ } finally {
1024
+ wasm.__wbindgen_add_to_stack_pointer(16);
1025
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1026
+ }
1027
+ }
1028
+ /**
1029
+ * @returns {string}
1030
+ */
1031
+ version() {
1032
+ let deferred1_0;
1033
+ let deferred1_1;
1034
+ try {
1035
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1036
+ wasm.bitwardenclient_version(retptr, this.__wbg_ptr);
1037
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1038
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1039
+ deferred1_0 = r0;
1040
+ deferred1_1 = r1;
1041
+ return getStringFromWasm0(r0, r1);
1042
+ } finally {
1043
+ wasm.__wbindgen_add_to_stack_pointer(16);
1044
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1045
+ }
1046
+ }
1047
+ /**
1048
+ * @param {string} msg
1049
+ */
1050
+ throw(msg) {
1051
+ try {
1052
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1053
+ const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1054
+ const len0 = WASM_VECTOR_LEN;
1055
+ wasm.bitwardenclient_throw(retptr, this.__wbg_ptr, ptr0, len0);
1056
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1057
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1058
+ if (r1) {
1059
+ throw takeObject(r0);
1060
+ }
1061
+ } finally {
1062
+ wasm.__wbindgen_add_to_stack_pointer(16);
1063
+ }
1064
+ }
1065
+ /**
1066
+ * Test method, calls http endpoint
1067
+ * @param {string} url
1068
+ * @returns {Promise<string>}
1069
+ */
1070
+ http_get(url) {
1071
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1072
+ const len0 = WASM_VECTOR_LEN;
1073
+ const ret = wasm.bitwardenclient_http_get(this.__wbg_ptr, ptr0, len0);
1074
+ return takeObject(ret);
1075
+ }
1076
+ /**
1077
+ * @returns {CryptoClient}
1078
+ */
1079
+ crypto() {
1080
+ const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1081
+ return CryptoClient.__wrap(ret);
1082
+ }
1083
+ /**
1084
+ * @returns {VaultClient}
1085
+ */
1086
+ vault() {
1087
+ const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1088
+ return VaultClient.__wrap(ret);
1089
+ }
1090
+ /**
1091
+ * Constructs a specific client for platform-specific functionality
1092
+ * @returns {PlatformClient}
1093
+ */
1094
+ platform() {
1095
+ const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
1096
+ return PlatformClient.__wrap(ret);
1097
+ }
1098
+ /**
1099
+ * Constructs a specific client for generating passwords and passphrases
1100
+ * @returns {GeneratorClient}
1101
+ */
1102
+ generator() {
1103
+ const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1104
+ return GeneratorClient.__wrap(ret);
1105
+ }
1106
+ /**
1107
+ * @returns {ExporterClient}
1108
+ */
1109
+ exporters() {
1110
+ const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1111
+ return ExporterClient.__wrap(ret);
1112
+ }
1113
+ }
1114
+
1115
+ const CiphersClientFinalization =
1116
+ typeof FinalizationRegistry === "undefined"
1117
+ ? { register: () => {}, unregister: () => {} }
1118
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ciphersclient_free(ptr >>> 0, 1));
1119
+
1120
+ export class CiphersClient {
1121
+ static __wrap(ptr) {
1122
+ ptr = ptr >>> 0;
1123
+ const obj = Object.create(CiphersClient.prototype);
1124
+ obj.__wbg_ptr = ptr;
1125
+ CiphersClientFinalization.register(obj, obj.__wbg_ptr, obj);
1126
+ return obj;
1127
+ }
1128
+
1129
+ __destroy_into_raw() {
1130
+ const ptr = this.__wbg_ptr;
1131
+ this.__wbg_ptr = 0;
1132
+ CiphersClientFinalization.unregister(this);
1133
+ return ptr;
1134
+ }
1135
+
1136
+ free() {
1137
+ const ptr = this.__destroy_into_raw();
1138
+ wasm.__wbg_ciphersclient_free(ptr, 0);
1139
+ }
1140
+ /**
1141
+ * @param {CipherView} cipher_view
1142
+ * @returns {EncryptionContext}
1143
+ */
1144
+ encrypt(cipher_view) {
1145
+ try {
1146
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1147
+ wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1148
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1149
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1150
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1151
+ if (r2) {
1152
+ throw takeObject(r1);
1153
+ }
1154
+ return takeObject(r0);
1155
+ } finally {
1156
+ wasm.__wbindgen_add_to_stack_pointer(16);
1157
+ }
1158
+ }
1159
+ /**
1160
+ * @param {Cipher} cipher
1161
+ * @returns {CipherView}
1162
+ */
1163
+ decrypt(cipher) {
1164
+ try {
1165
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1166
+ wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1167
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1168
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1169
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1170
+ if (r2) {
1171
+ throw takeObject(r1);
1172
+ }
1173
+ return takeObject(r0);
1174
+ } finally {
1175
+ wasm.__wbindgen_add_to_stack_pointer(16);
1176
+ }
1177
+ }
1178
+ /**
1179
+ * @param {Cipher[]} ciphers
1180
+ * @returns {CipherListView[]}
1181
+ */
1182
+ decrypt_list(ciphers) {
1183
+ try {
1184
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1185
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1186
+ const len0 = WASM_VECTOR_LEN;
1187
+ wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1188
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1189
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1190
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1191
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1192
+ if (r3) {
1193
+ throw takeObject(r2);
1194
+ }
1195
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1196
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1197
+ return v2;
1198
+ } finally {
1199
+ wasm.__wbindgen_add_to_stack_pointer(16);
1200
+ }
1201
+ }
1202
+ /**
1203
+ * Decrypt cipher list with failures
1204
+ * Returns both successfully decrypted ciphers and any that failed to decrypt
1205
+ * @param {Cipher[]} ciphers
1206
+ * @returns {DecryptCipherListResult}
1207
+ */
1208
+ decrypt_list_with_failures(ciphers) {
1209
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1210
+ const len0 = WASM_VECTOR_LEN;
1211
+ const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1212
+ return takeObject(ret);
1213
+ }
1214
+ /**
1215
+ * @param {CipherView} cipher_view
1216
+ * @returns {Fido2CredentialView[]}
1217
+ */
1218
+ decrypt_fido2_credentials(cipher_view) {
1219
+ try {
1220
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1221
+ wasm.ciphersclient_decrypt_fido2_credentials(
1222
+ retptr,
1223
+ this.__wbg_ptr,
1224
+ addHeapObject(cipher_view),
1225
+ );
1226
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1227
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1228
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1229
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1230
+ if (r3) {
1231
+ throw takeObject(r2);
1232
+ }
1233
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1234
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1235
+ return v1;
1236
+ } finally {
1237
+ wasm.__wbindgen_add_to_stack_pointer(16);
1238
+ }
1239
+ }
1240
+ /**
1241
+ * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1242
+ * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1243
+ * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1244
+ * encrypting the rest of the CipherView.
1245
+ * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1246
+ * @param {CipherView} cipher_view
1247
+ * @param {Fido2CredentialFullView[]} fido2_credentials
1248
+ * @returns {CipherView}
1249
+ */
1250
+ set_fido2_credentials(cipher_view, fido2_credentials) {
1251
+ try {
1252
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1253
+ const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1254
+ const len0 = WASM_VECTOR_LEN;
1255
+ wasm.ciphersclient_set_fido2_credentials(
1256
+ retptr,
1257
+ this.__wbg_ptr,
1258
+ addHeapObject(cipher_view),
1259
+ ptr0,
1260
+ len0,
1261
+ );
1262
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1263
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1264
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1265
+ if (r2) {
1266
+ throw takeObject(r1);
1267
+ }
1268
+ return takeObject(r0);
1269
+ } finally {
1270
+ wasm.__wbindgen_add_to_stack_pointer(16);
1271
+ }
1272
+ }
1273
+ /**
1274
+ * @param {CipherView} cipher_view
1275
+ * @param {OrganizationId} organization_id
1276
+ * @returns {CipherView}
1277
+ */
1278
+ move_to_organization(cipher_view, organization_id) {
1279
+ try {
1280
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1281
+ wasm.ciphersclient_move_to_organization(
1282
+ retptr,
1283
+ this.__wbg_ptr,
1284
+ addHeapObject(cipher_view),
1285
+ addHeapObject(organization_id),
1286
+ );
1287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1289
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1290
+ if (r2) {
1291
+ throw takeObject(r1);
1292
+ }
1293
+ return takeObject(r0);
1294
+ } finally {
1295
+ wasm.__wbindgen_add_to_stack_pointer(16);
1296
+ }
1297
+ }
1298
+ /**
1299
+ * @param {CipherView} cipher_view
1300
+ * @returns {string}
1301
+ */
1302
+ decrypt_fido2_private_key(cipher_view) {
1303
+ let deferred2_0;
1304
+ let deferred2_1;
1305
+ try {
1306
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1307
+ wasm.ciphersclient_decrypt_fido2_private_key(
1308
+ retptr,
1309
+ this.__wbg_ptr,
1310
+ addHeapObject(cipher_view),
1311
+ );
1312
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1313
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1314
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1315
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1316
+ var ptr1 = r0;
1317
+ var len1 = r1;
1318
+ if (r3) {
1319
+ ptr1 = 0;
1320
+ len1 = 0;
1321
+ throw takeObject(r2);
1322
+ }
1323
+ deferred2_0 = ptr1;
1324
+ deferred2_1 = len1;
1325
+ return getStringFromWasm0(ptr1, len1);
1326
+ } finally {
1327
+ wasm.__wbindgen_add_to_stack_pointer(16);
1328
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1329
+ }
1330
+ }
1331
+ }
1332
+
1333
+ const CryptoClientFinalization =
1334
+ typeof FinalizationRegistry === "undefined"
1335
+ ? { register: () => {}, unregister: () => {} }
1336
+ : new FinalizationRegistry((ptr) => wasm.__wbg_cryptoclient_free(ptr >>> 0, 1));
1337
+ /**
1338
+ * A client for the crypto operations.
1339
+ */
1340
+ export class CryptoClient {
1341
+ static __wrap(ptr) {
1342
+ ptr = ptr >>> 0;
1343
+ const obj = Object.create(CryptoClient.prototype);
1344
+ obj.__wbg_ptr = ptr;
1345
+ CryptoClientFinalization.register(obj, obj.__wbg_ptr, obj);
1346
+ return obj;
1347
+ }
1348
+
1349
+ __destroy_into_raw() {
1350
+ const ptr = this.__wbg_ptr;
1351
+ this.__wbg_ptr = 0;
1352
+ CryptoClientFinalization.unregister(this);
1353
+ return ptr;
1354
+ }
1355
+
1356
+ free() {
1357
+ const ptr = this.__destroy_into_raw();
1358
+ wasm.__wbg_cryptoclient_free(ptr, 0);
1359
+ }
1360
+ /**
1361
+ * Initialization method for the user crypto. Needs to be called before any other crypto
1362
+ * operations.
1363
+ * @param {InitUserCryptoRequest} req
1364
+ * @returns {Promise<void>}
1365
+ */
1366
+ initialize_user_crypto(req) {
1367
+ const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1368
+ return takeObject(ret);
1369
+ }
1370
+ /**
1371
+ * Initialization method for the organization crypto. Needs to be called after
1372
+ * `initialize_user_crypto` but before any other crypto operations.
1373
+ * @param {InitOrgCryptoRequest} req
1374
+ * @returns {Promise<void>}
1375
+ */
1376
+ initialize_org_crypto(req) {
1377
+ const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1378
+ return takeObject(ret);
1379
+ }
1380
+ /**
1381
+ * Generates a new key pair and encrypts the private key with the provided user key.
1382
+ * Crypto initialization not required.
1383
+ * @param {string} user_key
1384
+ * @returns {MakeKeyPairResponse}
1385
+ */
1386
+ make_key_pair(user_key) {
1387
+ try {
1388
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1389
+ const ptr0 = passStringToWasm0(user_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1390
+ const len0 = WASM_VECTOR_LEN;
1391
+ wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, ptr0, len0);
1392
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1393
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1394
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1395
+ if (r2) {
1396
+ throw takeObject(r1);
1397
+ }
1398
+ return takeObject(r0);
1399
+ } finally {
1400
+ wasm.__wbindgen_add_to_stack_pointer(16);
1401
+ }
1402
+ }
1403
+ /**
1404
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1405
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
1406
+ * Crypto initialization not required.
1407
+ * @param {VerifyAsymmetricKeysRequest} request
1408
+ * @returns {VerifyAsymmetricKeysResponse}
1409
+ */
1410
+ verify_asymmetric_keys(request) {
1411
+ try {
1412
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1413
+ wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1414
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1415
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1416
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1417
+ if (r2) {
1418
+ throw takeObject(r1);
1419
+ }
1420
+ return takeObject(r0);
1421
+ } finally {
1422
+ wasm.__wbindgen_add_to_stack_pointer(16);
1423
+ }
1424
+ }
1425
+ /**
1426
+ * Makes a new signing key pair and signs the public key for the user
1427
+ * @returns {MakeUserSigningKeysResponse}
1428
+ */
1429
+ make_user_signing_keys_for_enrollment() {
1430
+ try {
1431
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1432
+ wasm.cryptoclient_make_user_signing_keys_for_enrollment(retptr, this.__wbg_ptr);
1433
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1434
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1435
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1436
+ if (r2) {
1437
+ throw takeObject(r1);
1438
+ }
1439
+ return takeObject(r0);
1440
+ } finally {
1441
+ wasm.__wbindgen_add_to_stack_pointer(16);
1442
+ }
1443
+ }
1444
+ /**
1445
+ * Creates a rotated set of account keys for the current state
1446
+ * @param {string} user_key
1447
+ * @returns {RotateUserKeysResponse}
1448
+ */
1449
+ get_v2_rotated_account_keys(user_key) {
1450
+ try {
1451
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1452
+ const ptr0 = passStringToWasm0(user_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1453
+ const len0 = WASM_VECTOR_LEN;
1454
+ wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr, ptr0, len0);
1455
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1456
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1457
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1458
+ if (r2) {
1459
+ throw takeObject(r1);
1460
+ }
1461
+ return takeObject(r0);
1462
+ } finally {
1463
+ wasm.__wbindgen_add_to_stack_pointer(16);
1464
+ }
1465
+ }
1466
+ }
1467
+
1468
+ const ExporterClientFinalization =
1469
+ typeof FinalizationRegistry === "undefined"
1470
+ ? { register: () => {}, unregister: () => {} }
1471
+ : new FinalizationRegistry((ptr) => wasm.__wbg_exporterclient_free(ptr >>> 0, 1));
1472
+
1473
+ export class ExporterClient {
1474
+ static __wrap(ptr) {
1475
+ ptr = ptr >>> 0;
1476
+ const obj = Object.create(ExporterClient.prototype);
1477
+ obj.__wbg_ptr = ptr;
1478
+ ExporterClientFinalization.register(obj, obj.__wbg_ptr, obj);
1479
+ return obj;
1480
+ }
1481
+
1482
+ __destroy_into_raw() {
1483
+ const ptr = this.__wbg_ptr;
1484
+ this.__wbg_ptr = 0;
1485
+ ExporterClientFinalization.unregister(this);
1486
+ return ptr;
1487
+ }
1488
+
1489
+ free() {
1490
+ const ptr = this.__destroy_into_raw();
1491
+ wasm.__wbg_exporterclient_free(ptr, 0);
1492
+ }
1493
+ /**
1494
+ * @param {Folder[]} folders
1495
+ * @param {Cipher[]} ciphers
1496
+ * @param {ExportFormat} format
1497
+ * @returns {string}
1498
+ */
1499
+ export_vault(folders, ciphers, format) {
1500
+ let deferred4_0;
1501
+ let deferred4_1;
1502
+ try {
1503
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1504
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
1505
+ const len0 = WASM_VECTOR_LEN;
1506
+ const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1507
+ const len1 = WASM_VECTOR_LEN;
1508
+ wasm.exporterclient_export_vault(
1509
+ retptr,
1510
+ this.__wbg_ptr,
1511
+ ptr0,
1512
+ len0,
1513
+ ptr1,
1514
+ len1,
1515
+ addHeapObject(format),
1516
+ );
1517
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1518
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1519
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1520
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1521
+ var ptr3 = r0;
1522
+ var len3 = r1;
1523
+ if (r3) {
1524
+ ptr3 = 0;
1525
+ len3 = 0;
1526
+ throw takeObject(r2);
1527
+ }
1528
+ deferred4_0 = ptr3;
1529
+ deferred4_1 = len3;
1530
+ return getStringFromWasm0(ptr3, len3);
1531
+ } finally {
1532
+ wasm.__wbindgen_add_to_stack_pointer(16);
1533
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1534
+ }
1535
+ }
1536
+ /**
1537
+ * @param {Collection[]} collections
1538
+ * @param {Cipher[]} ciphers
1539
+ * @param {ExportFormat} format
1540
+ * @returns {string}
1541
+ */
1542
+ export_organization_vault(collections, ciphers, format) {
1543
+ let deferred4_0;
1544
+ let deferred4_1;
1545
+ try {
1546
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1547
+ const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
1548
+ const len0 = WASM_VECTOR_LEN;
1549
+ const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1550
+ const len1 = WASM_VECTOR_LEN;
1551
+ wasm.exporterclient_export_organization_vault(
1552
+ retptr,
1553
+ this.__wbg_ptr,
1554
+ ptr0,
1555
+ len0,
1556
+ ptr1,
1557
+ len1,
1558
+ addHeapObject(format),
1559
+ );
1560
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1561
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1562
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1563
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1564
+ var ptr3 = r0;
1565
+ var len3 = r1;
1566
+ if (r3) {
1567
+ ptr3 = 0;
1568
+ len3 = 0;
1569
+ throw takeObject(r2);
1570
+ }
1571
+ deferred4_0 = ptr3;
1572
+ deferred4_1 = len3;
1573
+ return getStringFromWasm0(ptr3, len3);
1574
+ } finally {
1575
+ wasm.__wbindgen_add_to_stack_pointer(16);
1576
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1577
+ }
1578
+ }
1579
+ /**
1580
+ * Credential Exchange Format (CXF)
1581
+ *
1582
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
1583
+ *
1584
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
1585
+ * Ideally the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
1586
+ * @param {Account} account
1587
+ * @param {Cipher[]} ciphers
1588
+ * @returns {string}
1589
+ */
1590
+ export_cxf(account, ciphers) {
1591
+ let deferred3_0;
1592
+ let deferred3_1;
1593
+ try {
1594
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1595
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1596
+ const len0 = WASM_VECTOR_LEN;
1597
+ wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
1598
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1599
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1600
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1601
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1602
+ var ptr2 = r0;
1603
+ var len2 = r1;
1604
+ if (r3) {
1605
+ ptr2 = 0;
1606
+ len2 = 0;
1607
+ throw takeObject(r2);
1608
+ }
1609
+ deferred3_0 = ptr2;
1610
+ deferred3_1 = len2;
1611
+ return getStringFromWasm0(ptr2, len2);
1612
+ } finally {
1613
+ wasm.__wbindgen_add_to_stack_pointer(16);
1614
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1615
+ }
1616
+ }
1617
+ /**
1618
+ * Credential Exchange Format (CXF)
1619
+ *
1620
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
1621
+ *
1622
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
1623
+ * Ideally the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
1624
+ * @param {string} payload
1625
+ * @returns {Cipher[]}
1626
+ */
1627
+ import_cxf(payload) {
1628
+ try {
1629
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1630
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1631
+ const len0 = WASM_VECTOR_LEN;
1632
+ wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
1633
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1634
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1635
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1636
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1637
+ if (r3) {
1638
+ throw takeObject(r2);
1639
+ }
1640
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1641
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1642
+ return v2;
1643
+ } finally {
1644
+ wasm.__wbindgen_add_to_stack_pointer(16);
1645
+ }
1646
+ }
1647
+ }
1648
+
1649
+ const FoldersClientFinalization =
1650
+ typeof FinalizationRegistry === "undefined"
1651
+ ? { register: () => {}, unregister: () => {} }
1652
+ : new FinalizationRegistry((ptr) => wasm.__wbg_foldersclient_free(ptr >>> 0, 1));
1653
+
1654
+ export class FoldersClient {
1655
+ static __wrap(ptr) {
1656
+ ptr = ptr >>> 0;
1657
+ const obj = Object.create(FoldersClient.prototype);
1658
+ obj.__wbg_ptr = ptr;
1659
+ FoldersClientFinalization.register(obj, obj.__wbg_ptr, obj);
1660
+ return obj;
1661
+ }
1662
+
1663
+ __destroy_into_raw() {
1664
+ const ptr = this.__wbg_ptr;
1665
+ this.__wbg_ptr = 0;
1666
+ FoldersClientFinalization.unregister(this);
1667
+ return ptr;
1668
+ }
1669
+
1670
+ free() {
1671
+ const ptr = this.__destroy_into_raw();
1672
+ wasm.__wbg_foldersclient_free(ptr, 0);
1673
+ }
1674
+ /**
1675
+ * @param {FolderView} folder_view
1676
+ * @returns {Folder}
1677
+ */
1678
+ encrypt(folder_view) {
1679
+ try {
1680
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1681
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
1682
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1683
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1684
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1685
+ if (r2) {
1686
+ throw takeObject(r1);
1687
+ }
1688
+ return takeObject(r0);
1689
+ } finally {
1690
+ wasm.__wbindgen_add_to_stack_pointer(16);
1691
+ }
1692
+ }
1693
+ /**
1694
+ * @param {Folder} folder
1695
+ * @returns {FolderView}
1696
+ */
1697
+ decrypt(folder) {
1698
+ try {
1699
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1700
+ wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
1701
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1702
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1703
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1704
+ if (r2) {
1705
+ throw takeObject(r1);
1706
+ }
1707
+ return takeObject(r0);
1708
+ } finally {
1709
+ wasm.__wbindgen_add_to_stack_pointer(16);
1710
+ }
1711
+ }
1712
+ /**
1713
+ * @param {Folder[]} folders
1714
+ * @returns {FolderView[]}
1715
+ */
1716
+ decrypt_list(folders) {
1717
+ try {
1718
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1719
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
1720
+ const len0 = WASM_VECTOR_LEN;
1721
+ wasm.foldersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1722
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1723
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1724
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1725
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1726
+ if (r3) {
1727
+ throw takeObject(r2);
1728
+ }
1729
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1730
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1731
+ return v2;
1732
+ } finally {
1733
+ wasm.__wbindgen_add_to_stack_pointer(16);
1734
+ }
1735
+ }
1736
+ }
1737
+
1738
+ const GeneratorClientFinalization =
1739
+ typeof FinalizationRegistry === "undefined"
1740
+ ? { register: () => {}, unregister: () => {} }
1741
+ : new FinalizationRegistry((ptr) => wasm.__wbg_generatorclient_free(ptr >>> 0, 1));
1742
+
1743
+ export class GeneratorClient {
1744
+ static __wrap(ptr) {
1745
+ ptr = ptr >>> 0;
1746
+ const obj = Object.create(GeneratorClient.prototype);
1747
+ obj.__wbg_ptr = ptr;
1748
+ GeneratorClientFinalization.register(obj, obj.__wbg_ptr, obj);
1749
+ return obj;
1750
+ }
1751
+
1752
+ __destroy_into_raw() {
1753
+ const ptr = this.__wbg_ptr;
1754
+ this.__wbg_ptr = 0;
1755
+ GeneratorClientFinalization.unregister(this);
1756
+ return ptr;
1757
+ }
1758
+
1759
+ free() {
1760
+ const ptr = this.__destroy_into_raw();
1761
+ wasm.__wbg_generatorclient_free(ptr, 0);
1762
+ }
1763
+ /**
1764
+ * Generates a random password.
1765
+ *
1766
+ * The character sets and password length can be customized using the `input` parameter.
1767
+ *
1768
+ * # Examples
1769
+ *
1770
+ * ```
1771
+ * use bitwarden_core::Client;
1772
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
1773
+ *
1774
+ * async fn test() -> Result<(), PassphraseError> {
1775
+ * let input = PasswordGeneratorRequest {
1776
+ * lowercase: true,
1777
+ * uppercase: true,
1778
+ * numbers: true,
1779
+ * length: 20,
1780
+ * ..Default::default()
1781
+ * };
1782
+ * let password = Client::new(None).generator().password(input).unwrap();
1783
+ * println!("{}", password);
1784
+ * Ok(())
1785
+ * }
1786
+ * ```
1787
+ * @param {PasswordGeneratorRequest} input
1788
+ * @returns {string}
1789
+ */
1790
+ password(input) {
1791
+ let deferred2_0;
1792
+ let deferred2_1;
1793
+ try {
1794
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1795
+ wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
1796
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1797
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1798
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1799
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1800
+ var ptr1 = r0;
1801
+ var len1 = r1;
1802
+ if (r3) {
1803
+ ptr1 = 0;
1804
+ len1 = 0;
1805
+ throw takeObject(r2);
1806
+ }
1807
+ deferred2_0 = ptr1;
1808
+ deferred2_1 = len1;
1809
+ return getStringFromWasm0(ptr1, len1);
1810
+ } finally {
1811
+ wasm.__wbindgen_add_to_stack_pointer(16);
1812
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1813
+ }
1814
+ }
1815
+ /**
1816
+ * Generates a random passphrase.
1817
+ * A passphrase is a combination of random words separated by a character.
1818
+ * An example of passphrase is `correct horse battery staple`.
1819
+ *
1820
+ * The number of words and their case, the word separator, and the inclusion of
1821
+ * a number in the passphrase can be customized using the `input` parameter.
1822
+ *
1823
+ * # Examples
1824
+ *
1825
+ * ```
1826
+ * use bitwarden_core::Client;
1827
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
1828
+ *
1829
+ * async fn test() -> Result<(), PassphraseError> {
1830
+ * let input = PassphraseGeneratorRequest {
1831
+ * num_words: 4,
1832
+ * ..Default::default()
1833
+ * };
1834
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
1835
+ * println!("{}", passphrase);
1836
+ * Ok(())
1837
+ * }
1838
+ * ```
1839
+ * @param {PassphraseGeneratorRequest} input
1840
+ * @returns {string}
1841
+ */
1842
+ passphrase(input) {
1843
+ let deferred2_0;
1844
+ let deferred2_1;
1845
+ try {
1846
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1847
+ wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
1848
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1849
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1850
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1851
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1852
+ var ptr1 = r0;
1853
+ var len1 = r1;
1854
+ if (r3) {
1855
+ ptr1 = 0;
1856
+ len1 = 0;
1857
+ throw takeObject(r2);
1858
+ }
1859
+ deferred2_0 = ptr1;
1860
+ deferred2_1 = len1;
1861
+ return getStringFromWasm0(ptr1, len1);
1862
+ } finally {
1863
+ wasm.__wbindgen_add_to_stack_pointer(16);
1864
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1865
+ }
1866
+ }
1867
+ }
1868
+
1869
+ const IncomingMessageFinalization =
1870
+ typeof FinalizationRegistry === "undefined"
1871
+ ? { register: () => {}, unregister: () => {} }
1872
+ : new FinalizationRegistry((ptr) => wasm.__wbg_incomingmessage_free(ptr >>> 0, 1));
1873
+
1874
+ export class IncomingMessage {
1875
+ static __wrap(ptr) {
1876
+ ptr = ptr >>> 0;
1877
+ const obj = Object.create(IncomingMessage.prototype);
1878
+ obj.__wbg_ptr = ptr;
1879
+ IncomingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
1880
+ return obj;
1881
+ }
1882
+
1883
+ __destroy_into_raw() {
1884
+ const ptr = this.__wbg_ptr;
1885
+ this.__wbg_ptr = 0;
1886
+ IncomingMessageFinalization.unregister(this);
1887
+ return ptr;
1888
+ }
1889
+
1890
+ free() {
1891
+ const ptr = this.__destroy_into_raw();
1892
+ wasm.__wbg_incomingmessage_free(ptr, 0);
1893
+ }
1894
+ /**
1895
+ * @returns {Uint8Array}
1896
+ */
1897
+ get payload() {
1898
+ try {
1899
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1900
+ wasm.__wbg_get_incomingmessage_payload(retptr, this.__wbg_ptr);
1901
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1902
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1903
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1904
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
1905
+ return v1;
1906
+ } finally {
1907
+ wasm.__wbindgen_add_to_stack_pointer(16);
1908
+ }
1909
+ }
1910
+ /**
1911
+ * @param {Uint8Array} arg0
1912
+ */
1913
+ set payload(arg0) {
1914
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1915
+ const len0 = WASM_VECTOR_LEN;
1916
+ wasm.__wbg_set_incomingmessage_payload(this.__wbg_ptr, ptr0, len0);
1917
+ }
1918
+ /**
1919
+ * @returns {Endpoint}
1920
+ */
1921
+ get destination() {
1922
+ const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
1923
+ return takeObject(ret);
1924
+ }
1925
+ /**
1926
+ * @param {Endpoint} arg0
1927
+ */
1928
+ set destination(arg0) {
1929
+ wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
1930
+ }
1931
+ /**
1932
+ * @returns {Endpoint}
1933
+ */
1934
+ get source() {
1935
+ const ret = wasm.__wbg_get_incomingmessage_source(this.__wbg_ptr);
1936
+ return takeObject(ret);
1937
+ }
1938
+ /**
1939
+ * @param {Endpoint} arg0
1940
+ */
1941
+ set source(arg0) {
1942
+ wasm.__wbg_set_incomingmessage_source(this.__wbg_ptr, addHeapObject(arg0));
1943
+ }
1944
+ /**
1945
+ * @returns {string | undefined}
1946
+ */
1947
+ get topic() {
1948
+ try {
1949
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1950
+ wasm.__wbg_get_incomingmessage_topic(retptr, this.__wbg_ptr);
1951
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1952
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1953
+ let v1;
1954
+ if (r0 !== 0) {
1955
+ v1 = getStringFromWasm0(r0, r1).slice();
1956
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
1957
+ }
1958
+ return v1;
1959
+ } finally {
1960
+ wasm.__wbindgen_add_to_stack_pointer(16);
1961
+ }
1962
+ }
1963
+ /**
1964
+ * @param {string | null} [arg0]
1965
+ */
1966
+ set topic(arg0) {
1967
+ var ptr0 = isLikeNone(arg0)
1968
+ ? 0
1969
+ : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1970
+ var len0 = WASM_VECTOR_LEN;
1971
+ wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
1972
+ }
1973
+ /**
1974
+ * @param {Uint8Array} payload
1975
+ * @param {Endpoint} destination
1976
+ * @param {Endpoint} source
1977
+ * @param {string | null} [topic]
1978
+ */
1979
+ constructor(payload, destination, source, topic) {
1980
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
1981
+ const len0 = WASM_VECTOR_LEN;
1982
+ var ptr1 = isLikeNone(topic)
1983
+ ? 0
1984
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1985
+ var len1 = WASM_VECTOR_LEN;
1986
+ const ret = wasm.incomingmessage_new(
1987
+ ptr0,
1988
+ len0,
1989
+ addHeapObject(destination),
1990
+ addHeapObject(source),
1991
+ ptr1,
1992
+ len1,
1993
+ );
1994
+ this.__wbg_ptr = ret >>> 0;
1995
+ IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
1996
+ return this;
1997
+ }
1998
+ /**
1999
+ * Try to parse the payload as JSON.
2000
+ * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2001
+ */
2002
+ parse_payload_as_json() {
2003
+ const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2004
+ return takeObject(ret);
2005
+ }
2006
+ }
2007
+
2008
+ const IpcClientFinalization =
2009
+ typeof FinalizationRegistry === "undefined"
2010
+ ? { register: () => {}, unregister: () => {} }
2011
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclient_free(ptr >>> 0, 1));
2012
+ /**
2013
+ * JavaScript wrapper around the IPC client. For more information, see the
2014
+ * [IpcClient] documentation.
2015
+ */
2016
+ export class IpcClient {
2017
+ __destroy_into_raw() {
2018
+ const ptr = this.__wbg_ptr;
2019
+ this.__wbg_ptr = 0;
2020
+ IpcClientFinalization.unregister(this);
2021
+ return ptr;
2022
+ }
2023
+
2024
+ free() {
2025
+ const ptr = this.__destroy_into_raw();
2026
+ wasm.__wbg_ipcclient_free(ptr, 0);
2027
+ }
2028
+ /**
2029
+ * @param {IpcCommunicationBackend} communication_provider
2030
+ */
2031
+ constructor(communication_provider) {
2032
+ _assertClass(communication_provider, IpcCommunicationBackend);
2033
+ const ret = wasm.ipcclient_new(communication_provider.__wbg_ptr);
2034
+ this.__wbg_ptr = ret >>> 0;
2035
+ IpcClientFinalization.register(this, this.__wbg_ptr, this);
2036
+ return this;
2037
+ }
2038
+ /**
2039
+ * @returns {Promise<void>}
2040
+ */
2041
+ start() {
2042
+ const ret = wasm.ipcclient_start(this.__wbg_ptr);
2043
+ return takeObject(ret);
2044
+ }
2045
+ /**
2046
+ * @returns {Promise<boolean>}
2047
+ */
2048
+ isRunning() {
2049
+ const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2050
+ return takeObject(ret);
2051
+ }
2052
+ /**
2053
+ * @param {OutgoingMessage} message
2054
+ * @returns {Promise<void>}
2055
+ */
2056
+ send(message) {
2057
+ _assertClass(message, OutgoingMessage);
2058
+ var ptr0 = message.__destroy_into_raw();
2059
+ const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2060
+ return takeObject(ret);
2061
+ }
2062
+ /**
2063
+ * @returns {Promise<IpcClientSubscription>}
2064
+ */
2065
+ subscribe() {
2066
+ const ret = wasm.ipcclient_subscribe(this.__wbg_ptr);
2067
+ return takeObject(ret);
2068
+ }
2069
+ }
2070
+
2071
+ const IpcClientSubscriptionFinalization =
2072
+ typeof FinalizationRegistry === "undefined"
2073
+ ? { register: () => {}, unregister: () => {} }
2074
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclientsubscription_free(ptr >>> 0, 1));
2075
+ /**
2076
+ * JavaScript wrapper around the IPC client subscription. For more information, see the
2077
+ * [IpcClientSubscription](crate::IpcClientSubscription) documentation.
2078
+ */
2079
+ export class IpcClientSubscription {
2080
+ static __wrap(ptr) {
2081
+ ptr = ptr >>> 0;
2082
+ const obj = Object.create(IpcClientSubscription.prototype);
2083
+ obj.__wbg_ptr = ptr;
2084
+ IpcClientSubscriptionFinalization.register(obj, obj.__wbg_ptr, obj);
2085
+ return obj;
2086
+ }
2087
+
2088
+ __destroy_into_raw() {
2089
+ const ptr = this.__wbg_ptr;
2090
+ this.__wbg_ptr = 0;
2091
+ IpcClientSubscriptionFinalization.unregister(this);
2092
+ return ptr;
2093
+ }
2094
+
2095
+ free() {
2096
+ const ptr = this.__destroy_into_raw();
2097
+ wasm.__wbg_ipcclientsubscription_free(ptr, 0);
2098
+ }
2099
+ /**
2100
+ * @param {AbortSignal | null} [abort_signal]
2101
+ * @returns {Promise<IncomingMessage>}
2102
+ */
2103
+ receive(abort_signal) {
2104
+ const ret = wasm.ipcclientsubscription_receive(
2105
+ this.__wbg_ptr,
2106
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
2107
+ );
2108
+ return takeObject(ret);
2109
+ }
2110
+ }
2111
+
2112
+ const IpcCommunicationBackendFinalization =
2113
+ typeof FinalizationRegistry === "undefined"
2114
+ ? { register: () => {}, unregister: () => {} }
2115
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipccommunicationbackend_free(ptr >>> 0, 1));
2116
+ /**
2117
+ * JavaScript implementation of the `CommunicationBackend` trait for IPC communication.
2118
+ */
2119
+ export class IpcCommunicationBackend {
2120
+ __destroy_into_raw() {
2121
+ const ptr = this.__wbg_ptr;
2122
+ this.__wbg_ptr = 0;
2123
+ IpcCommunicationBackendFinalization.unregister(this);
2124
+ return ptr;
2125
+ }
2126
+
2127
+ free() {
2128
+ const ptr = this.__destroy_into_raw();
2129
+ wasm.__wbg_ipccommunicationbackend_free(ptr, 0);
2130
+ }
2131
+ /**
2132
+ * Creates a new instance of the JavaScript communication backend.
2133
+ * @param {IpcCommunicationBackendSender} sender
2134
+ */
2135
+ constructor(sender) {
2136
+ const ret = wasm.ipccommunicationbackend_new(addHeapObject(sender));
2137
+ this.__wbg_ptr = ret >>> 0;
2138
+ IpcCommunicationBackendFinalization.register(this, this.__wbg_ptr, this);
2139
+ return this;
2140
+ }
2141
+ /**
2142
+ * Used by JavaScript to provide an incoming message to the IPC framework.
2143
+ * @param {IncomingMessage} message
2144
+ */
2145
+ receive(message) {
2146
+ try {
2147
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2148
+ _assertClass(message, IncomingMessage);
2149
+ var ptr0 = message.__destroy_into_raw();
2150
+ wasm.ipccommunicationbackend_receive(retptr, this.__wbg_ptr, ptr0);
2151
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2152
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2153
+ if (r1) {
2154
+ throw takeObject(r0);
2155
+ }
2156
+ } finally {
2157
+ wasm.__wbindgen_add_to_stack_pointer(16);
2158
+ }
2159
+ }
2160
+ }
2161
+
2162
+ const OutgoingMessageFinalization =
2163
+ typeof FinalizationRegistry === "undefined"
2164
+ ? { register: () => {}, unregister: () => {} }
2165
+ : new FinalizationRegistry((ptr) => wasm.__wbg_outgoingmessage_free(ptr >>> 0, 1));
2166
+
2167
+ export class OutgoingMessage {
2168
+ static __wrap(ptr) {
2169
+ ptr = ptr >>> 0;
2170
+ const obj = Object.create(OutgoingMessage.prototype);
2171
+ obj.__wbg_ptr = ptr;
2172
+ OutgoingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2173
+ return obj;
2174
+ }
2175
+
2176
+ __destroy_into_raw() {
2177
+ const ptr = this.__wbg_ptr;
2178
+ this.__wbg_ptr = 0;
2179
+ OutgoingMessageFinalization.unregister(this);
2180
+ return ptr;
2181
+ }
2182
+
2183
+ free() {
2184
+ const ptr = this.__destroy_into_raw();
2185
+ wasm.__wbg_outgoingmessage_free(ptr, 0);
2186
+ }
2187
+ /**
2188
+ * @returns {Uint8Array}
2189
+ */
2190
+ get payload() {
2191
+ try {
2192
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2193
+ wasm.__wbg_get_outgoingmessage_payload(retptr, this.__wbg_ptr);
2194
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2195
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2196
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2197
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2198
+ return v1;
2199
+ } finally {
2200
+ wasm.__wbindgen_add_to_stack_pointer(16);
2201
+ }
2202
+ }
2203
+ /**
2204
+ * @param {Uint8Array} arg0
2205
+ */
2206
+ set payload(arg0) {
2207
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
2208
+ const len0 = WASM_VECTOR_LEN;
2209
+ wasm.__wbg_set_outgoingmessage_payload(this.__wbg_ptr, ptr0, len0);
2210
+ }
2211
+ /**
2212
+ * @returns {Endpoint}
2213
+ */
2214
+ get destination() {
2215
+ const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
2216
+ return takeObject(ret);
2217
+ }
2218
+ /**
2219
+ * @param {Endpoint} arg0
2220
+ */
2221
+ set destination(arg0) {
2222
+ wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
2223
+ }
2224
+ /**
2225
+ * @returns {string | undefined}
2226
+ */
2227
+ get topic() {
2228
+ try {
2229
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2230
+ wasm.__wbg_get_outgoingmessage_topic(retptr, this.__wbg_ptr);
2231
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2232
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2233
+ let v1;
2234
+ if (r0 !== 0) {
2235
+ v1 = getStringFromWasm0(r0, r1).slice();
2236
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2237
+ }
2238
+ return v1;
2239
+ } finally {
2240
+ wasm.__wbindgen_add_to_stack_pointer(16);
2241
+ }
2242
+ }
2243
+ /**
2244
+ * @param {string | null} [arg0]
2245
+ */
2246
+ set topic(arg0) {
2247
+ var ptr0 = isLikeNone(arg0)
2248
+ ? 0
2249
+ : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2250
+ var len0 = WASM_VECTOR_LEN;
2251
+ wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
2252
+ }
2253
+ /**
2254
+ * @param {Uint8Array} payload
2255
+ * @param {Endpoint} destination
2256
+ * @param {string | null} [topic]
2257
+ */
2258
+ constructor(payload, destination, topic) {
2259
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2260
+ const len0 = WASM_VECTOR_LEN;
2261
+ var ptr1 = isLikeNone(topic)
2262
+ ? 0
2263
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2264
+ var len1 = WASM_VECTOR_LEN;
2265
+ const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
2266
+ this.__wbg_ptr = ret >>> 0;
2267
+ OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
2268
+ return this;
2269
+ }
2270
+ /**
2271
+ * Create a new message and encode the payload as JSON.
2272
+ * @param {any} payload
2273
+ * @param {Endpoint} destination
2274
+ * @param {string | null} [topic]
2275
+ * @returns {OutgoingMessage}
2276
+ */
2277
+ static new_json_payload(payload, destination, topic) {
2278
+ try {
2279
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2280
+ var ptr0 = isLikeNone(topic)
2281
+ ? 0
2282
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2283
+ var len0 = WASM_VECTOR_LEN;
2284
+ wasm.outgoingmessage_new_json_payload(
2285
+ retptr,
2286
+ addHeapObject(payload),
2287
+ addHeapObject(destination),
2288
+ ptr0,
2289
+ len0,
2290
+ );
2291
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2292
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2293
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2294
+ if (r2) {
2295
+ throw takeObject(r1);
2296
+ }
2297
+ return OutgoingMessage.__wrap(r0);
2298
+ } finally {
2299
+ wasm.__wbindgen_add_to_stack_pointer(16);
2300
+ }
2301
+ }
2302
+ }
348
2303
 
349
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
2304
+ const PlatformClientFinalization =
2305
+ typeof FinalizationRegistry === "undefined"
2306
+ ? { register: () => {}, unregister: () => {} }
2307
+ : new FinalizationRegistry((ptr) => wasm.__wbg_platformclient_free(ptr >>> 0, 1));
350
2308
 
351
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
2309
+ export class PlatformClient {
2310
+ static __wrap(ptr) {
2311
+ ptr = ptr >>> 0;
2312
+ const obj = Object.create(PlatformClient.prototype);
2313
+ obj.__wbg_ptr = ptr;
2314
+ PlatformClientFinalization.register(obj, obj.__wbg_ptr, obj);
2315
+ return obj;
2316
+ }
352
2317
 
353
- const BitwardenClientFinalization =
2318
+ __destroy_into_raw() {
2319
+ const ptr = this.__wbg_ptr;
2320
+ this.__wbg_ptr = 0;
2321
+ PlatformClientFinalization.unregister(this);
2322
+ return ptr;
2323
+ }
2324
+
2325
+ free() {
2326
+ const ptr = this.__destroy_into_raw();
2327
+ wasm.__wbg_platformclient_free(ptr, 0);
2328
+ }
2329
+ /**
2330
+ * @returns {StateClient}
2331
+ */
2332
+ state() {
2333
+ const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
2334
+ return StateClient.__wrap(ret);
2335
+ }
2336
+ }
2337
+
2338
+ const PureCryptoFinalization =
354
2339
  typeof FinalizationRegistry === "undefined"
355
2340
  ? { register: () => {}, unregister: () => {} }
356
- : new FinalizationRegistry((ptr) => wasm.__wbg_bitwardenclient_free(ptr >>> 0, 1));
357
-
358
- export class BitwardenClient {
2341
+ : new FinalizationRegistry((ptr) => wasm.__wbg_purecrypto_free(ptr >>> 0, 1));
2342
+ /**
2343
+ * This module represents a stopgap solution to provide access to primitive crypto functions for JS
2344
+ * clients. It is not intended to be used outside of the JS clients and this pattern should not be
2345
+ * proliferated. It is necessary because we want to use SDK crypto prior to the SDK being fully
2346
+ * responsible for state and keys.
2347
+ */
2348
+ export class PureCrypto {
359
2349
  __destroy_into_raw() {
360
2350
  const ptr = this.__wbg_ptr;
361
2351
  this.__wbg_ptr = 0;
362
- BitwardenClientFinalization.unregister(this);
2352
+ PureCryptoFinalization.unregister(this);
363
2353
  return ptr;
364
2354
  }
365
2355
 
366
2356
  free() {
367
2357
  const ptr = this.__destroy_into_raw();
368
- wasm.__wbg_bitwardenclient_free(ptr, 0);
2358
+ wasm.__wbg_purecrypto_free(ptr, 0);
2359
+ }
2360
+ /**
2361
+ * DEPRECATED: Use `symmetric_decrypt_string` instead.
2362
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
2363
+ * @param {string} enc_string
2364
+ * @param {Uint8Array} key
2365
+ * @returns {string}
2366
+ */
2367
+ static symmetric_decrypt(enc_string, key) {
2368
+ let deferred4_0;
2369
+ let deferred4_1;
2370
+ try {
2371
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2372
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2373
+ const len0 = WASM_VECTOR_LEN;
2374
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2375
+ const len1 = WASM_VECTOR_LEN;
2376
+ wasm.purecrypto_symmetric_decrypt(retptr, ptr0, len0, ptr1, len1);
2377
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2378
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2379
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2380
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2381
+ var ptr3 = r0;
2382
+ var len3 = r1;
2383
+ if (r3) {
2384
+ ptr3 = 0;
2385
+ len3 = 0;
2386
+ throw takeObject(r2);
2387
+ }
2388
+ deferred4_0 = ptr3;
2389
+ deferred4_1 = len3;
2390
+ return getStringFromWasm0(ptr3, len3);
2391
+ } finally {
2392
+ wasm.__wbindgen_add_to_stack_pointer(16);
2393
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2394
+ }
2395
+ }
2396
+ /**
2397
+ * @param {string} enc_string
2398
+ * @param {Uint8Array} key
2399
+ * @returns {string}
2400
+ */
2401
+ static symmetric_decrypt_string(enc_string, key) {
2402
+ let deferred4_0;
2403
+ let deferred4_1;
2404
+ try {
2405
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2406
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2407
+ const len0 = WASM_VECTOR_LEN;
2408
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2409
+ const len1 = WASM_VECTOR_LEN;
2410
+ wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
2411
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2412
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2413
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2414
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2415
+ var ptr3 = r0;
2416
+ var len3 = r1;
2417
+ if (r3) {
2418
+ ptr3 = 0;
2419
+ len3 = 0;
2420
+ throw takeObject(r2);
2421
+ }
2422
+ deferred4_0 = ptr3;
2423
+ deferred4_1 = len3;
2424
+ return getStringFromWasm0(ptr3, len3);
2425
+ } finally {
2426
+ wasm.__wbindgen_add_to_stack_pointer(16);
2427
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2428
+ }
2429
+ }
2430
+ /**
2431
+ * @param {string} enc_string
2432
+ * @param {Uint8Array} key
2433
+ * @returns {Uint8Array}
2434
+ */
2435
+ static symmetric_decrypt_bytes(enc_string, key) {
2436
+ try {
2437
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2438
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2439
+ const len0 = WASM_VECTOR_LEN;
2440
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2441
+ const len1 = WASM_VECTOR_LEN;
2442
+ wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
2443
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2444
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2445
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2446
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2447
+ if (r3) {
2448
+ throw takeObject(r2);
2449
+ }
2450
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2451
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2452
+ return v3;
2453
+ } finally {
2454
+ wasm.__wbindgen_add_to_stack_pointer(16);
2455
+ }
2456
+ }
2457
+ /**
2458
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
2459
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
2460
+ * @param {Uint8Array} enc_bytes
2461
+ * @param {Uint8Array} key
2462
+ * @returns {Uint8Array}
2463
+ */
2464
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
2465
+ try {
2466
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2467
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
2468
+ const len0 = WASM_VECTOR_LEN;
2469
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2470
+ const len1 = WASM_VECTOR_LEN;
2471
+ wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
2472
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2473
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2474
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2475
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2476
+ if (r3) {
2477
+ throw takeObject(r2);
2478
+ }
2479
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2480
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2481
+ return v3;
2482
+ } finally {
2483
+ wasm.__wbindgen_add_to_stack_pointer(16);
2484
+ }
2485
+ }
2486
+ /**
2487
+ * @param {Uint8Array} enc_bytes
2488
+ * @param {Uint8Array} key
2489
+ * @returns {Uint8Array}
2490
+ */
2491
+ static symmetric_decrypt_filedata(enc_bytes, key) {
2492
+ try {
2493
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2494
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
2495
+ const len0 = WASM_VECTOR_LEN;
2496
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2497
+ const len1 = WASM_VECTOR_LEN;
2498
+ wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
2499
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2500
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2501
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2502
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2503
+ if (r3) {
2504
+ throw takeObject(r2);
2505
+ }
2506
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2507
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2508
+ return v3;
2509
+ } finally {
2510
+ wasm.__wbindgen_add_to_stack_pointer(16);
2511
+ }
2512
+ }
2513
+ /**
2514
+ * @param {string} plain
2515
+ * @param {Uint8Array} key
2516
+ * @returns {string}
2517
+ */
2518
+ static symmetric_encrypt_string(plain, key) {
2519
+ let deferred4_0;
2520
+ let deferred4_1;
2521
+ try {
2522
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2523
+ const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2524
+ const len0 = WASM_VECTOR_LEN;
2525
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2526
+ const len1 = WASM_VECTOR_LEN;
2527
+ wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
2528
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2529
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2530
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2531
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2532
+ var ptr3 = r0;
2533
+ var len3 = r1;
2534
+ if (r3) {
2535
+ ptr3 = 0;
2536
+ len3 = 0;
2537
+ throw takeObject(r2);
2538
+ }
2539
+ deferred4_0 = ptr3;
2540
+ deferred4_1 = len3;
2541
+ return getStringFromWasm0(ptr3, len3);
2542
+ } finally {
2543
+ wasm.__wbindgen_add_to_stack_pointer(16);
2544
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2545
+ }
2546
+ }
2547
+ /**
2548
+ * DEPRECATED: Only used by send keys
2549
+ * @param {Uint8Array} plain
2550
+ * @param {Uint8Array} key
2551
+ * @returns {string}
2552
+ */
2553
+ static symmetric_encrypt_bytes(plain, key) {
2554
+ let deferred4_0;
2555
+ let deferred4_1;
2556
+ try {
2557
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2558
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
2559
+ const len0 = WASM_VECTOR_LEN;
2560
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2561
+ const len1 = WASM_VECTOR_LEN;
2562
+ wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
2563
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2564
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2565
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2566
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2567
+ var ptr3 = r0;
2568
+ var len3 = r1;
2569
+ if (r3) {
2570
+ ptr3 = 0;
2571
+ len3 = 0;
2572
+ throw takeObject(r2);
2573
+ }
2574
+ deferred4_0 = ptr3;
2575
+ deferred4_1 = len3;
2576
+ return getStringFromWasm0(ptr3, len3);
2577
+ } finally {
2578
+ wasm.__wbindgen_add_to_stack_pointer(16);
2579
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2580
+ }
2581
+ }
2582
+ /**
2583
+ * @param {Uint8Array} plain
2584
+ * @param {Uint8Array} key
2585
+ * @returns {Uint8Array}
2586
+ */
2587
+ static symmetric_encrypt_filedata(plain, key) {
2588
+ try {
2589
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2590
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
2591
+ const len0 = WASM_VECTOR_LEN;
2592
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2593
+ const len1 = WASM_VECTOR_LEN;
2594
+ wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
2595
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2596
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2597
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2598
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2599
+ if (r3) {
2600
+ throw takeObject(r2);
2601
+ }
2602
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2603
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2604
+ return v3;
2605
+ } finally {
2606
+ wasm.__wbindgen_add_to_stack_pointer(16);
2607
+ }
2608
+ }
2609
+ /**
2610
+ * @param {string} encrypted_user_key
2611
+ * @param {string} master_password
2612
+ * @param {string} email
2613
+ * @param {Kdf} kdf
2614
+ * @returns {Uint8Array}
2615
+ */
2616
+ static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
2617
+ try {
2618
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2619
+ const ptr0 = passStringToWasm0(
2620
+ encrypted_user_key,
2621
+ wasm.__wbindgen_malloc,
2622
+ wasm.__wbindgen_realloc,
2623
+ );
2624
+ const len0 = WASM_VECTOR_LEN;
2625
+ const ptr1 = passStringToWasm0(
2626
+ master_password,
2627
+ wasm.__wbindgen_malloc,
2628
+ wasm.__wbindgen_realloc,
2629
+ );
2630
+ const len1 = WASM_VECTOR_LEN;
2631
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2632
+ const len2 = WASM_VECTOR_LEN;
2633
+ wasm.purecrypto_decrypt_user_key_with_master_password(
2634
+ retptr,
2635
+ ptr0,
2636
+ len0,
2637
+ ptr1,
2638
+ len1,
2639
+ ptr2,
2640
+ len2,
2641
+ addHeapObject(kdf),
2642
+ );
2643
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2644
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2645
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2646
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2647
+ if (r3) {
2648
+ throw takeObject(r2);
2649
+ }
2650
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
2651
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2652
+ return v4;
2653
+ } finally {
2654
+ wasm.__wbindgen_add_to_stack_pointer(16);
2655
+ }
2656
+ }
2657
+ /**
2658
+ * @param {Uint8Array} user_key
2659
+ * @param {string} master_password
2660
+ * @param {string} email
2661
+ * @param {Kdf} kdf
2662
+ * @returns {string}
2663
+ */
2664
+ static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
2665
+ let deferred5_0;
2666
+ let deferred5_1;
2667
+ try {
2668
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2669
+ const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
2670
+ const len0 = WASM_VECTOR_LEN;
2671
+ const ptr1 = passStringToWasm0(
2672
+ master_password,
2673
+ wasm.__wbindgen_malloc,
2674
+ wasm.__wbindgen_realloc,
2675
+ );
2676
+ const len1 = WASM_VECTOR_LEN;
2677
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2678
+ const len2 = WASM_VECTOR_LEN;
2679
+ wasm.purecrypto_encrypt_user_key_with_master_password(
2680
+ retptr,
2681
+ ptr0,
2682
+ len0,
2683
+ ptr1,
2684
+ len1,
2685
+ ptr2,
2686
+ len2,
2687
+ addHeapObject(kdf),
2688
+ );
2689
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2690
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2691
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2692
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2693
+ var ptr4 = r0;
2694
+ var len4 = r1;
2695
+ if (r3) {
2696
+ ptr4 = 0;
2697
+ len4 = 0;
2698
+ throw takeObject(r2);
2699
+ }
2700
+ deferred5_0 = ptr4;
2701
+ deferred5_1 = len4;
2702
+ return getStringFromWasm0(ptr4, len4);
2703
+ } finally {
2704
+ wasm.__wbindgen_add_to_stack_pointer(16);
2705
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
2706
+ }
2707
+ }
2708
+ /**
2709
+ * @returns {Uint8Array}
2710
+ */
2711
+ static make_user_key_aes256_cbc_hmac() {
2712
+ try {
2713
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2714
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
2715
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2716
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2717
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2718
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2719
+ return v1;
2720
+ } finally {
2721
+ wasm.__wbindgen_add_to_stack_pointer(16);
2722
+ }
2723
+ }
2724
+ /**
2725
+ * @returns {Uint8Array}
2726
+ */
2727
+ static make_user_key_xchacha20_poly1305() {
2728
+ try {
2729
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2730
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
2731
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2732
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2733
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2734
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2735
+ return v1;
2736
+ } finally {
2737
+ wasm.__wbindgen_add_to_stack_pointer(16);
2738
+ }
2739
+ }
2740
+ /**
2741
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
2742
+ * as an EncString.
2743
+ * @param {Uint8Array} key_to_be_wrapped
2744
+ * @param {Uint8Array} wrapping_key
2745
+ * @returns {string}
2746
+ */
2747
+ static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
2748
+ let deferred4_0;
2749
+ let deferred4_1;
2750
+ try {
2751
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2752
+ const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
2753
+ const len0 = WASM_VECTOR_LEN;
2754
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
2755
+ const len1 = WASM_VECTOR_LEN;
2756
+ wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
2757
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2758
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2759
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2760
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2761
+ var ptr3 = r0;
2762
+ var len3 = r1;
2763
+ if (r3) {
2764
+ ptr3 = 0;
2765
+ len3 = 0;
2766
+ throw takeObject(r2);
2767
+ }
2768
+ deferred4_0 = ptr3;
2769
+ deferred4_1 = len3;
2770
+ return getStringFromWasm0(ptr3, len3);
2771
+ } finally {
2772
+ wasm.__wbindgen_add_to_stack_pointer(16);
2773
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2774
+ }
2775
+ }
2776
+ /**
2777
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
2778
+ * unwrapped key as a serialized byte array.
2779
+ * @param {string} wrapped_key
2780
+ * @param {Uint8Array} wrapping_key
2781
+ * @returns {Uint8Array}
2782
+ */
2783
+ static unwrap_symmetric_key(wrapped_key, wrapping_key) {
2784
+ try {
2785
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2786
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2787
+ const len0 = WASM_VECTOR_LEN;
2788
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
2789
+ const len1 = WASM_VECTOR_LEN;
2790
+ wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
2791
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2792
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2793
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2794
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2795
+ if (r3) {
2796
+ throw takeObject(r2);
2797
+ }
2798
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2799
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2800
+ return v3;
2801
+ } finally {
2802
+ wasm.__wbindgen_add_to_stack_pointer(16);
2803
+ }
2804
+ }
2805
+ /**
2806
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
2807
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
2808
+ * used. The specific use-case for this function is to enable rotateable key sets, where
2809
+ * the "public key" is not public, with the intent of preventing the server from being able
2810
+ * to overwrite the user key unlocked by the rotateable keyset.
2811
+ * @param {Uint8Array} encapsulation_key
2812
+ * @param {Uint8Array} wrapping_key
2813
+ * @returns {string}
2814
+ */
2815
+ static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
2816
+ let deferred4_0;
2817
+ let deferred4_1;
2818
+ try {
2819
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2820
+ const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
2821
+ const len0 = WASM_VECTOR_LEN;
2822
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
2823
+ const len1 = WASM_VECTOR_LEN;
2824
+ wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
2825
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2826
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2827
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2828
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2829
+ var ptr3 = r0;
2830
+ var len3 = r1;
2831
+ if (r3) {
2832
+ ptr3 = 0;
2833
+ len3 = 0;
2834
+ throw takeObject(r2);
2835
+ }
2836
+ deferred4_0 = ptr3;
2837
+ deferred4_1 = len3;
2838
+ return getStringFromWasm0(ptr3, len3);
2839
+ } finally {
2840
+ wasm.__wbindgen_add_to_stack_pointer(16);
2841
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2842
+ }
2843
+ }
2844
+ /**
2845
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
2846
+ * wrapping key.
2847
+ * @param {string} wrapped_key
2848
+ * @param {Uint8Array} wrapping_key
2849
+ * @returns {Uint8Array}
2850
+ */
2851
+ static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
2852
+ try {
2853
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2854
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2855
+ const len0 = WASM_VECTOR_LEN;
2856
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
2857
+ const len1 = WASM_VECTOR_LEN;
2858
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
2859
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2860
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2861
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2862
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2863
+ if (r3) {
2864
+ throw takeObject(r2);
2865
+ }
2866
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2867
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2868
+ return v3;
2869
+ } finally {
2870
+ wasm.__wbindgen_add_to_stack_pointer(16);
2871
+ }
2872
+ }
2873
+ /**
2874
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
2875
+ * key,
2876
+ * @param {Uint8Array} decapsulation_key
2877
+ * @param {Uint8Array} wrapping_key
2878
+ * @returns {string}
2879
+ */
2880
+ static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
2881
+ let deferred4_0;
2882
+ let deferred4_1;
2883
+ try {
2884
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2885
+ const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
2886
+ const len0 = WASM_VECTOR_LEN;
2887
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
2888
+ const len1 = WASM_VECTOR_LEN;
2889
+ wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
2890
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2891
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2892
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2893
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2894
+ var ptr3 = r0;
2895
+ var len3 = r1;
2896
+ if (r3) {
2897
+ ptr3 = 0;
2898
+ len3 = 0;
2899
+ throw takeObject(r2);
2900
+ }
2901
+ deferred4_0 = ptr3;
2902
+ deferred4_1 = len3;
2903
+ return getStringFromWasm0(ptr3, len3);
2904
+ } finally {
2905
+ wasm.__wbindgen_add_to_stack_pointer(16);
2906
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2907
+ }
369
2908
  }
370
2909
  /**
371
- * @param {ClientSettings | undefined} [settings]
372
- * @param {LogLevel | undefined} [log_level]
2910
+ * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
2911
+ * wrapping key.
2912
+ * @param {string} wrapped_key
2913
+ * @param {Uint8Array} wrapping_key
2914
+ * @returns {Uint8Array}
373
2915
  */
374
- constructor(settings, log_level) {
375
- const ret = wasm.bitwardenclient_new(
376
- isLikeNone(settings) ? 0 : addHeapObject(settings),
377
- isLikeNone(log_level) ? 5 : log_level,
378
- );
379
- this.__wbg_ptr = ret >>> 0;
380
- BitwardenClientFinalization.register(this, this.__wbg_ptr, this);
381
- return this;
2916
+ static unwrap_decapsulation_key(wrapped_key, wrapping_key) {
2917
+ try {
2918
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2919
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2920
+ const len0 = WASM_VECTOR_LEN;
2921
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
2922
+ const len1 = WASM_VECTOR_LEN;
2923
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
2924
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2925
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2926
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2927
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2928
+ if (r3) {
2929
+ throw takeObject(r2);
2930
+ }
2931
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2932
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2933
+ return v3;
2934
+ } finally {
2935
+ wasm.__wbindgen_add_to_stack_pointer(16);
2936
+ }
382
2937
  }
383
2938
  /**
384
- * Test method, echoes back the input
385
- * @param {string} msg
2939
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
2940
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
2941
+ * the sender's authenticity cannot be verified by the recipient.
2942
+ * @param {Uint8Array} shared_key
2943
+ * @param {Uint8Array} encapsulation_key
386
2944
  * @returns {string}
387
2945
  */
388
- echo(msg) {
389
- let deferred2_0;
390
- let deferred2_1;
2946
+ static encapsulate_key_unsigned(shared_key, encapsulation_key) {
2947
+ let deferred4_0;
2948
+ let deferred4_1;
391
2949
  try {
392
2950
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2951
+ const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
394
2952
  const len0 = WASM_VECTOR_LEN;
395
- wasm.bitwardenclient_echo(retptr, this.__wbg_ptr, ptr0, len0);
2953
+ const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
2954
+ const len1 = WASM_VECTOR_LEN;
2955
+ wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
396
2956
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
397
2957
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
398
- deferred2_0 = r0;
399
- deferred2_1 = r1;
400
- return getStringFromWasm0(r0, r1);
2958
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2959
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2960
+ var ptr3 = r0;
2961
+ var len3 = r1;
2962
+ if (r3) {
2963
+ ptr3 = 0;
2964
+ len3 = 0;
2965
+ throw takeObject(r2);
2966
+ }
2967
+ deferred4_0 = ptr3;
2968
+ deferred4_1 = len3;
2969
+ return getStringFromWasm0(ptr3, len3);
401
2970
  } finally {
402
2971
  wasm.__wbindgen_add_to_stack_pointer(16);
403
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2972
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
404
2973
  }
405
2974
  }
406
2975
  /**
407
- * @returns {string}
2976
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
2977
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
2978
+ * recipient.
2979
+ * @param {string} encapsulated_key
2980
+ * @param {Uint8Array} decapsulation_key
2981
+ * @returns {Uint8Array}
408
2982
  */
409
- version() {
410
- let deferred1_0;
411
- let deferred1_1;
2983
+ static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
412
2984
  try {
413
2985
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
414
- wasm.bitwardenclient_version(retptr, this.__wbg_ptr);
2986
+ const ptr0 = passStringToWasm0(
2987
+ encapsulated_key,
2988
+ wasm.__wbindgen_malloc,
2989
+ wasm.__wbindgen_realloc,
2990
+ );
2991
+ const len0 = WASM_VECTOR_LEN;
2992
+ const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
2993
+ const len1 = WASM_VECTOR_LEN;
2994
+ wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
415
2995
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
416
2996
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
417
- deferred1_0 = r0;
418
- deferred1_1 = r1;
419
- return getStringFromWasm0(r0, r1);
2997
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2998
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2999
+ if (r3) {
3000
+ throw takeObject(r2);
3001
+ }
3002
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3003
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3004
+ return v3;
420
3005
  } finally {
421
3006
  wasm.__wbindgen_add_to_stack_pointer(16);
422
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
423
3007
  }
424
3008
  }
425
3009
  /**
426
- * @param {string} msg
427
- * @returns {Promise<void>}
3010
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3011
+ * the corresponding verifying key.
3012
+ * @param {string} signing_key
3013
+ * @param {Uint8Array} wrapping_key
3014
+ * @returns {Uint8Array}
428
3015
  */
429
- throw(msg) {
430
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
431
- const len0 = WASM_VECTOR_LEN;
432
- const ret = wasm.bitwardenclient_throw(this.__wbg_ptr, ptr0, len0);
433
- return takeObject(ret);
3016
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
3017
+ try {
3018
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3019
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3020
+ const len0 = WASM_VECTOR_LEN;
3021
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3022
+ const len1 = WASM_VECTOR_LEN;
3023
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3024
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3025
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3026
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3027
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3028
+ if (r3) {
3029
+ throw takeObject(r2);
3030
+ }
3031
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3032
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3033
+ return v3;
3034
+ } finally {
3035
+ wasm.__wbindgen_add_to_stack_pointer(16);
3036
+ }
434
3037
  }
435
3038
  /**
436
- * Test method, calls http endpoint
437
- * @param {string} url
438
- * @returns {Promise<string>}
3039
+ * Returns the algorithm used for the given verifying key.
3040
+ * @param {Uint8Array} verifying_key
3041
+ * @returns {SignatureAlgorithm}
439
3042
  */
440
- http_get(url) {
441
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
442
- const len0 = WASM_VECTOR_LEN;
443
- const ret = wasm.bitwardenclient_http_get(this.__wbg_ptr, ptr0, len0);
444
- return takeObject(ret);
3043
+ static key_algorithm_for_verifying_key(verifying_key) {
3044
+ try {
3045
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3046
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3047
+ const len0 = WASM_VECTOR_LEN;
3048
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3049
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3050
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3051
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3052
+ if (r2) {
3053
+ throw takeObject(r1);
3054
+ }
3055
+ return takeObject(r0);
3056
+ } finally {
3057
+ wasm.__wbindgen_add_to_stack_pointer(16);
3058
+ }
445
3059
  }
446
3060
  /**
447
- * @returns {ClientCrypto}
3061
+ * For a given signing identity (verifying key), this function verifies that the signing
3062
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
3063
+ * that the signing identity has the intent to receive messages encrypted to the public
3064
+ * key.
3065
+ * @param {Uint8Array} signed_public_key
3066
+ * @param {Uint8Array} verifying_key
3067
+ * @returns {Uint8Array}
448
3068
  */
449
- crypto() {
450
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
451
- return ClientCrypto.__wrap(ret);
3069
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
3070
+ try {
3071
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3072
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
3073
+ const len0 = WASM_VECTOR_LEN;
3074
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3075
+ const len1 = WASM_VECTOR_LEN;
3076
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
3077
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3078
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3079
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3080
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3081
+ if (r3) {
3082
+ throw takeObject(r2);
3083
+ }
3084
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3085
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3086
+ return v3;
3087
+ } finally {
3088
+ wasm.__wbindgen_add_to_stack_pointer(16);
3089
+ }
452
3090
  }
453
3091
  /**
454
- * @returns {ClientVault}
3092
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3093
+ * @param {Uint8Array} password
3094
+ * @param {Uint8Array} salt
3095
+ * @param {Kdf} kdf
3096
+ * @returns {Uint8Array}
455
3097
  */
456
- vault() {
457
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
458
- return ClientVault.__wrap(ret);
3098
+ static derive_kdf_material(password, salt, kdf) {
3099
+ try {
3100
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3101
+ const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3102
+ const len0 = WASM_VECTOR_LEN;
3103
+ const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3104
+ const len1 = WASM_VECTOR_LEN;
3105
+ wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3106
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3107
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3108
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3109
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3110
+ if (r3) {
3111
+ throw takeObject(r2);
3112
+ }
3113
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3114
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3115
+ return v3;
3116
+ } finally {
3117
+ wasm.__wbindgen_add_to_stack_pointer(16);
3118
+ }
459
3119
  }
460
3120
  }
461
3121
 
462
- const ClientCryptoFinalization =
3122
+ const StateClientFinalization =
463
3123
  typeof FinalizationRegistry === "undefined"
464
3124
  ? { register: () => {}, unregister: () => {} }
465
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientcrypto_free(ptr >>> 0, 1));
3125
+ : new FinalizationRegistry((ptr) => wasm.__wbg_stateclient_free(ptr >>> 0, 1));
466
3126
 
467
- export class ClientCrypto {
3127
+ export class StateClient {
468
3128
  static __wrap(ptr) {
469
3129
  ptr = ptr >>> 0;
470
- const obj = Object.create(ClientCrypto.prototype);
3130
+ const obj = Object.create(StateClient.prototype);
471
3131
  obj.__wbg_ptr = ptr;
472
- ClientCryptoFinalization.register(obj, obj.__wbg_ptr, obj);
3132
+ StateClientFinalization.register(obj, obj.__wbg_ptr, obj);
473
3133
  return obj;
474
3134
  }
475
3135
 
476
3136
  __destroy_into_raw() {
477
3137
  const ptr = this.__wbg_ptr;
478
3138
  this.__wbg_ptr = 0;
479
- ClientCryptoFinalization.unregister(this);
3139
+ StateClientFinalization.unregister(this);
480
3140
  return ptr;
481
3141
  }
482
3142
 
483
3143
  free() {
484
3144
  const ptr = this.__destroy_into_raw();
485
- wasm.__wbg_clientcrypto_free(ptr, 0);
3145
+ wasm.__wbg_stateclient_free(ptr, 0);
486
3146
  }
487
3147
  /**
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>}
492
- */
493
- initialize_user_crypto(req) {
494
- const ret = wasm.clientcrypto_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
495
- return takeObject(ret);
496
- }
497
- /**
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
501
- * @returns {Promise<void>}
3148
+ * @param {Repository<Cipher>} store
502
3149
  */
503
- initialize_org_crypto(req) {
504
- const ret = wasm.clientcrypto_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
505
- return takeObject(ret);
3150
+ register_cipher_repository(store) {
3151
+ wasm.stateclient_register_cipher_repository(this.__wbg_ptr, addHeapObject(store));
506
3152
  }
507
3153
  }
508
3154
 
509
- const ClientFoldersFinalization =
3155
+ const TotpClientFinalization =
510
3156
  typeof FinalizationRegistry === "undefined"
511
3157
  ? { register: () => {}, unregister: () => {} }
512
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientfolders_free(ptr >>> 0, 1));
3158
+ : new FinalizationRegistry((ptr) => wasm.__wbg_totpclient_free(ptr >>> 0, 1));
513
3159
 
514
- export class ClientFolders {
3160
+ export class TotpClient {
515
3161
  static __wrap(ptr) {
516
3162
  ptr = ptr >>> 0;
517
- const obj = Object.create(ClientFolders.prototype);
3163
+ const obj = Object.create(TotpClient.prototype);
518
3164
  obj.__wbg_ptr = ptr;
519
- ClientFoldersFinalization.register(obj, obj.__wbg_ptr, obj);
3165
+ TotpClientFinalization.register(obj, obj.__wbg_ptr, obj);
520
3166
  return obj;
521
3167
  }
522
3168
 
523
3169
  __destroy_into_raw() {
524
3170
  const ptr = this.__wbg_ptr;
525
3171
  this.__wbg_ptr = 0;
526
- ClientFoldersFinalization.unregister(this);
3172
+ TotpClientFinalization.unregister(this);
527
3173
  return ptr;
528
3174
  }
529
3175
 
530
3176
  free() {
531
3177
  const ptr = this.__destroy_into_raw();
532
- wasm.__wbg_clientfolders_free(ptr, 0);
3178
+ wasm.__wbg_totpclient_free(ptr, 0);
533
3179
  }
534
3180
  /**
535
- * Decrypt folder
536
- * @param {Folder} folder
537
- * @returns {FolderView}
3181
+ * Generates a TOTP code from a provided key
3182
+ *
3183
+ * # Arguments
3184
+ * - `key` - Can be:
3185
+ * - A base32 encoded string
3186
+ * - OTP Auth URI
3187
+ * - Steam URI
3188
+ * - `time_ms` - Optional timestamp in milliseconds
3189
+ * @param {string} key
3190
+ * @param {number | null} [time_ms]
3191
+ * @returns {TotpResponse}
538
3192
  */
539
- decrypt(folder) {
3193
+ generate_totp(key, time_ms) {
540
3194
  try {
541
3195
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
542
- wasm.clientfolders_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
3196
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3197
+ const len0 = WASM_VECTOR_LEN;
3198
+ wasm.totpclient_generate_totp(
3199
+ retptr,
3200
+ this.__wbg_ptr,
3201
+ ptr0,
3202
+ len0,
3203
+ !isLikeNone(time_ms),
3204
+ isLikeNone(time_ms) ? 0 : time_ms,
3205
+ );
543
3206
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
544
3207
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
545
3208
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -553,240 +3216,294 @@ export class ClientFolders {
553
3216
  }
554
3217
  }
555
3218
 
556
- const ClientVaultFinalization =
3219
+ const VaultClientFinalization =
557
3220
  typeof FinalizationRegistry === "undefined"
558
3221
  ? { register: () => {}, unregister: () => {} }
559
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientvault_free(ptr >>> 0, 1));
3222
+ : new FinalizationRegistry((ptr) => wasm.__wbg_vaultclient_free(ptr >>> 0, 1));
560
3223
 
561
- export class ClientVault {
3224
+ export class VaultClient {
562
3225
  static __wrap(ptr) {
563
3226
  ptr = ptr >>> 0;
564
- const obj = Object.create(ClientVault.prototype);
3227
+ const obj = Object.create(VaultClient.prototype);
565
3228
  obj.__wbg_ptr = ptr;
566
- ClientVaultFinalization.register(obj, obj.__wbg_ptr, obj);
3229
+ VaultClientFinalization.register(obj, obj.__wbg_ptr, obj);
567
3230
  return obj;
568
3231
  }
569
3232
 
570
3233
  __destroy_into_raw() {
571
3234
  const ptr = this.__wbg_ptr;
572
3235
  this.__wbg_ptr = 0;
573
- ClientVaultFinalization.unregister(this);
3236
+ VaultClientFinalization.unregister(this);
574
3237
  return ptr;
575
3238
  }
576
3239
 
577
3240
  free() {
578
3241
  const ptr = this.__destroy_into_raw();
579
- wasm.__wbg_clientvault_free(ptr, 0);
3242
+ wasm.__wbg_vaultclient_free(ptr, 0);
3243
+ }
3244
+ /**
3245
+ * Attachment related operations.
3246
+ * @returns {AttachmentsClient}
3247
+ */
3248
+ attachments() {
3249
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3250
+ return AttachmentsClient.__wrap(ret);
3251
+ }
3252
+ /**
3253
+ * Cipher related operations.
3254
+ * @returns {CiphersClient}
3255
+ */
3256
+ ciphers() {
3257
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3258
+ return CiphersClient.__wrap(ret);
580
3259
  }
581
3260
  /**
582
- * @returns {ClientFolders}
3261
+ * Folder related operations.
3262
+ * @returns {FoldersClient}
583
3263
  */
584
3264
  folders() {
585
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
586
- return ClientFolders.__wrap(ret);
3265
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3266
+ return FoldersClient.__wrap(ret);
3267
+ }
3268
+ /**
3269
+ * TOTP related operations.
3270
+ * @returns {TotpClient}
3271
+ */
3272
+ totp() {
3273
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3274
+ return TotpClient.__wrap(ret);
587
3275
  }
588
3276
  }
589
3277
 
590
- export function __wbindgen_string_new(arg0, arg1) {
591
- const ret = getStringFromWasm0(arg0, arg1);
592
- return addHeapObject(ret);
3278
+ export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
3279
+ const ret = String(getObject(arg1));
3280
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3281
+ const len1 = WASM_VECTOR_LEN;
3282
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3283
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
593
3284
  }
594
3285
 
595
- export function __wbg_get_ef828680c64da212() {
596
- return handleError(function (arg0, arg1) {
597
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
598
- return addHeapObject(ret);
3286
+ export function __wbg_abort_410ec47a64ac6117(arg0, arg1) {
3287
+ getObject(arg0).abort(getObject(arg1));
3288
+ }
3289
+
3290
+ export function __wbg_abort_775ef1d17fc65868(arg0) {
3291
+ getObject(arg0).abort();
3292
+ }
3293
+
3294
+ export function __wbg_addEventListener_dc3da056b615f634(arg0, arg1, arg2, arg3) {
3295
+ getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
3296
+ }
3297
+
3298
+ export function __wbg_append_299d5d48292c0495() {
3299
+ return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3300
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
599
3301
  }, arguments);
600
3302
  }
601
3303
 
602
- export function __wbindgen_object_drop_ref(arg0) {
603
- takeObject(arg0);
3304
+ export function __wbg_append_8c7dd8d641a5f01b() {
3305
+ return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3306
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
3307
+ }, arguments);
604
3308
  }
605
3309
 
606
- export function __wbindgen_string_get(arg0, arg1) {
607
- const obj = getObject(arg1);
608
- const ret = typeof obj === "string" ? obj : undefined;
609
- var ptr1 = isLikeNone(ret)
610
- ? 0
611
- : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
612
- var len1 = WASM_VECTOR_LEN;
613
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
614
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3310
+ export function __wbg_append_b2d1fc16de2a0e81() {
3311
+ return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
3312
+ getObject(arg0).append(
3313
+ getStringFromWasm0(arg1, arg2),
3314
+ getObject(arg3),
3315
+ getStringFromWasm0(arg4, arg5),
3316
+ );
3317
+ }, arguments);
615
3318
  }
616
3319
 
617
- export function __wbg_new_fe19e4f3db5c3999(arg0, arg1) {
618
- let deferred0_0;
619
- let deferred0_1;
620
- try {
621
- deferred0_0 = arg0;
622
- deferred0_1 = arg1;
623
- const ret = new Error(getStringFromWasm0(arg0, arg1));
624
- return addHeapObject(ret);
625
- } finally {
626
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
627
- }
3320
+ export function __wbg_append_b44785ebeb668479() {
3321
+ return handleError(function (arg0, arg1, arg2, arg3) {
3322
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getObject(arg3));
3323
+ }, arguments);
628
3324
  }
629
3325
 
630
- export function __wbg_setname_46d623c31ae39910(arg0, arg1, arg2) {
631
- let deferred0_0;
632
- let deferred0_1;
633
- try {
634
- deferred0_0 = arg1;
635
- deferred0_1 = arg2;
636
- getObject(arg0).name = getStringFromWasm0(arg1, arg2);
637
- } finally {
638
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
639
- }
3326
+ export function __wbg_buffer_609cc3eee51ed158(arg0) {
3327
+ const ret = getObject(arg0).buffer;
3328
+ return addHeapObject(ret);
640
3329
  }
641
3330
 
642
- export function __wbg_setvariant_262a12673324f71b(arg0, arg1, arg2) {
643
- let deferred0_0;
644
- let deferred0_1;
645
- try {
646
- deferred0_0 = arg1;
647
- deferred0_1 = arg2;
648
- getObject(arg0).variant = getStringFromWasm0(arg1, arg2);
649
- } finally {
650
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
651
- }
3331
+ export function __wbg_call_672a4d21634d4a24() {
3332
+ return handleError(function (arg0, arg1) {
3333
+ const ret = getObject(arg0).call(getObject(arg1));
3334
+ return addHeapObject(ret);
3335
+ }, arguments);
652
3336
  }
653
3337
 
654
- export function __wbindgen_jsval_loose_eq(arg0, arg1) {
655
- const ret = getObject(arg0) == getObject(arg1);
656
- return ret;
3338
+ export function __wbg_call_7cccdd69e0791ae2() {
3339
+ return handleError(function (arg0, arg1, arg2) {
3340
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
3341
+ return addHeapObject(ret);
3342
+ }, arguments);
657
3343
  }
658
3344
 
659
- export function __wbindgen_is_object(arg0) {
660
- const val = getObject(arg0);
661
- const ret = typeof val === "object" && val !== null;
662
- return ret;
3345
+ export function __wbg_clearTimeout_b1115618e821c3b2(arg0) {
3346
+ const ret = clearTimeout(takeObject(arg0));
3347
+ return addHeapObject(ret);
663
3348
  }
664
3349
 
665
- export function __wbg_getwithrefkey_edc2c8960f0f1191(arg0, arg1) {
666
- const ret = getObject(arg0)[getObject(arg1)];
3350
+ export function __wbg_crypto_574e78ad8b13b65f(arg0) {
3351
+ const ret = getObject(arg0).crypto;
667
3352
  return addHeapObject(ret);
668
3353
  }
669
3354
 
670
- export function __wbindgen_is_undefined(arg0) {
671
- const ret = getObject(arg0) === undefined;
672
- return ret;
3355
+ export function __wbg_debug_e17b51583ca6a632(arg0, arg1, arg2, arg3) {
3356
+ console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
673
3357
  }
674
3358
 
675
- export function __wbindgen_in(arg0, arg1) {
676
- const ret = getObject(arg0) in getObject(arg1);
3359
+ export function __wbg_done_769e5ede4b31c67b(arg0) {
3360
+ const ret = getObject(arg0).done;
677
3361
  return ret;
678
3362
  }
679
3363
 
680
- export function __wbg_isSafeInteger_b9dff570f01a9100(arg0) {
681
- const ret = Number.isSafeInteger(getObject(arg0));
682
- return ret;
3364
+ export function __wbg_entries_3265d4158b33e5dc(arg0) {
3365
+ const ret = Object.entries(getObject(arg0));
3366
+ return addHeapObject(ret);
683
3367
  }
684
3368
 
685
- export function __wbindgen_as_number(arg0) {
686
- const ret = +getObject(arg0);
687
- return ret;
3369
+ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
3370
+ let deferred0_0;
3371
+ let deferred0_1;
3372
+ try {
3373
+ deferred0_0 = arg0;
3374
+ deferred0_1 = arg1;
3375
+ console.error(getStringFromWasm0(arg0, arg1));
3376
+ } finally {
3377
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3378
+ }
688
3379
  }
689
3380
 
690
- export function __wbindgen_is_string(arg0) {
691
- const ret = typeof getObject(arg0) === "string";
692
- return ret;
3381
+ export function __wbg_error_80de38b3f7cc3c3c(arg0, arg1, arg2, arg3) {
3382
+ console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
693
3383
  }
694
3384
 
695
- export function __wbg_entries_c02034de337d3ee2(arg0) {
696
- const ret = Object.entries(getObject(arg0));
3385
+ export function __wbg_fetch_3afbdcc7ddbf16fe(arg0) {
3386
+ const ret = fetch(getObject(arg0));
697
3387
  return addHeapObject(ret);
698
3388
  }
699
3389
 
700
- export function __wbg_length_f217bbbf7e8e4df4(arg0) {
701
- const ret = getObject(arg0).length;
702
- return ret;
703
- }
704
-
705
- export function __wbg_get_5419cf6b954aa11d(arg0, arg1) {
706
- const ret = getObject(arg0)[arg1 >>> 0];
3390
+ export function __wbg_fetch_509096533071c657(arg0, arg1) {
3391
+ const ret = getObject(arg0).fetch(getObject(arg1));
707
3392
  return addHeapObject(ret);
708
3393
  }
709
3394
 
710
- export function __wbindgen_object_clone_ref(arg0) {
711
- const ret = getObject(arg0);
712
- return addHeapObject(ret);
3395
+ export function __wbg_getRandomValues_38097e921c2494c3() {
3396
+ return handleError(function (arg0, arg1) {
3397
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
3398
+ }, arguments);
713
3399
  }
714
3400
 
715
- export function __wbg_next_b06e115d1b01e10b() {
716
- return handleError(function (arg0) {
717
- const ret = getObject(arg0).next();
718
- return addHeapObject(ret);
3401
+ export function __wbg_getRandomValues_b8f5dbd5f3995a9e() {
3402
+ return handleError(function (arg0, arg1) {
3403
+ getObject(arg0).getRandomValues(getObject(arg1));
719
3404
  }, arguments);
720
3405
  }
721
3406
 
722
- export function __wbg_done_983b5ffcaec8c583(arg0) {
723
- const ret = getObject(arg0).done;
3407
+ export function __wbg_getTime_46267b1c24877e30(arg0) {
3408
+ const ret = getObject(arg0).getTime();
724
3409
  return ret;
725
3410
  }
726
3411
 
727
- export function __wbg_value_2ab8a198c834c26a(arg0) {
728
- const ret = getObject(arg0).value;
3412
+ export function __wbg_get_67b2ba62fc30de12() {
3413
+ return handleError(function (arg0, arg1) {
3414
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
3415
+ return addHeapObject(ret);
3416
+ }, arguments);
3417
+ }
3418
+
3419
+ export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
3420
+ const ret = getObject(arg0)[arg1 >>> 0];
729
3421
  return addHeapObject(ret);
730
3422
  }
731
3423
 
732
- export function __wbg_call_3bfa248576352471() {
3424
+ export function __wbg_get_fe8b1fc2a9351d29() {
733
3425
  return handleError(function (arg0, arg1, arg2) {
734
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
735
- return addHeapObject(ret);
3426
+ let deferred0_0;
3427
+ let deferred0_1;
3428
+ try {
3429
+ deferred0_0 = arg1;
3430
+ deferred0_1 = arg2;
3431
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
3432
+ return addHeapObject(ret);
3433
+ } finally {
3434
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3435
+ }
736
3436
  }, arguments);
737
3437
  }
738
3438
 
739
- export function __wbg_new_e69b5f66fda8f13c() {
740
- const ret = new Object();
3439
+ export function __wbg_getaccesstoken_add1fa985a1fcf9b(arg0) {
3440
+ const ret = getObject(arg0).get_access_token();
741
3441
  return addHeapObject(ret);
742
3442
  }
743
3443
 
744
- export function __wbg_setmethod_ce2da76000b02f6a(arg0, arg1, arg2) {
745
- getObject(arg0).method = getStringFromWasm0(arg1, arg2);
3444
+ export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {
3445
+ const ret = getObject(arg0)[getObject(arg1)];
3446
+ return addHeapObject(ret);
746
3447
  }
747
3448
 
748
- export function __wbg_new_a9ae04a5200606a5() {
749
- return handleError(function () {
750
- const ret = new Headers();
751
- return addHeapObject(ret);
3449
+ export function __wbg_has_a5ea9117f258a0ec() {
3450
+ return handleError(function (arg0, arg1) {
3451
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
3452
+ return ret;
752
3453
  }, arguments);
753
3454
  }
754
3455
 
755
- export function __wbg_setheaders_f5205d36e423a544(arg0, arg1) {
756
- getObject(arg0).headers = getObject(arg1);
757
- }
758
-
759
- export function __wbg_setmode_4919fd636102c586(arg0, arg1) {
760
- getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
3456
+ export function __wbg_headers_9cb51cfd2ac780a4(arg0) {
3457
+ const ret = getObject(arg0).headers;
3458
+ return addHeapObject(ret);
761
3459
  }
762
3460
 
763
- export function __wbg_setcredentials_a4e661320cdb9738(arg0, arg1) {
764
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
3461
+ export function __wbg_incomingmessage_new(arg0) {
3462
+ const ret = IncomingMessage.__wrap(arg0);
3463
+ return addHeapObject(ret);
765
3464
  }
766
3465
 
767
- export function __wbg_setbody_aa8b691bec428bf4(arg0, arg1) {
768
- getObject(arg0).body = getObject(arg1);
3466
+ export function __wbg_info_033d8b8a0838f1d3(arg0, arg1, arg2, arg3) {
3467
+ console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
769
3468
  }
770
3469
 
771
- export function __wbg_signal_9acfcec9e7dffc22(arg0) {
772
- const ret = getObject(arg0).signal;
773
- return addHeapObject(ret);
3470
+ export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
3471
+ let result;
3472
+ try {
3473
+ result = getObject(arg0) instanceof ArrayBuffer;
3474
+ } catch (_) {
3475
+ result = false;
3476
+ }
3477
+ const ret = result;
3478
+ return ret;
774
3479
  }
775
3480
 
776
- export function __wbg_setsignal_812ccb8269a7fd90(arg0, arg1) {
777
- getObject(arg0).signal = getObject(arg1);
3481
+ export function __wbg_instanceof_Map_f3469ce2244d2430(arg0) {
3482
+ let result;
3483
+ try {
3484
+ result = getObject(arg0) instanceof Map;
3485
+ } catch (_) {
3486
+ result = false;
3487
+ }
3488
+ const ret = result;
3489
+ return ret;
778
3490
  }
779
3491
 
780
- export function __wbg_append_8b3e7f74a47ea7d5() {
781
- return handleError(function (arg0, arg1, arg2, arg3, arg4) {
782
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
783
- }, arguments);
3492
+ export function __wbg_instanceof_Response_f2cc20d9f7dfd644(arg0) {
3493
+ let result;
3494
+ try {
3495
+ result = getObject(arg0) instanceof Response;
3496
+ } catch (_) {
3497
+ result = false;
3498
+ }
3499
+ const ret = result;
3500
+ return ret;
784
3501
  }
785
3502
 
786
- export function __wbg_instanceof_Response_3c0e210a57ff751d(arg0) {
3503
+ export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
787
3504
  let result;
788
3505
  try {
789
- result = getObject(arg0) instanceof Response;
3506
+ result = getObject(arg0) instanceof Uint8Array;
790
3507
  } catch (_) {
791
3508
  result = false;
792
3509
  }
@@ -794,65 +3511,72 @@ export function __wbg_instanceof_Response_3c0e210a57ff751d(arg0) {
794
3511
  return ret;
795
3512
  }
796
3513
 
797
- export function __wbg_status_5f4e900d22140a18(arg0) {
798
- const ret = getObject(arg0).status;
3514
+ export function __wbg_ipcclientsubscription_new(arg0) {
3515
+ const ret = IpcClientSubscription.__wrap(arg0);
3516
+ return addHeapObject(ret);
3517
+ }
3518
+
3519
+ export function __wbg_isArray_a1eab7e0d067391b(arg0) {
3520
+ const ret = Array.isArray(getObject(arg0));
799
3521
  return ret;
800
3522
  }
801
3523
 
802
- export function __wbg_url_58af972663531d16(arg0, arg1) {
803
- const ret = getObject(arg1).url;
804
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
805
- const len1 = WASM_VECTOR_LEN;
806
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
807
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3524
+ export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) {
3525
+ const ret = Number.isSafeInteger(getObject(arg0));
3526
+ return ret;
808
3527
  }
809
3528
 
810
- export function __wbg_headers_1b9bf90c73fae600(arg0) {
811
- const ret = getObject(arg0).headers;
3529
+ export function __wbg_iterator_9a24c88df860dc65() {
3530
+ const ret = Symbol.iterator;
812
3531
  return addHeapObject(ret);
813
3532
  }
814
3533
 
815
- export function __wbg_stringify_eead5648c09faaf8() {
816
- return handleError(function (arg0) {
817
- const ret = JSON.stringify(getObject(arg0));
818
- return addHeapObject(ret);
819
- }, arguments);
3534
+ export function __wbg_length_a446193dc22c12f8(arg0) {
3535
+ const ret = getObject(arg0).length;
3536
+ return ret;
820
3537
  }
821
3538
 
822
- export function __wbg_abort_c57daab47a6c1215(arg0) {
823
- getObject(arg0).abort();
3539
+ export function __wbg_length_e2d2a49132c1b256(arg0) {
3540
+ const ret = getObject(arg0).length;
3541
+ return ret;
824
3542
  }
825
3543
 
826
- export function __wbg_text_ebeee8b31af4c919() {
3544
+ export function __wbg_list_e78f0f65f8a26cd6() {
827
3545
  return handleError(function (arg0) {
828
- const ret = getObject(arg0).text();
3546
+ const ret = getObject(arg0).list();
829
3547
  return addHeapObject(ret);
830
3548
  }, arguments);
831
3549
  }
832
3550
 
833
- export function __wbindgen_cb_drop(arg0) {
834
- const obj = takeObject(arg0).original;
835
- if (obj.cnt-- == 1) {
836
- obj.a = 0;
837
- return true;
838
- }
839
- const ret = false;
840
- return ret;
3551
+ export function __wbg_log_cad59bb680daec67(arg0, arg1, arg2, arg3) {
3552
+ console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
841
3553
  }
842
3554
 
843
- export function __wbindgen_error_new(arg0, arg1) {
844
- const ret = new Error(getStringFromWasm0(arg0, arg1));
3555
+ export function __wbg_msCrypto_a61aeb35a24c1329(arg0) {
3556
+ const ret = getObject(arg0).msCrypto;
3557
+ return addHeapObject(ret);
3558
+ }
3559
+
3560
+ export function __wbg_new0_f788a2397c7ca929() {
3561
+ const ret = new Date();
845
3562
  return addHeapObject(ret);
846
3563
  }
847
3564
 
848
- export function __wbg_new_1073970097e5a420(arg0, arg1) {
3565
+ export function __wbg_new_018dcc2d6c8c2f6a() {
3566
+ return handleError(function () {
3567
+ const ret = new Headers();
3568
+ return addHeapObject(ret);
3569
+ }, arguments);
3570
+ }
3571
+
3572
+ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
849
3573
  try {
850
3574
  var state0 = { a: arg0, b: arg1 };
851
3575
  var cb0 = (arg0, arg1) => {
852
3576
  const a = state0.a;
853
3577
  state0.a = 0;
854
3578
  try {
855
- return __wbg_adapter_125(a, state0.b, arg0, arg1);
3579
+ return __wbg_adapter_280(a, state0.b, arg0, arg1);
856
3580
  } finally {
857
3581
  state0.a = a;
858
3582
  }
@@ -864,359 +3588,492 @@ export function __wbg_new_1073970097e5a420(arg0, arg1) {
864
3588
  }
865
3589
  }
866
3590
 
867
- export function __wbg_set_f975102236d3c502(arg0, arg1, arg2) {
868
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
3591
+ export function __wbg_new_405e22f390576ce2() {
3592
+ const ret = new Object();
3593
+ return addHeapObject(ret);
3594
+ }
3595
+
3596
+ export function __wbg_new_78feb108b6472713() {
3597
+ const ret = new Array();
3598
+ return addHeapObject(ret);
869
3599
  }
870
3600
 
871
- export function __wbg_new_abda76e883ba8a5f() {
3601
+ export function __wbg_new_8a6f238a6ece86ea() {
872
3602
  const ret = new Error();
873
3603
  return addHeapObject(ret);
874
3604
  }
875
3605
 
876
- export function __wbg_stack_658279fe44541cf6(arg0, arg1) {
877
- const ret = getObject(arg1).stack;
878
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
879
- const len1 = WASM_VECTOR_LEN;
880
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
881
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3606
+ export function __wbg_new_9fd39a253424609a() {
3607
+ return handleError(function () {
3608
+ const ret = new FormData();
3609
+ return addHeapObject(ret);
3610
+ }, arguments);
3611
+ }
3612
+
3613
+ export function __wbg_new_a12002a7f91c75be(arg0) {
3614
+ const ret = new Uint8Array(getObject(arg0));
3615
+ return addHeapObject(ret);
3616
+ }
3617
+
3618
+ export function __wbg_new_c68d7209be747379(arg0, arg1) {
3619
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
3620
+ return addHeapObject(ret);
3621
+ }
3622
+
3623
+ export function __wbg_new_e25e5aab09ff45db() {
3624
+ return handleError(function () {
3625
+ const ret = new AbortController();
3626
+ return addHeapObject(ret);
3627
+ }, arguments);
882
3628
  }
883
3629
 
884
- export function __wbg_error_f851667af71bcfc6(arg0, arg1) {
3630
+ export function __wbg_new_f24b6d53abe5bc82(arg0, arg1) {
885
3631
  let deferred0_0;
886
3632
  let deferred0_1;
887
3633
  try {
888
3634
  deferred0_0 = arg0;
889
3635
  deferred0_1 = arg1;
890
- console.error(getStringFromWasm0(arg0, arg1));
3636
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
3637
+ return addHeapObject(ret);
891
3638
  } finally {
892
3639
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
893
3640
  }
894
3641
  }
895
3642
 
896
- export function __wbg_crypto_1d1f22824a6a080c(arg0) {
897
- const ret = getObject(arg0).crypto;
3643
+ export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
3644
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
898
3645
  return addHeapObject(ret);
899
3646
  }
900
3647
 
901
- export function __wbg_process_4a72847cc503995b(arg0) {
902
- const ret = getObject(arg0).process;
3648
+ export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) {
3649
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
903
3650
  return addHeapObject(ret);
904
3651
  }
905
3652
 
906
- export function __wbg_versions_f686565e586dd935(arg0) {
907
- const ret = getObject(arg0).versions;
3653
+ export function __wbg_newwithlength_a381634e90c276d4(arg0) {
3654
+ const ret = new Uint8Array(arg0 >>> 0);
3655
+ return addHeapObject(ret);
3656
+ }
3657
+
3658
+ export function __wbg_newwithstrandinit_06c535e0a867c635() {
3659
+ return handleError(function (arg0, arg1, arg2) {
3660
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
3661
+ return addHeapObject(ret);
3662
+ }, arguments);
3663
+ }
3664
+
3665
+ export function __wbg_newwithu8arraysequenceandoptions_068570c487f69127() {
3666
+ return handleError(function (arg0, arg1) {
3667
+ const ret = new Blob(getObject(arg0), getObject(arg1));
3668
+ return addHeapObject(ret);
3669
+ }, arguments);
3670
+ }
3671
+
3672
+ export function __wbg_next_25feadfc0913fea9(arg0) {
3673
+ const ret = getObject(arg0).next;
908
3674
  return addHeapObject(ret);
909
3675
  }
910
3676
 
911
- export function __wbg_node_104a2ff8d6ea03a2(arg0) {
3677
+ export function __wbg_next_6574e1a8a62d1055() {
3678
+ return handleError(function (arg0) {
3679
+ const ret = getObject(arg0).next();
3680
+ return addHeapObject(ret);
3681
+ }, arguments);
3682
+ }
3683
+
3684
+ export function __wbg_node_905d3e251edff8a2(arg0) {
912
3685
  const ret = getObject(arg0).node;
913
3686
  return addHeapObject(ret);
914
3687
  }
915
3688
 
916
- export function __wbg_require_cca90b1a94a0255b() {
3689
+ export function __wbg_parse_def2e24ef1252aff() {
3690
+ return handleError(function (arg0, arg1) {
3691
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
3692
+ return addHeapObject(ret);
3693
+ }, arguments);
3694
+ }
3695
+
3696
+ export function __wbg_process_dc0fbacc7c1c06f7(arg0) {
3697
+ const ret = getObject(arg0).process;
3698
+ return addHeapObject(ret);
3699
+ }
3700
+
3701
+ export function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
3702
+ const ret = getObject(arg0).push(getObject(arg1));
3703
+ return ret;
3704
+ }
3705
+
3706
+ export function __wbg_queueMicrotask_97d92b4fcc8a61c5(arg0) {
3707
+ queueMicrotask(getObject(arg0));
3708
+ }
3709
+
3710
+ export function __wbg_queueMicrotask_d3219def82552485(arg0) {
3711
+ const ret = getObject(arg0).queueMicrotask;
3712
+ return addHeapObject(ret);
3713
+ }
3714
+
3715
+ export function __wbg_randomFillSync_ac0988aba3254290() {
3716
+ return handleError(function (arg0, arg1) {
3717
+ getObject(arg0).randomFillSync(takeObject(arg1));
3718
+ }, arguments);
3719
+ }
3720
+
3721
+ export function __wbg_remove_ea8cb7fadc70e111() {
3722
+ return handleError(function (arg0, arg1, arg2) {
3723
+ let deferred0_0;
3724
+ let deferred0_1;
3725
+ try {
3726
+ deferred0_0 = arg1;
3727
+ deferred0_1 = arg2;
3728
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
3729
+ return addHeapObject(ret);
3730
+ } finally {
3731
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3732
+ }
3733
+ }, arguments);
3734
+ }
3735
+
3736
+ export function __wbg_require_60cc747a6bc5215a() {
917
3737
  return handleError(function () {
918
3738
  const ret = module.require;
919
3739
  return addHeapObject(ret);
920
3740
  }, arguments);
921
3741
  }
922
3742
 
923
- export function __wbindgen_is_function(arg0) {
924
- const ret = typeof getObject(arg0) === "function";
925
- return ret;
3743
+ export function __wbg_resolve_4851785c9c5f573d(arg0) {
3744
+ const ret = Promise.resolve(getObject(arg0));
3745
+ return addHeapObject(ret);
3746
+ }
3747
+
3748
+ export function __wbg_send_9b8fc6bb517867dd() {
3749
+ return handleError(function (arg0, arg1) {
3750
+ const ret = getObject(arg0).send(OutgoingMessage.__wrap(arg1));
3751
+ return addHeapObject(ret);
3752
+ }, arguments);
3753
+ }
3754
+
3755
+ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
3756
+ const ret = setTimeout(getObject(arg0), arg1);
3757
+ return addHeapObject(ret);
3758
+ }
3759
+
3760
+ export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
3761
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
3762
+ }
3763
+
3764
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
3765
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
3766
+ }
3767
+
3768
+ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
3769
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3770
+ }
3771
+
3772
+ export function __wbg_set_84a98f482fda77e5() {
3773
+ return handleError(function (arg0, arg1, arg2, arg3) {
3774
+ let deferred0_0;
3775
+ let deferred0_1;
3776
+ try {
3777
+ deferred0_0 = arg1;
3778
+ deferred0_1 = arg2;
3779
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
3780
+ return addHeapObject(ret);
3781
+ } finally {
3782
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3783
+ }
3784
+ }, arguments);
3785
+ }
3786
+
3787
+ export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
3788
+ getObject(arg0).body = getObject(arg1);
3789
+ }
3790
+
3791
+ export function __wbg_setcredentials_c3a22f1cd105a2c6(arg0, arg1) {
3792
+ getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
3793
+ }
3794
+
3795
+ export function __wbg_setheaders_834c0bdb6a8949ad(arg0, arg1) {
3796
+ getObject(arg0).headers = getObject(arg1);
926
3797
  }
927
3798
 
928
- export function __wbg_msCrypto_eb05e62b530a1508(arg0) {
929
- const ret = getObject(arg0).msCrypto;
930
- return addHeapObject(ret);
3799
+ export function __wbg_setmethod_3c5280fe5d890842(arg0, arg1, arg2) {
3800
+ getObject(arg0).method = getStringFromWasm0(arg1, arg2);
931
3801
  }
932
3802
 
933
- export function __wbg_newwithlength_76462a666eca145f(arg0) {
934
- const ret = new Uint8Array(arg0 >>> 0);
935
- return addHeapObject(ret);
3803
+ export function __wbg_setmode_5dc300b865044b65(arg0, arg1) {
3804
+ getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
936
3805
  }
937
3806
 
938
- export function __wbindgen_memory() {
939
- const ret = wasm.memory;
940
- return addHeapObject(ret);
3807
+ export function __wbg_setname_c0e2d6f348c746f4(arg0, arg1, arg2) {
3808
+ let deferred0_0;
3809
+ let deferred0_1;
3810
+ try {
3811
+ deferred0_0 = arg1;
3812
+ deferred0_1 = arg2;
3813
+ getObject(arg0).name = getStringFromWasm0(arg1, arg2);
3814
+ } finally {
3815
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3816
+ }
941
3817
  }
942
3818
 
943
- export function __wbg_buffer_ccaed51a635d8a2d(arg0) {
944
- const ret = getObject(arg0).buffer;
945
- return addHeapObject(ret);
3819
+ export function __wbg_setsignal_75b21ef3a81de905(arg0, arg1) {
3820
+ getObject(arg0).signal = getObject(arg1);
946
3821
  }
947
3822
 
948
- export function __wbg_newwithbyteoffsetandlength_7e3eb787208af730(arg0, arg1, arg2) {
949
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
950
- return addHeapObject(ret);
3823
+ export function __wbg_settype_39ed370d3edd403c(arg0, arg1, arg2) {
3824
+ getObject(arg0).type = getStringFromWasm0(arg1, arg2);
951
3825
  }
952
3826
 
953
- export function __wbg_randomFillSync_5c9c955aa56b6049() {
954
- return handleError(function (arg0, arg1) {
955
- getObject(arg0).randomFillSync(takeObject(arg1));
956
- }, arguments);
3827
+ export function __wbg_setvariant_d1d41b778dfe9c17(arg0, arg1, arg2) {
3828
+ let deferred0_0;
3829
+ let deferred0_1;
3830
+ try {
3831
+ deferred0_0 = arg1;
3832
+ deferred0_1 = arg2;
3833
+ getObject(arg0).variant = getStringFromWasm0(arg1, arg2);
3834
+ } finally {
3835
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3836
+ }
957
3837
  }
958
3838
 
959
- export function __wbg_subarray_975a06f9dbd16995(arg0, arg1, arg2) {
960
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
3839
+ export function __wbg_signal_aaf9ad74119f20a4(arg0) {
3840
+ const ret = getObject(arg0).signal;
961
3841
  return addHeapObject(ret);
962
3842
  }
963
3843
 
964
- export function __wbg_getRandomValues_3aa56aa6edec874c() {
965
- return handleError(function (arg0, arg1) {
966
- getObject(arg0).getRandomValues(getObject(arg1));
967
- }, arguments);
3844
+ export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
3845
+ const ret = getObject(arg1).stack;
3846
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3847
+ const len1 = WASM_VECTOR_LEN;
3848
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3849
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
968
3850
  }
969
3851
 
970
- export function __wbg_new_fec2611eb9180f95(arg0) {
971
- const ret = new Uint8Array(getObject(arg0));
972
- return addHeapObject(ret);
3852
+ export function __wbg_static_accessor_GLOBAL_88a902d13a557d07() {
3853
+ const ret = typeof global === "undefined" ? null : global;
3854
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
973
3855
  }
974
3856
 
975
- export function __wbg_set_ec2fcf81bc573fd9(arg0, arg1, arg2) {
976
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3857
+ export function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() {
3858
+ const ret = typeof globalThis === "undefined" ? null : globalThis;
3859
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
977
3860
  }
978
3861
 
979
- export function __wbg_self_bf91bf94d9e04084() {
980
- return handleError(function () {
981
- const ret = self.self;
982
- return addHeapObject(ret);
983
- }, arguments);
3862
+ export function __wbg_static_accessor_SELF_37c5d418e4bf5819() {
3863
+ const ret = typeof self === "undefined" ? null : self;
3864
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
984
3865
  }
985
3866
 
986
- export function __wbg_window_52dd9f07d03fd5f8() {
987
- return handleError(function () {
988
- const ret = window.window;
989
- return addHeapObject(ret);
990
- }, arguments);
3867
+ export function __wbg_static_accessor_WINDOW_5de37043a91a9c40() {
3868
+ const ret = typeof window === "undefined" ? null : window;
3869
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
991
3870
  }
992
3871
 
993
- export function __wbg_globalThis_05c129bf37fcf1be() {
994
- return handleError(function () {
995
- const ret = globalThis.globalThis;
996
- return addHeapObject(ret);
997
- }, arguments);
3872
+ export function __wbg_status_f6360336ca686bf0(arg0) {
3873
+ const ret = getObject(arg0).status;
3874
+ return ret;
998
3875
  }
999
3876
 
1000
- export function __wbg_global_3eca19bb09e9c484() {
1001
- return handleError(function () {
1002
- const ret = global.global;
3877
+ export function __wbg_stringify_f7ed6987935b4a24() {
3878
+ return handleError(function (arg0) {
3879
+ const ret = JSON.stringify(getObject(arg0));
1003
3880
  return addHeapObject(ret);
1004
3881
  }, arguments);
1005
3882
  }
1006
3883
 
1007
- export function __wbg_newnoargs_1ede4bf2ebbaaf43(arg0, arg1) {
1008
- const ret = new Function(getStringFromWasm0(arg0, arg1));
3884
+ export function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) {
3885
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1009
3886
  return addHeapObject(ret);
1010
3887
  }
1011
3888
 
1012
- export function __wbg_call_a9ef466721e824f2() {
1013
- return handleError(function (arg0, arg1) {
1014
- const ret = getObject(arg0).call(getObject(arg1));
3889
+ export function __wbg_text_7805bea50de2af49() {
3890
+ return handleError(function (arg0) {
3891
+ const ret = getObject(arg0).text();
1015
3892
  return addHeapObject(ret);
1016
3893
  }, arguments);
1017
3894
  }
1018
3895
 
1019
- export function __wbg_iterator_695d699a44d6234c() {
1020
- const ret = Symbol.iterator;
3896
+ export function __wbg_then_44b73946d2fb3e7d(arg0, arg1) {
3897
+ const ret = getObject(arg0).then(getObject(arg1));
1021
3898
  return addHeapObject(ret);
1022
3899
  }
1023
3900
 
1024
- export function __wbg_next_13b477da1eaa3897(arg0) {
1025
- const ret = getObject(arg0).next;
3901
+ export function __wbg_then_48b406749878a531(arg0, arg1, arg2) {
3902
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1026
3903
  return addHeapObject(ret);
1027
3904
  }
1028
3905
 
1029
- export function __wbg_new_034f913e7636e987() {
1030
- const ret = new Array();
1031
- return addHeapObject(ret);
3906
+ export function __wbg_url_ae10c34ca209681d(arg0, arg1) {
3907
+ const ret = getObject(arg1).url;
3908
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3909
+ const len1 = WASM_VECTOR_LEN;
3910
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3911
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1032
3912
  }
1033
3913
 
1034
- export function __wbg_push_36cf4d81d7da33d1(arg0, arg1) {
1035
- const ret = getObject(arg0).push(getObject(arg1));
1036
- return ret;
3914
+ export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
3915
+ const ret = getObject(arg0).value;
3916
+ return addHeapObject(ret);
1037
3917
  }
1038
3918
 
1039
- export function __wbg_instanceof_ArrayBuffer_74945570b4a62ec7(arg0) {
1040
- let result;
1041
- try {
1042
- result = getObject(arg0) instanceof ArrayBuffer;
1043
- } catch (_) {
1044
- result = false;
1045
- }
1046
- const ret = result;
1047
- return ret;
3919
+ export function __wbg_versions_c01dfd4722a88165(arg0) {
3920
+ const ret = getObject(arg0).versions;
3921
+ return addHeapObject(ret);
1048
3922
  }
1049
3923
 
1050
- export function __wbg_new_70a2f23d1565c04c(arg0, arg1) {
1051
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1052
- return addHeapObject(ret);
3924
+ export function __wbg_warn_aaf1f4664a035bd6(arg0, arg1, arg2, arg3) {
3925
+ console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1053
3926
  }
1054
3927
 
1055
- export function __wbg_has_bd717f25f195f23d() {
1056
- return handleError(function (arg0, arg1) {
1057
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
1058
- return ret;
1059
- }, arguments);
3928
+ export function __wbindgen_as_number(arg0) {
3929
+ const ret = +getObject(arg0);
3930
+ return ret;
1060
3931
  }
1061
3932
 
1062
- export function __wbg_resolve_0aad7c1484731c99(arg0) {
1063
- const ret = Promise.resolve(getObject(arg0));
3933
+ export function __wbindgen_bigint_from_i64(arg0) {
3934
+ const ret = arg0;
1064
3935
  return addHeapObject(ret);
1065
3936
  }
1066
3937
 
1067
- export function __wbg_then_748f75edfb032440(arg0, arg1) {
1068
- const ret = getObject(arg0).then(getObject(arg1));
3938
+ export function __wbindgen_bigint_from_u64(arg0) {
3939
+ const ret = BigInt.asUintN(64, arg0);
1069
3940
  return addHeapObject(ret);
1070
3941
  }
1071
3942
 
1072
- export function __wbg_then_4866a7d9f55d8f3e(arg0, arg1, arg2) {
1073
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1074
- return addHeapObject(ret);
3943
+ export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
3944
+ const v = getObject(arg1);
3945
+ const ret = typeof v === "bigint" ? v : undefined;
3946
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
3947
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1075
3948
  }
1076
3949
 
1077
- export function __wbg_length_9254c4bd3b9f23c4(arg0) {
1078
- const ret = getObject(arg0).length;
3950
+ export function __wbindgen_boolean_get(arg0) {
3951
+ const v = getObject(arg0);
3952
+ const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2;
1079
3953
  return ret;
1080
3954
  }
1081
3955
 
1082
- export function __wbg_instanceof_Uint8Array_df0761410414ef36(arg0) {
1083
- let result;
1084
- try {
1085
- result = getObject(arg0) instanceof Uint8Array;
1086
- } catch (_) {
1087
- result = false;
3956
+ export function __wbindgen_cb_drop(arg0) {
3957
+ const obj = takeObject(arg0).original;
3958
+ if (obj.cnt-- == 1) {
3959
+ obj.a = 0;
3960
+ return true;
1088
3961
  }
1089
- const ret = result;
3962
+ const ret = false;
1090
3963
  return ret;
1091
3964
  }
1092
3965
 
1093
- export function __wbg_new_4e7308fbedde3997() {
1094
- return handleError(function () {
1095
- const ret = new FormData();
1096
- return addHeapObject(ret);
1097
- }, arguments);
1098
- }
1099
-
1100
- export function __wbg_append_43a4b1c9d5df4168() {
1101
- return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1102
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1103
- }, arguments);
1104
- }
1105
-
1106
- export function __wbg_settype_623d2ee701e6310a(arg0, arg1, arg2) {
1107
- getObject(arg0).type = getStringFromWasm0(arg1, arg2);
3966
+ export function __wbindgen_closure_wrapper2913(arg0, arg1, arg2) {
3967
+ const ret = makeMutClosure(arg0, arg1, 920, __wbg_adapter_50);
3968
+ return addHeapObject(ret);
1108
3969
  }
1109
3970
 
1110
- export function __wbg_newwithu8arraysequenceandoptions_d41c0fdf78490206() {
1111
- return handleError(function (arg0, arg1) {
1112
- const ret = new Blob(getObject(arg0), getObject(arg1));
1113
- return addHeapObject(ret);
1114
- }, arguments);
3971
+ export function __wbindgen_closure_wrapper3753(arg0, arg1, arg2) {
3972
+ const ret = makeMutClosure(arg0, arg1, 1004, __wbg_adapter_53);
3973
+ return addHeapObject(ret);
1115
3974
  }
1116
3975
 
1117
- export function __wbg_append_7ee78799a92a9731() {
1118
- return handleError(function (arg0, arg1, arg2, arg3) {
1119
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getObject(arg3));
1120
- }, arguments);
3976
+ export function __wbindgen_closure_wrapper4171(arg0, arg1, arg2) {
3977
+ const ret = makeMutClosure(arg0, arg1, 1127, __wbg_adapter_56);
3978
+ return addHeapObject(ret);
1121
3979
  }
1122
3980
 
1123
- export function __wbg_append_8135c71037096394() {
1124
- return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
1125
- getObject(arg0).append(
1126
- getStringFromWasm0(arg1, arg2),
1127
- getObject(arg3),
1128
- getStringFromWasm0(arg4, arg5),
1129
- );
1130
- }, arguments);
3981
+ export function __wbindgen_debug_string(arg0, arg1) {
3982
+ const ret = debugString(getObject(arg1));
3983
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3984
+ const len1 = WASM_VECTOR_LEN;
3985
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3986
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1131
3987
  }
1132
3988
 
1133
- export function __wbg_fetch_f8d735ba6fe1b719(arg0) {
1134
- const ret = fetch(getObject(arg0));
3989
+ export function __wbindgen_error_new(arg0, arg1) {
3990
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1135
3991
  return addHeapObject(ret);
1136
3992
  }
1137
3993
 
1138
- export function __wbg_fetch_1fdc4448ed9eec00(arg0, arg1) {
1139
- const ret = getObject(arg0).fetch(getObject(arg1));
1140
- return addHeapObject(ret);
3994
+ export function __wbindgen_in(arg0, arg1) {
3995
+ const ret = getObject(arg0) in getObject(arg1);
3996
+ return ret;
1141
3997
  }
1142
3998
 
1143
- export function __wbg_new_75169ae5a9683c55() {
1144
- return handleError(function () {
1145
- const ret = new AbortController();
1146
- return addHeapObject(ret);
1147
- }, arguments);
3999
+ export function __wbindgen_is_bigint(arg0) {
4000
+ const ret = typeof getObject(arg0) === "bigint";
4001
+ return ret;
1148
4002
  }
1149
4003
 
1150
- export function __wbindgen_boolean_get(arg0) {
1151
- const v = getObject(arg0);
1152
- const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2;
4004
+ export function __wbindgen_is_function(arg0) {
4005
+ const ret = typeof getObject(arg0) === "function";
1153
4006
  return ret;
1154
4007
  }
1155
4008
 
1156
- export function __wbindgen_number_get(arg0, arg1) {
1157
- const obj = getObject(arg1);
1158
- const ret = typeof obj === "number" ? obj : undefined;
1159
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1160
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
4009
+ export function __wbindgen_is_object(arg0) {
4010
+ const val = getObject(arg0);
4011
+ const ret = typeof val === "object" && val !== null;
4012
+ return ret;
1161
4013
  }
1162
4014
 
1163
- export function __wbg_String_b9412f8799faab3e(arg0, arg1) {
1164
- const ret = String(getObject(arg1));
1165
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1166
- const len1 = WASM_VECTOR_LEN;
1167
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1168
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4015
+ export function __wbindgen_is_string(arg0) {
4016
+ const ret = typeof getObject(arg0) === "string";
4017
+ return ret;
1169
4018
  }
1170
4019
 
1171
- export function __wbindgen_debug_string(arg0, arg1) {
1172
- const ret = debugString(getObject(arg1));
1173
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1174
- const len1 = WASM_VECTOR_LEN;
1175
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1176
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4020
+ export function __wbindgen_is_undefined(arg0) {
4021
+ const ret = getObject(arg0) === undefined;
4022
+ return ret;
1177
4023
  }
1178
4024
 
1179
- export function __wbindgen_throw(arg0, arg1) {
1180
- throw new Error(getStringFromWasm0(arg0, arg1));
4025
+ export function __wbindgen_jsval_eq(arg0, arg1) {
4026
+ const ret = getObject(arg0) === getObject(arg1);
4027
+ return ret;
1181
4028
  }
1182
4029
 
1183
- export function __wbg_queueMicrotask_848aa4969108a57e(arg0) {
1184
- const ret = getObject(arg0).queueMicrotask;
1185
- return addHeapObject(ret);
4030
+ export function __wbindgen_jsval_loose_eq(arg0, arg1) {
4031
+ const ret = getObject(arg0) == getObject(arg1);
4032
+ return ret;
1186
4033
  }
1187
4034
 
1188
- export function __wbg_queueMicrotask_c5419c06eab41e73(arg0) {
1189
- queueMicrotask(getObject(arg0));
4035
+ export function __wbindgen_memory() {
4036
+ const ret = wasm.memory;
4037
+ return addHeapObject(ret);
1190
4038
  }
1191
4039
 
1192
- export function __wbg_newwithstrandinit_4b92c89af0a8e383() {
1193
- return handleError(function (arg0, arg1, arg2) {
1194
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
1195
- return addHeapObject(ret);
1196
- }, arguments);
4040
+ export function __wbindgen_number_get(arg0, arg1) {
4041
+ const obj = getObject(arg1);
4042
+ const ret = typeof obj === "number" ? obj : undefined;
4043
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
4044
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1197
4045
  }
1198
4046
 
1199
- export function __wbg_debug_a0b6c2c5ac9a4bfd(arg0, arg1, arg2, arg3) {
1200
- console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4047
+ export function __wbindgen_number_new(arg0) {
4048
+ const ret = arg0;
4049
+ return addHeapObject(ret);
1201
4050
  }
1202
4051
 
1203
- export function __wbg_error_4d17c5bb1ca90c94(arg0, arg1, arg2, arg3) {
1204
- console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4052
+ export function __wbindgen_object_clone_ref(arg0) {
4053
+ const ret = getObject(arg0);
4054
+ return addHeapObject(ret);
1205
4055
  }
1206
4056
 
1207
- export function __wbg_info_1c7fba7da21072d1(arg0, arg1, arg2, arg3) {
1208
- console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4057
+ export function __wbindgen_object_drop_ref(arg0) {
4058
+ takeObject(arg0);
1209
4059
  }
1210
4060
 
1211
- export function __wbg_log_4de37a0274d94769(arg0, arg1, arg2, arg3) {
1212
- console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4061
+ export function __wbindgen_string_get(arg0, arg1) {
4062
+ const obj = getObject(arg1);
4063
+ const ret = typeof obj === "string" ? obj : undefined;
4064
+ var ptr1 = isLikeNone(ret)
4065
+ ? 0
4066
+ : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4067
+ var len1 = WASM_VECTOR_LEN;
4068
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4069
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1213
4070
  }
1214
4071
 
1215
- export function __wbg_warn_2e2787d40aad9a81(arg0, arg1, arg2, arg3) {
1216
- console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4072
+ export function __wbindgen_string_new(arg0, arg1) {
4073
+ const ret = getStringFromWasm0(arg0, arg1);
4074
+ return addHeapObject(ret);
1217
4075
  }
1218
4076
 
1219
- export function __wbindgen_closure_wrapper1820(arg0, arg1, arg2) {
1220
- const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_38);
1221
- return addHeapObject(ret);
4077
+ export function __wbindgen_throw(arg0, arg1) {
4078
+ throw new Error(getStringFromWasm0(arg0, arg1));
1222
4079
  }