@bitwarden/sdk-internal 0.2.0-main.20 → 0.2.0-main.200

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