@wireapp/core-crypto 0.9.1 → 0.10.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.1",
3
+ "version": "0.10.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
  *
@@ -35,6 +35,14 @@ const heap = new Array(128).fill(undefined);
35
35
  heap.push(undefined, null, true, false);
36
36
  function getObject(idx) { return heap[idx]; }
37
37
  let heap_next = heap.length;
38
+ function addHeapObject(obj) {
39
+ if (heap_next === heap.length)
40
+ heap.push(heap.length + 1);
41
+ const idx = heap_next;
42
+ heap_next = heap[idx];
43
+ heap[idx] = obj;
44
+ return idx;
45
+ }
38
46
  function dropObject(idx) {
39
47
  if (idx < 132)
40
48
  return;
@@ -46,14 +54,6 @@ function takeObject(idx) {
46
54
  dropObject(idx);
47
55
  return ret;
48
56
  }
49
- function addHeapObject(obj) {
50
- if (heap_next === heap.length)
51
- heap.push(heap.length + 1);
52
- const idx = heap_next;
53
- heap_next = heap[idx];
54
- heap[idx] = obj;
55
- return idx;
56
- }
57
57
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available'); } });
58
58
  if (typeof TextDecoder !== 'undefined') {
59
59
  cachedTextDecoder.decode();
@@ -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__hca6e257aac6d0416(arg0, arg1, addHeapObject(arg2));
233
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb4735603d1460e0b(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__h82968d72c5531950(retptr, arg0, arg1, addHeapObject(arg2));
238
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hae47a88d8cc19d80(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) {
@@ -300,7 +300,7 @@ function handleError(f, args) {
300
300
  }
301
301
  }
302
302
  function __wbg_adapter_288(arg0, arg1, arg2, arg3) {
303
- wasm$1.wasm_bindgen__convert__closures__invoke2_mut__ha54056c10ac24945(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
303
+ wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h29314eb9a720dde0(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
304
304
  }
305
305
  /**
306
306
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -903,15 +903,16 @@ let CoreCrypto$1 = class CoreCrypto {
903
903
  *
904
904
  * see [core_crypto::mls::MlsCentral::new_conversation]
905
905
  * @param {Uint8Array} conversation_id
906
+ * @param {number} creator_credential_type
906
907
  * @param {ConversationConfiguration} config
907
908
  * @returns {Promise<any>}
908
909
  */
909
- create_conversation(conversation_id, config) {
910
+ create_conversation(conversation_id, creator_credential_type, config) {
910
911
  const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
911
912
  const len0 = WASM_VECTOR_LEN;
912
913
  _assertClass(config, ConversationConfiguration);
913
914
  var ptr1 = config.__destroy_into_raw();
914
- const ret = wasm$1.corecrypto_create_conversation(this.__wbg_ptr, ptr0, len0, ptr1);
915
+ const ret = wasm$1.corecrypto_create_conversation(this.__wbg_ptr, ptr0, len0, creator_credential_type, ptr1);
915
916
  return takeObject(ret);
916
917
  }
917
918
  /**
@@ -2600,13 +2601,13 @@ async function __wbg_load(module, imports) {
2600
2601
  function __wbg_get_imports() {
2601
2602
  const imports = {};
2602
2603
  imports.wbg = {};
2603
- imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2604
- takeObject(arg0);
2605
- };
2606
2604
  imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
2607
2605
  const ret = getObject(arg0);
2608
2606
  return addHeapObject(ret);
2609
2607
  };
2608
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2609
+ takeObject(arg0);
2610
+ };
2610
2611
  imports.wbg.__wbindgen_is_object = function (arg0) {
2611
2612
  const val = getObject(arg0);
2612
2613
  const ret = typeof (val) === 'object' && val !== null;
@@ -2624,17 +2625,6 @@ function __wbg_get_imports() {
2624
2625
  const ret = getObject(arg0) in getObject(arg1);
2625
2626
  return ret;
2626
2627
  };
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
2628
  imports.wbg.__wbg_objectStoreNames_432a9424fbdfefda = function (arg0) {
2639
2629
  const ret = getObject(arg0).objectStoreNames;
2640
2630
  return addHeapObject(ret);
@@ -2663,24 +2653,6 @@ function __wbg_get_imports() {
2663
2653
  const ret = getObject(arg0).length;
2664
2654
  return ret;
2665
2655
  };
2666
- imports.wbg.__wbg_new_09938a7d020f049b = function (arg0) {
2667
- const ret = new Uint8Array(getObject(arg0));
2668
- return addHeapObject(ret);
2669
- };
2670
- imports.wbg.__wbg_call_587b30eea3e09332 = function () {
2671
- return handleError(function (arg0, arg1, arg2) {
2672
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2673
- return addHeapObject(ret);
2674
- }, arguments);
2675
- };
2676
- imports.wbg.__wbg_new_0394642eae39db16 = function () {
2677
- const ret = new Array();
2678
- return addHeapObject(ret);
2679
- };
2680
- imports.wbg.__wbg_push_109cfc26d02582dd = function (arg0, arg1) {
2681
- const ret = getObject(arg0).push(getObject(arg1));
2682
- return ret;
2683
- };
2684
2656
  imports.wbg.__wbg_new_2b55e405e4af4986 = function (arg0, arg1) {
2685
2657
  try {
2686
2658
  var state0 = { a: arg0, b: arg1 };
@@ -2701,16 +2673,30 @@ function __wbg_get_imports() {
2701
2673
  state0.a = state0.b = 0;
2702
2674
  }
2703
2675
  };
2704
- imports.wbg.__wbindgen_number_new = function (arg0) {
2705
- const ret = arg0;
2676
+ imports.wbg.__wbg_call_587b30eea3e09332 = function () {
2677
+ return handleError(function (arg0, arg1, arg2) {
2678
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2679
+ return addHeapObject(ret);
2680
+ }, arguments);
2681
+ };
2682
+ imports.wbg.__wbg_new_09938a7d020f049b = function (arg0) {
2683
+ const ret = new Uint8Array(getObject(arg0));
2706
2684
  return addHeapObject(ret);
2707
2685
  };
2708
- imports.wbg.__wbg_new_0f2b71ca2f2a6029 = function () {
2709
- const ret = new Map();
2686
+ imports.wbg.__wbg_new_0394642eae39db16 = function () {
2687
+ const ret = new Array();
2710
2688
  return addHeapObject(ret);
2711
2689
  };
2712
- imports.wbg.__wbg_set_da7be7bf0e037b14 = function (arg0, arg1, arg2) {
2713
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2690
+ imports.wbg.__wbg_push_109cfc26d02582dd = function (arg0, arg1) {
2691
+ const ret = getObject(arg0).push(getObject(arg1));
2692
+ return ret;
2693
+ };
2694
+ imports.wbg.__wbindgen_number_new = function (arg0) {
2695
+ const ret = arg0;
2696
+ return addHeapObject(ret);
2697
+ };
2698
+ imports.wbg.__wbg_new_2b6fea4ea03b1b95 = function () {
2699
+ const ret = new Object();
2714
2700
  return addHeapObject(ret);
2715
2701
  };
2716
2702
  imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
@@ -2721,8 +2707,12 @@ function __wbg_get_imports() {
2721
2707
  const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2722
2708
  return addHeapObject(ret);
2723
2709
  };
2724
- imports.wbg.__wbg_new_2b6fea4ea03b1b95 = function () {
2725
- const ret = new Object();
2710
+ imports.wbg.__wbg_new_0f2b71ca2f2a6029 = function () {
2711
+ const ret = new Map();
2712
+ return addHeapObject(ret);
2713
+ };
2714
+ imports.wbg.__wbg_set_da7be7bf0e037b14 = function (arg0, arg1, arg2) {
2715
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2726
2716
  return addHeapObject(ret);
2727
2717
  };
2728
2718
  imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
@@ -3091,12 +3081,6 @@ function __wbg_get_imports() {
3091
3081
  const ret = getObject(arg0).target;
3092
3082
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
3093
3083
  };
3094
- imports.wbg.__wbg_error_a16f2288166003c0 = function () {
3095
- return handleError(function (arg0) {
3096
- const ret = getObject(arg0).error;
3097
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
3098
- }, arguments);
3099
- };
3100
3084
  imports.wbg.__wbg_result_fcdf1e20f03fa375 = function () {
3101
3085
  return handleError(function (arg0) {
3102
3086
  const ret = getObject(arg0).result;
@@ -3137,6 +3121,12 @@ function __wbg_get_imports() {
3137
3121
  getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
3138
3122
  }, arguments);
3139
3123
  };
3124
+ imports.wbg.__wbg_error_a16f2288166003c0 = function () {
3125
+ return handleError(function (arg0) {
3126
+ const ret = getObject(arg0).error;
3127
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
3128
+ }, arguments);
3129
+ };
3140
3130
  imports.wbg.__wbindgen_is_falsy = function (arg0) {
3141
3131
  const ret = !getObject(arg0);
3142
3132
  return ret;
@@ -3301,12 +3291,12 @@ function __wbg_get_imports() {
3301
3291
  return addHeapObject(ret);
3302
3292
  }, arguments);
3303
3293
  };
3304
- imports.wbg.__wbindgen_closure_wrapper1663 = function (arg0, arg1, arg2) {
3305
- const ret = makeMutClosure(arg0, arg1, 162, __wbg_adapter_52);
3294
+ imports.wbg.__wbindgen_closure_wrapper1634 = function (arg0, arg1, arg2) {
3295
+ const ret = makeMutClosure(arg0, arg1, 161, __wbg_adapter_52);
3306
3296
  return addHeapObject(ret);
3307
3297
  };
3308
- imports.wbg.__wbindgen_closure_wrapper4791 = function (arg0, arg1, arg2) {
3309
- const ret = makeMutClosure(arg0, arg1, 162, __wbg_adapter_55);
3298
+ imports.wbg.__wbindgen_closure_wrapper4776 = function (arg0, arg1, arg2) {
3299
+ const ret = makeMutClosure(arg0, arg1, 161, __wbg_adapter_55);
3310
3300
  return addHeapObject(ret);
3311
3301
  };
3312
3302
  return imports;
@@ -3373,7 +3363,7 @@ var exports = /*#__PURE__*/Object.freeze({
3373
3363
  var wasm = async (opt = {}) => {
3374
3364
  let {importHook, serverPath} = opt;
3375
3365
 
3376
- let path = "assets/core_crypto_ffi-3aab42da.wasm";
3366
+ let path = "assets/core_crypto_ffi-3ec195cb.wasm";
3377
3367
 
3378
3368
  if (serverPath != null) {
3379
3369
  path = serverPath + /[^\/\\]*$/.exec(path)[0];
@@ -3773,16 +3763,17 @@ class CoreCrypto {
3773
3763
  * You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
3774
3764
  *
3775
3765
  * @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
3766
+ * @param creatorCredentialType - kind of credential the creator wants to create the group with
3776
3767
  * @param configuration - configuration of the MLS group
3777
3768
  * @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
3778
3769
  * @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
3779
3770
  * @param configuration.custom - {@link CustomConfiguration}
3780
3771
  */
3781
- async createConversation(conversationId, configuration = {}) {
3772
+ async createConversation(conversationId, creatorCredentialType, configuration = {}) {
3782
3773
  try {
3783
3774
  const { ciphersuite, externalSenders, custom = {} } = configuration || {};
3784
3775
  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));
3776
+ const ret = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").create_conversation(conversationId, creatorCredentialType, config));
3786
3777
  return ret;
3787
3778
  }
3788
3779
  catch (e) {