@wireapp/core-crypto 9.1.1 → 9.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "9.1.1",
3
+ "version": "9.2.0",
4
4
  "author": "Wire CoreCrypto team <team.corecrypto@wire.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,6 +51,7 @@ export const corecrypto_get_device_identities: (a: number, b: number, c: number,
51
51
  export const corecrypto_get_user_identities: (a: number, b: number, c: number, d: number) => any;
52
52
  export const corecrypto_e2ei_is_pki_env_setup: (a: number) => any;
53
53
  export const corecrypto_e2ei_is_enabled: (a: number, b: number) => any;
54
+ export const corecrypto_e2ei_conversation_state: (a: number, b: number) => any;
54
55
  export const __wbg_epochobserver_free: (a: number, b: number) => void;
55
56
  export const epochobserver_new: (a: any, b: any) => [number, number, number];
56
57
  export const corecrypto_register_epoch_observer: (a: number, b: number) => any;
@@ -246,11 +247,11 @@ export const __wbg_get_decryptedmessage_senderClientId: (a: number) => number;
246
247
  export const __wbg_get_decryptedmessage_identity: (a: number) => number;
247
248
  export const __wbg_get_decryptedmessage_commitDelay: (a: number) => [number, bigint];
248
249
  export const __wbg_get_decryptedmessage_message: (a: number) => [number, number];
250
+ export const welcome_new: (a: number, b: number) => number;
251
+ export const keypackage_new: (a: number, b: number) => number;
252
+ export const groupinfo_new: (a: number, b: number) => number;
249
253
  export const externalsenderkey_new: (a: number, b: number) => number;
250
254
  export const secretkey_new: (a: number, b: number) => number;
251
- export const groupinfo_new: (a: number, b: number) => number;
252
- export const keypackage_new: (a: number, b: number) => number;
253
- export const welcome_new: (a: number, b: number) => number;
254
255
  export const conversationid_new: (a: number, b: number) => number;
255
256
  export const __wbg_proteusautoprekeybundle_free: (a: number, b: number) => void;
256
257
  export const __wbg_welcome_free: (a: number, b: number) => void;
@@ -267,11 +268,11 @@ export const __wbindgen_exn_store: (a: number) => void;
267
268
  export const __externref_table_alloc: () => number;
268
269
  export const __wbindgen_export_4: WebAssembly.Table;
269
270
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
270
- export const __wbindgen_export_6: WebAssembly.Table;
271
271
  export const __externref_drop_slice: (a: number, b: number) => void;
272
+ export const __wbindgen_export_7: WebAssembly.Table;
272
273
  export const __externref_table_dealloc: (a: number) => void;
273
- export const closure2587_externref_shim: (a: number, b: number, c: any) => void;
274
- export const closure1021_externref_shim: (a: number, b: number, c: any) => void;
275
- export const closure2899_externref_shim: (a: number, b: number, c: any) => void;
276
- export const closure3000_externref_shim: (a: number, b: number, c: any, d: any) => void;
274
+ export const closure2600_externref_shim: (a: number, b: number, c: any) => void;
275
+ export const closure2909_externref_shim: (a: number, b: number, c: any) => void;
276
+ export const closure1026_externref_shim: (a: number, b: number, c: any) => void;
277
+ export const closure3010_externref_shim: (a: number, b: number, c: any, d: any) => void;
277
278
  export const __wbindgen_start: () => void;
package/src/corecrypto.js CHANGED
@@ -1,19 +1,3 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __toESM = (mod, isNodeMode, target) => {
7
- target = mod != null ? __create(__getProtoOf(mod)) : {};
8
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
- for (let key of __getOwnPropNames(mod))
10
- if (!__hasOwnProp.call(to, key))
11
- __defProp(to, key, {
12
- get: () => mod[key],
13
- enumerable: true
14
- });
15
- return to;
16
- };
17
1
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
18
2
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
19
3
  }) : x)(function(x) {
@@ -327,8 +311,18 @@ ${val.stack}`;
327
311
  }
328
312
  return className;
329
313
  }
314
+ function getArrayJsValueFromWasm0(ptr, len) {
315
+ ptr = ptr >>> 0;
316
+ const mem = getDataViewMemory0();
317
+ const result = [];
318
+ for (let i = ptr;i < ptr + 4 * len; i += 4) {
319
+ result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
320
+ }
321
+ wasm.__externref_drop_slice(ptr, len);
322
+ return result;
323
+ }
330
324
  var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((state) => {
331
- wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
325
+ wasm.__wbindgen_export_7.get(state.dtor)(state.a, state.b);
332
326
  });
333
327
  function makeMutClosure(arg0, arg1, dtor, f) {
334
328
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
@@ -340,7 +334,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
340
334
  return f(a, state.b, ...args);
341
335
  } finally {
342
336
  if (--state.cnt === 0) {
343
- wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
337
+ wasm.__wbindgen_export_7.get(state.dtor)(a, state.b);
344
338
  CLOSURE_DTORS.unregister(state);
345
339
  } else {
346
340
  state.a = a;
@@ -351,16 +345,6 @@ function makeMutClosure(arg0, arg1, dtor, f) {
351
345
  CLOSURE_DTORS.register(real, state, state);
352
346
  return real;
353
347
  }
354
- function getArrayJsValueFromWasm0(ptr, len) {
355
- ptr = ptr >>> 0;
356
- const mem = getDataViewMemory0();
357
- const result = [];
358
- for (let i = ptr;i < ptr + 4 * len; i += 4) {
359
- result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
360
- }
361
- wasm.__externref_drop_slice(ptr, len);
362
- return result;
363
- }
364
348
  function _assertClass(instance, klass) {
365
349
  if (!(instance instanceof klass)) {
366
350
  throw new Error(`expected instance of ${klass.name}`);
@@ -438,17 +422,17 @@ function build_metadata() {
438
422
  const ret = wasm.build_metadata();
439
423
  return BuildMetadata.__wrap(ret);
440
424
  }
441
- function __wbg_adapter_12(arg0, arg1, arg2) {
442
- wasm.closure2587_externref_shim(arg0, arg1, arg2);
425
+ function __wbg_adapter_8(arg0, arg1, arg2) {
426
+ wasm.closure2600_externref_shim(arg0, arg1, arg2);
443
427
  }
444
- function __wbg_adapter_27(arg0, arg1, arg2) {
445
- wasm.closure1021_externref_shim(arg0, arg1, arg2);
428
+ function __wbg_adapter_13(arg0, arg1, arg2) {
429
+ wasm.closure2909_externref_shim(arg0, arg1, arg2);
446
430
  }
447
- function __wbg_adapter_30(arg0, arg1, arg2) {
448
- wasm.closure2899_externref_shim(arg0, arg1, arg2);
431
+ function __wbg_adapter_18(arg0, arg1, arg2) {
432
+ wasm.closure1026_externref_shim(arg0, arg1, arg2);
449
433
  }
450
- function __wbg_adapter_510(arg0, arg1, arg2, arg3) {
451
- wasm.closure3000_externref_shim(arg0, arg1, arg2, arg3);
434
+ function __wbg_adapter_511(arg0, arg1, arg2, arg3) {
435
+ wasm.closure3010_externref_shim(arg0, arg1, arg2, arg3);
452
436
  }
453
437
  var Ciphersuite = Object.freeze({
454
438
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
@@ -1061,6 +1045,11 @@ class CoreCrypto {
1061
1045
  const ret = wasm.corecrypto_e2ei_is_enabled(this.__wbg_ptr, ciphersuite);
1062
1046
  return ret;
1063
1047
  }
1048
+ e2ei_conversation_state(conversation_id) {
1049
+ _assertClass(conversation_id, ConversationId);
1050
+ const ret = wasm.corecrypto_e2ei_conversation_state(this.__wbg_ptr, conversation_id.__wbg_ptr);
1051
+ return ret;
1052
+ }
1064
1053
  register_epoch_observer(epoch_observer) {
1065
1054
  _assertClass(epoch_observer, EpochObserver);
1066
1055
  var ptr0 = epoch_observer.__destroy_into_raw();
@@ -2909,7 +2898,7 @@ function __wbg_get_imports() {
2909
2898
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2910
2899
  }
2911
2900
  };
2912
- imports.wbg.__wbg_execute_e16031c0218b029a = function() {
2901
+ imports.wbg.__wbg_execute_09ff4bbba08ec862 = function() {
2913
2902
  return handleError(function(arg0, arg1) {
2914
2903
  const ret = arg0.execute(CoreCryptoContext.__wrap(arg1));
2915
2904
  return ret;
@@ -2945,7 +2934,7 @@ function __wbg_get_imports() {
2945
2934
  return ret;
2946
2935
  }, arguments);
2947
2936
  };
2948
- imports.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7 = function() {
2937
+ imports.wbg.__wbg_getRandomValues_9b655bdd369112f2 = function() {
2949
2938
  return handleError(function(arg0, arg1) {
2950
2939
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2951
2940
  }, arguments);
@@ -3162,7 +3151,7 @@ function __wbg_get_imports() {
3162
3151
  const a = state0.a;
3163
3152
  state0.a = 0;
3164
3153
  try {
3165
- return __wbg_adapter_510(a, state0.b, arg02, arg12);
3154
+ return __wbg_adapter_511(a, state0.b, arg02, arg12);
3166
3155
  } finally {
3167
3156
  state0.a = a;
3168
3157
  }
@@ -3541,10 +3530,6 @@ function __wbg_get_imports() {
3541
3530
  const ret = WireIdentity.__wrap(arg0);
3542
3531
  return ret;
3543
3532
  };
3544
- imports.wbg.__wbindgen_cast_1ead7d7e37c24a99 = function(arg0, arg1) {
3545
- const ret = makeMutClosure(arg0, arg1, 2898, __wbg_adapter_30);
3546
- return ret;
3547
- };
3548
3533
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
3549
3534
  const ret = getStringFromWasm0(arg0, arg1);
3550
3535
  return ret;
@@ -3555,6 +3540,10 @@ function __wbg_get_imports() {
3555
3540
  const ret = v0;
3556
3541
  return ret;
3557
3542
  };
3543
+ imports.wbg.__wbindgen_cast_2baa7f4ea256cb04 = function(arg0, arg1) {
3544
+ const ret = makeMutClosure(arg0, arg1, 2908, __wbg_adapter_13);
3545
+ return ret;
3546
+ };
3558
3547
  imports.wbg.__wbindgen_cast_2e1c22bbccdbf7b5 = function(arg0, arg1) {
3559
3548
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3560
3549
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -3571,8 +3560,8 @@ function __wbg_get_imports() {
3571
3560
  const ret = v0;
3572
3561
  return ret;
3573
3562
  };
3574
- imports.wbg.__wbindgen_cast_63e1f1d269ff3fa8 = function(arg0, arg1) {
3575
- const ret = makeMutClosure(arg0, arg1, 2586, __wbg_adapter_12);
3563
+ imports.wbg.__wbindgen_cast_77ac86d8075f2f98 = function(arg0, arg1) {
3564
+ const ret = makeMutClosure(arg0, arg1, 1025, __wbg_adapter_18);
3576
3565
  return ret;
3577
3566
  };
3578
3567
  imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
@@ -3581,10 +3570,6 @@ function __wbg_get_imports() {
3581
3570
  const ret = v0;
3582
3571
  return ret;
3583
3572
  };
3584
- imports.wbg.__wbindgen_cast_9b175b9f4d06c9c3 = function(arg0, arg1) {
3585
- const ret = makeMutClosure(arg0, arg1, 1020, __wbg_adapter_27);
3586
- return ret;
3587
- };
3588
3573
  imports.wbg.__wbindgen_cast_b77aa29fa8fe8560 = function(arg0, arg1) {
3589
3574
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3590
3575
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -3595,6 +3580,10 @@ function __wbg_get_imports() {
3595
3580
  const ret = getArrayU8FromWasm0(arg0, arg1);
3596
3581
  return ret;
3597
3582
  };
3583
+ imports.wbg.__wbindgen_cast_cbc163adba6f840a = function(arg0, arg1) {
3584
+ const ret = makeMutClosure(arg0, arg1, 2599, __wbg_adapter_8);
3585
+ return ret;
3586
+ };
3598
3587
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
3599
3588
  const ret = arg0;
3600
3589
  return ret;
@@ -3649,6 +3638,12 @@ function safeBigintToNumber(x) {
3649
3638
  }
3650
3639
  return new Number(x).valueOf();
3651
3640
  }
3641
+ function safeBigIntOrUndefinedToNumberOrUndefined(x) {
3642
+ if (x === undefined || x === null) {
3643
+ return;
3644
+ }
3645
+ return safeBigintToNumber(x);
3646
+ }
3652
3647
 
3653
3648
  // src/CoreCryptoMLS.ts
3654
3649
  function commitBundleFromFfi(commitBundle) {
@@ -3673,7 +3668,7 @@ function bufferedDecryptedMessageFromFfi(m) {
3673
3668
  return {
3674
3669
  message: m.message,
3675
3670
  isActive: m.isActive,
3676
- commitDelay: m.commitDelay ? safeBigintToNumber(m.commitDelay) : undefined,
3671
+ commitDelay: safeBigIntOrUndefinedToNumberOrUndefined(m.commitDelay),
3677
3672
  senderClientId: m.senderClientId,
3678
3673
  hasEpochChanged: m.hasEpochChanged,
3679
3674
  identity: m.identity,
@@ -3721,7 +3716,7 @@ function mlsTransportToFfi(mlsTransport) {
3721
3716
  function crlRegistrationFromFfi(r) {
3722
3717
  return {
3723
3718
  dirty: r.dirty,
3724
- expiration: r.expiration ? safeBigintToNumber(r.expiration) : undefined
3719
+ expiration: safeBigIntOrUndefinedToNumberOrUndefined(r.expiration)
3725
3720
  };
3726
3721
  }
3727
3722
  function normalizeEnum(enumType, value) {