@bitwarden/sdk-internal 0.2.0-main.17 → 0.2.0-main.170

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