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

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