@bitwarden/sdk-internal 0.2.0-main.132 → 0.2.0-main.134

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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 66e623193b87953d021d911a8a900c79c469469f
1
+ 5cb4eb03ed7ccc0c4ecc0875f78f718c8a2175e5
@@ -227,6 +227,35 @@ export interface CryptoError extends Error {
227
227
 
228
228
  export function isCryptoError(error: any): error is CryptoError;
229
229
 
230
+ export type Endpoint =
231
+ | { Web: { id: number } }
232
+ | "BrowserForeground"
233
+ | "BrowserBackground"
234
+ | "DesktopRenderer"
235
+ | "DesktopMain";
236
+
237
+ export interface OutgoingMessage {
238
+ data: number[];
239
+ destination: Endpoint;
240
+ }
241
+
242
+ export interface IncomingMessage {
243
+ data: number[];
244
+ destination: Endpoint;
245
+ source: Endpoint;
246
+ }
247
+
248
+ export interface CommunicationBackend {
249
+ send(message: OutgoingMessage): Promise<void>;
250
+ receive(): Promise<IncomingMessage>;
251
+ }
252
+
253
+ export interface DeserializeError extends Error {
254
+ name: "DeserializeError";
255
+ }
256
+
257
+ export function isDeserializeError(error: any): error is DeserializeError;
258
+
230
259
  export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
231
260
 
232
261
  export interface SshKeyExportError extends Error {
@@ -415,6 +444,12 @@ export class CryptoClient {
415
444
  */
416
445
  verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
417
446
  }
447
+ export class IpcClient {
448
+ free(): void;
449
+ constructor(communication_provider: CommunicationBackend);
450
+ send(message: OutgoingMessage): Promise<void>;
451
+ receive(): Promise<IncomingMessage>;
452
+ }
418
453
  /**
419
454
  * This module represents a stopgap solution to provide access to primitive crypto functions for JS
420
455
  * clients. It is not intended to be used outside of the JS clients and this pattern should not be
@@ -430,6 +465,18 @@ export class PureCrypto {
430
465
  static symmetric_encrypt(plain: string, key: Uint8Array): string;
431
466
  static symmetric_encrypt_to_array_buffer(plain: Uint8Array, key: Uint8Array): Uint8Array;
432
467
  }
468
+ export class ReceiveError {
469
+ private constructor();
470
+ free(): void;
471
+ crypto_error: any;
472
+ communication_error: any;
473
+ }
474
+ export class SendError {
475
+ private constructor();
476
+ free(): void;
477
+ crypto_error: any;
478
+ communication_error: any;
479
+ }
433
480
  export class VaultClient {
434
481
  private constructor();
435
482
  free(): void;
@@ -272,6 +272,19 @@ export function isCryptoError(error) {
272
272
  }
273
273
  }
274
274
 
275
+ /**
276
+ * @param {any} error
277
+ * @returns {boolean}
278
+ */
279
+ export function isDeserializeError(error) {
280
+ try {
281
+ const ret = wasm.isDeserializeError(addBorrowedObject(error));
282
+ return ret !== 0;
283
+ } finally {
284
+ heap[stack_pointer++] = undefined;
285
+ }
286
+ }
287
+
275
288
  /**
276
289
  * @param {any} error
277
290
  * @returns {boolean}
@@ -490,7 +503,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
490
503
  );
491
504
  }
492
505
 
493
- function __wbg_adapter_150(arg0, arg1, arg2, arg3) {
506
+ function __wbg_adapter_174(arg0, arg1, arg2, arg3) {
494
507
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h33defb2ea0fdb769(
495
508
  arg0,
496
509
  arg1,
@@ -839,6 +852,49 @@ export class CryptoClient {
839
852
  }
840
853
  }
841
854
 
855
+ const IpcClientFinalization =
856
+ typeof FinalizationRegistry === "undefined"
857
+ ? { register: () => {}, unregister: () => {} }
858
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclient_free(ptr >>> 0, 1));
859
+
860
+ export class IpcClient {
861
+ __destroy_into_raw() {
862
+ const ptr = this.__wbg_ptr;
863
+ this.__wbg_ptr = 0;
864
+ IpcClientFinalization.unregister(this);
865
+ return ptr;
866
+ }
867
+
868
+ free() {
869
+ const ptr = this.__destroy_into_raw();
870
+ wasm.__wbg_ipcclient_free(ptr, 0);
871
+ }
872
+ /**
873
+ * @param {CommunicationBackend} communication_provider
874
+ */
875
+ constructor(communication_provider) {
876
+ const ret = wasm.ipcclient_new(addHeapObject(communication_provider));
877
+ this.__wbg_ptr = ret >>> 0;
878
+ IpcClientFinalization.register(this, this.__wbg_ptr, this);
879
+ return this;
880
+ }
881
+ /**
882
+ * @param {OutgoingMessage} message
883
+ * @returns {Promise<void>}
884
+ */
885
+ send(message) {
886
+ const ret = wasm.ipcclient_send(this.__wbg_ptr, addHeapObject(message));
887
+ return takeObject(ret);
888
+ }
889
+ /**
890
+ * @returns {Promise<IncomingMessage>}
891
+ */
892
+ receive() {
893
+ const ret = wasm.ipcclient_receive(this.__wbg_ptr);
894
+ return takeObject(ret);
895
+ }
896
+ }
897
+
842
898
  const PureCryptoFinalization =
843
899
  typeof FinalizationRegistry === "undefined"
844
900
  ? { register: () => {}, unregister: () => {} }
@@ -1012,6 +1068,112 @@ export class PureCrypto {
1012
1068
  }
1013
1069
  }
1014
1070
 
1071
+ const ReceiveErrorFinalization =
1072
+ typeof FinalizationRegistry === "undefined"
1073
+ ? { register: () => {}, unregister: () => {} }
1074
+ : new FinalizationRegistry((ptr) => wasm.__wbg_receiveerror_free(ptr >>> 0, 1));
1075
+
1076
+ export class ReceiveError {
1077
+ static __wrap(ptr) {
1078
+ ptr = ptr >>> 0;
1079
+ const obj = Object.create(ReceiveError.prototype);
1080
+ obj.__wbg_ptr = ptr;
1081
+ ReceiveErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1082
+ return obj;
1083
+ }
1084
+
1085
+ __destroy_into_raw() {
1086
+ const ptr = this.__wbg_ptr;
1087
+ this.__wbg_ptr = 0;
1088
+ ReceiveErrorFinalization.unregister(this);
1089
+ return ptr;
1090
+ }
1091
+
1092
+ free() {
1093
+ const ptr = this.__destroy_into_raw();
1094
+ wasm.__wbg_receiveerror_free(ptr, 0);
1095
+ }
1096
+ /**
1097
+ * @returns {any}
1098
+ */
1099
+ get crypto_error() {
1100
+ const ret = wasm.__wbg_get_receiveerror_crypto_error(this.__wbg_ptr);
1101
+ return takeObject(ret);
1102
+ }
1103
+ /**
1104
+ * @param {any} arg0
1105
+ */
1106
+ set crypto_error(arg0) {
1107
+ wasm.__wbg_set_receiveerror_crypto_error(this.__wbg_ptr, addHeapObject(arg0));
1108
+ }
1109
+ /**
1110
+ * @returns {any}
1111
+ */
1112
+ get communication_error() {
1113
+ const ret = wasm.__wbg_get_receiveerror_communication_error(this.__wbg_ptr);
1114
+ return takeObject(ret);
1115
+ }
1116
+ /**
1117
+ * @param {any} arg0
1118
+ */
1119
+ set communication_error(arg0) {
1120
+ wasm.__wbg_set_receiveerror_communication_error(this.__wbg_ptr, addHeapObject(arg0));
1121
+ }
1122
+ }
1123
+
1124
+ const SendErrorFinalization =
1125
+ typeof FinalizationRegistry === "undefined"
1126
+ ? { register: () => {}, unregister: () => {} }
1127
+ : new FinalizationRegistry((ptr) => wasm.__wbg_senderror_free(ptr >>> 0, 1));
1128
+
1129
+ export class SendError {
1130
+ static __wrap(ptr) {
1131
+ ptr = ptr >>> 0;
1132
+ const obj = Object.create(SendError.prototype);
1133
+ obj.__wbg_ptr = ptr;
1134
+ SendErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1135
+ return obj;
1136
+ }
1137
+
1138
+ __destroy_into_raw() {
1139
+ const ptr = this.__wbg_ptr;
1140
+ this.__wbg_ptr = 0;
1141
+ SendErrorFinalization.unregister(this);
1142
+ return ptr;
1143
+ }
1144
+
1145
+ free() {
1146
+ const ptr = this.__destroy_into_raw();
1147
+ wasm.__wbg_senderror_free(ptr, 0);
1148
+ }
1149
+ /**
1150
+ * @returns {any}
1151
+ */
1152
+ get crypto_error() {
1153
+ const ret = wasm.__wbg_get_receiveerror_crypto_error(this.__wbg_ptr);
1154
+ return takeObject(ret);
1155
+ }
1156
+ /**
1157
+ * @param {any} arg0
1158
+ */
1159
+ set crypto_error(arg0) {
1160
+ wasm.__wbg_set_receiveerror_crypto_error(this.__wbg_ptr, addHeapObject(arg0));
1161
+ }
1162
+ /**
1163
+ * @returns {any}
1164
+ */
1165
+ get communication_error() {
1166
+ const ret = wasm.__wbg_get_receiveerror_communication_error(this.__wbg_ptr);
1167
+ return takeObject(ret);
1168
+ }
1169
+ /**
1170
+ * @param {any} arg0
1171
+ */
1172
+ set communication_error(arg0) {
1173
+ wasm.__wbg_set_receiveerror_communication_error(this.__wbg_ptr, addHeapObject(arg0));
1174
+ }
1175
+ }
1176
+
1015
1177
  const VaultClientFinalization =
1016
1178
  typeof FinalizationRegistry === "undefined"
1017
1179
  ? { register: () => {}, unregister: () => {} }
@@ -1234,6 +1396,11 @@ export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
1234
1396
  return ret;
1235
1397
  }
1236
1398
 
1399
+ export function __wbg_isArray_a1eab7e0d067391b(arg0) {
1400
+ const ret = Array.isArray(getObject(arg0));
1401
+ return ret;
1402
+ }
1403
+
1237
1404
  export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) {
1238
1405
  const ret = Number.isSafeInteger(getObject(arg0));
1239
1406
  return ret;
@@ -1282,7 +1449,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1282
1449
  const a = state0.a;
1283
1450
  state0.a = 0;
1284
1451
  try {
1285
- return __wbg_adapter_150(a, state0.b, arg0, arg1);
1452
+ return __wbg_adapter_174(a, state0.b, arg0, arg1);
1286
1453
  } finally {
1287
1454
  state0.a = a;
1288
1455
  }
@@ -1417,6 +1584,18 @@ export function __wbg_randomFillSync_ab2cfe79ebbf2740() {
1417
1584
  }, arguments);
1418
1585
  }
1419
1586
 
1587
+ export function __wbg_receive_9512d555fb8b5130() {
1588
+ return handleError(function (arg0) {
1589
+ const ret = getObject(arg0).receive();
1590
+ return addHeapObject(ret);
1591
+ }, arguments);
1592
+ }
1593
+
1594
+ export function __wbg_receiveerror_new(arg0) {
1595
+ const ret = ReceiveError.__wrap(arg0);
1596
+ return addHeapObject(ret);
1597
+ }
1598
+
1420
1599
  export function __wbg_require_79b1e9274cde3c87() {
1421
1600
  return handleError(function () {
1422
1601
  const ret = module.require;
@@ -1429,6 +1608,22 @@ export function __wbg_resolve_4851785c9c5f573d(arg0) {
1429
1608
  return addHeapObject(ret);
1430
1609
  }
1431
1610
 
1611
+ export function __wbg_send_c9eacaae08065b18() {
1612
+ return handleError(function (arg0, arg1) {
1613
+ const ret = getObject(arg0).send(takeObject(arg1));
1614
+ return addHeapObject(ret);
1615
+ }, arguments);
1616
+ }
1617
+
1618
+ export function __wbg_senderror_new(arg0) {
1619
+ const ret = SendError.__wrap(arg0);
1620
+ return addHeapObject(ret);
1621
+ }
1622
+
1623
+ export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
1624
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1625
+ }
1626
+
1432
1627
  export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
1433
1628
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1434
1629
  }
@@ -1599,8 +1794,8 @@ export function __wbindgen_cb_drop(arg0) {
1599
1794
  return ret;
1600
1795
  }
1601
1796
 
1602
- export function __wbindgen_closure_wrapper2148(arg0, arg1, arg2) {
1603
- const ret = makeMutClosure(arg0, arg1, 548, __wbg_adapter_40);
1797
+ export function __wbindgen_closure_wrapper2219(arg0, arg1, arg2) {
1798
+ const ret = makeMutClosure(arg0, arg1, 574, __wbg_adapter_40);
1604
1799
  return addHeapObject(ret);
1605
1800
  }
1606
1801
 
Binary file
@@ -3,6 +3,21 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const isEncryptionSettingsError: (a: number) => number;
5
5
  export const isCryptoError: (a: number) => number;
6
+ export const __wbg_receiveerror_free: (a: number, b: number) => void;
7
+ export const __wbg_get_receiveerror_crypto_error: (a: number) => number;
8
+ export const __wbg_set_receiveerror_crypto_error: (a: number, b: number) => void;
9
+ export const __wbg_get_receiveerror_communication_error: (a: number) => number;
10
+ export const __wbg_set_receiveerror_communication_error: (a: number, b: number) => void;
11
+ export const __wbg_ipcclient_free: (a: number, b: number) => void;
12
+ export const ipcclient_new: (a: number) => number;
13
+ export const ipcclient_send: (a: number, b: number) => number;
14
+ export const ipcclient_receive: (a: number) => number;
15
+ export const isDeserializeError: (a: number) => number;
16
+ export const __wbg_set_senderror_crypto_error: (a: number, b: number) => void;
17
+ export const __wbg_set_senderror_communication_error: (a: number, b: number) => void;
18
+ export const __wbg_get_senderror_crypto_error: (a: number) => number;
19
+ export const __wbg_get_senderror_communication_error: (a: number) => number;
20
+ export const __wbg_senderror_free: (a: number, b: number) => void;
6
21
  export const isSshKeyExportError: (a: number) => number;
7
22
  export const isSshKeyImportError: (a: number) => number;
8
23
  export const isKeyGenerationError: (a: number) => number;