@wireapp/core-crypto 1.0.0-rc.1 → 1.0.0-rc.2

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": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.2",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -79,6 +79,24 @@ export interface ConversationConfiguration {
79
79
  * Implementation specific configuration
80
80
  */
81
81
  custom?: CustomConfiguration;
82
+ /**
83
+ * Trust anchors to be added in the group's context extensions
84
+ */
85
+ perDomainTrustAnchors?: PerDomainTrustAnchor[];
86
+ }
87
+ /**
88
+ * A wrapper containing the configuration for trust anchors to be added in the group's context
89
+ * extensions
90
+ */
91
+ export interface PerDomainTrustAnchor {
92
+ /**
93
+ * Domain name of the owning backend this anchor refers to. One of the certificate in the chain has to have this domain in its SANs
94
+ */
95
+ domain_name: string;
96
+ /**
97
+ * PEM encoded (partial) certificate chain. This contains the certificate chain for the CA certificate issuing the E2E Identity certificates
98
+ */
99
+ intermediate_certificate_chain: string;
82
100
  }
83
101
  /**
84
102
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -690,6 +708,22 @@ export declare class CoreCrypto {
690
708
  * @returns The encrypted payload for the given group. This needs to be fanned out to the other members of the group.
691
709
  */
692
710
  encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
711
+ /**
712
+ * Updates the trust anchors for a conversation. This should be called when a federated event happens (new team added/removed).
713
+ * Clients should add and/or remove trust anchors from the new backend to the conversation. The method will check
714
+ * for duplicated domains and the validity of the certificate chain.
715
+ *
716
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
717
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
718
+ * epoch, use new encryption secrets etc...
719
+ *
720
+ * @param conversationId - The ID of the conversation
721
+ * @param removeDomainNames - Domains to remove from the trust anchors
722
+ * @param addTrustAnchors - New trust anchors to add to the conversation
723
+ *
724
+ * @returns A {@link CommitBundle}
725
+ */
726
+ update_trust_anchors_from_conversation(conversationId: ConversationId, removeDomainNames: string[], addTrustAnchors: PerDomainTrustAnchor[]): Promise<CommitBundle>;
693
727
  /**
694
728
  * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
695
729
  *
@@ -1026,30 +1060,30 @@ export declare class CoreCrypto {
1026
1060
  e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite): Promise<WireE2eIdentity>;
1027
1061
  /**
1028
1062
  * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1029
- * As a consequence, this method does not support changing the ClientId which should remain the same as the Basic one.
1030
1063
  * Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1031
1064
  *
1065
+ * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
1032
1066
  * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
1033
1067
  * @param handle user handle e.g. `alice.smith.qa@example.com`
1034
1068
  * @param expiryDays generated x509 certificate expiry
1035
1069
  * @param ciphersuite - for generating signing key material
1036
1070
  * @returns The new {@link WireE2eIdentity} object
1037
1071
  */
1038
- e2eiNewActivationEnrollment(displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite): Promise<WireE2eIdentity>;
1072
+ e2eiNewActivationEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite): Promise<WireE2eIdentity>;
1039
1073
  /**
1040
1074
  * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1041
1075
  * having to change/rotate their credential, either because the former one is expired or it
1042
- * has been revoked. As a consequence, this method does not support changing neither ClientId which
1043
- * should remain the same as the previous one. It lets you change the DisplayName or the handle
1076
+ * has been revoked. It lets you change the DisplayName or the handle
1044
1077
  * if you need to. Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1045
1078
  *
1079
+ * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
1046
1080
  * @param expiryDays generated x509 certificate expiry
1047
1081
  * @param ciphersuite - for generating signing key material
1048
1082
  * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
1049
1083
  * @param handle user handle e.g. `alice.smith.qa@example.com`
1050
1084
  * @returns The new {@link WireE2eIdentity} object
1051
1085
  */
1052
- e2eiNewRotateEnrollment(expiryDays: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string): Promise<WireE2eIdentity>;
1086
+ e2eiNewRotateEnrollment(clientId: string, expiryDays: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string): Promise<WireE2eIdentity>;
1053
1087
  /**
1054
1088
  * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ; that means he cannot initialize with a Basic credential
1055
1089
  *
@@ -39,14 +39,6 @@ const heap = new Array(128).fill(undefined);
39
39
  heap.push(undefined, null, true, false);
40
40
  function getObject(idx) { return heap[idx]; }
41
41
  let heap_next = heap.length;
42
- function addHeapObject(obj) {
43
- if (heap_next === heap.length)
44
- heap.push(heap.length + 1);
45
- const idx = heap_next;
46
- heap_next = heap[idx];
47
- heap[idx] = obj;
48
- return idx;
49
- }
50
42
  function dropObject(idx) {
51
43
  if (idx < 132)
52
44
  return;
@@ -58,6 +50,14 @@ function takeObject(idx) {
58
50
  dropObject(idx);
59
51
  return ret;
60
52
  }
53
+ function addHeapObject(obj) {
54
+ if (heap_next === heap.length)
55
+ heap.push(heap.length + 1);
56
+ const idx = heap_next;
57
+ heap_next = heap[idx];
58
+ heap[idx] = obj;
59
+ return idx;
60
+ }
61
61
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available'); } });
62
62
  if (typeof TextDecoder !== 'undefined') {
63
63
  cachedTextDecoder.decode();
@@ -234,12 +234,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
234
234
  return real;
235
235
  }
236
236
  function __wbg_adapter_52(arg0, arg1, arg2) {
237
- wasm$1.wasm_bindgen__convert__closures__invoke1_mut__h8d579dd3e9d6cb9a(arg0, arg1, addHeapObject(arg2));
237
+ wasm$1.wasm_bindgen__convert__closures__invoke1_mut__h79cafe3df8446843(arg0, arg1, addHeapObject(arg2));
238
238
  }
239
239
  function __wbg_adapter_55(arg0, arg1, arg2) {
240
240
  try {
241
241
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
242
- wasm$1.wasm_bindgen__convert__closures__invoke1_mut__h746b8b0ddaf8393e(retptr, arg0, arg1, addHeapObject(arg2));
242
+ wasm$1.wasm_bindgen__convert__closures__invoke1_mut__he1696d119fd3caab(retptr, arg0, arg1, addHeapObject(arg2));
243
243
  var r0 = getInt32Memory0()[retptr / 4 + 0];
244
244
  var r1 = getInt32Memory0()[retptr / 4 + 1];
245
245
  if (r1) {
@@ -313,8 +313,8 @@ function handleError(f, args) {
313
313
  wasm$1.__wbindgen_exn_store(addHeapObject(e));
314
314
  }
315
315
  }
316
- function __wbg_adapter_296(arg0, arg1, arg2, arg3) {
317
- wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h80912c0a9461abcd(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
316
+ function __wbg_adapter_298(arg0, arg1, arg2, arg3) {
317
+ wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h2ada45b9b70febc7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
318
318
  }
319
319
  /**
320
320
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -617,12 +617,25 @@ class ConversationConfiguration {
617
617
  * @param {(Uint8Array)[] | undefined} external_senders
618
618
  * @param {number | undefined} key_rotation_span
619
619
  * @param {number | undefined} wire_policy
620
+ * @param {Array<any>} per_domain_trust_anchors
620
621
  */
621
- constructor(ciphersuite, external_senders, key_rotation_span, wire_policy) {
622
- var ptr0 = isLikeNone(external_senders) ? 0 : passArrayJsValueToWasm0(external_senders, wasm$1.__wbindgen_malloc);
623
- var len0 = WASM_VECTOR_LEN;
624
- const ret = wasm$1.conversationconfiguration_new(isLikeNone(ciphersuite) ? 8 : ciphersuite, ptr0, len0, !isLikeNone(key_rotation_span), isLikeNone(key_rotation_span) ? 0 : key_rotation_span, isLikeNone(wire_policy) ? 3 : wire_policy);
625
- return ConversationConfiguration.__wrap(ret);
622
+ constructor(ciphersuite, external_senders, key_rotation_span, wire_policy, per_domain_trust_anchors) {
623
+ try {
624
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
625
+ var ptr0 = isLikeNone(external_senders) ? 0 : passArrayJsValueToWasm0(external_senders, wasm$1.__wbindgen_malloc);
626
+ var len0 = WASM_VECTOR_LEN;
627
+ wasm$1.conversationconfiguration_new(retptr, isLikeNone(ciphersuite) ? 8 : ciphersuite, ptr0, len0, !isLikeNone(key_rotation_span), isLikeNone(key_rotation_span) ? 0 : key_rotation_span, isLikeNone(wire_policy) ? 3 : wire_policy, addHeapObject(per_domain_trust_anchors));
628
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
629
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
630
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
631
+ if (r2) {
632
+ throw takeObject(r1);
633
+ }
634
+ return ConversationConfiguration.__wrap(r0);
635
+ }
636
+ finally {
637
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
638
+ }
626
639
  }
627
640
  }
628
641
  /**
@@ -702,36 +715,42 @@ let CoreCrypto$1 = class CoreCrypto {
702
715
  * Returns: [`WasmCryptoResult<WireE2eIdentity>`]
703
716
  *
704
717
  * see [core_crypto::mls::MlsCentral::e2ei_new_activation_enrollment]
718
+ * @param {string} client_id
705
719
  * @param {string} display_name
706
720
  * @param {string} handle
707
721
  * @param {number} expiry_days
708
722
  * @param {number} ciphersuite
709
723
  * @returns {Promise<any>}
710
724
  */
711
- e2ei_new_activation_enrollment(display_name, handle, expiry_days, ciphersuite) {
712
- const ptr0 = passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
725
+ e2ei_new_activation_enrollment(client_id, display_name, handle, expiry_days, ciphersuite) {
726
+ const ptr0 = passStringToWasm0(client_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
713
727
  const len0 = WASM_VECTOR_LEN;
714
- const ptr1 = passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
728
+ const ptr1 = passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
715
729
  const len1 = WASM_VECTOR_LEN;
716
- const ret = wasm$1.corecrypto_e2ei_new_activation_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, expiry_days, ciphersuite);
730
+ const ptr2 = passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
731
+ const len2 = WASM_VECTOR_LEN;
732
+ const ret = wasm$1.corecrypto_e2ei_new_activation_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
717
733
  return takeObject(ret);
718
734
  }
719
735
  /**
720
736
  * Returns: [`WasmCryptoResult<WireE2eIdentity>`]
721
737
  *
722
738
  * see [core_crypto::mls::MlsCentral::e2ei_new_rotate_enrollment]
739
+ * @param {string} client_id
723
740
  * @param {string | undefined} display_name
724
741
  * @param {string | undefined} handle
725
742
  * @param {number} expiry_days
726
743
  * @param {number} ciphersuite
727
744
  * @returns {Promise<any>}
728
745
  */
729
- e2ei_new_rotate_enrollment(display_name, handle, expiry_days, ciphersuite) {
730
- var ptr0 = isLikeNone(display_name) ? 0 : passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
731
- var len0 = WASM_VECTOR_LEN;
732
- var ptr1 = isLikeNone(handle) ? 0 : passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
746
+ e2ei_new_rotate_enrollment(client_id, display_name, handle, expiry_days, ciphersuite) {
747
+ const ptr0 = passStringToWasm0(client_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
748
+ const len0 = WASM_VECTOR_LEN;
749
+ var ptr1 = isLikeNone(display_name) ? 0 : passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
733
750
  var len1 = WASM_VECTOR_LEN;
734
- const ret = wasm$1.corecrypto_e2ei_new_rotate_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, expiry_days, ciphersuite);
751
+ var ptr2 = isLikeNone(handle) ? 0 : passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
752
+ var len2 = WASM_VECTOR_LEN;
753
+ const ret = wasm$1.corecrypto_e2ei_new_rotate_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
735
754
  return takeObject(ret);
736
755
  }
737
756
  /**
@@ -1177,6 +1196,23 @@ let CoreCrypto$1 = class CoreCrypto {
1177
1196
  return takeObject(ret);
1178
1197
  }
1179
1198
  /**
1199
+ * Returns: [`WasmCryptoResult<CommitBundle>`]
1200
+ *
1201
+ * see [core_crypto::mls::MlsCentral::update_trust_anchors_from_conversation]
1202
+ * @param {Uint8Array} conversation_id
1203
+ * @param {(string)[]} remove_domain_names
1204
+ * @param {Array<any>} add_trust_anchors
1205
+ * @returns {Promise<any>}
1206
+ */
1207
+ update_trust_anchors_from_conversation(conversation_id, remove_domain_names, add_trust_anchors) {
1208
+ const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
1209
+ const len0 = WASM_VECTOR_LEN;
1210
+ const ptr1 = passArrayJsValueToWasm0(remove_domain_names, wasm$1.__wbindgen_malloc);
1211
+ const len1 = WASM_VECTOR_LEN;
1212
+ const ret = wasm$1.corecrypto_update_trust_anchors_from_conversation(this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(add_trust_anchors));
1213
+ return takeObject(ret);
1214
+ }
1215
+ /**
1180
1216
  * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
1181
1217
  *
1182
1218
  * see [core_crypto::mls::MlsCentral::new_proposal]
@@ -2436,6 +2472,37 @@ class NewAcmeOrder {
2436
2472
  }
2437
2473
  /**
2438
2474
  */
2475
+ class PerDomainTrustAnchor {
2476
+ static __wrap(ptr) {
2477
+ ptr = ptr >>> 0;
2478
+ const obj = Object.create(PerDomainTrustAnchor.prototype);
2479
+ obj.__wbg_ptr = ptr;
2480
+ return obj;
2481
+ }
2482
+ __destroy_into_raw() {
2483
+ const ptr = this.__wbg_ptr;
2484
+ this.__wbg_ptr = 0;
2485
+ return ptr;
2486
+ }
2487
+ free() {
2488
+ const ptr = this.__destroy_into_raw();
2489
+ wasm$1.__wbg_perdomaintrustanchor_free(ptr);
2490
+ }
2491
+ /**
2492
+ * @param {string} domain_name
2493
+ * @param {string} intermediate_certificate_chain
2494
+ */
2495
+ constructor(domain_name, intermediate_certificate_chain) {
2496
+ const ptr0 = passStringToWasm0(domain_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
2497
+ const len0 = WASM_VECTOR_LEN;
2498
+ const ptr1 = passStringToWasm0(intermediate_certificate_chain, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
2499
+ const len1 = WASM_VECTOR_LEN;
2500
+ const ret = wasm$1.perdomaintrustanchor_new(ptr0, len0, ptr1, len1);
2501
+ return PerDomainTrustAnchor.__wrap(ret);
2502
+ }
2503
+ }
2504
+ /**
2505
+ */
2439
2506
  class ProposalBundle {
2440
2507
  static __wrap(ptr) {
2441
2508
  ptr = ptr >>> 0;
@@ -2727,6 +2794,9 @@ async function __wbg_load(module, imports) {
2727
2794
  function __wbg_get_imports() {
2728
2795
  const imports = {};
2729
2796
  imports.wbg = {};
2797
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2798
+ takeObject(arg0);
2799
+ };
2730
2800
  imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
2731
2801
  const ret = getObject(arg0);
2732
2802
  return addHeapObject(ret);
@@ -2736,9 +2806,6 @@ function __wbg_get_imports() {
2736
2806
  const ret = typeof (val) === 'object' && val !== null;
2737
2807
  return ret;
2738
2808
  };
2739
- imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2740
- takeObject(arg0);
2741
- };
2742
2809
  imports.wbg.__wbg_getwithrefkey_5e6d9547403deab8 = function (arg0, arg1) {
2743
2810
  const ret = getObject(arg0)[getObject(arg1)];
2744
2811
  return addHeapObject(ret);
@@ -2791,6 +2858,10 @@ function __wbg_get_imports() {
2791
2858
  const ret = getObject(arg0).length;
2792
2859
  return ret;
2793
2860
  };
2861
+ imports.wbg.__wbg_new_b51585de1b234aff = function () {
2862
+ const ret = new Object();
2863
+ return addHeapObject(ret);
2864
+ };
2794
2865
  imports.wbg.__wbg_call_01734de55d61e11d = function () {
2795
2866
  return handleError(function (arg0, arg1, arg2) {
2796
2867
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
@@ -2813,23 +2884,19 @@ function __wbg_get_imports() {
2813
2884
  const ret = FfiWireE2EIdentity.__wrap(arg0);
2814
2885
  return addHeapObject(ret);
2815
2886
  };
2816
- imports.wbg.__wbg_proteusautoprekeybundle_new = function (arg0) {
2817
- const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2818
- return addHeapObject(ret);
2819
- };
2820
- imports.wbg.__wbg_new_b51585de1b234aff = function () {
2821
- const ret = new Object();
2887
+ imports.wbg.__wbindgen_number_new = function (arg0) {
2888
+ const ret = arg0;
2822
2889
  return addHeapObject(ret);
2823
2890
  };
2824
2891
  imports.wbg.__wbg_set_502d29070ea18557 = function (arg0, arg1, arg2) {
2825
2892
  getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2826
2893
  };
2827
- imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2828
- const ret = BigInt.asUintN(64, arg0);
2894
+ imports.wbg.__wbg_proteusautoprekeybundle_new = function (arg0) {
2895
+ const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2829
2896
  return addHeapObject(ret);
2830
2897
  };
2831
- imports.wbg.__wbindgen_number_new = function (arg0) {
2832
- const ret = arg0;
2898
+ imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2899
+ const ret = BigInt.asUintN(64, arg0);
2833
2900
  return addHeapObject(ret);
2834
2901
  };
2835
2902
  imports.wbg.__wbg_new_56693dbed0c32988 = function () {
@@ -2966,7 +3033,7 @@ function __wbg_get_imports() {
2966
3033
  const a = state0.a;
2967
3034
  state0.a = 0;
2968
3035
  try {
2969
- return __wbg_adapter_296(a, state0.b, arg0, arg1);
3036
+ return __wbg_adapter_298(a, state0.b, arg0, arg1);
2970
3037
  }
2971
3038
  finally {
2972
3039
  state0.a = a;
@@ -3241,6 +3308,12 @@ function __wbg_get_imports() {
3241
3308
  const ret = getObject(arg0).target;
3242
3309
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
3243
3310
  };
3311
+ imports.wbg.__wbg_error_8a79f35fe9368563 = function () {
3312
+ return handleError(function (arg0) {
3313
+ const ret = getObject(arg0).error;
3314
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
3315
+ }, arguments);
3316
+ };
3244
3317
  imports.wbg.__wbg_result_edff16ff107d6acb = function () {
3245
3318
  return handleError(function (arg0) {
3246
3319
  const ret = getObject(arg0).result;
@@ -3281,12 +3354,6 @@ function __wbg_get_imports() {
3281
3354
  getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
3282
3355
  }, arguments);
3283
3356
  };
3284
- imports.wbg.__wbg_error_8a79f35fe9368563 = function () {
3285
- return handleError(function (arg0) {
3286
- const ret = getObject(arg0).error;
3287
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
3288
- }, arguments);
3289
- };
3290
3357
  imports.wbg.__wbindgen_is_falsy = function (arg0) {
3291
3358
  const ret = !getObject(arg0);
3292
3359
  return ret;
@@ -3415,12 +3482,12 @@ function __wbg_get_imports() {
3415
3482
  return addHeapObject(ret);
3416
3483
  }, arguments);
3417
3484
  };
3418
- imports.wbg.__wbindgen_closure_wrapper1977 = function (arg0, arg1, arg2) {
3419
- const ret = makeMutClosure(arg0, arg1, 166, __wbg_adapter_52);
3485
+ imports.wbg.__wbindgen_closure_wrapper1985 = function (arg0, arg1, arg2) {
3486
+ const ret = makeMutClosure(arg0, arg1, 168, __wbg_adapter_52);
3420
3487
  return addHeapObject(ret);
3421
3488
  };
3422
- imports.wbg.__wbindgen_closure_wrapper4646 = function (arg0, arg1, arg2) {
3423
- const ret = makeMutClosure(arg0, arg1, 166, __wbg_adapter_55);
3489
+ imports.wbg.__wbindgen_closure_wrapper4701 = function (arg0, arg1, arg2) {
3490
+ const ret = makeMutClosure(arg0, arg1, 168, __wbg_adapter_55);
3424
3491
  return addHeapObject(ret);
3425
3492
  };
3426
3493
  return imports;
@@ -3476,6 +3543,7 @@ var exports = /*#__PURE__*/Object.freeze({
3476
3543
  MemberAddedMessages: MemberAddedMessages,
3477
3544
  NewAcmeAuthz: NewAcmeAuthz,
3478
3545
  NewAcmeOrder: NewAcmeOrder,
3546
+ PerDomainTrustAnchor: PerDomainTrustAnchor,
3479
3547
  ProposalBundle: ProposalBundle,
3480
3548
  ProteusAutoPrekeyBundle: ProteusAutoPrekeyBundle,
3481
3549
  RotateBundle: RotateBundle,
@@ -3488,7 +3556,7 @@ var exports = /*#__PURE__*/Object.freeze({
3488
3556
  var wasm = async (opt = {}) => {
3489
3557
  let {importHook, serverPath} = opt;
3490
3558
 
3491
- let path = "assets/core_crypto_ffi-ca75d34d.wasm";
3559
+ let path = "assets/core_crypto_ffi-b7eb1191.wasm";
3492
3560
 
3493
3561
  if (serverPath != null) {
3494
3562
  path = serverPath + /[^\/\\]*$/.exec(path)[0];
@@ -3896,8 +3964,8 @@ class CoreCrypto {
3896
3964
  */
3897
3965
  async createConversation(conversationId, creatorCredentialType, configuration = {}) {
3898
3966
  try {
3899
- const { ciphersuite, externalSenders, custom = {} } = configuration || {};
3900
- const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(ciphersuite, externalSenders, custom?.keyRotationSpan);
3967
+ const { ciphersuite, externalSenders, custom = {}, perDomainTrustAnchors = [] } = configuration || {};
3968
+ const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(ciphersuite, externalSenders, custom?.keyRotationSpan, custom?.wirePolicy, perDomainTrustAnchors);
3901
3969
  const ret = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").create_conversation(conversationId, creatorCredentialType, config));
3902
3970
  return ret;
3903
3971
  }
@@ -3949,6 +4017,40 @@ class CoreCrypto {
3949
4017
  async encryptMessage(conversationId, message) {
3950
4018
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").encrypt_message(conversationId, message));
3951
4019
  }
4020
+ /**
4021
+ * Updates the trust anchors for a conversation. This should be called when a federated event happens (new team added/removed).
4022
+ * Clients should add and/or remove trust anchors from the new backend to the conversation. The method will check
4023
+ * for duplicated domains and the validity of the certificate chain.
4024
+ *
4025
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
4026
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
4027
+ * epoch, use new encryption secrets etc...
4028
+ *
4029
+ * @param conversationId - The ID of the conversation
4030
+ * @param removeDomainNames - Domains to remove from the trust anchors
4031
+ * @param addTrustAnchors - New trust anchors to add to the conversation
4032
+ *
4033
+ * @returns A {@link CommitBundle}
4034
+ */
4035
+ async update_trust_anchors_from_conversation(conversationId, removeDomainNames, addTrustAnchors) {
4036
+ try {
4037
+ const ffiRet = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").update_trust_anchors_from_conversation(conversationId, removeDomainNames, addTrustAnchors));
4038
+ const gi = ffiRet.group_info;
4039
+ const ret = {
4040
+ welcome: ffiRet.welcome,
4041
+ commit: ffiRet.commit,
4042
+ groupInfo: {
4043
+ encryptionType: gi.encryption_type,
4044
+ ratchetTreeType: gi.ratchet_tree_type,
4045
+ payload: gi.payload
4046
+ },
4047
+ };
4048
+ return ret;
4049
+ }
4050
+ catch (e) {
4051
+ throw CoreCryptoError.fromStdError(e);
4052
+ }
4053
+ }
3952
4054
  /**
3953
4055
  * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
3954
4056
  *
@@ -4495,34 +4597,34 @@ class CoreCrypto {
4495
4597
  }
4496
4598
  /**
4497
4599
  * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
4498
- * As a consequence, this method does not support changing the ClientId which should remain the same as the Basic one.
4499
4600
  * Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
4500
4601
  *
4602
+ * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
4501
4603
  * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
4502
4604
  * @param handle user handle e.g. `alice.smith.qa@example.com`
4503
4605
  * @param expiryDays generated x509 certificate expiry
4504
4606
  * @param ciphersuite - for generating signing key material
4505
4607
  * @returns The new {@link WireE2eIdentity} object
4506
4608
  */
4507
- async e2eiNewActivationEnrollment(displayName, handle, expiryDays, ciphersuite) {
4508
- const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_new_activation_enrollment(displayName, handle, expiryDays, ciphersuite));
4609
+ async e2eiNewActivationEnrollment(clientId, displayName, handle, expiryDays, ciphersuite) {
4610
+ const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_new_activation_enrollment(clientId, displayName, handle, expiryDays, ciphersuite));
4509
4611
  return new WireE2eIdentity(e2ei);
4510
4612
  }
4511
4613
  /**
4512
4614
  * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
4513
4615
  * having to change/rotate their credential, either because the former one is expired or it
4514
- * has been revoked. As a consequence, this method does not support changing neither ClientId which
4515
- * should remain the same as the previous one. It lets you change the DisplayName or the handle
4616
+ * has been revoked. It lets you change the DisplayName or the handle
4516
4617
  * if you need to. Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
4517
4618
  *
4619
+ * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
4518
4620
  * @param expiryDays generated x509 certificate expiry
4519
4621
  * @param ciphersuite - for generating signing key material
4520
4622
  * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
4521
4623
  * @param handle user handle e.g. `alice.smith.qa@example.com`
4522
4624
  * @returns The new {@link WireE2eIdentity} object
4523
4625
  */
4524
- async e2eiNewRotateEnrollment(expiryDays, ciphersuite, displayName, handle) {
4525
- const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_new_rotate_enrollment(displayName, handle, expiryDays, ciphersuite));
4626
+ async e2eiNewRotateEnrollment(clientId, expiryDays, ciphersuite, displayName, handle) {
4627
+ const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_new_rotate_enrollment(clientId, displayName, handle, expiryDays, ciphersuite));
4526
4628
  return new WireE2eIdentity(e2ei);
4527
4629
  }
4528
4630
  /**