@bitwarden/sdk-internal 0.2.0-main.22 → 0.2.0-main.221

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