@wireapp/core-crypto 0.9.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "0.9.2",
3
+ "version": "0.11.0",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -648,12 +648,13 @@ export declare class CoreCrypto {
648
648
  * You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
649
649
  *
650
650
  * @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
651
+ * @param creatorCredentialType - kind of credential the creator wants to create the group with
651
652
  * @param configuration - configuration of the MLS group
652
653
  * @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
653
654
  * @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
654
655
  * @param configuration.custom - {@link CustomConfiguration}
655
656
  */
656
- createConversation(conversationId: ConversationId, configuration?: ConversationConfiguration): Promise<any>;
657
+ createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType, configuration?: ConversationConfiguration): Promise<any>;
657
658
  /**
658
659
  * Decrypts a message for a given conversation
659
660
  *
@@ -1026,6 +1027,14 @@ export declare class CoreCrypto {
1026
1027
  * @returns the persisted enrollment instance
1027
1028
  */
1028
1029
  e2eiEnrollmentStashPop(handle: Uint8Array): Promise<WireE2eIdentity>;
1030
+ /**
1031
+ * Indicates when to mark a conversation as degraded i.e. when not all its members have a X509.
1032
+ * Credential generated by Wire's end-to-end identity enrollment
1033
+ *
1034
+ * @param conversationId The group's ID
1035
+ * @returns true if all the members have valid X509 credentials
1036
+ */
1037
+ e2eiIsDegraded(conversationId: ConversationId): Promise<boolean>;
1029
1038
  /**
1030
1039
  * Returns the current version of {@link CoreCrypto}
1031
1040
  *
@@ -230,12 +230,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
230
230
  return real;
231
231
  }
232
232
  function __wbg_adapter_52(arg0, arg1, arg2) {
233
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9c249377169e2f4c(arg0, arg1, addHeapObject(arg2));
233
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2c0be6d28c8e9135(arg0, arg1, addHeapObject(arg2));
234
234
  }
235
235
  function __wbg_adapter_55(arg0, arg1, arg2) {
236
236
  try {
237
237
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
238
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hee720ad0abaf79d4(retptr, arg0, arg1, addHeapObject(arg2));
238
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hce3b8b280b7641eb(retptr, arg0, arg1, addHeapObject(arg2));
239
239
  var r0 = getInt32Memory0()[retptr / 4 + 0];
240
240
  var r1 = getInt32Memory0()[retptr / 4 + 1];
241
241
  if (r1) {
@@ -299,8 +299,8 @@ function handleError(f, args) {
299
299
  wasm$1.__wbindgen_exn_store(addHeapObject(e));
300
300
  }
301
301
  }
302
- function __wbg_adapter_288(arg0, arg1, arg2, arg3) {
303
- wasm$1.wasm_bindgen__convert__closures__invoke2_mut__ha9bc5bb1a764a589(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
302
+ function __wbg_adapter_289(arg0, arg1, arg2, arg3) {
303
+ wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h120d2893b5400e83(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
304
304
  }
305
305
  /**
306
306
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -712,6 +712,19 @@ let CoreCrypto$1 = class CoreCrypto {
712
712
  return takeObject(ret);
713
713
  }
714
714
  /**
715
+ * Returns [`WasmCryptoResult<bool>`]
716
+ *
717
+ * see [core_crypto::mls::MlsCentral::e2ei_is_degraded]
718
+ * @param {Uint8Array} conversation_id
719
+ * @returns {Promise<any>}
720
+ */
721
+ e2ei_is_degraded(conversation_id) {
722
+ const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
723
+ const len0 = WASM_VECTOR_LEN;
724
+ const ret = wasm$1.corecrypto_e2ei_is_degraded(this.__wbg_ptr, ptr0, len0);
725
+ return takeObject(ret);
726
+ }
727
+ /**
715
728
  * Returns the current version of CoreCrypto
716
729
  * @returns {string}
717
730
  */
@@ -903,15 +916,16 @@ let CoreCrypto$1 = class CoreCrypto {
903
916
  *
904
917
  * see [core_crypto::mls::MlsCentral::new_conversation]
905
918
  * @param {Uint8Array} conversation_id
919
+ * @param {number} creator_credential_type
906
920
  * @param {ConversationConfiguration} config
907
921
  * @returns {Promise<any>}
908
922
  */
909
- create_conversation(conversation_id, config) {
923
+ create_conversation(conversation_id, creator_credential_type, config) {
910
924
  const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
911
925
  const len0 = WASM_VECTOR_LEN;
912
926
  _assertClass(config, ConversationConfiguration);
913
927
  var ptr1 = config.__destroy_into_raw();
914
- const ret = wasm$1.corecrypto_create_conversation(this.__wbg_ptr, ptr0, len0, ptr1);
928
+ const ret = wasm$1.corecrypto_create_conversation(this.__wbg_ptr, ptr0, len0, creator_credential_type, ptr1);
915
929
  return takeObject(ret);
916
930
  }
917
931
  /**
@@ -2604,14 +2618,14 @@ function __wbg_get_imports() {
2604
2618
  const ret = getObject(arg0);
2605
2619
  return addHeapObject(ret);
2606
2620
  };
2607
- imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2608
- takeObject(arg0);
2609
- };
2610
2621
  imports.wbg.__wbindgen_is_object = function (arg0) {
2611
2622
  const val = getObject(arg0);
2612
2623
  const ret = typeof (val) === 'object' && val !== null;
2613
2624
  return ret;
2614
2625
  };
2626
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2627
+ takeObject(arg0);
2628
+ };
2615
2629
  imports.wbg.__wbg_getwithrefkey_5e6d9547403deab8 = function (arg0, arg1) {
2616
2630
  const ret = getObject(arg0)[getObject(arg1)];
2617
2631
  return addHeapObject(ret);
@@ -2624,17 +2638,6 @@ function __wbg_get_imports() {
2624
2638
  const ret = getObject(arg0) in getObject(arg1);
2625
2639
  return ret;
2626
2640
  };
2627
- imports.wbg.__wbg_commit_008545ae6e591814 = function () {
2628
- return handleError(function (arg0) {
2629
- getObject(arg0).commit();
2630
- }, arguments);
2631
- };
2632
- imports.wbg.__wbg_setoncomplete_1a27889412475f6f = function (arg0, arg1) {
2633
- getObject(arg0).oncomplete = getObject(arg1);
2634
- };
2635
- imports.wbg.__wbg_setonerror_74c492184749a58a = function (arg0, arg1) {
2636
- getObject(arg0).onerror = getObject(arg1);
2637
- };
2638
2641
  imports.wbg.__wbg_objectStoreNames_432a9424fbdfefda = function (arg0) {
2639
2642
  const ret = getObject(arg0).objectStoreNames;
2640
2643
  return addHeapObject(ret);
@@ -2669,8 +2672,8 @@ function __wbg_get_imports() {
2669
2672
  return addHeapObject(ret);
2670
2673
  }, arguments);
2671
2674
  };
2672
- imports.wbg.__wbg_new_09938a7d020f049b = function (arg0) {
2673
- const ret = new Uint8Array(getObject(arg0));
2675
+ imports.wbg.__wbindgen_number_new = function (arg0) {
2676
+ const ret = arg0;
2674
2677
  return addHeapObject(ret);
2675
2678
  };
2676
2679
  imports.wbg.__wbg_new_2b55e405e4af4986 = function (arg0, arg1) {
@@ -2680,7 +2683,7 @@ function __wbg_get_imports() {
2680
2683
  const a = state0.a;
2681
2684
  state0.a = 0;
2682
2685
  try {
2683
- return __wbg_adapter_288(a, state0.b, arg0, arg1);
2686
+ return __wbg_adapter_289(a, state0.b, arg0, arg1);
2684
2687
  }
2685
2688
  finally {
2686
2689
  state0.a = a;
@@ -2693,6 +2696,10 @@ function __wbg_get_imports() {
2693
2696
  state0.a = state0.b = 0;
2694
2697
  }
2695
2698
  };
2699
+ imports.wbg.__wbg_new_09938a7d020f049b = function (arg0) {
2700
+ const ret = new Uint8Array(getObject(arg0));
2701
+ return addHeapObject(ret);
2702
+ };
2696
2703
  imports.wbg.__wbg_new_0394642eae39db16 = function () {
2697
2704
  const ret = new Array();
2698
2705
  return addHeapObject(ret);
@@ -2709,6 +2716,10 @@ function __wbg_get_imports() {
2709
2716
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2710
2717
  return addHeapObject(ret);
2711
2718
  };
2719
+ imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2720
+ const ret = BigInt.asUintN(64, arg0);
2721
+ return addHeapObject(ret);
2722
+ };
2712
2723
  imports.wbg.__wbg_new_2b6fea4ea03b1b95 = function () {
2713
2724
  const ret = new Object();
2714
2725
  return addHeapObject(ret);
@@ -2717,22 +2728,14 @@ function __wbg_get_imports() {
2717
2728
  const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2718
2729
  return addHeapObject(ret);
2719
2730
  };
2720
- imports.wbg.__wbindgen_number_new = function (arg0) {
2721
- const ret = arg0;
2722
- return addHeapObject(ret);
2723
- };
2724
- imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2725
- const ret = BigInt.asUintN(64, arg0);
2731
+ imports.wbg.__wbg_new_87297f22973157c8 = function (arg0, arg1) {
2732
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2726
2733
  return addHeapObject(ret);
2727
2734
  };
2728
2735
  imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
2729
2736
  const ret = FfiWireE2EIdentity.__wrap(arg0);
2730
2737
  return addHeapObject(ret);
2731
2738
  };
2732
- imports.wbg.__wbg_new_87297f22973157c8 = function (arg0, arg1) {
2733
- const ret = new Error(getStringFromWasm0(arg0, arg1));
2734
- return addHeapObject(ret);
2735
- };
2736
2739
  imports.wbg.__wbg_setonsuccess_d668ac71ae816a35 = function (arg0, arg1) {
2737
2740
  getObject(arg0).onsuccess = getObject(arg1);
2738
2741
  };
@@ -3091,6 +3094,12 @@ function __wbg_get_imports() {
3091
3094
  const ret = getObject(arg0).target;
3092
3095
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
3093
3096
  };
3097
+ imports.wbg.__wbg_error_a16f2288166003c0 = function () {
3098
+ return handleError(function (arg0) {
3099
+ const ret = getObject(arg0).error;
3100
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
3101
+ }, arguments);
3102
+ };
3094
3103
  imports.wbg.__wbg_result_fcdf1e20f03fa375 = function () {
3095
3104
  return handleError(function (arg0) {
3096
3105
  const ret = getObject(arg0).result;
@@ -3131,12 +3140,6 @@ function __wbg_get_imports() {
3131
3140
  getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
3132
3141
  }, arguments);
3133
3142
  };
3134
- imports.wbg.__wbg_error_a16f2288166003c0 = function () {
3135
- return handleError(function (arg0) {
3136
- const ret = getObject(arg0).error;
3137
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
3138
- }, arguments);
3139
- };
3140
3143
  imports.wbg.__wbindgen_is_falsy = function (arg0) {
3141
3144
  const ret = !getObject(arg0);
3142
3145
  return ret;
@@ -3301,12 +3304,12 @@ function __wbg_get_imports() {
3301
3304
  return addHeapObject(ret);
3302
3305
  }, arguments);
3303
3306
  };
3304
- imports.wbg.__wbindgen_closure_wrapper1659 = function (arg0, arg1, arg2) {
3305
- const ret = makeMutClosure(arg0, arg1, 161, __wbg_adapter_52);
3307
+ imports.wbg.__wbindgen_closure_wrapper1651 = function (arg0, arg1, arg2) {
3308
+ const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_52);
3306
3309
  return addHeapObject(ret);
3307
3310
  };
3308
- imports.wbg.__wbindgen_closure_wrapper4794 = function (arg0, arg1, arg2) {
3309
- const ret = makeMutClosure(arg0, arg1, 161, __wbg_adapter_55);
3311
+ imports.wbg.__wbindgen_closure_wrapper4775 = function (arg0, arg1, arg2) {
3312
+ const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_55);
3310
3313
  return addHeapObject(ret);
3311
3314
  };
3312
3315
  return imports;
@@ -3373,7 +3376,7 @@ var exports = /*#__PURE__*/Object.freeze({
3373
3376
  var wasm = async (opt = {}) => {
3374
3377
  let {importHook, serverPath} = opt;
3375
3378
 
3376
- let path = "assets/core_crypto_ffi-8c5ea533.wasm";
3379
+ let path = "assets/core_crypto_ffi-7b1dbee8.wasm";
3377
3380
 
3378
3381
  if (serverPath != null) {
3379
3382
  path = serverPath + /[^\/\\]*$/.exec(path)[0];
@@ -3773,16 +3776,17 @@ class CoreCrypto {
3773
3776
  * You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
3774
3777
  *
3775
3778
  * @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
3779
+ * @param creatorCredentialType - kind of credential the creator wants to create the group with
3776
3780
  * @param configuration - configuration of the MLS group
3777
3781
  * @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
3778
3782
  * @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
3779
3783
  * @param configuration.custom - {@link CustomConfiguration}
3780
3784
  */
3781
- async createConversation(conversationId, configuration = {}) {
3785
+ async createConversation(conversationId, creatorCredentialType, configuration = {}) {
3782
3786
  try {
3783
3787
  const { ciphersuite, externalSenders, custom = {} } = configuration || {};
3784
3788
  const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(ciphersuite, externalSenders, custom?.keyRotationSpan);
3785
- const ret = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").create_conversation(conversationId, config));
3789
+ const ret = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").create_conversation(conversationId, creatorCredentialType, config));
3786
3790
  return ret;
3787
3791
  }
3788
3792
  catch (e) {
@@ -4410,6 +4414,16 @@ class CoreCrypto {
4410
4414
  const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_enrollment_stash_pop(handle));
4411
4415
  return new WireE2eIdentity(e2ei);
4412
4416
  }
4417
+ /**
4418
+ * Indicates when to mark a conversation as degraded i.e. when not all its members have a X509.
4419
+ * Credential generated by Wire's end-to-end identity enrollment
4420
+ *
4421
+ * @param conversationId The group's ID
4422
+ * @returns true if all the members have valid X509 credentials
4423
+ */
4424
+ async e2eiIsDegraded(conversationId) {
4425
+ return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_is_degraded(conversationId));
4426
+ }
4413
4427
  /**
4414
4428
  * Returns the current version of {@link CoreCrypto}
4415
4429
  *