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

Sign up to get free protection for your applications and to get access to all the features.
@@ -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__hdb6540dbb26cf63b(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__h3c15a82f614455aa(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_312(arg0, arg1, arg2, arg3) {
317
+ wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h5286c52f12e3fed2(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
318
318
  }
319
319
  /**
320
320
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -481,15 +481,18 @@ class AcmeDirectory {
481
481
  * @param {string} new_nonce
482
482
  * @param {string} new_account
483
483
  * @param {string} new_order
484
+ * @param {string} revoke_cert
484
485
  */
485
- constructor(new_nonce, new_account, new_order) {
486
+ constructor(new_nonce, new_account, new_order, revoke_cert) {
486
487
  const ptr0 = passStringToWasm0(new_nonce, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
487
488
  const len0 = WASM_VECTOR_LEN;
488
489
  const ptr1 = passStringToWasm0(new_account, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
489
490
  const len1 = WASM_VECTOR_LEN;
490
491
  const ptr2 = passStringToWasm0(new_order, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
491
492
  const len2 = WASM_VECTOR_LEN;
492
- const ret = wasm$1.acmedirectory_new(ptr0, len0, ptr1, len1, ptr2, len2);
493
+ const ptr3 = passStringToWasm0(revoke_cert, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
494
+ const len3 = WASM_VECTOR_LEN;
495
+ const ret = wasm$1.acmedirectory_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
493
496
  return AcmeDirectory.__wrap(ret);
494
497
  }
495
498
  /**
@@ -552,6 +555,103 @@ class AcmeDirectory {
552
555
  wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
553
556
  }
554
557
  }
558
+ /**
559
+ * @returns {string}
560
+ */
561
+ get revokeCert() {
562
+ let deferred1_0;
563
+ let deferred1_1;
564
+ try {
565
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
566
+ wasm$1.acmedirectory_revokeCert(retptr, this.__wbg_ptr);
567
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
568
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
569
+ deferred1_0 = r0;
570
+ deferred1_1 = r1;
571
+ return getStringFromWasm0(r0, r1);
572
+ }
573
+ finally {
574
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
575
+ wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
576
+ }
577
+ }
578
+ }
579
+ /**
580
+ * to avoid recursion
581
+ */
582
+ class BufferedDecryptedMessage {
583
+ static __wrap(ptr) {
584
+ ptr = ptr >>> 0;
585
+ const obj = Object.create(BufferedDecryptedMessage.prototype);
586
+ obj.__wbg_ptr = ptr;
587
+ return obj;
588
+ }
589
+ __destroy_into_raw() {
590
+ const ptr = this.__wbg_ptr;
591
+ this.__wbg_ptr = 0;
592
+ return ptr;
593
+ }
594
+ free() {
595
+ const ptr = this.__destroy_into_raw();
596
+ wasm$1.__wbg_buffereddecryptedmessage_free(ptr);
597
+ }
598
+ /**
599
+ * @returns {any}
600
+ */
601
+ get message() {
602
+ const ret = wasm$1.buffereddecryptedmessage_message(this.__wbg_ptr);
603
+ return takeObject(ret);
604
+ }
605
+ /**
606
+ * @returns {Array<any>}
607
+ */
608
+ get proposals() {
609
+ const ret = wasm$1.buffereddecryptedmessage_proposals(this.__wbg_ptr);
610
+ return takeObject(ret);
611
+ }
612
+ /**
613
+ * @returns {boolean}
614
+ */
615
+ get is_active() {
616
+ const ret = wasm$1.buffereddecryptedmessage_is_active(this.__wbg_ptr);
617
+ return ret !== 0;
618
+ }
619
+ /**
620
+ * @returns {number | undefined}
621
+ */
622
+ get commit_delay() {
623
+ try {
624
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
625
+ wasm$1.buffereddecryptedmessage_commit_delay(retptr, this.__wbg_ptr);
626
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
627
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
628
+ return r0 === 0 ? undefined : r1 >>> 0;
629
+ }
630
+ finally {
631
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
632
+ }
633
+ }
634
+ /**
635
+ * @returns {any}
636
+ */
637
+ get sender_client_id() {
638
+ const ret = wasm$1.buffereddecryptedmessage_sender_client_id(this.__wbg_ptr);
639
+ return takeObject(ret);
640
+ }
641
+ /**
642
+ * @returns {boolean}
643
+ */
644
+ get has_epoch_changed() {
645
+ const ret = wasm$1.buffereddecryptedmessage_has_epoch_changed(this.__wbg_ptr);
646
+ return ret !== 0;
647
+ }
648
+ /**
649
+ * @returns {WireIdentity | undefined}
650
+ */
651
+ get identity() {
652
+ const ret = wasm$1.buffereddecryptedmessage_identity(this.__wbg_ptr);
653
+ return ret === 0 ? undefined : WireIdentity.__wrap(ret);
654
+ }
555
655
  }
556
656
  /**
557
657
  */
@@ -617,12 +717,25 @@ class ConversationConfiguration {
617
717
  * @param {(Uint8Array)[] | undefined} external_senders
618
718
  * @param {number | undefined} key_rotation_span
619
719
  * @param {number | undefined} wire_policy
720
+ * @param {Array<any>} per_domain_trust_anchors
620
721
  */
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);
722
+ constructor(ciphersuite, external_senders, key_rotation_span, wire_policy, per_domain_trust_anchors) {
723
+ try {
724
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
725
+ var ptr0 = isLikeNone(external_senders) ? 0 : passArrayJsValueToWasm0(external_senders, wasm$1.__wbindgen_malloc);
726
+ var len0 = WASM_VECTOR_LEN;
727
+ 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));
728
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
729
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
730
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
731
+ if (r2) {
732
+ throw takeObject(r1);
733
+ }
734
+ return ConversationConfiguration.__wrap(r0);
735
+ }
736
+ finally {
737
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
738
+ }
626
739
  }
627
740
  }
628
741
  /**
@@ -678,7 +791,7 @@ let CoreCrypto$1 = class CoreCrypto {
678
791
  wasm$1.__wbg_corecrypto_free(ptr);
679
792
  }
680
793
  /**
681
- * Returns: [`WasmCryptoResult<WireE2eIdentity>`]
794
+ * Returns: [`WasmCryptoResult<E2eiEnrollment>`]
682
795
  *
683
796
  * see [core_crypto::mls::MlsCentral::e2ei_new_enrollment]
684
797
  * @param {string} client_id
@@ -699,39 +812,45 @@ let CoreCrypto$1 = class CoreCrypto {
699
812
  return takeObject(ret);
700
813
  }
701
814
  /**
702
- * Returns: [`WasmCryptoResult<WireE2eIdentity>`]
815
+ * Returns: [`WasmCryptoResult<E2eiEnrollment>`]
703
816
  *
704
817
  * see [core_crypto::mls::MlsCentral::e2ei_new_activation_enrollment]
818
+ * @param {string} client_id
705
819
  * @param {string} display_name
706
820
  * @param {string} handle
707
821
  * @param {number} expiry_days
708
822
  * @param {number} ciphersuite
709
823
  * @returns {Promise<any>}
710
824
  */
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);
825
+ e2ei_new_activation_enrollment(client_id, display_name, handle, expiry_days, ciphersuite) {
826
+ const ptr0 = passStringToWasm0(client_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
713
827
  const len0 = WASM_VECTOR_LEN;
714
- const ptr1 = passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
828
+ const ptr1 = passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
715
829
  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);
830
+ const ptr2 = passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
831
+ const len2 = WASM_VECTOR_LEN;
832
+ const ret = wasm$1.corecrypto_e2ei_new_activation_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
717
833
  return takeObject(ret);
718
834
  }
719
835
  /**
720
- * Returns: [`WasmCryptoResult<WireE2eIdentity>`]
836
+ * Returns: [`WasmCryptoResult<E2eiEnrollment>`]
721
837
  *
722
838
  * see [core_crypto::mls::MlsCentral::e2ei_new_rotate_enrollment]
839
+ * @param {string} client_id
723
840
  * @param {string | undefined} display_name
724
841
  * @param {string | undefined} handle
725
842
  * @param {number} expiry_days
726
843
  * @param {number} ciphersuite
727
844
  * @returns {Promise<any>}
728
845
  */
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);
846
+ e2ei_new_rotate_enrollment(client_id, display_name, handle, expiry_days, ciphersuite) {
847
+ const ptr0 = passStringToWasm0(client_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
848
+ const len0 = WASM_VECTOR_LEN;
849
+ var ptr1 = isLikeNone(display_name) ? 0 : passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
733
850
  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);
851
+ var ptr2 = isLikeNone(handle) ? 0 : passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
852
+ var len2 = WASM_VECTOR_LEN;
853
+ const ret = wasm$1.corecrypto_e2ei_new_rotate_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
735
854
  return takeObject(ret);
736
855
  }
737
856
  /**
@@ -788,14 +907,41 @@ let CoreCrypto$1 = class CoreCrypto {
788
907
  /**
789
908
  * Returns [`WasmCryptoResult<bool>`]
790
909
  *
791
- * see [core_crypto::mls::MlsCentral::e2ei_is_degraded]
910
+ * see [core_crypto::mls::MlsCentral::e2ei_conversation_state]
792
911
  * @param {Uint8Array} conversation_id
793
912
  * @returns {Promise<any>}
794
913
  */
795
- e2ei_is_degraded(conversation_id) {
914
+ e2ei_conversation_state(conversation_id) {
796
915
  const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
797
916
  const len0 = WASM_VECTOR_LEN;
798
- const ret = wasm$1.corecrypto_e2ei_is_degraded(this.__wbg_ptr, ptr0, len0);
917
+ const ret = wasm$1.corecrypto_e2ei_conversation_state(this.__wbg_ptr, ptr0, len0);
918
+ return takeObject(ret);
919
+ }
920
+ /**
921
+ * Returns [`WasmCryptoResult<bool>`]
922
+ *
923
+ * see [core_crypto::mls::MlsCentral::e2ei_is_enabled]
924
+ * @param {number} ciphersuite
925
+ * @returns {Promise<any>}
926
+ */
927
+ e2ei_is_enabled(ciphersuite) {
928
+ const ret = wasm$1.corecrypto_e2ei_is_enabled(this.__wbg_ptr, ciphersuite);
929
+ return takeObject(ret);
930
+ }
931
+ /**
932
+ * Returns [`WasmCryptoResult<Vec<WireIdentity>>`]
933
+ *
934
+ * see [core_crypto::mls::MlsCentral::get_user_identities]
935
+ * @param {Uint8Array} conversation_id
936
+ * @param {(Uint8Array)[]} client_ids
937
+ * @returns {Promise<any>}
938
+ */
939
+ get_user_identities(conversation_id, client_ids) {
940
+ const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
941
+ const len0 = WASM_VECTOR_LEN;
942
+ const ptr1 = passArrayJsValueToWasm0(client_ids, wasm$1.__wbindgen_malloc);
943
+ const len1 = WASM_VECTOR_LEN;
944
+ const ret = wasm$1.corecrypto_get_user_identities(this.__wbg_ptr, ptr0, len0, ptr1, len1);
799
945
  return takeObject(ret);
800
946
  }
801
947
  /**
@@ -1177,9 +1323,26 @@ let CoreCrypto$1 = class CoreCrypto {
1177
1323
  return takeObject(ret);
1178
1324
  }
1179
1325
  /**
1326
+ * Returns: [`WasmCryptoResult<CommitBundle>`]
1327
+ *
1328
+ * see [core_crypto::mls::MlsCentral::update_trust_anchors_from_conversation]
1329
+ * @param {Uint8Array} conversation_id
1330
+ * @param {(string)[]} remove_domain_names
1331
+ * @param {Array<any>} add_trust_anchors
1332
+ * @returns {Promise<any>}
1333
+ */
1334
+ update_trust_anchors_from_conversation(conversation_id, remove_domain_names, add_trust_anchors) {
1335
+ const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
1336
+ const len0 = WASM_VECTOR_LEN;
1337
+ const ptr1 = passArrayJsValueToWasm0(remove_domain_names, wasm$1.__wbindgen_malloc);
1338
+ const len1 = WASM_VECTOR_LEN;
1339
+ const ret = wasm$1.corecrypto_update_trust_anchors_from_conversation(this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(add_trust_anchors));
1340
+ return takeObject(ret);
1341
+ }
1342
+ /**
1180
1343
  * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
1181
1344
  *
1182
- * see [core_crypto::mls::MlsCentral::new_proposal]
1345
+ * see [core_crypto::mls::MlsCentral::new_add_proposal]
1183
1346
  * @param {Uint8Array} conversation_id
1184
1347
  * @param {Uint8Array} keypackage
1185
1348
  * @returns {Promise<any>}
@@ -1195,7 +1358,7 @@ let CoreCrypto$1 = class CoreCrypto {
1195
1358
  /**
1196
1359
  * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
1197
1360
  *
1198
- * see [core_crypto::mls::MlsCentral::new_proposal]
1361
+ * see [core_crypto::mls::MlsCentral::new_update_proposal]
1199
1362
  * @param {Uint8Array} conversation_id
1200
1363
  * @returns {Promise<any>}
1201
1364
  */
@@ -1208,7 +1371,7 @@ let CoreCrypto$1 = class CoreCrypto {
1208
1371
  /**
1209
1372
  * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
1210
1373
  *
1211
- * see [core_crypto::mls::MlsCentral::new_proposal]
1374
+ * see [core_crypto::mls::MlsCentral::new_remove_proposal]
1212
1375
  * @param {Uint8Array} conversation_id
1213
1376
  * @param {Uint8Array} client_id
1214
1377
  * @returns {Promise<any>}
@@ -1719,14 +1882,14 @@ class DecryptedMessage {
1719
1882
  * @returns {any}
1720
1883
  */
1721
1884
  get message() {
1722
- const ret = wasm$1.decryptedmessage_message(this.__wbg_ptr);
1885
+ const ret = wasm$1.buffereddecryptedmessage_message(this.__wbg_ptr);
1723
1886
  return takeObject(ret);
1724
1887
  }
1725
1888
  /**
1726
1889
  * @returns {Array<any>}
1727
1890
  */
1728
1891
  get proposals() {
1729
- const ret = wasm$1.decryptedmessage_proposals(this.__wbg_ptr);
1892
+ const ret = wasm$1.buffereddecryptedmessage_proposals(this.__wbg_ptr);
1730
1893
  return takeObject(ret);
1731
1894
  }
1732
1895
  /**
@@ -1742,7 +1905,7 @@ class DecryptedMessage {
1742
1905
  get commit_delay() {
1743
1906
  try {
1744
1907
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
1745
- wasm$1.decryptedmessage_commit_delay(retptr, this.__wbg_ptr);
1908
+ wasm$1.buffereddecryptedmessage_commit_delay(retptr, this.__wbg_ptr);
1746
1909
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1747
1910
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1748
1911
  return r0 === 0 ? undefined : r1 >>> 0;
@@ -1755,7 +1918,7 @@ class DecryptedMessage {
1755
1918
  * @returns {any}
1756
1919
  */
1757
1920
  get sender_client_id() {
1758
- const ret = wasm$1.decryptedmessage_sender_client_id(this.__wbg_ptr);
1921
+ const ret = wasm$1.buffereddecryptedmessage_sender_client_id(this.__wbg_ptr);
1759
1922
  return takeObject(ret);
1760
1923
  }
1761
1924
  /**
@@ -1769,9 +1932,16 @@ class DecryptedMessage {
1769
1932
  * @returns {WireIdentity | undefined}
1770
1933
  */
1771
1934
  get identity() {
1772
- const ret = wasm$1.decryptedmessage_identity(this.__wbg_ptr);
1935
+ const ret = wasm$1.buffereddecryptedmessage_identity(this.__wbg_ptr);
1773
1936
  return ret === 0 ? undefined : WireIdentity.__wrap(ret);
1774
1937
  }
1938
+ /**
1939
+ * @returns {Array<any> | undefined}
1940
+ */
1941
+ get buffered_messages() {
1942
+ const ret = wasm$1.decryptedmessage_buffered_messages(this.__wbg_ptr);
1943
+ return takeObject(ret);
1944
+ }
1775
1945
  }
1776
1946
  /**
1777
1947
  */
@@ -2436,6 +2606,37 @@ class NewAcmeOrder {
2436
2606
  }
2437
2607
  /**
2438
2608
  */
2609
+ class PerDomainTrustAnchor {
2610
+ static __wrap(ptr) {
2611
+ ptr = ptr >>> 0;
2612
+ const obj = Object.create(PerDomainTrustAnchor.prototype);
2613
+ obj.__wbg_ptr = ptr;
2614
+ return obj;
2615
+ }
2616
+ __destroy_into_raw() {
2617
+ const ptr = this.__wbg_ptr;
2618
+ this.__wbg_ptr = 0;
2619
+ return ptr;
2620
+ }
2621
+ free() {
2622
+ const ptr = this.__destroy_into_raw();
2623
+ wasm$1.__wbg_perdomaintrustanchor_free(ptr);
2624
+ }
2625
+ /**
2626
+ * @param {string} domain_name
2627
+ * @param {string} intermediate_certificate_chain
2628
+ */
2629
+ constructor(domain_name, intermediate_certificate_chain) {
2630
+ const ptr0 = passStringToWasm0(domain_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
2631
+ const len0 = WASM_VECTOR_LEN;
2632
+ const ptr1 = passStringToWasm0(intermediate_certificate_chain, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
2633
+ const len1 = WASM_VECTOR_LEN;
2634
+ const ret = wasm$1.perdomaintrustanchor_new(ptr0, len0, ptr1, len1);
2635
+ return PerDomainTrustAnchor.__wrap(ret);
2636
+ }
2637
+ }
2638
+ /**
2639
+ */
2439
2640
  class ProposalBundle {
2440
2641
  static __wrap(ptr) {
2441
2642
  ptr = ptr >>> 0;
@@ -2537,7 +2738,7 @@ class RotateBundle {
2537
2738
  wasm$1.__wbg_rotatebundle_free(ptr);
2538
2739
  }
2539
2740
  /**
2540
- * @returns {Array<any>}
2741
+ * @returns {Map<any, any>}
2541
2742
  */
2542
2743
  get commits() {
2543
2744
  const ret = wasm$1.rotatebundle_commits(this.__wbg_ptr);
@@ -2602,8 +2803,9 @@ class WireIdentity {
2602
2803
  * @param {string} handle
2603
2804
  * @param {string} display_name
2604
2805
  * @param {string} domain
2806
+ * @param {string} certificate
2605
2807
  */
2606
- constructor(client_id, handle, display_name, domain) {
2808
+ constructor(client_id, handle, display_name, domain, certificate) {
2607
2809
  const ptr0 = passStringToWasm0(client_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
2608
2810
  const len0 = WASM_VECTOR_LEN;
2609
2811
  const ptr1 = passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
@@ -2612,7 +2814,9 @@ class WireIdentity {
2612
2814
  const len2 = WASM_VECTOR_LEN;
2613
2815
  const ptr3 = passStringToWasm0(domain, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
2614
2816
  const len3 = WASM_VECTOR_LEN;
2615
- const ret = wasm$1.wireidentity_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
2817
+ const ptr4 = passStringToWasm0(certificate, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
2818
+ const len4 = WASM_VECTOR_LEN;
2819
+ const ret = wasm$1.wireidentity_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
2616
2820
  return WireIdentity.__wrap(ret);
2617
2821
  }
2618
2822
  /**
@@ -2683,7 +2887,27 @@ class WireIdentity {
2683
2887
  let deferred1_1;
2684
2888
  try {
2685
2889
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
2686
- wasm$1.wireidentity_domain(retptr, this.__wbg_ptr);
2890
+ wasm$1.acmedirectory_revokeCert(retptr, this.__wbg_ptr);
2891
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2892
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2893
+ deferred1_0 = r0;
2894
+ deferred1_1 = r1;
2895
+ return getStringFromWasm0(r0, r1);
2896
+ }
2897
+ finally {
2898
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
2899
+ wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
2900
+ }
2901
+ }
2902
+ /**
2903
+ * @returns {string}
2904
+ */
2905
+ get certificate() {
2906
+ let deferred1_0;
2907
+ let deferred1_1;
2908
+ try {
2909
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
2910
+ wasm$1.wireidentity_certificate(retptr, this.__wbg_ptr);
2687
2911
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2688
2912
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2689
2913
  deferred1_0 = r0;
@@ -2801,14 +3025,6 @@ function __wbg_get_imports() {
2801
3025
  const ret = new Uint8Array(getObject(arg0));
2802
3026
  return addHeapObject(ret);
2803
3027
  };
2804
- imports.wbg.__wbg_new_898a68150f225f2e = function () {
2805
- const ret = new Array();
2806
- return addHeapObject(ret);
2807
- };
2808
- imports.wbg.__wbg_push_ca1c26067ef907ac = function (arg0, arg1) {
2809
- const ret = getObject(arg0).push(getObject(arg1));
2810
- return ret;
2811
- };
2812
3028
  imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
2813
3029
  const ret = FfiWireE2EIdentity.__wrap(arg0);
2814
3030
  return addHeapObject(ret);
@@ -2817,21 +3033,25 @@ function __wbg_get_imports() {
2817
3033
  const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2818
3034
  return addHeapObject(ret);
2819
3035
  };
2820
- imports.wbg.__wbg_new_b51585de1b234aff = function () {
2821
- const ret = new Object();
3036
+ imports.wbg.__wbindgen_number_new = function (arg0) {
3037
+ const ret = arg0;
2822
3038
  return addHeapObject(ret);
2823
3039
  };
2824
- imports.wbg.__wbg_set_502d29070ea18557 = function (arg0, arg1, arg2) {
2825
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2826
- };
2827
- imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2828
- const ret = BigInt.asUintN(64, arg0);
3040
+ imports.wbg.__wbg_new_898a68150f225f2e = function () {
3041
+ const ret = new Array();
2829
3042
  return addHeapObject(ret);
2830
3043
  };
2831
- imports.wbg.__wbindgen_number_new = function (arg0) {
2832
- const ret = arg0;
3044
+ imports.wbg.__wbg_push_ca1c26067ef907ac = function (arg0, arg1) {
3045
+ const ret = getObject(arg0).push(getObject(arg1));
3046
+ return ret;
3047
+ };
3048
+ imports.wbg.__wbg_new_b51585de1b234aff = function () {
3049
+ const ret = new Object();
2833
3050
  return addHeapObject(ret);
2834
3051
  };
3052
+ imports.wbg.__wbg_set_841ac57cff3d672b = function (arg0, arg1, arg2) {
3053
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
3054
+ };
2835
3055
  imports.wbg.__wbg_new_56693dbed0c32988 = function () {
2836
3056
  const ret = new Map();
2837
3057
  return addHeapObject(ret);
@@ -2840,22 +3060,29 @@ function __wbg_get_imports() {
2840
3060
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2841
3061
  return addHeapObject(ret);
2842
3062
  };
3063
+ imports.wbg.__wbg_set_502d29070ea18557 = function (arg0, arg1, arg2) {
3064
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
3065
+ };
3066
+ imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
3067
+ const ret = BigInt.asUintN(64, arg0);
3068
+ return addHeapObject(ret);
3069
+ };
2843
3070
  imports.wbg.__wbg_new_d258248ed531ff54 = function (arg0, arg1) {
2844
3071
  const ret = new Error(getStringFromWasm0(arg0, arg1));
2845
3072
  return addHeapObject(ret);
2846
3073
  };
2847
- imports.wbg.__wbg_openCursor_555d508ba71b21cc = function () {
2848
- return handleError(function (arg0, arg1) {
2849
- const ret = getObject(arg0).openCursor(getObject(arg1));
2850
- return addHeapObject(ret);
2851
- }, arguments);
2852
- };
2853
3074
  imports.wbg.__wbg_openCursor_4d6f62b69b34be26 = function () {
2854
3075
  return handleError(function (arg0) {
2855
3076
  const ret = getObject(arg0).openCursor();
2856
3077
  return addHeapObject(ret);
2857
3078
  }, arguments);
2858
3079
  };
3080
+ imports.wbg.__wbg_openCursor_555d508ba71b21cc = function () {
3081
+ return handleError(function (arg0, arg1) {
3082
+ const ret = getObject(arg0).openCursor(getObject(arg1));
3083
+ return addHeapObject(ret);
3084
+ }, arguments);
3085
+ };
2859
3086
  imports.wbg.__wbg_setonsuccess_f518a37d8228a576 = function (arg0, arg1) {
2860
3087
  getObject(arg0).onsuccess = getObject(arg1);
2861
3088
  };
@@ -2912,9 +3139,6 @@ function __wbg_get_imports() {
2912
3139
  const ret = CoreCrypto$1.__wrap(arg0);
2913
3140
  return addHeapObject(ret);
2914
3141
  };
2915
- imports.wbg.__wbg_set_841ac57cff3d672b = function (arg0, arg1, arg2) {
2916
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2917
- };
2918
3142
  imports.wbg.__wbg_instanceof_Promise_0e98a5bf082e090f = function (arg0) {
2919
3143
  let result;
2920
3144
  try {
@@ -2966,7 +3190,7 @@ function __wbg_get_imports() {
2966
3190
  const a = state0.a;
2967
3191
  state0.a = 0;
2968
3192
  try {
2969
- return __wbg_adapter_296(a, state0.b, arg0, arg1);
3193
+ return __wbg_adapter_312(a, state0.b, arg0, arg1);
2970
3194
  }
2971
3195
  finally {
2972
3196
  state0.a = a;
@@ -2979,6 +3203,10 @@ function __wbg_get_imports() {
2979
3203
  state0.a = state0.b = 0;
2980
3204
  }
2981
3205
  };
3206
+ imports.wbg.__wbindgen_is_string = function (arg0) {
3207
+ const ret = typeof (getObject(arg0)) === 'string';
3208
+ return ret;
3209
+ };
2982
3210
  imports.wbg.__wbg_reject_7bd6ac9617013c02 = function (arg0) {
2983
3211
  const ret = Promise.reject(getObject(arg0));
2984
3212
  return addHeapObject(ret);
@@ -2987,6 +3215,10 @@ function __wbg_get_imports() {
2987
3215
  const ret = ProposalBundle.__wrap(arg0);
2988
3216
  return addHeapObject(ret);
2989
3217
  };
3218
+ imports.wbg.__wbg_buffereddecryptedmessage_new = function (arg0) {
3219
+ const ret = BufferedDecryptedMessage.__wrap(arg0);
3220
+ return addHeapObject(ret);
3221
+ };
2990
3222
  imports.wbg.__wbg_commitbundle_new = function (arg0) {
2991
3223
  const ret = CommitBundle.__wrap(arg0);
2992
3224
  return addHeapObject(ret);
@@ -3056,11 +3288,9 @@ function __wbg_get_imports() {
3056
3288
  return addHeapObject(ret);
3057
3289
  }, arguments);
3058
3290
  };
3059
- imports.wbg.__wbg_put_fb32824d87feec5c = function () {
3060
- return handleError(function (arg0, arg1, arg2) {
3061
- const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
3062
- return addHeapObject(ret);
3063
- }, arguments);
3291
+ imports.wbg.__wbg_now_9c5990bda04c7e53 = function () {
3292
+ const ret = Date.now();
3293
+ return ret;
3064
3294
  };
3065
3295
  imports.wbg.__wbg_put_d6937bc51f51a398 = function () {
3066
3296
  return handleError(function (arg0, arg1) {
@@ -3068,6 +3298,12 @@ function __wbg_get_imports() {
3068
3298
  return addHeapObject(ret);
3069
3299
  }, arguments);
3070
3300
  };
3301
+ imports.wbg.__wbg_put_fb32824d87feec5c = function () {
3302
+ return handleError(function (arg0, arg1, arg2) {
3303
+ const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
3304
+ return addHeapObject(ret);
3305
+ }, arguments);
3306
+ };
3071
3307
  imports.wbg.__wbg_delete_ca1cfc48f1f7981c = function () {
3072
3308
  return handleError(function (arg0, arg1) {
3073
3309
  const ret = getObject(arg0).delete(getObject(arg1));
@@ -3098,10 +3334,6 @@ function __wbg_get_imports() {
3098
3334
  return addHeapObject(ret);
3099
3335
  }, arguments);
3100
3336
  };
3101
- imports.wbg.__wbg_now_9c5990bda04c7e53 = function () {
3102
- const ret = Date.now();
3103
- return ret;
3104
- };
3105
3337
  imports.wbg.__wbindgen_memory = function () {
3106
3338
  const ret = wasm$1.memory;
3107
3339
  return addHeapObject(ret);
@@ -3144,10 +3376,6 @@ function __wbg_get_imports() {
3144
3376
  const ret = getObject(arg0).node;
3145
3377
  return addHeapObject(ret);
3146
3378
  };
3147
- imports.wbg.__wbindgen_is_string = function (arg0) {
3148
- const ret = typeof (getObject(arg0)) === 'string';
3149
- return ret;
3150
- };
3151
3379
  imports.wbg.__wbg_require_8f08ceecec0f4fee = function () {
3152
3380
  return handleError(function () {
3153
3381
  const ret = module.require;
@@ -3415,12 +3643,12 @@ function __wbg_get_imports() {
3415
3643
  return addHeapObject(ret);
3416
3644
  }, arguments);
3417
3645
  };
3418
- imports.wbg.__wbindgen_closure_wrapper1977 = function (arg0, arg1, arg2) {
3419
- const ret = makeMutClosure(arg0, arg1, 166, __wbg_adapter_52);
3646
+ imports.wbg.__wbindgen_closure_wrapper1718 = function (arg0, arg1, arg2) {
3647
+ const ret = makeMutClosure(arg0, arg1, 149, __wbg_adapter_52);
3420
3648
  return addHeapObject(ret);
3421
3649
  };
3422
- imports.wbg.__wbindgen_closure_wrapper4646 = function (arg0, arg1, arg2) {
3423
- const ret = makeMutClosure(arg0, arg1, 166, __wbg_adapter_55);
3650
+ imports.wbg.__wbindgen_closure_wrapper4849 = function (arg0, arg1, arg2) {
3651
+ const ret = makeMutClosure(arg0, arg1, 149, __wbg_adapter_55);
3424
3652
  return addHeapObject(ret);
3425
3653
  };
3426
3654
  return imports;
@@ -3461,6 +3689,7 @@ var exports = /*#__PURE__*/Object.freeze({
3461
3689
  __proto__: null,
3462
3690
  AcmeChallenge: AcmeChallenge,
3463
3691
  AcmeDirectory: AcmeDirectory,
3692
+ BufferedDecryptedMessage: BufferedDecryptedMessage,
3464
3693
  Ciphersuite: Ciphersuite$1,
3465
3694
  CommitBundle: CommitBundle,
3466
3695
  ConversationConfiguration: ConversationConfiguration,
@@ -3476,6 +3705,7 @@ var exports = /*#__PURE__*/Object.freeze({
3476
3705
  MemberAddedMessages: MemberAddedMessages,
3477
3706
  NewAcmeAuthz: NewAcmeAuthz,
3478
3707
  NewAcmeOrder: NewAcmeOrder,
3708
+ PerDomainTrustAnchor: PerDomainTrustAnchor,
3479
3709
  ProposalBundle: ProposalBundle,
3480
3710
  ProteusAutoPrekeyBundle: ProteusAutoPrekeyBundle,
3481
3711
  RotateBundle: RotateBundle,
@@ -3485,26 +3715,35 @@ var exports = /*#__PURE__*/Object.freeze({
3485
3715
  initSync: initSync
3486
3716
  });
3487
3717
 
3488
- var wasm = async (opt = {}) => {
3489
- let {importHook, serverPath} = opt;
3718
+ const wasm_path = "assets/core_crypto_ffi-c595f07a.wasm";
3490
3719
 
3491
- let path = "assets/core_crypto_ffi-ca75d34d.wasm";
3720
+
3721
+ var wasm = async (opt = {}) => {
3722
+ let {importHook, serverPath, initializeHook} = opt;
3723
+
3724
+ let final_path = wasm_path;
3492
3725
 
3493
3726
  if (serverPath != null) {
3494
- path = serverPath + /[^\/\\]*$/.exec(path)[0];
3727
+ final_path = serverPath + /[^\/\\]*$/.exec(final_path)[0];
3495
3728
  }
3496
3729
 
3497
3730
  if (importHook != null) {
3498
- path = importHook(path);
3731
+ final_path = importHook(final_path);
3732
+ }
3733
+
3734
+ if (initializeHook != null) {
3735
+ await initializeHook(__wbg_init, final_path);
3736
+
3737
+ } else {
3738
+ await __wbg_init(final_path);
3499
3739
  }
3500
3740
 
3501
- await __wbg_init(path);
3502
3741
  return exports;
3503
3742
  };
3504
3743
 
3505
3744
  // Wire
3506
3745
  // Copyright (C) 2022 Wire Swiss GmbH
3507
- var _a, _CoreCrypto_module, _CoreCrypto_cc, _CoreCrypto_assertModuleLoaded, _WireE2eIdentity_e2ei;
3746
+ var _a, _CoreCrypto_module, _CoreCrypto_cc, _CoreCrypto_assertModuleLoaded, _E2eiEnrollment_enrollment;
3508
3747
  /**
3509
3748
  * Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
3510
3749
  *
@@ -3812,7 +4051,7 @@ class CoreCrypto {
3812
4051
  /**
3813
4052
  * Closes this {@link CoreCrypto} instance and deallocates all loaded resources
3814
4053
  *
3815
- * **CAUTION**: This {@link CoreCrypto} instance won't be useable after a call to this method, but there's no way to express this requirement in TypeScript so you'll get errors instead!
4054
+ * **CAUTION**: This {@link CoreCrypto} instance won't be usable after a call to this method, but there's no way to express this requirement in TypeScript, so you'll get errors instead!
3816
4055
  */
3817
4056
  async close() {
3818
4057
  await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").close());
@@ -3896,8 +4135,8 @@ class CoreCrypto {
3896
4135
  */
3897
4136
  async createConversation(conversationId, creatorCredentialType, configuration = {}) {
3898
4137
  try {
3899
- const { ciphersuite, externalSenders, custom = {} } = configuration || {};
3900
- const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(ciphersuite, externalSenders, custom?.keyRotationSpan);
4138
+ const { ciphersuite, externalSenders, custom = {}, perDomainTrustAnchors = [] } = configuration || {};
4139
+ const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(ciphersuite, externalSenders, custom?.keyRotationSpan, custom?.wirePolicy, perDomainTrustAnchors);
3901
4140
  const ret = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").create_conversation(conversationId, creatorCredentialType, config));
3902
4141
  return ret;
3903
4142
  }
@@ -3906,7 +4145,12 @@ class CoreCrypto {
3906
4145
  }
3907
4146
  }
3908
4147
  /**
3909
- * Decrypts a message for a given conversation
4148
+ * Decrypts a message for a given conversation.
4149
+ *
4150
+ * Note: you should catch & ignore the following error reasons:
4151
+ * * "We already decrypted this message once"
4152
+ * * "You tried to join with an external commit but did not merge it yet. We will reapply this message for you when you merge your external commit"
4153
+ * * "Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives"
3910
4154
  *
3911
4155
  * @param conversationId - The ID of the conversation
3912
4156
  * @param payload - The encrypted message buffer
@@ -3931,6 +4175,16 @@ class CoreCrypto {
3931
4175
  senderClientId: ffiDecryptedMessage.sender_client_id,
3932
4176
  commitDelay,
3933
4177
  hasEpochChanged: ffiDecryptedMessage.has_epoch_changed,
4178
+ bufferedMessages: ffiDecryptedMessage.buffered_messages?.map(m => {
4179
+ return {
4180
+ message: m.message,
4181
+ proposals: m.proposals,
4182
+ isActive: m.is_active,
4183
+ senderClientId: m.sender_client_id,
4184
+ commitDelay: m.commit_delay,
4185
+ hasEpochChanged: m.has_epoch_changed,
4186
+ };
4187
+ }),
3934
4188
  };
3935
4189
  return ret;
3936
4190
  }
@@ -3949,9 +4203,47 @@ class CoreCrypto {
3949
4203
  async encryptMessage(conversationId, message) {
3950
4204
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").encrypt_message(conversationId, message));
3951
4205
  }
4206
+ /**
4207
+ * Updates the trust anchors for a conversation. This should be called when a federated event happens (new team added/removed).
4208
+ * Clients should add and/or remove trust anchors from the new backend to the conversation. The method will check
4209
+ * for duplicated domains and the validity of the certificate chain.
4210
+ *
4211
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
4212
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
4213
+ * epoch, use new encryption secrets etc...
4214
+ *
4215
+ * @param conversationId - The ID of the conversation
4216
+ * @param removeDomainNames - Domains to remove from the trust anchors
4217
+ * @param addTrustAnchors - New trust anchors to add to the conversation
4218
+ *
4219
+ * @returns A {@link CommitBundle}
4220
+ */
4221
+ async updateTrustAnchorsFromConversation(conversationId, removeDomainNames, addTrustAnchors) {
4222
+ try {
4223
+ const ffiRet = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").update_trust_anchors_from_conversation(conversationId, removeDomainNames, addTrustAnchors));
4224
+ const gi = ffiRet.group_info;
4225
+ const ret = {
4226
+ welcome: ffiRet.welcome,
4227
+ commit: ffiRet.commit,
4228
+ groupInfo: {
4229
+ encryptionType: gi.encryption_type,
4230
+ ratchetTreeType: gi.ratchet_tree_type,
4231
+ payload: gi.payload
4232
+ },
4233
+ };
4234
+ return ret;
4235
+ }
4236
+ catch (e) {
4237
+ throw CoreCryptoError.fromStdError(e);
4238
+ }
4239
+ }
3952
4240
  /**
3953
4241
  * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
3954
4242
  *
4243
+ * Important: you have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
4244
+ * it references has already been deleted locally. Join this group with an external commit", ignore it and then try
4245
+ * to join this group with an external commit.
4246
+ *
3955
4247
  * @param welcomeMessage - TLS-serialized MLS Welcome message
3956
4248
  * @param configuration - configuration of the MLS group
3957
4249
  * @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
@@ -3967,7 +4259,10 @@ class CoreCrypto {
3967
4259
  }
3968
4260
  }
3969
4261
  /**
3970
- * @returns The client's public key
4262
+ * Get the client's public signature key. To upload to the DS for further backend side validation
4263
+ *
4264
+ * @param ciphersuite - of the signature key to get
4265
+ * @returns the client's public signature key
3971
4266
  */
3972
4267
  async clientPublicKey(ciphersuite) {
3973
4268
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").client_public_key(ciphersuite));
@@ -4004,7 +4299,7 @@ class CoreCrypto {
4004
4299
  /**
4005
4300
  * Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
4006
4301
  *
4007
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
4302
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
4008
4303
  * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
4009
4304
  * epoch, use new encryption secrets etc...
4010
4305
  *
@@ -4038,7 +4333,7 @@ class CoreCrypto {
4038
4333
  * Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
4039
4334
  * to do so, otherwise this operation does nothing.
4040
4335
  *
4041
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
4336
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
4042
4337
  * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
4043
4338
  * epoch, use new encryption secrets etc...
4044
4339
  *
@@ -4067,9 +4362,9 @@ class CoreCrypto {
4067
4362
  }
4068
4363
  }
4069
4364
  /**
4070
- * Creates an update commit which forces every client to update their keypackages in the conversation
4365
+ * Creates an update commit which forces every client to update their LeafNode in the conversation
4071
4366
  *
4072
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
4367
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
4073
4368
  * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
4074
4369
  * epoch, use new encryption secrets etc...
4075
4370
  *
@@ -4157,6 +4452,9 @@ class CoreCrypto {
4157
4452
  throw new Error("Invalid proposal type!");
4158
4453
  }
4159
4454
  }
4455
+ /**
4456
+ * Creates a new external Add proposal for self client to join a conversation.
4457
+ */
4160
4458
  async newExternalProposal(externalProposalType, args) {
4161
4459
  switch (externalProposalType) {
4162
4460
  case ExternalProposalType.Add: {
@@ -4210,6 +4508,7 @@ class CoreCrypto {
4210
4508
  * and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
4211
4509
  *
4212
4510
  * @param conversationId - The ID of the conversation
4511
+ * @returns eventually decrypted buffered messages if any
4213
4512
  */
4214
4513
  async mergePendingGroupFromExternalCommit(conversationId) {
4215
4514
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").merge_pending_group_from_external_commit(conversationId));
@@ -4225,20 +4524,19 @@ class CoreCrypto {
4225
4524
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").clear_pending_group_from_external_commit(conversationId));
4226
4525
  }
4227
4526
  /**
4228
- * Allows to mark the latest commit produced as "accepted" and be able to safely merge it
4229
- * into the local group state
4527
+ * Allows to mark the latest commit produced as "accepted" and be able to safely merge it into the local group state
4230
4528
  *
4231
4529
  * @param conversationId - The group's ID
4530
+ * @returns the messages from current epoch which had been buffered, if any
4232
4531
  */
4233
4532
  async commitAccepted(conversationId) {
4234
4533
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").commit_accepted(conversationId));
4235
4534
  }
4236
4535
  /**
4237
- * Allows to remove a pending proposal (rollback). Use this when backend rejects the proposal you just sent e.g. if permissions
4238
- * have changed meanwhile.
4536
+ * Allows to remove a pending proposal (rollback). Use this when backend rejects the proposal you just sent e.g. if permissions have changed meanwhile.
4239
4537
  *
4240
4538
  * **CAUTION**: only use this when you had an explicit response from the Delivery Service
4241
- * e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc..
4539
+ * e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc
4242
4540
  *
4243
4541
  * @param conversationId - The group's ID
4244
4542
  * @param proposalRef - A reference to the proposal to delete. You get one when using {@link CoreCrypto.newProposal}
@@ -4247,8 +4545,7 @@ class CoreCrypto {
4247
4545
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").clear_pending_proposal(conversationId, proposalRef));
4248
4546
  }
4249
4547
  /**
4250
- * Allows to remove a pending commit (rollback). Use this when backend rejects the commit you just sent e.g. if permissions
4251
- * have changed meanwhile.
4548
+ * Allows to remove a pending commit (rollback). Use this when backend rejects the commit you just sent e.g. if permissions have changed meanwhile.
4252
4549
  *
4253
4550
  * **CAUTION**: only use this when you had an explicit response from the Delivery Service
4254
4551
  * e.g. 403. Do not use otherwise e.g. 5xx responses, timeout etc..
@@ -4305,7 +4602,7 @@ class CoreCrypto {
4305
4602
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").reseed_rng(seed));
4306
4603
  }
4307
4604
  /**
4308
- * Initiailizes the proteus client
4605
+ * Initializes the proteus client
4309
4606
  */
4310
4607
  async proteusInit() {
4311
4608
  return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_init());
@@ -4482,54 +4779,56 @@ class CoreCrypto {
4482
4779
  * Creates an enrollment instance with private key material you can use in order to fetch
4483
4780
  * a new x509 certificate from the acme server.
4484
4781
  *
4485
- * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
4486
- * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
4487
- * @param handle user handle e.g. `alice.smith.qa@example.com`
4488
- * @param expiryDays generated x509 certificate expiry
4782
+ * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
4783
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
4784
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
4785
+ * @param expiryDays - generated x509 certificate expiry
4489
4786
  * @param ciphersuite - for generating signing key material
4490
- * @returns The new {@link WireE2eIdentity} object
4787
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiMlsInitOnly}
4491
4788
  */
4492
4789
  async e2eiNewEnrollment(clientId, displayName, handle, expiryDays, ciphersuite) {
4493
4790
  const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_new_enrollment(clientId, displayName, handle, expiryDays, ciphersuite));
4494
- return new WireE2eIdentity(e2ei);
4791
+ return new E2eiEnrollment(e2ei);
4495
4792
  }
4496
4793
  /**
4497
4794
  * 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
4795
  * Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
4500
4796
  *
4501
- * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
4502
- * @param handle user handle e.g. `alice.smith.qa@example.com`
4503
- * @param expiryDays generated x509 certificate expiry
4797
+ * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
4798
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
4799
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
4800
+ * @param expiryDays - generated x509 certificate expiry
4504
4801
  * @param ciphersuite - for generating signing key material
4505
- * @returns The new {@link WireE2eIdentity} object
4802
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
4506
4803
  */
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));
4509
- return new WireE2eIdentity(e2ei);
4804
+ async e2eiNewActivationEnrollment(clientId, displayName, handle, expiryDays, ciphersuite) {
4805
+ const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_new_activation_enrollment(clientId, displayName, handle, expiryDays, ciphersuite));
4806
+ return new E2eiEnrollment(e2ei);
4510
4807
  }
4511
4808
  /**
4512
4809
  * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
4513
4810
  * 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
4811
+ * has been revoked. It lets you change the DisplayName or the handle
4516
4812
  * if you need to. Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
4517
4813
  *
4518
- * @param expiryDays generated x509 certificate expiry
4814
+ * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
4815
+ * @param expiryDays - generated x509 certificate expiry
4519
4816
  * @param ciphersuite - for generating signing key material
4520
- * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
4521
- * @param handle user handle e.g. `alice.smith.qa@example.com`
4522
- * @returns The new {@link WireE2eIdentity} object
4817
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
4818
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
4819
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
4523
4820
  */
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));
4526
- return new WireE2eIdentity(e2ei);
4821
+ async e2eiNewRotateEnrollment(clientId, expiryDays, ciphersuite, displayName, handle) {
4822
+ const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_new_rotate_enrollment(clientId, displayName, handle, expiryDays, ciphersuite));
4823
+ return new E2eiEnrollment(e2ei);
4527
4824
  }
4528
4825
  /**
4529
- * 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
4826
+ * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
4827
+ * that means he cannot initialize with a Basic credential
4530
4828
  *
4531
4829
  * @param enrollment - the enrollment instance used to fetch the certificates
4532
4830
  * @param certificateChain - the raw response from ACME server
4831
+ * @returns a MlsClient initialized with only a x509 credential
4533
4832
  */
4534
4833
  async e2eiMlsInitOnly(enrollment, certificateChain) {
4535
4834
  return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_mls_init_only(enrollment.inner(), certificateChain);
@@ -4542,9 +4841,16 @@ class CoreCrypto {
4542
4841
  * @param enrollment - the enrollment instance used to fetch the certificates
4543
4842
  * @param certificateChain - the raw response from ACME server
4544
4843
  * @param newKeyPackageCount - number of KeyPackages with new identity to generate
4844
+ * @returns a {@link RotateBundle} with commits to fan-out to other group members, KeyPackages to upload and old ones to delete
4545
4845
  */
4546
4846
  async e2eiRotateAll(enrollment, certificateChain, newKeyPackageCount) {
4547
- return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_rotate_all(enrollment.inner(), certificateChain, newKeyPackageCount);
4847
+ const ffiRet = await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_rotate_all(enrollment.inner(), certificateChain, newKeyPackageCount);
4848
+ const ret = {
4849
+ commits: ffiRet.commits,
4850
+ newKeyPackages: ffiRet.new_key_packages,
4851
+ keyPackageRefsToRemove: ffiRet.key_package_refs_to_remove,
4852
+ };
4853
+ return ret;
4548
4854
  }
4549
4855
  /**
4550
4856
  * Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
@@ -4564,17 +4870,39 @@ class CoreCrypto {
4564
4870
  */
4565
4871
  async e2eiEnrollmentStashPop(handle) {
4566
4872
  const e2ei = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_enrollment_stash_pop(handle));
4567
- return new WireE2eIdentity(e2ei);
4873
+ return new E2eiEnrollment(e2ei);
4568
4874
  }
4569
4875
  /**
4570
4876
  * Indicates when to mark a conversation as degraded i.e. when not all its members have a X509.
4571
4877
  * Credential generated by Wire's end-to-end identity enrollment
4572
4878
  *
4573
4879
  * @param conversationId The group's ID
4574
- * @returns true if all the members have valid X509 credentials
4880
+ * @returns the conversation state given current members
4881
+ */
4882
+ async e2eiConversationState(conversationId) {
4883
+ let state = await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_conversation_state(conversationId));
4884
+ // @ts-ignore
4885
+ return E2eiConversationState[E2eiConversationState[state]];
4886
+ }
4887
+ /**
4888
+ * Returns true when end-to-end-identity is enabled for the given Ciphersuite
4889
+ *
4890
+ * @param ciphersuite of the credential to check
4891
+ * @returns true if end-to-end identity is enabled for the given ciphersuite
4575
4892
  */
4576
- async e2eiIsDegraded(conversationId) {
4577
- return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_is_degraded(conversationId));
4893
+ async e2eiIsEnabled(ciphersuite) {
4894
+ return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").e2ei_is_enabled(ciphersuite));
4895
+ }
4896
+ /**
4897
+ * From a given conversation, get the identity of the members supplied. Identity is only present for members with a
4898
+ * Certificate Credential (after turning on end-to-end identity).
4899
+ *
4900
+ * @param conversationId - identifier of the conversation
4901
+ * @param clientIds - identifiers of the user
4902
+ * @returns identities or if no member has a x509 certificate, it will return an empty List
4903
+ */
4904
+ async getUserIdentities(conversationId, clientIds) {
4905
+ return await CoreCryptoError.asyncMapErr(__classPrivateFieldGet(this, _CoreCrypto_cc, "f").get_user_identities(conversationId, clientIds));
4578
4906
  }
4579
4907
  /**
4580
4908
  * Returns the current version of {@link CoreCrypto}
@@ -4593,21 +4921,21 @@ _a = CoreCrypto, _CoreCrypto_cc = new WeakMap(), _CoreCrypto_assertModuleLoaded
4593
4921
  };
4594
4922
  /** @hidden */
4595
4923
  _CoreCrypto_module = { value: void 0 };
4596
- class WireE2eIdentity {
4924
+ class E2eiEnrollment {
4597
4925
  /** @hidden */
4598
4926
  constructor(e2ei) {
4599
4927
  /** @hidden */
4600
- _WireE2eIdentity_e2ei.set(this, void 0);
4601
- __classPrivateFieldSet(this, _WireE2eIdentity_e2ei, e2ei, "f");
4928
+ _E2eiEnrollment_enrollment.set(this, void 0);
4929
+ __classPrivateFieldSet(this, _E2eiEnrollment_enrollment, e2ei, "f");
4602
4930
  }
4603
4931
  free() {
4604
- __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").free();
4932
+ __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").free();
4605
4933
  }
4606
4934
  /**
4607
4935
  * Should only be used internally
4608
4936
  */
4609
4937
  inner() {
4610
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f");
4938
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f");
4611
4939
  }
4612
4940
  /**
4613
4941
  * Parses the response from `GET /acme/{provisioner-name}/directory`.
@@ -4619,7 +4947,7 @@ class WireE2eIdentity {
4619
4947
  */
4620
4948
  directoryResponse(directory) {
4621
4949
  try {
4622
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").directory_response(directory);
4950
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").directory_response(directory);
4623
4951
  }
4624
4952
  catch (e) {
4625
4953
  throw CoreCryptoError.fromStdError(e);
@@ -4634,7 +4962,7 @@ class WireE2eIdentity {
4634
4962
  */
4635
4963
  newAccountRequest(previousNonce) {
4636
4964
  try {
4637
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_account_request(previousNonce);
4965
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_account_request(previousNonce);
4638
4966
  }
4639
4967
  catch (e) {
4640
4968
  throw CoreCryptoError.fromStdError(e);
@@ -4647,7 +4975,7 @@ class WireE2eIdentity {
4647
4975
  */
4648
4976
  newAccountResponse(account) {
4649
4977
  try {
4650
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_account_response(account);
4978
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_account_response(account);
4651
4979
  }
4652
4980
  catch (e) {
4653
4981
  throw CoreCryptoError.fromStdError(e);
@@ -4661,7 +4989,7 @@ class WireE2eIdentity {
4661
4989
  */
4662
4990
  newOrderRequest(previousNonce) {
4663
4991
  try {
4664
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_order_request(previousNonce);
4992
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_order_request(previousNonce);
4665
4993
  }
4666
4994
  catch (e) {
4667
4995
  throw CoreCryptoError.fromStdError(e);
@@ -4675,7 +5003,7 @@ class WireE2eIdentity {
4675
5003
  */
4676
5004
  newOrderResponse(order) {
4677
5005
  try {
4678
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_order_response(order);
5006
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_order_response(order);
4679
5007
  }
4680
5008
  catch (e) {
4681
5009
  throw CoreCryptoError.fromStdError(e);
@@ -4691,7 +5019,7 @@ class WireE2eIdentity {
4691
5019
  */
4692
5020
  newAuthzRequest(url, previousNonce) {
4693
5021
  try {
4694
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_authz_request(url, previousNonce);
5022
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_authz_request(url, previousNonce);
4695
5023
  }
4696
5024
  catch (e) {
4697
5025
  throw CoreCryptoError.fromStdError(e);
@@ -4705,7 +5033,7 @@ class WireE2eIdentity {
4705
5033
  */
4706
5034
  newAuthzResponse(authz) {
4707
5035
  try {
4708
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_authz_response(authz);
5036
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_authz_response(authz);
4709
5037
  }
4710
5038
  catch (e) {
4711
5039
  throw CoreCryptoError.fromStdError(e);
@@ -4724,7 +5052,7 @@ class WireE2eIdentity {
4724
5052
  */
4725
5053
  createDpopToken(expirySecs, backendNonce) {
4726
5054
  try {
4727
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").create_dpop_token(expirySecs, backendNonce);
5055
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").create_dpop_token(expirySecs, backendNonce);
4728
5056
  }
4729
5057
  catch (e) {
4730
5058
  throw CoreCryptoError.fromStdError(e);
@@ -4739,7 +5067,7 @@ class WireE2eIdentity {
4739
5067
  */
4740
5068
  newDpopChallengeRequest(accessToken, previousNonce) {
4741
5069
  try {
4742
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_dpop_challenge_request(accessToken, previousNonce);
5070
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_dpop_challenge_request(accessToken, previousNonce);
4743
5071
  }
4744
5072
  catch (e) {
4745
5073
  throw CoreCryptoError.fromStdError(e);
@@ -4754,7 +5082,7 @@ class WireE2eIdentity {
4754
5082
  */
4755
5083
  newOidcChallengeRequest(idToken, previousNonce) {
4756
5084
  try {
4757
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_oidc_challenge_request(idToken, previousNonce);
5085
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_oidc_challenge_request(idToken, previousNonce);
4758
5086
  }
4759
5087
  catch (e) {
4760
5088
  throw CoreCryptoError.fromStdError(e);
@@ -4768,7 +5096,7 @@ class WireE2eIdentity {
4768
5096
  */
4769
5097
  newChallengeResponse(challenge) {
4770
5098
  try {
4771
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").new_challenge_response(challenge);
5099
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").new_challenge_response(challenge);
4772
5100
  }
4773
5101
  catch (e) {
4774
5102
  throw CoreCryptoError.fromStdError(e);
@@ -4783,7 +5111,7 @@ class WireE2eIdentity {
4783
5111
  */
4784
5112
  checkOrderRequest(orderUrl, previousNonce) {
4785
5113
  try {
4786
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").check_order_request(orderUrl, previousNonce);
5114
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").check_order_request(orderUrl, previousNonce);
4787
5115
  }
4788
5116
  catch (e) {
4789
5117
  throw CoreCryptoError.fromStdError(e);
@@ -4793,12 +5121,12 @@ class WireE2eIdentity {
4793
5121
  * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}`.
4794
5122
  *
4795
5123
  * @param order HTTP response body
4796
- * @return the finalize url to use with {@link finalizeRequest}
5124
+ * @return finalize url to use with {@link finalizeRequest}
4797
5125
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
4798
5126
  */
4799
5127
  checkOrderResponse(order) {
4800
5128
  try {
4801
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").check_order_response(order);
5129
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").check_order_response(order);
4802
5130
  }
4803
5131
  catch (e) {
4804
5132
  throw CoreCryptoError.fromStdError(e);
@@ -4812,7 +5140,7 @@ class WireE2eIdentity {
4812
5140
  */
4813
5141
  finalizeRequest(previousNonce) {
4814
5142
  try {
4815
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").finalize_request(previousNonce);
5143
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").finalize_request(previousNonce);
4816
5144
  }
4817
5145
  catch (e) {
4818
5146
  throw CoreCryptoError.fromStdError(e);
@@ -4827,7 +5155,7 @@ class WireE2eIdentity {
4827
5155
  */
4828
5156
  finalizeResponse(finalize) {
4829
5157
  try {
4830
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").finalize_response(finalize);
5158
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").finalize_response(finalize);
4831
5159
  }
4832
5160
  catch (e) {
4833
5161
  throw CoreCryptoError.fromStdError(e);
@@ -4841,13 +5169,33 @@ class WireE2eIdentity {
4841
5169
  */
4842
5170
  certificateRequest(previousNonce) {
4843
5171
  try {
4844
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").certificate_request(previousNonce);
5172
+ return __classPrivateFieldGet(this, _E2eiEnrollment_enrollment, "f").certificate_request(previousNonce);
4845
5173
  }
4846
5174
  catch (e) {
4847
5175
  throw CoreCryptoError.fromStdError(e);
4848
5176
  }
4849
5177
  }
4850
5178
  }
4851
- _WireE2eIdentity_e2ei = new WeakMap();
5179
+ _E2eiEnrollment_enrollment = new WeakMap();
5180
+ /**
5181
+ * Indicates the state of a Conversation regarding end-to-end identity.
5182
+ * Note: this does not check pending state (pending commit, pending proposals) so it does not
5183
+ * consider members about to be added/removed
5184
+ */
5185
+ var E2eiConversationState;
5186
+ (function (E2eiConversationState) {
5187
+ /**
5188
+ * All clients have a valid E2EI certificate
5189
+ */
5190
+ E2eiConversationState[E2eiConversationState["Verified"] = 1] = "Verified";
5191
+ /**
5192
+ * Some clients are either still Basic or their certificate is expired
5193
+ */
5194
+ E2eiConversationState[E2eiConversationState["Degraded"] = 2] = "Degraded";
5195
+ /**
5196
+ * All clients are still Basic. If all client have expired certificates, Degraded is returned.
5197
+ */
5198
+ E2eiConversationState[E2eiConversationState["NotEnabled"] = 3] = "NotEnabled";
5199
+ })(E2eiConversationState || (E2eiConversationState = {}));
4852
5200
 
4853
- export { Ciphersuite, CoreCrypto, CoreCryptoError, CredentialType, ExternalProposalType, GroupInfoEncryptionType, ProposalType, RatchetTreeType, WireE2eIdentity, WirePolicy };
5201
+ export { Ciphersuite, CoreCrypto, CoreCryptoError, CredentialType, E2eiConversationState, E2eiEnrollment, ExternalProposalType, GroupInfoEncryptionType, ProposalType, RatchetTreeType, WirePolicy };