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

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