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