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

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