@wireapp/core-crypto 0.5.2 → 0.6.0-pre.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.
@@ -151,6 +151,15 @@ function getFloat64Memory0() {
|
|
151
151
|
return cachedFloat64Memory0;
|
152
152
|
}
|
153
153
|
|
154
|
+
let cachedBigInt64Memory0 = new BigInt64Array();
|
155
|
+
|
156
|
+
function getBigInt64Memory0() {
|
157
|
+
if (cachedBigInt64Memory0.byteLength === 0) {
|
158
|
+
cachedBigInt64Memory0 = new BigInt64Array(wasm$1.memory.buffer);
|
159
|
+
}
|
160
|
+
return cachedBigInt64Memory0;
|
161
|
+
}
|
162
|
+
|
154
163
|
function debugString(val) {
|
155
164
|
// primitive types
|
156
165
|
const type = typeof val;
|
@@ -240,10 +249,10 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
240
249
|
|
241
250
|
return real;
|
242
251
|
}
|
243
|
-
function
|
252
|
+
function __wbg_adapter_52(arg0, arg1, arg2) {
|
244
253
|
try {
|
245
254
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
246
|
-
wasm$1.
|
255
|
+
wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__he93426143887b9de(retptr, arg0, arg1, addHeapObject(arg2));
|
247
256
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
248
257
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
249
258
|
if (r1) {
|
@@ -254,11 +263,12 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
|
|
254
263
|
}
|
255
264
|
}
|
256
265
|
|
257
|
-
function
|
258
|
-
wasm$1.
|
266
|
+
function __wbg_adapter_55(arg0, arg1, arg2) {
|
267
|
+
wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h582590a1b3576cbe(arg0, arg1, addHeapObject(arg2));
|
259
268
|
}
|
260
269
|
|
261
270
|
/**
|
271
|
+
* Returns the current version of CoreCrypto
|
262
272
|
* @returns {string}
|
263
273
|
*/
|
264
274
|
function version() {
|
@@ -318,10 +328,18 @@ function handleError(f, args) {
|
|
318
328
|
function getArrayU8FromWasm0(ptr, len) {
|
319
329
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
320
330
|
}
|
321
|
-
function
|
322
|
-
wasm$1.
|
331
|
+
function __wbg_adapter_212(arg0, arg1, arg2, arg3) {
|
332
|
+
wasm$1.wasm_bindgen__convert__closures__invoke2_mut__hd463cd1468254416(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
323
333
|
}
|
324
334
|
|
335
|
+
/**
|
336
|
+
* see [core_crypto::prelude::mls::conversation::public_group_state::MlsRatchetTreeType]
|
337
|
+
*/
|
338
|
+
const RatchetTreeType$1 = Object.freeze({ Full:1,"1":"Full",Delta:2,"2":"Delta",ByRef:3,"3":"ByRef", });
|
339
|
+
/**
|
340
|
+
* see [core_crypto::prelude::mls::conversation::public_group_state::MlsPublicGroupStateEncryptionType]
|
341
|
+
*/
|
342
|
+
const PublicGroupStateEncryptionType$1 = Object.freeze({ Plaintext:1,"1":"Plaintext",JweEncrypted:2,"2":"JweEncrypted", });
|
325
343
|
/**
|
326
344
|
* see [core_crypto::prelude::CiphersuiteName]
|
327
345
|
*/
|
@@ -384,11 +402,11 @@ class CommitBundle {
|
|
384
402
|
return takeObject(ret);
|
385
403
|
}
|
386
404
|
/**
|
387
|
-
* @returns {
|
405
|
+
* @returns {PublicGroupStateBundle}
|
388
406
|
*/
|
389
407
|
get public_group_state() {
|
390
408
|
const ret = wasm$1.commitbundle_public_group_state(this.ptr);
|
391
|
-
return
|
409
|
+
return PublicGroupStateBundle.__wrap(ret);
|
392
410
|
}
|
393
411
|
}
|
394
412
|
/**
|
@@ -431,6 +449,43 @@ class ConversationConfiguration {
|
|
431
449
|
}
|
432
450
|
/**
|
433
451
|
*/
|
452
|
+
class ConversationInitBundle {
|
453
|
+
|
454
|
+
__destroy_into_raw() {
|
455
|
+
const ptr = this.ptr;
|
456
|
+
this.ptr = 0;
|
457
|
+
|
458
|
+
return ptr;
|
459
|
+
}
|
460
|
+
|
461
|
+
free() {
|
462
|
+
const ptr = this.__destroy_into_raw();
|
463
|
+
wasm$1.__wbg_conversationinitbundle_free(ptr);
|
464
|
+
}
|
465
|
+
/**
|
466
|
+
* @returns {Uint8Array}
|
467
|
+
*/
|
468
|
+
get conversation_id() {
|
469
|
+
const ret = wasm$1.conversationinitbundle_conversation_id(this.ptr);
|
470
|
+
return takeObject(ret);
|
471
|
+
}
|
472
|
+
/**
|
473
|
+
* @returns {Uint8Array}
|
474
|
+
*/
|
475
|
+
get commit() {
|
476
|
+
const ret = wasm$1.conversationinitbundle_commit(this.ptr);
|
477
|
+
return takeObject(ret);
|
478
|
+
}
|
479
|
+
/**
|
480
|
+
* @returns {PublicGroupStateBundle}
|
481
|
+
*/
|
482
|
+
get public_group_state() {
|
483
|
+
const ret = wasm$1.conversationinitbundle_public_group_state(this.ptr);
|
484
|
+
return PublicGroupStateBundle.__wrap(ret);
|
485
|
+
}
|
486
|
+
}
|
487
|
+
/**
|
488
|
+
*/
|
434
489
|
class CoreCrypto$1 {
|
435
490
|
|
436
491
|
static __wrap(ptr) {
|
@@ -651,62 +706,6 @@ class CoreCrypto$1 {
|
|
651
706
|
return takeObject(ret);
|
652
707
|
}
|
653
708
|
/**
|
654
|
-
* Returns: [`WasmCryptoResult<Option<MemberAddedMessages>>`]
|
655
|
-
*
|
656
|
-
* see [core_crypto::MlsCentral::add_members_to_conversation]
|
657
|
-
* @param {Uint8Array} conversation_id
|
658
|
-
* @param {any[]} clients
|
659
|
-
* @returns {Promise<any>}
|
660
|
-
*/
|
661
|
-
final_add_clients_to_conversation(conversation_id, clients) {
|
662
|
-
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
663
|
-
const len0 = WASM_VECTOR_LEN;
|
664
|
-
const ptr1 = passArrayJsValueToWasm0(clients, wasm$1.__wbindgen_malloc);
|
665
|
-
const len1 = WASM_VECTOR_LEN;
|
666
|
-
const ret = wasm$1.corecrypto_final_add_clients_to_conversation(this.ptr, ptr0, len0, ptr1, len1);
|
667
|
-
return takeObject(ret);
|
668
|
-
}
|
669
|
-
/**
|
670
|
-
* Returns: [`WasmCryptoResult<Option<js_sys::Uint8Array>>`]
|
671
|
-
*
|
672
|
-
* see [core_crypto::MlsCentral::remove_members_from_conversation]
|
673
|
-
* @param {Uint8Array} conversation_id
|
674
|
-
* @param {(Uint8Array)[]} clients
|
675
|
-
* @returns {Promise<any>}
|
676
|
-
*/
|
677
|
-
final_remove_clients_from_conversation(conversation_id, clients) {
|
678
|
-
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
679
|
-
const len0 = WASM_VECTOR_LEN;
|
680
|
-
const ptr1 = passArrayJsValueToWasm0(clients, wasm$1.__wbindgen_malloc);
|
681
|
-
const len1 = WASM_VECTOR_LEN;
|
682
|
-
const ret = wasm$1.corecrypto_final_remove_clients_from_conversation(this.ptr, ptr0, len0, ptr1, len1);
|
683
|
-
return takeObject(ret);
|
684
|
-
}
|
685
|
-
/**
|
686
|
-
* Returns: [`WasmCryptoResult<CommitBundle>`]
|
687
|
-
*
|
688
|
-
* see [core_crypto::MlsCentral::update_keying_material]
|
689
|
-
* @param {Uint8Array} conversation_id
|
690
|
-
* @returns {Promise<any>}
|
691
|
-
*/
|
692
|
-
final_update_keying_material(conversation_id) {
|
693
|
-
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
694
|
-
const len0 = WASM_VECTOR_LEN;
|
695
|
-
const ret = wasm$1.corecrypto_final_update_keying_material(this.ptr, ptr0, len0);
|
696
|
-
return takeObject(ret);
|
697
|
-
}
|
698
|
-
/**
|
699
|
-
* see [core_crypto::MlsCentral::commit_pending_proposals]
|
700
|
-
* @param {Uint8Array} conversation_id
|
701
|
-
* @returns {Promise<any>}
|
702
|
-
*/
|
703
|
-
final_commit_pending_proposals(conversation_id) {
|
704
|
-
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
705
|
-
const len0 = WASM_VECTOR_LEN;
|
706
|
-
const ret = wasm$1.corecrypto_final_commit_pending_proposals(this.ptr, ptr0, len0);
|
707
|
-
return takeObject(ret);
|
708
|
-
}
|
709
|
-
/**
|
710
709
|
* Returns: [`WasmCryptoResult<()>`]
|
711
710
|
*
|
712
711
|
* see [core_crypto::MlsCentral::wipe_conversation]
|
@@ -841,14 +840,14 @@ class CoreCrypto$1 {
|
|
841
840
|
return takeObject(ret);
|
842
841
|
}
|
843
842
|
/**
|
844
|
-
* Returns: [`WasmCryptoResult<
|
843
|
+
* Returns: [`WasmCryptoResult<ConversationInitBundle>`]
|
845
844
|
*
|
846
845
|
* see [core_crypto::MlsCentral::join_by_external_commit]
|
847
|
-
* @param {Uint8Array}
|
846
|
+
* @param {Uint8Array} public_group_state
|
848
847
|
* @returns {Promise<any>}
|
849
848
|
*/
|
850
|
-
join_by_external_commit(
|
851
|
-
const ptr0 = passArray8ToWasm0(
|
849
|
+
join_by_external_commit(public_group_state) {
|
850
|
+
const ptr0 = passArray8ToWasm0(public_group_state, wasm$1.__wbindgen_malloc);
|
852
851
|
const len0 = WASM_VECTOR_LEN;
|
853
852
|
const ret = wasm$1.corecrypto_join_by_external_commit(this.ptr, ptr0, len0);
|
854
853
|
return takeObject(ret);
|
@@ -871,6 +870,19 @@ class CoreCrypto$1 {
|
|
871
870
|
return takeObject(ret);
|
872
871
|
}
|
873
872
|
/**
|
873
|
+
* Returns: [`WasmCryptoResult<()>`]
|
874
|
+
*
|
875
|
+
* see [core_crypto::MlsCentral::clear_pending_group_from_external_commit]
|
876
|
+
* @param {Uint8Array} conversation_id
|
877
|
+
* @returns {Promise<any>}
|
878
|
+
*/
|
879
|
+
clear_pending_group_from_external_commit(conversation_id) {
|
880
|
+
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
881
|
+
const len0 = WASM_VECTOR_LEN;
|
882
|
+
const ret = wasm$1.corecrypto_clear_pending_group_from_external_commit(this.ptr, ptr0, len0);
|
883
|
+
return takeObject(ret);
|
884
|
+
}
|
885
|
+
/**
|
874
886
|
* see [core_crypto::MlsCentral::commit_accepted]
|
875
887
|
* @param {Uint8Array} conversation_id
|
876
888
|
* @returns {Promise<any>}
|
@@ -930,6 +942,183 @@ class CoreCrypto$1 {
|
|
930
942
|
const ret = wasm$1.corecrypto_reseed_rng(this.ptr, ptr0, len0);
|
931
943
|
return takeObject(ret);
|
932
944
|
}
|
945
|
+
/**
|
946
|
+
* Returns: [`WasmCryptoResult<()>`]
|
947
|
+
*
|
948
|
+
* see [core_crypto::proteus::ProteusCentral::try_new]
|
949
|
+
* @returns {Promise<any>}
|
950
|
+
*/
|
951
|
+
proteus_init() {
|
952
|
+
const ret = wasm$1.corecrypto_proteus_init(this.ptr);
|
953
|
+
return takeObject(ret);
|
954
|
+
}
|
955
|
+
/**
|
956
|
+
* Returns: [`WasmCryptoResult<()>`]
|
957
|
+
*
|
958
|
+
* see [core_crypto::proteus::ProteusCentral::session_from_prekey]
|
959
|
+
* @param {string} session_id
|
960
|
+
* @param {Uint8Array} prekey
|
961
|
+
* @returns {Promise<any>}
|
962
|
+
*/
|
963
|
+
proteus_session_from_prekey(session_id, prekey) {
|
964
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
965
|
+
const len0 = WASM_VECTOR_LEN;
|
966
|
+
const ptr1 = passArray8ToWasm0(prekey, wasm$1.__wbindgen_malloc);
|
967
|
+
const len1 = WASM_VECTOR_LEN;
|
968
|
+
const ret = wasm$1.corecrypto_proteus_session_from_prekey(this.ptr, ptr0, len0, ptr1, len1);
|
969
|
+
return takeObject(ret);
|
970
|
+
}
|
971
|
+
/**
|
972
|
+
* Returns: [`WasmCryptoResult<()>`]
|
973
|
+
*
|
974
|
+
* see [core_crypto::proteus::ProteusCentral::session_from_message]
|
975
|
+
* @param {string} session_id
|
976
|
+
* @param {Uint8Array} envelope
|
977
|
+
* @returns {Promise<any>}
|
978
|
+
*/
|
979
|
+
proteus_session_from_message(session_id, envelope) {
|
980
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
981
|
+
const len0 = WASM_VECTOR_LEN;
|
982
|
+
const ptr1 = passArray8ToWasm0(envelope, wasm$1.__wbindgen_malloc);
|
983
|
+
const len1 = WASM_VECTOR_LEN;
|
984
|
+
const ret = wasm$1.corecrypto_proteus_session_from_message(this.ptr, ptr0, len0, ptr1, len1);
|
985
|
+
return takeObject(ret);
|
986
|
+
}
|
987
|
+
/**
|
988
|
+
* Returns: [`WasmCryptoResult<()>`]
|
989
|
+
*
|
990
|
+
* see [core_crypto::proteus::ProteusCentral::session_save]
|
991
|
+
* @param {string} session_id
|
992
|
+
* @returns {Promise<any>}
|
993
|
+
*/
|
994
|
+
proteus_session_save(session_id) {
|
995
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
996
|
+
const len0 = WASM_VECTOR_LEN;
|
997
|
+
const ret = wasm$1.corecrypto_proteus_session_save(this.ptr, ptr0, len0);
|
998
|
+
return takeObject(ret);
|
999
|
+
}
|
1000
|
+
/**
|
1001
|
+
* Returns: [`WasmCryptoResult<()>`]
|
1002
|
+
*
|
1003
|
+
* see [core_crypto::proteus::ProteusCentral::session_delete]
|
1004
|
+
* @param {string} session_id
|
1005
|
+
* @returns {Promise<any>}
|
1006
|
+
*/
|
1007
|
+
proteus_session_delete(session_id) {
|
1008
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1009
|
+
const len0 = WASM_VECTOR_LEN;
|
1010
|
+
const ret = wasm$1.corecrypto_proteus_session_delete(this.ptr, ptr0, len0);
|
1011
|
+
return takeObject(ret);
|
1012
|
+
}
|
1013
|
+
/**
|
1014
|
+
* Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
|
1015
|
+
*
|
1016
|
+
* see [core_crypto::proteus::ProteusCentral::decrypt]
|
1017
|
+
* @param {string} session_id
|
1018
|
+
* @param {Uint8Array} ciphertext
|
1019
|
+
* @returns {Promise<any>}
|
1020
|
+
*/
|
1021
|
+
proteus_decrypt(session_id, ciphertext) {
|
1022
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1023
|
+
const len0 = WASM_VECTOR_LEN;
|
1024
|
+
const ptr1 = passArray8ToWasm0(ciphertext, wasm$1.__wbindgen_malloc);
|
1025
|
+
const len1 = WASM_VECTOR_LEN;
|
1026
|
+
const ret = wasm$1.corecrypto_proteus_decrypt(this.ptr, ptr0, len0, ptr1, len1);
|
1027
|
+
return takeObject(ret);
|
1028
|
+
}
|
1029
|
+
/**
|
1030
|
+
* Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
|
1031
|
+
*
|
1032
|
+
* see [core_crypto::proteus::ProteusCentral::encrypt]
|
1033
|
+
* @param {string} session_id
|
1034
|
+
* @param {Uint8Array} plaintext
|
1035
|
+
* @returns {Promise<Uint8Array>}
|
1036
|
+
*/
|
1037
|
+
proteus_encrypt(session_id, plaintext) {
|
1038
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1039
|
+
const len0 = WASM_VECTOR_LEN;
|
1040
|
+
const ptr1 = passArray8ToWasm0(plaintext, wasm$1.__wbindgen_malloc);
|
1041
|
+
const len1 = WASM_VECTOR_LEN;
|
1042
|
+
const ret = wasm$1.corecrypto_proteus_encrypt(this.ptr, ptr0, len0, ptr1, len1);
|
1043
|
+
return takeObject(ret);
|
1044
|
+
}
|
1045
|
+
/**
|
1046
|
+
* Returns: [`WasmCryptoResult<js_sys::Map<string, Uint8Array>>`]
|
1047
|
+
*
|
1048
|
+
* see [core_crypto::proteus::ProteusCentral::encrypt_batched]
|
1049
|
+
* @param {(string)[]} sessions
|
1050
|
+
* @param {Uint8Array} plaintext
|
1051
|
+
* @returns {Promise<Map<any, any>>}
|
1052
|
+
*/
|
1053
|
+
proteus_encrypt_batched(sessions, plaintext) {
|
1054
|
+
const ptr0 = passArrayJsValueToWasm0(sessions, wasm$1.__wbindgen_malloc);
|
1055
|
+
const len0 = WASM_VECTOR_LEN;
|
1056
|
+
const ptr1 = passArray8ToWasm0(plaintext, wasm$1.__wbindgen_malloc);
|
1057
|
+
const len1 = WASM_VECTOR_LEN;
|
1058
|
+
const ret = wasm$1.corecrypto_proteus_encrypt_batched(this.ptr, ptr0, len0, ptr1, len1);
|
1059
|
+
return takeObject(ret);
|
1060
|
+
}
|
1061
|
+
/**
|
1062
|
+
* Returns: [`WasmCryptoResult<Uint8Array>`]
|
1063
|
+
*
|
1064
|
+
* see [core_crypto::proteus::ProteusCentral::new_prekey]
|
1065
|
+
* @param {number} prekey_id
|
1066
|
+
* @returns {Promise<Uint8Array>}
|
1067
|
+
*/
|
1068
|
+
proteus_new_prekey(prekey_id) {
|
1069
|
+
const ret = wasm$1.corecrypto_proteus_new_prekey(this.ptr, prekey_id);
|
1070
|
+
return takeObject(ret);
|
1071
|
+
}
|
1072
|
+
/**
|
1073
|
+
* Returns: [`WasmCryptoResult<String>`]
|
1074
|
+
*
|
1075
|
+
* see [core_crypto::proteus::ProteusCentral::fingerprint]
|
1076
|
+
* @returns {Promise<string>}
|
1077
|
+
*/
|
1078
|
+
proteus_fingerprint() {
|
1079
|
+
const ret = wasm$1.corecrypto_proteus_fingerprint(this.ptr);
|
1080
|
+
return takeObject(ret);
|
1081
|
+
}
|
1082
|
+
/**
|
1083
|
+
* Returns: [`WasmCryptoResult<()>`]
|
1084
|
+
*
|
1085
|
+
* see [core_crypto::proteus::ProteusCentral::cryptobox_migrate]
|
1086
|
+
* @param {string} path
|
1087
|
+
* @returns {Promise<any>}
|
1088
|
+
*/
|
1089
|
+
proteus_cryptobox_migrate(path) {
|
1090
|
+
const ptr0 = passStringToWasm0(path, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1091
|
+
const len0 = WASM_VECTOR_LEN;
|
1092
|
+
const ret = wasm$1.corecrypto_proteus_cryptobox_migrate(this.ptr, ptr0, len0);
|
1093
|
+
return takeObject(ret);
|
1094
|
+
}
|
1095
|
+
/**
|
1096
|
+
* Returns: [`WasmCryptoResult<Vec<u8>>`]
|
1097
|
+
*
|
1098
|
+
* see [core_crypto::MlsCentral::export_secret_key]
|
1099
|
+
* @param {Uint8Array} conversation_id
|
1100
|
+
* @param {number} key_length
|
1101
|
+
* @returns {Promise<any>}
|
1102
|
+
*/
|
1103
|
+
export_secret_key(conversation_id, key_length) {
|
1104
|
+
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
1105
|
+
const len0 = WASM_VECTOR_LEN;
|
1106
|
+
const ret = wasm$1.corecrypto_export_secret_key(this.ptr, ptr0, len0, key_length);
|
1107
|
+
return takeObject(ret);
|
1108
|
+
}
|
1109
|
+
/**
|
1110
|
+
* Returns: [`WasmCryptoResult<Box<[js_sys::Uint8Array]>`]
|
1111
|
+
*
|
1112
|
+
* see [core_crypto::MlsCentral::get_client_ids]
|
1113
|
+
* @param {Uint8Array} conversation_id
|
1114
|
+
* @returns {Promise<any>}
|
1115
|
+
*/
|
1116
|
+
get_client_ids(conversation_id) {
|
1117
|
+
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
1118
|
+
const len0 = WASM_VECTOR_LEN;
|
1119
|
+
const ret = wasm$1.corecrypto_get_client_ids(this.ptr, ptr0, len0);
|
1120
|
+
return takeObject(ret);
|
1121
|
+
}
|
933
1122
|
}
|
934
1123
|
/**
|
935
1124
|
* see [core_crypto::prelude::CoreCryptoCallbacks]
|
@@ -956,10 +1145,11 @@ class CoreCryptoWasmCallbacks {
|
|
956
1145
|
}
|
957
1146
|
/**
|
958
1147
|
* @param {Function} authorize
|
959
|
-
* @param {Function}
|
1148
|
+
* @param {Function} user_authorize
|
1149
|
+
* @param {Function} client_is_existing_group_user
|
960
1150
|
*/
|
961
|
-
constructor(authorize,
|
962
|
-
const ret = wasm$1.corecryptowasmcallbacks_new(addHeapObject(authorize), addHeapObject(
|
1151
|
+
constructor(authorize, user_authorize, client_is_existing_group_user) {
|
1152
|
+
const ret = wasm$1.corecryptowasmcallbacks_new(addHeapObject(authorize), addHeapObject(user_authorize), addHeapObject(client_is_existing_group_user));
|
963
1153
|
return CoreCryptoWasmCallbacks.__wrap(ret);
|
964
1154
|
}
|
965
1155
|
}
|
@@ -1021,6 +1211,13 @@ class DecryptedMessage {
|
|
1021
1211
|
const ret = wasm$1.decryptedmessage_sender_client_id(this.ptr);
|
1022
1212
|
return takeObject(ret);
|
1023
1213
|
}
|
1214
|
+
/**
|
1215
|
+
* @returns {boolean}
|
1216
|
+
*/
|
1217
|
+
get has_epoch_changed() {
|
1218
|
+
const ret = wasm$1.decryptedmessage_has_epoch_changed(this.ptr);
|
1219
|
+
return ret !== 0;
|
1220
|
+
}
|
1024
1221
|
}
|
1025
1222
|
/**
|
1026
1223
|
* see [core_crypto::prelude::ConversationMember]
|
@@ -1094,10 +1291,13 @@ class MemberAddedMessages {
|
|
1094
1291
|
/**
|
1095
1292
|
* @param {Uint8Array} welcome
|
1096
1293
|
* @param {Uint8Array} commit
|
1097
|
-
* @param {
|
1294
|
+
* @param {PublicGroupStateBundle} public_group_state
|
1098
1295
|
*/
|
1099
1296
|
constructor(welcome, commit, public_group_state) {
|
1100
|
-
|
1297
|
+
_assertClass(public_group_state, PublicGroupStateBundle);
|
1298
|
+
var ptr0 = public_group_state.ptr;
|
1299
|
+
public_group_state.ptr = 0;
|
1300
|
+
const ret = wasm$1.memberaddedmessages_new(addHeapObject(welcome), addHeapObject(commit), ptr0);
|
1101
1301
|
return MemberAddedMessages.__wrap(ret);
|
1102
1302
|
}
|
1103
1303
|
/**
|
@@ -1115,16 +1315,23 @@ class MemberAddedMessages {
|
|
1115
1315
|
return takeObject(ret);
|
1116
1316
|
}
|
1117
1317
|
/**
|
1118
|
-
* @returns {
|
1318
|
+
* @returns {PublicGroupStateBundle}
|
1119
1319
|
*/
|
1120
1320
|
get public_group_state() {
|
1121
1321
|
const ret = wasm$1.memberaddedmessages_public_group_state(this.ptr);
|
1122
|
-
return
|
1322
|
+
return PublicGroupStateBundle.__wrap(ret);
|
1123
1323
|
}
|
1124
1324
|
}
|
1125
1325
|
/**
|
1126
1326
|
*/
|
1127
|
-
class
|
1327
|
+
class ProposalBundle {
|
1328
|
+
|
1329
|
+
static __wrap(ptr) {
|
1330
|
+
const obj = Object.create(ProposalBundle.prototype);
|
1331
|
+
obj.ptr = ptr;
|
1332
|
+
|
1333
|
+
return obj;
|
1334
|
+
}
|
1128
1335
|
|
1129
1336
|
__destroy_into_raw() {
|
1130
1337
|
const ptr = this.ptr;
|
@@ -1135,29 +1342,29 @@ class MlsConversationInitMessage {
|
|
1135
1342
|
|
1136
1343
|
free() {
|
1137
1344
|
const ptr = this.__destroy_into_raw();
|
1138
|
-
wasm$1.
|
1345
|
+
wasm$1.__wbg_proposalbundle_free(ptr);
|
1139
1346
|
}
|
1140
1347
|
/**
|
1141
1348
|
* @returns {Uint8Array}
|
1142
1349
|
*/
|
1143
|
-
get
|
1144
|
-
const ret = wasm$1.
|
1350
|
+
get proposal() {
|
1351
|
+
const ret = wasm$1.proposalbundle_proposal(this.ptr);
|
1145
1352
|
return takeObject(ret);
|
1146
1353
|
}
|
1147
1354
|
/**
|
1148
1355
|
* @returns {Uint8Array}
|
1149
1356
|
*/
|
1150
|
-
get
|
1151
|
-
const ret = wasm$1.
|
1357
|
+
get proposal_ref() {
|
1358
|
+
const ret = wasm$1.proposalbundle_proposal_ref(this.ptr);
|
1152
1359
|
return takeObject(ret);
|
1153
1360
|
}
|
1154
1361
|
}
|
1155
1362
|
/**
|
1156
1363
|
*/
|
1157
|
-
class
|
1364
|
+
class PublicGroupStateBundle {
|
1158
1365
|
|
1159
1366
|
static __wrap(ptr) {
|
1160
|
-
const obj = Object.create(
|
1367
|
+
const obj = Object.create(PublicGroupStateBundle.prototype);
|
1161
1368
|
obj.ptr = ptr;
|
1162
1369
|
|
1163
1370
|
return obj;
|
@@ -1172,20 +1379,27 @@ class ProposalBundle {
|
|
1172
1379
|
|
1173
1380
|
free() {
|
1174
1381
|
const ptr = this.__destroy_into_raw();
|
1175
|
-
wasm$1.
|
1382
|
+
wasm$1.__wbg_publicgroupstatebundle_free(ptr);
|
1176
1383
|
}
|
1177
1384
|
/**
|
1178
|
-
* @returns {
|
1385
|
+
* @returns {number}
|
1179
1386
|
*/
|
1180
|
-
get
|
1181
|
-
const ret = wasm$1.
|
1182
|
-
return
|
1387
|
+
get encryption_type() {
|
1388
|
+
const ret = wasm$1.publicgroupstatebundle_encryption_type(this.ptr);
|
1389
|
+
return ret >>> 0;
|
1390
|
+
}
|
1391
|
+
/**
|
1392
|
+
* @returns {number}
|
1393
|
+
*/
|
1394
|
+
get ratchet_tree_type() {
|
1395
|
+
const ret = wasm$1.publicgroupstatebundle_ratchet_tree_type(this.ptr);
|
1396
|
+
return ret >>> 0;
|
1183
1397
|
}
|
1184
1398
|
/**
|
1185
1399
|
* @returns {Uint8Array}
|
1186
1400
|
*/
|
1187
|
-
get
|
1188
|
-
const ret = wasm$1.
|
1401
|
+
get payload() {
|
1402
|
+
const ret = wasm$1.publicgroupstatebundle_payload(this.ptr);
|
1189
1403
|
return takeObject(ret);
|
1190
1404
|
}
|
1191
1405
|
}
|
@@ -1236,83 +1450,68 @@ function getImports() {
|
|
1236
1450
|
const ret = typeof(val) === 'object' && val !== null;
|
1237
1451
|
return ret;
|
1238
1452
|
};
|
1239
|
-
imports.wbg.
|
1240
|
-
const ret =
|
1241
|
-
return addHeapObject(ret);
|
1242
|
-
};
|
1243
|
-
imports.wbg.__wbg_new0_a57059d72c5b7aee = function() {
|
1244
|
-
const ret = new Date();
|
1453
|
+
imports.wbg.__wbg_getwithrefkey_15c62c2b8546208d = function(arg0, arg1) {
|
1454
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
1245
1455
|
return addHeapObject(ret);
|
1246
1456
|
};
|
1247
|
-
imports.wbg.
|
1248
|
-
const ret = getObject(arg0)
|
1457
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
1458
|
+
const ret = getObject(arg0) === undefined;
|
1249
1459
|
return ret;
|
1250
1460
|
};
|
1251
|
-
imports.wbg.
|
1252
|
-
getObject(arg0)
|
1461
|
+
imports.wbg.__wbindgen_in = function(arg0, arg1) {
|
1462
|
+
const ret = getObject(arg0) in getObject(arg1);
|
1463
|
+
return ret;
|
1253
1464
|
};
|
1254
|
-
imports.wbg.
|
1255
|
-
const ret =
|
1465
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
1466
|
+
const ret = arg0;
|
1256
1467
|
return addHeapObject(ret);
|
1257
1468
|
};
|
1258
|
-
imports.wbg.
|
1259
|
-
const ret =
|
1469
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
1470
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
1260
1471
|
return addHeapObject(ret);
|
1261
1472
|
};
|
1262
1473
|
imports.wbg.__wbg_new_1d9a920c6bfc44a8 = function() {
|
1263
1474
|
const ret = new Array();
|
1264
1475
|
return addHeapObject(ret);
|
1265
1476
|
};
|
1266
|
-
imports.wbg.__wbg_push_740e4b286702d964 = function(arg0, arg1) {
|
1267
|
-
const ret = getObject(arg0).push(getObject(arg1));
|
1268
|
-
return ret;
|
1269
|
-
};
|
1270
1477
|
imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
|
1271
1478
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
1272
1479
|
};
|
1273
|
-
imports.wbg.
|
1274
|
-
const ret =
|
1480
|
+
imports.wbg.__wbg_new_268f7b7dd3430798 = function() {
|
1481
|
+
const ret = new Map();
|
1275
1482
|
return addHeapObject(ret);
|
1276
1483
|
};
|
1277
|
-
imports.wbg.
|
1278
|
-
const ret =
|
1484
|
+
imports.wbg.__wbg_new_0b9bfdd97583284e = function() {
|
1485
|
+
const ret = new Object();
|
1279
1486
|
return addHeapObject(ret);
|
1280
1487
|
};
|
1281
|
-
imports.wbg.
|
1282
|
-
const ret =
|
1488
|
+
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
1489
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
1283
1490
|
return addHeapObject(ret);
|
1284
1491
|
};
|
1285
|
-
imports.wbg.
|
1286
|
-
const
|
1287
|
-
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
1492
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
1493
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
1288
1494
|
return ret;
|
1289
1495
|
};
|
1290
|
-
imports.wbg.
|
1291
|
-
|
1292
|
-
var state0 = {a: arg0, b: arg1};
|
1293
|
-
var cb0 = (arg0, arg1) => {
|
1294
|
-
const a = state0.a;
|
1295
|
-
state0.a = 0;
|
1296
|
-
try {
|
1297
|
-
return __wbg_adapter_175(a, state0.b, arg0, arg1);
|
1298
|
-
} finally {
|
1299
|
-
state0.a = a;
|
1300
|
-
}
|
1301
|
-
};
|
1302
|
-
const ret = new Promise(cb0);
|
1303
|
-
return addHeapObject(ret);
|
1304
|
-
} finally {
|
1305
|
-
state0.a = state0.b = 0;
|
1306
|
-
}
|
1496
|
+
imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
1497
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
1307
1498
|
};
|
1308
|
-
imports.wbg.
|
1309
|
-
const ret =
|
1499
|
+
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
|
1500
|
+
const ret = arg0;
|
1310
1501
|
return addHeapObject(ret);
|
1311
1502
|
};
|
1312
|
-
imports.wbg.
|
1313
|
-
const ret =
|
1503
|
+
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
1504
|
+
const ret = BigInt.asUintN(64, arg0);
|
1505
|
+
return addHeapObject(ret);
|
1506
|
+
};
|
1507
|
+
imports.wbg.__wbg_objectStoreNames_8c06c40d2b05141c = function(arg0) {
|
1508
|
+
const ret = getObject(arg0).objectStoreNames;
|
1314
1509
|
return addHeapObject(ret);
|
1315
1510
|
};
|
1511
|
+
imports.wbg.__wbg_length_b59f358f797fd9f4 = function(arg0) {
|
1512
|
+
const ret = getObject(arg0).length;
|
1513
|
+
return ret;
|
1514
|
+
};
|
1316
1515
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
1317
1516
|
const obj = getObject(arg1);
|
1318
1517
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
@@ -1321,45 +1520,34 @@ function getImports() {
|
|
1321
1520
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
1322
1521
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
1323
1522
|
};
|
1324
|
-
imports.wbg.__wbg_isArray_27c46c67f498e15d = function(arg0) {
|
1325
|
-
const ret = Array.isArray(getObject(arg0));
|
1326
|
-
return ret;
|
1327
|
-
};
|
1328
1523
|
imports.wbg.__wbg_length_6e3bbe7c8bd4dbd8 = function(arg0) {
|
1329
1524
|
const ret = getObject(arg0).length;
|
1330
1525
|
return ret;
|
1331
1526
|
};
|
1332
|
-
imports.wbg.
|
1333
|
-
const ret =
|
1527
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
1528
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
1334
1529
|
return addHeapObject(ret);
|
1335
1530
|
};
|
1336
|
-
imports.wbg.
|
1337
|
-
const ret =
|
1531
|
+
imports.wbg.__wbg_new0_a57059d72c5b7aee = function() {
|
1532
|
+
const ret = new Date();
|
1338
1533
|
return addHeapObject(ret);
|
1339
|
-
}
|
1340
|
-
imports.wbg.
|
1341
|
-
const ret =
|
1534
|
+
};
|
1535
|
+
imports.wbg.__wbg_getTime_cb82adb2556ed13e = function(arg0) {
|
1536
|
+
const ret = getObject(arg0).getTime();
|
1342
1537
|
return ret;
|
1343
1538
|
};
|
1344
|
-
imports.wbg.
|
1345
|
-
const ret = getObject(arg0)
|
1346
|
-
return
|
1347
|
-
}, arguments) };
|
1348
|
-
imports.wbg.__wbg_next_579e583d33566a86 = function(arg0) {
|
1349
|
-
const ret = getObject(arg0).next;
|
1350
|
-
return addHeapObject(ret);
|
1539
|
+
imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
1540
|
+
const ret = getObject(arg0) == getObject(arg1);
|
1541
|
+
return ret;
|
1351
1542
|
};
|
1352
|
-
imports.wbg.
|
1353
|
-
const
|
1354
|
-
|
1355
|
-
}, arguments) };
|
1356
|
-
imports.wbg.__wbg_done_1b73b0672e15f234 = function(arg0) {
|
1357
|
-
const ret = getObject(arg0).done;
|
1543
|
+
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
1544
|
+
const v = getObject(arg0);
|
1545
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
1358
1546
|
return ret;
|
1359
1547
|
};
|
1360
|
-
imports.wbg.
|
1361
|
-
const ret = getObject(arg0)
|
1362
|
-
return
|
1548
|
+
imports.wbg.__wbindgen_is_bigint = function(arg0) {
|
1549
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
1550
|
+
return ret;
|
1363
1551
|
};
|
1364
1552
|
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
1365
1553
|
const obj = getObject(arg1);
|
@@ -1371,16 +1559,99 @@ function getImports() {
|
|
1371
1559
|
const ret = Number.isSafeInteger(getObject(arg0));
|
1372
1560
|
return ret;
|
1373
1561
|
};
|
1562
|
+
imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
|
1563
|
+
const v = getObject(arg1);
|
1564
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
1565
|
+
getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0n : ret;
|
1566
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
1567
|
+
};
|
1568
|
+
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
|
1569
|
+
const ret = getObject(arg0) === getObject(arg1);
|
1570
|
+
return ret;
|
1571
|
+
};
|
1572
|
+
imports.wbg.__wbg_isArray_27c46c67f498e15d = function(arg0) {
|
1573
|
+
const ret = Array.isArray(getObject(arg0));
|
1574
|
+
return ret;
|
1575
|
+
};
|
1576
|
+
imports.wbg.__wbg_iterator_6f9d4f28845f426c = function() {
|
1577
|
+
const ret = Symbol.iterator;
|
1578
|
+
return addHeapObject(ret);
|
1579
|
+
};
|
1374
1580
|
imports.wbg.__wbg_get_57245cc7d7c7619d = function(arg0, arg1) {
|
1375
1581
|
const ret = getObject(arg0)[arg1 >>> 0];
|
1376
1582
|
return addHeapObject(ret);
|
1377
1583
|
};
|
1378
|
-
imports.wbg.
|
1379
|
-
const ret = getObject(arg0)
|
1584
|
+
imports.wbg.__wbg_new_8c3f0052272a457a = function(arg0) {
|
1585
|
+
const ret = new Uint8Array(getObject(arg0));
|
1586
|
+
return addHeapObject(ret);
|
1587
|
+
};
|
1588
|
+
imports.wbg.__wbg_push_740e4b286702d964 = function(arg0, arg1) {
|
1589
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
1380
1590
|
return ret;
|
1381
1591
|
};
|
1382
|
-
imports.wbg.
|
1383
|
-
const ret =
|
1592
|
+
imports.wbg.__wbg_corecrypto_new = function(arg0) {
|
1593
|
+
const ret = CoreCrypto$1.__wrap(arg0);
|
1594
|
+
return addHeapObject(ret);
|
1595
|
+
};
|
1596
|
+
imports.wbg.__wbg_call_e1f72c051cdab859 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
1597
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
|
1598
|
+
return addHeapObject(ret);
|
1599
|
+
}, arguments) };
|
1600
|
+
imports.wbg.__wbg_new_9962f939219f1820 = function(arg0, arg1) {
|
1601
|
+
try {
|
1602
|
+
var state0 = {a: arg0, b: arg1};
|
1603
|
+
var cb0 = (arg0, arg1) => {
|
1604
|
+
const a = state0.a;
|
1605
|
+
state0.a = 0;
|
1606
|
+
try {
|
1607
|
+
return __wbg_adapter_212(a, state0.b, arg0, arg1);
|
1608
|
+
} finally {
|
1609
|
+
state0.a = a;
|
1610
|
+
}
|
1611
|
+
};
|
1612
|
+
const ret = new Promise(cb0);
|
1613
|
+
return addHeapObject(ret);
|
1614
|
+
} finally {
|
1615
|
+
state0.a = state0.b = 0;
|
1616
|
+
}
|
1617
|
+
};
|
1618
|
+
imports.wbg.__wbg_reject_72477563edad55b7 = function(arg0) {
|
1619
|
+
const ret = Promise.reject(getObject(arg0));
|
1620
|
+
return addHeapObject(ret);
|
1621
|
+
};
|
1622
|
+
imports.wbg.__wbg_proposalbundle_new = function(arg0) {
|
1623
|
+
const ret = ProposalBundle.__wrap(arg0);
|
1624
|
+
return addHeapObject(ret);
|
1625
|
+
};
|
1626
|
+
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
1627
|
+
const ret = new Error();
|
1628
|
+
return addHeapObject(ret);
|
1629
|
+
};
|
1630
|
+
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
1631
|
+
const ret = getObject(arg1).stack;
|
1632
|
+
const ptr0 = passStringToWasm0(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1633
|
+
const len0 = WASM_VECTOR_LEN;
|
1634
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
1635
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
1636
|
+
};
|
1637
|
+
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
1638
|
+
try {
|
1639
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
1640
|
+
} finally {
|
1641
|
+
wasm$1.__wbindgen_free(arg0, arg1);
|
1642
|
+
}
|
1643
|
+
};
|
1644
|
+
imports.wbg.__wbg_commit_73ecc83e291e455b = function() { return handleError(function (arg0) {
|
1645
|
+
getObject(arg0).commit();
|
1646
|
+
}, arguments) };
|
1647
|
+
imports.wbg.__wbg_setoncomplete_3e57a8cec8327f66 = function(arg0, arg1) {
|
1648
|
+
getObject(arg0).oncomplete = getObject(arg1);
|
1649
|
+
};
|
1650
|
+
imports.wbg.__wbg_setonerror_00051c0213f27b2c = function(arg0, arg1) {
|
1651
|
+
getObject(arg0).onerror = getObject(arg1);
|
1652
|
+
};
|
1653
|
+
imports.wbg.__wbindgen_is_null = function(arg0) {
|
1654
|
+
const ret = getObject(arg0) === null;
|
1384
1655
|
return ret;
|
1385
1656
|
};
|
1386
1657
|
imports.wbg.__wbg_name_ebb75bfad2bf6938 = function(arg0, arg1) {
|
@@ -1390,10 +1661,6 @@ function getImports() {
|
|
1390
1661
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
1391
1662
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
1392
1663
|
};
|
1393
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
1394
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
1395
|
-
return addHeapObject(ret);
|
1396
|
-
};
|
1397
1664
|
imports.wbg.__wbg_transaction_83b53b72aa710599 = function() { return handleError(function (arg0, arg1, arg2) {
|
1398
1665
|
const ret = getObject(arg0).transaction(getObject(arg1), takeObject(arg2));
|
1399
1666
|
return addHeapObject(ret);
|
@@ -1407,17 +1674,8 @@ function getImports() {
|
|
1407
1674
|
const ret = false;
|
1408
1675
|
return ret;
|
1409
1676
|
};
|
1410
|
-
imports.wbg.
|
1411
|
-
getObject(arg0).
|
1412
|
-
}, arguments) };
|
1413
|
-
imports.wbg.__wbg_setoncomplete_3e57a8cec8327f66 = function(arg0, arg1) {
|
1414
|
-
getObject(arg0).oncomplete = getObject(arg1);
|
1415
|
-
};
|
1416
|
-
imports.wbg.__wbg_setonerror_00051c0213f27b2c = function(arg0, arg1) {
|
1417
|
-
getObject(arg0).onerror = getObject(arg1);
|
1418
|
-
};
|
1419
|
-
imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
|
1420
|
-
const ret = getObject(arg0).get(getObject(arg1));
|
1677
|
+
imports.wbg.__wbg_delete_8abedd1043b4105d = function() { return handleError(function (arg0, arg1) {
|
1678
|
+
const ret = getObject(arg0).delete(getObject(arg1));
|
1421
1679
|
return addHeapObject(ret);
|
1422
1680
|
}, arguments) };
|
1423
1681
|
imports.wbg.__wbg_setonsuccess_5f71593bc51653a3 = function(arg0, arg1) {
|
@@ -1442,16 +1700,12 @@ function getImports() {
|
|
1442
1700
|
const ret = getObject(arg0).put(getObject(arg1));
|
1443
1701
|
return addHeapObject(ret);
|
1444
1702
|
}, arguments) };
|
1445
|
-
imports.wbg.
|
1446
|
-
const ret = getObject(arg0).
|
1447
|
-
return addHeapObject(ret);
|
1448
|
-
}, arguments) };
|
1449
|
-
imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
|
1450
|
-
const ret = getObject(arg0).count();
|
1703
|
+
imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
|
1704
|
+
const ret = getObject(arg0).get(getObject(arg1));
|
1451
1705
|
return addHeapObject(ret);
|
1452
1706
|
}, arguments) };
|
1453
|
-
imports.wbg.
|
1454
|
-
const ret = getObject(arg0)
|
1707
|
+
imports.wbg.__wbg_get_765201544a2b6869 = function() { return handleError(function (arg0, arg1) {
|
1708
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
1455
1709
|
return addHeapObject(ret);
|
1456
1710
|
}, arguments) };
|
1457
1711
|
imports.wbg.__wbg_get_3c3e41997e95952c = function() { return handleError(function (arg0, arg1) {
|
@@ -1466,13 +1720,6 @@ function getImports() {
|
|
1466
1720
|
const ret = getObject(arg0).openCursor(getObject(arg1));
|
1467
1721
|
return addHeapObject(ret);
|
1468
1722
|
}, arguments) };
|
1469
|
-
imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
|
1470
|
-
getObject(arg0).close();
|
1471
|
-
};
|
1472
|
-
imports.wbg.__wbg_deleteDatabase_f6454de6a88aebde = function() { return handleError(function (arg0, arg1, arg2) {
|
1473
|
-
const ret = getObject(arg0).deleteDatabase(getStringFromWasm0(arg1, arg2));
|
1474
|
-
return addHeapObject(ret);
|
1475
|
-
}, arguments) };
|
1476
1723
|
imports.wbg.__wbg_open_a31c3fe1fdc244eb = function() { return handleError(function (arg0, arg1, arg2) {
|
1477
1724
|
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2));
|
1478
1725
|
return addHeapObject(ret);
|
@@ -1484,49 +1731,64 @@ function getImports() {
|
|
1484
1731
|
imports.wbg.__wbg_setonupgradeneeded_17d0b9530f1e0cac = function(arg0, arg1) {
|
1485
1732
|
getObject(arg0).onupgradeneeded = getObject(arg1);
|
1486
1733
|
};
|
1487
|
-
imports.wbg.
|
1734
|
+
imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
|
1735
|
+
const ret = getObject(arg0).count();
|
1736
|
+
return addHeapObject(ret);
|
1737
|
+
}, arguments) };
|
1738
|
+
imports.wbg.__wbg_count_46eda68a16dbe30e = function() { return handleError(function (arg0, arg1) {
|
1739
|
+
const ret = getObject(arg0).count(getObject(arg1));
|
1740
|
+
return addHeapObject(ret);
|
1741
|
+
}, arguments) };
|
1742
|
+
imports.wbg.__wbg_deleteDatabase_f6454de6a88aebde = function() { return handleError(function (arg0, arg1, arg2) {
|
1743
|
+
const ret = getObject(arg0).deleteDatabase(getStringFromWasm0(arg1, arg2));
|
1744
|
+
return addHeapObject(ret);
|
1745
|
+
}, arguments) };
|
1746
|
+
imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
|
1747
|
+
getObject(arg0).close();
|
1748
|
+
};
|
1749
|
+
imports.wbg.__wbg_randomFillSync_6894564c2c334c42 = function() { return handleError(function (arg0, arg1, arg2) {
|
1488
1750
|
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
1489
1751
|
}, arguments) };
|
1490
1752
|
imports.wbg.__wbg_subarray_58ad4efbb5bcb886 = function(arg0, arg1, arg2) {
|
1491
1753
|
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
1492
1754
|
return addHeapObject(ret);
|
1493
1755
|
};
|
1494
|
-
imports.wbg.
|
1756
|
+
imports.wbg.__wbg_getRandomValues_805f1c3d65988a5a = function() { return handleError(function (arg0, arg1) {
|
1495
1757
|
getObject(arg0).getRandomValues(getObject(arg1));
|
1496
1758
|
}, arguments) };
|
1497
1759
|
imports.wbg.__wbg_length_9e1ae1900cb0fbd5 = function(arg0) {
|
1498
1760
|
const ret = getObject(arg0).length;
|
1499
1761
|
return ret;
|
1500
1762
|
};
|
1501
|
-
imports.wbg.
|
1763
|
+
imports.wbg.__wbg_crypto_e1d53a1d73fb10b8 = function(arg0) {
|
1764
|
+
const ret = getObject(arg0).crypto;
|
1765
|
+
return addHeapObject(ret);
|
1766
|
+
};
|
1767
|
+
imports.wbg.__wbg_process_038c26bf42b093f8 = function(arg0) {
|
1502
1768
|
const ret = getObject(arg0).process;
|
1503
1769
|
return addHeapObject(ret);
|
1504
1770
|
};
|
1505
|
-
imports.wbg.
|
1771
|
+
imports.wbg.__wbg_versions_ab37218d2f0b24a8 = function(arg0) {
|
1506
1772
|
const ret = getObject(arg0).versions;
|
1507
1773
|
return addHeapObject(ret);
|
1508
1774
|
};
|
1509
|
-
imports.wbg.
|
1775
|
+
imports.wbg.__wbg_node_080f4b19d15bc1fe = function(arg0) {
|
1510
1776
|
const ret = getObject(arg0).node;
|
1511
1777
|
return addHeapObject(ret);
|
1512
1778
|
};
|
1513
|
-
imports.wbg.
|
1514
|
-
const ret =
|
1515
|
-
return ret;
|
1516
|
-
};
|
1517
|
-
imports.wbg.__wbg_static_accessor_NODE_MODULE_cf6401cc1091279e = function() {
|
1518
|
-
const ret = module;
|
1779
|
+
imports.wbg.__wbg_require_78a3dcfbdba9cbce = function() { return handleError(function () {
|
1780
|
+
const ret = module.require;
|
1519
1781
|
return addHeapObject(ret);
|
1782
|
+
}, arguments) };
|
1783
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
1784
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
1785
|
+
return ret;
|
1520
1786
|
};
|
1521
|
-
imports.wbg.
|
1522
|
-
const ret = getObject(arg0).
|
1787
|
+
imports.wbg.__wbg_call_168da88779e35f61 = function() { return handleError(function (arg0, arg1, arg2) {
|
1788
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
1523
1789
|
return addHeapObject(ret);
|
1524
1790
|
}, arguments) };
|
1525
|
-
imports.wbg.
|
1526
|
-
const ret = getObject(arg0).crypto;
|
1527
|
-
return addHeapObject(ret);
|
1528
|
-
};
|
1529
|
-
imports.wbg.__wbg_msCrypto_a21fc88caf1ecdc8 = function(arg0) {
|
1791
|
+
imports.wbg.__wbg_msCrypto_6e7d3e1f92610cbb = function(arg0) {
|
1530
1792
|
const ret = getObject(arg0).msCrypto;
|
1531
1793
|
return addHeapObject(ret);
|
1532
1794
|
};
|
@@ -1534,6 +1796,26 @@ function getImports() {
|
|
1534
1796
|
const ret = new Uint8Array(arg0 >>> 0);
|
1535
1797
|
return addHeapObject(ret);
|
1536
1798
|
};
|
1799
|
+
imports.wbg.__wbg_next_aaef7c8aa5e212ac = function() { return handleError(function (arg0) {
|
1800
|
+
const ret = getObject(arg0).next();
|
1801
|
+
return addHeapObject(ret);
|
1802
|
+
}, arguments) };
|
1803
|
+
imports.wbg.__wbg_done_1b73b0672e15f234 = function(arg0) {
|
1804
|
+
const ret = getObject(arg0).done;
|
1805
|
+
return ret;
|
1806
|
+
};
|
1807
|
+
imports.wbg.__wbg_value_1ccc36bc03462d71 = function(arg0) {
|
1808
|
+
const ret = getObject(arg0).value;
|
1809
|
+
return addHeapObject(ret);
|
1810
|
+
};
|
1811
|
+
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
|
1812
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
1813
|
+
return addHeapObject(ret);
|
1814
|
+
}, arguments) };
|
1815
|
+
imports.wbg.__wbg_next_579e583d33566a86 = function(arg0) {
|
1816
|
+
const ret = getObject(arg0).next;
|
1817
|
+
return addHeapObject(ret);
|
1818
|
+
};
|
1537
1819
|
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
|
1538
1820
|
const ret = self.self;
|
1539
1821
|
return addHeapObject(ret);
|
@@ -1554,10 +1836,6 @@ function getImports() {
|
|
1554
1836
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
1555
1837
|
return addHeapObject(ret);
|
1556
1838
|
};
|
1557
|
-
imports.wbg.__wbg_call_168da88779e35f61 = function() { return handleError(function (arg0, arg1, arg2) {
|
1558
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
1559
|
-
return addHeapObject(ret);
|
1560
|
-
}, arguments) };
|
1561
1839
|
imports.wbg.__wbg_call_3999bee59e9f7719 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
1562
1840
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
1563
1841
|
return addHeapObject(ret);
|
@@ -1589,10 +1867,10 @@ function getImports() {
|
|
1589
1867
|
const ret = getObject(arg0).target;
|
1590
1868
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
1591
1869
|
};
|
1592
|
-
imports.wbg.
|
1593
|
-
const ret = getObject(arg0).
|
1594
|
-
return addHeapObject(ret);
|
1595
|
-
};
|
1870
|
+
imports.wbg.__wbg_error_aacf5ac191e54ed0 = function() { return handleError(function (arg0) {
|
1871
|
+
const ret = getObject(arg0).error;
|
1872
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
1873
|
+
}, arguments) };
|
1596
1874
|
imports.wbg.__wbg_contains_6cf516181cd86571 = function(arg0, arg1, arg2) {
|
1597
1875
|
const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
|
1598
1876
|
return ret;
|
@@ -1613,20 +1891,12 @@ function getImports() {
|
|
1613
1891
|
const ret = getObject(arg0).createIndex(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4));
|
1614
1892
|
return addHeapObject(ret);
|
1615
1893
|
}, arguments) };
|
1616
|
-
imports.wbg.__wbg_length_b59f358f797fd9f4 = function(arg0) {
|
1617
|
-
const ret = getObject(arg0).length;
|
1618
|
-
return ret;
|
1619
|
-
};
|
1620
1894
|
imports.wbg.__wbg_deleteIndex_2f8e18b00c1554e1 = function() { return handleError(function (arg0, arg1, arg2) {
|
1621
1895
|
getObject(arg0).deleteIndex(getStringFromWasm0(arg1, arg2));
|
1622
1896
|
}, arguments) };
|
1623
1897
|
imports.wbg.__wbg_deleteObjectStore_1b698c5fd1bc077d = function() { return handleError(function (arg0, arg1, arg2) {
|
1624
1898
|
getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
|
1625
1899
|
}, arguments) };
|
1626
|
-
imports.wbg.__wbg_error_aacf5ac191e54ed0 = function() { return handleError(function (arg0) {
|
1627
|
-
const ret = getObject(arg0).error;
|
1628
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
1629
|
-
}, arguments) };
|
1630
1900
|
imports.wbg.__wbindgen_is_falsy = function(arg0) {
|
1631
1901
|
const ret = !getObject(arg0);
|
1632
1902
|
return ret;
|
@@ -1656,10 +1926,6 @@ function getImports() {
|
|
1656
1926
|
const ret = getObject(arg0).toString();
|
1657
1927
|
return addHeapObject(ret);
|
1658
1928
|
};
|
1659
|
-
imports.wbg.__wbg_new_8d2af00bc1e329ee = function(arg0, arg1) {
|
1660
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
1661
|
-
return addHeapObject(ret);
|
1662
|
-
};
|
1663
1929
|
imports.wbg.__wbg_instanceof_Uint8Array_971eeda69eb75003 = function(arg0) {
|
1664
1930
|
let result;
|
1665
1931
|
try {
|
@@ -1680,7 +1946,11 @@ function getImports() {
|
|
1680
1946
|
const ret = result;
|
1681
1947
|
return ret;
|
1682
1948
|
};
|
1683
|
-
imports.wbg.
|
1949
|
+
imports.wbg.__wbg_entries_65a76a413fc91037 = function(arg0) {
|
1950
|
+
const ret = Object.entries(getObject(arg0));
|
1951
|
+
return addHeapObject(ret);
|
1952
|
+
};
|
1953
|
+
imports.wbg.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
|
1684
1954
|
const ret = String(getObject(arg1));
|
1685
1955
|
const ptr0 = passStringToWasm0(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1686
1956
|
const len0 = WASM_VECTOR_LEN;
|
@@ -1735,12 +2005,12 @@ function getImports() {
|
|
1735
2005
|
const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
|
1736
2006
|
return addHeapObject(ret);
|
1737
2007
|
}, arguments) };
|
1738
|
-
imports.wbg.
|
1739
|
-
const ret = makeMutClosure(arg0, arg1,
|
2008
|
+
imports.wbg.__wbindgen_closure_wrapper2895 = function(arg0, arg1, arg2) {
|
2009
|
+
const ret = makeMutClosure(arg0, arg1, 130, __wbg_adapter_52);
|
1740
2010
|
return addHeapObject(ret);
|
1741
2011
|
};
|
1742
|
-
imports.wbg.
|
1743
|
-
const ret = makeMutClosure(arg0, arg1,
|
2012
|
+
imports.wbg.__wbindgen_closure_wrapper4971 = function(arg0, arg1, arg2) {
|
2013
|
+
const ret = makeMutClosure(arg0, arg1, 137, __wbg_adapter_55);
|
1744
2014
|
return addHeapObject(ret);
|
1745
2015
|
};
|
1746
2016
|
|
@@ -1750,6 +2020,7 @@ function getImports() {
|
|
1750
2020
|
function finalizeInit(instance, module) {
|
1751
2021
|
wasm$1 = instance.exports;
|
1752
2022
|
init.__wbindgen_wasm_module = module;
|
2023
|
+
cachedBigInt64Memory0 = new BigInt64Array();
|
1753
2024
|
cachedFloat64Memory0 = new Float64Array();
|
1754
2025
|
cachedInt32Memory0 = new Int32Array();
|
1755
2026
|
cachedUint32Memory0 = new Uint32Array();
|
@@ -1789,16 +2060,19 @@ async function init(input) {
|
|
1789
2060
|
var exports = /*#__PURE__*/Object.freeze({
|
1790
2061
|
__proto__: null,
|
1791
2062
|
version: version,
|
2063
|
+
RatchetTreeType: RatchetTreeType$1,
|
2064
|
+
PublicGroupStateEncryptionType: PublicGroupStateEncryptionType$1,
|
1792
2065
|
Ciphersuite: Ciphersuite$1,
|
1793
2066
|
CommitBundle: CommitBundle,
|
1794
2067
|
ConversationConfiguration: ConversationConfiguration,
|
2068
|
+
ConversationInitBundle: ConversationInitBundle,
|
1795
2069
|
CoreCrypto: CoreCrypto$1,
|
1796
2070
|
CoreCryptoWasmCallbacks: CoreCryptoWasmCallbacks,
|
1797
2071
|
DecryptedMessage: DecryptedMessage,
|
1798
2072
|
Invitee: Invitee,
|
1799
2073
|
MemberAddedMessages: MemberAddedMessages,
|
1800
|
-
MlsConversationInitMessage: MlsConversationInitMessage,
|
1801
2074
|
ProposalBundle: ProposalBundle,
|
2075
|
+
PublicGroupStateBundle: PublicGroupStateBundle,
|
1802
2076
|
initSync: initSync,
|
1803
2077
|
'default': init
|
1804
2078
|
});
|
@@ -1806,7 +2080,7 @@ var exports = /*#__PURE__*/Object.freeze({
|
|
1806
2080
|
var wasm = async (opt = {}) => {
|
1807
2081
|
let {importHook, serverPath} = opt;
|
1808
2082
|
|
1809
|
-
let path = "assets/core_crypto_ffi-
|
2083
|
+
let path = "assets/core_crypto_ffi-90af066e.wasm";
|
1810
2084
|
|
1811
2085
|
if (serverPath != null) {
|
1812
2086
|
path = serverPath + /[^\/\\]*$/.exec(path)[0];
|
@@ -1857,6 +2131,40 @@ var Ciphersuite;
|
|
1857
2131
|
*/
|
1858
2132
|
Ciphersuite[Ciphersuite["MLS_256_DHKEMP384_AES256GCM_SHA384_P384"] = 7] = "MLS_256_DHKEMP384_AES256GCM_SHA384_P384";
|
1859
2133
|
})(Ciphersuite || (Ciphersuite = {}));
|
2134
|
+
/**
|
2135
|
+
* Informs whether the PublicGroupState is confidential
|
2136
|
+
* see [core_crypto::mls::conversation::public_group_state::PublicGroupStateEncryptionType]
|
2137
|
+
*/
|
2138
|
+
var PublicGroupStateEncryptionType;
|
2139
|
+
(function (PublicGroupStateEncryptionType) {
|
2140
|
+
/**
|
2141
|
+
* Unencrypted
|
2142
|
+
*/
|
2143
|
+
PublicGroupStateEncryptionType[PublicGroupStateEncryptionType["Plaintext"] = 1] = "Plaintext";
|
2144
|
+
/**
|
2145
|
+
* Encrypted in a JWE (not yet implemented)
|
2146
|
+
*/
|
2147
|
+
PublicGroupStateEncryptionType[PublicGroupStateEncryptionType["JweEncrypted"] = 2] = "JweEncrypted";
|
2148
|
+
})(PublicGroupStateEncryptionType || (PublicGroupStateEncryptionType = {}));
|
2149
|
+
/**
|
2150
|
+
* Represents different ways of carrying the Ratchet Tree with some optimizations to save some space
|
2151
|
+
* see [core_crypto::mls::conversation::public_group_state::RatchetTreeType]
|
2152
|
+
*/
|
2153
|
+
var RatchetTreeType;
|
2154
|
+
(function (RatchetTreeType) {
|
2155
|
+
/**
|
2156
|
+
* Complete PublicGroupState
|
2157
|
+
*/
|
2158
|
+
RatchetTreeType[RatchetTreeType["Full"] = 1] = "Full";
|
2159
|
+
/**
|
2160
|
+
* Contains the difference since previous epoch (not yet implemented)
|
2161
|
+
*/
|
2162
|
+
RatchetTreeType[RatchetTreeType["Delta"] = 2] = "Delta";
|
2163
|
+
/**
|
2164
|
+
* To define (not yet implemented)
|
2165
|
+
*/
|
2166
|
+
RatchetTreeType[RatchetTreeType["ByRef"] = 3] = "ByRef";
|
2167
|
+
})(RatchetTreeType || (RatchetTreeType = {}));
|
1860
2168
|
/**
|
1861
2169
|
* MLS Proposal type
|
1862
2170
|
*/
|
@@ -1963,7 +2271,7 @@ class CoreCrypto {
|
|
1963
2271
|
* @param callbacks - Any interface following the {@link CoreCryptoCallbacks} interface
|
1964
2272
|
*/
|
1965
2273
|
registerCallbacks(callbacks) {
|
1966
|
-
const wasmCallbacks = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).CoreCryptoWasmCallbacks)(callbacks.authorize, callbacks.
|
2274
|
+
const wasmCallbacks = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).CoreCryptoWasmCallbacks)(callbacks.authorize, callbacks.userAuthorize, callbacks.clientIsExistingGroupUser);
|
1967
2275
|
__classPrivateFieldGet(this, _CoreCrypto_cc, "f").set_callbacks(wasmCallbacks);
|
1968
2276
|
}
|
1969
2277
|
/**
|
@@ -2043,6 +2351,7 @@ class CoreCrypto {
|
|
2043
2351
|
isActive: ffiDecryptedMessage.is_active,
|
2044
2352
|
senderClientId: ffiDecryptedMessage.sender_client_id,
|
2045
2353
|
commitDelay,
|
2354
|
+
hasEpochChanged: ffiDecryptedMessage.has_epoch_changed,
|
2046
2355
|
};
|
2047
2356
|
return ret;
|
2048
2357
|
}
|
@@ -2106,7 +2415,11 @@ class CoreCrypto {
|
|
2106
2415
|
const ret = {
|
2107
2416
|
welcome: ffiRet.welcome,
|
2108
2417
|
commit: ffiRet.commit,
|
2109
|
-
publicGroupState:
|
2418
|
+
publicGroupState: {
|
2419
|
+
encryptionType: ffiRet.public_group_state.encryption_type,
|
2420
|
+
ratchetTreeType: ffiRet.public_group_state.ratchet_tree_type,
|
2421
|
+
payload: ffiRet.public_group_state.payload
|
2422
|
+
},
|
2110
2423
|
};
|
2111
2424
|
return ret;
|
2112
2425
|
}
|
@@ -2128,7 +2441,11 @@ class CoreCrypto {
|
|
2128
2441
|
const ret = {
|
2129
2442
|
welcome: ffiRet.welcome,
|
2130
2443
|
commit: ffiRet.commit,
|
2131
|
-
publicGroupState:
|
2444
|
+
publicGroupState: {
|
2445
|
+
encryptionType: ffiRet.public_group_state.encryption_type,
|
2446
|
+
ratchetTreeType: ffiRet.public_group_state.ratchet_tree_type,
|
2447
|
+
payload: ffiRet.public_group_state.payload
|
2448
|
+
},
|
2132
2449
|
};
|
2133
2450
|
return ret;
|
2134
2451
|
}
|
@@ -2148,7 +2465,11 @@ class CoreCrypto {
|
|
2148
2465
|
const ret = {
|
2149
2466
|
welcome: ffiRet.welcome,
|
2150
2467
|
commit: ffiRet.commit,
|
2151
|
-
publicGroupState:
|
2468
|
+
publicGroupState: {
|
2469
|
+
encryptionType: ffiRet.public_group_state.encryption_type,
|
2470
|
+
ratchetTreeType: ffiRet.public_group_state.ratchet_tree_type,
|
2471
|
+
payload: ffiRet.public_group_state.payload
|
2472
|
+
},
|
2152
2473
|
};
|
2153
2474
|
return ret;
|
2154
2475
|
}
|
@@ -2168,86 +2489,13 @@ class CoreCrypto {
|
|
2168
2489
|
return ffiCommitBundle ? {
|
2169
2490
|
welcome: ffiCommitBundle.welcome,
|
2170
2491
|
commit: ffiCommitBundle.commit,
|
2171
|
-
publicGroupState:
|
2492
|
+
publicGroupState: {
|
2493
|
+
encryptionType: ffiCommitBundle.public_group_state.encryption_type,
|
2494
|
+
ratchetTreeType: ffiCommitBundle.public_group_state.ratchet_tree_type,
|
2495
|
+
payload: ffiCommitBundle.public_group_state.payload
|
2496
|
+
},
|
2172
2497
|
} : undefined;
|
2173
2498
|
}
|
2174
|
-
/**
|
2175
|
-
* Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
|
2176
|
-
* The returned {@link CommitBundle} is a TLS struct that needs to be fanned out to Delivery Service in order to validate the commit.
|
2177
|
-
* It also contains a Welcome message the Delivery Service will forward to invited clients and
|
2178
|
-
* an updated PublicGroupState required by clients willing to join the group by an external commit.
|
2179
|
-
*
|
2180
|
-
* **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
|
2181
|
-
* '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
|
2182
|
-
* epoch, use new encryption secrets etc...
|
2183
|
-
*
|
2184
|
-
* @param conversationId - The ID of the conversation
|
2185
|
-
* @param clients - Array of {@link Invitee} (which are Client ID / KeyPackage pairs)
|
2186
|
-
*
|
2187
|
-
* @returns A {@link CommitBundle} byte array to fan out to the Delivery Service
|
2188
|
-
*/
|
2189
|
-
async finalAddClientsToConversation(conversationId, clients) {
|
2190
|
-
const ffiClients = clients.map((invitee) => new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).Invitee)(invitee.id, invitee.kp));
|
2191
|
-
const ret = await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").add_clients_to_conversation(conversationId, ffiClients);
|
2192
|
-
ffiClients.forEach(c => c.free());
|
2193
|
-
return ret;
|
2194
|
-
}
|
2195
|
-
/**
|
2196
|
-
* Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
|
2197
|
-
* to do so, otherwise this operation does nothing.
|
2198
|
-
*
|
2199
|
-
* The returned {@link CommitBundle} is a TLS struct that needs to be fanned out to Delivery Service in order to validate the commit.
|
2200
|
-
* It also contains a Welcome message the Delivery Service will forward to invited clients and
|
2201
|
-
* an updated PublicGroupState required by clients willing to join the group by an external commit.
|
2202
|
-
*
|
2203
|
-
* **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
|
2204
|
-
* '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
|
2205
|
-
* epoch, use new encryption secrets etc...
|
2206
|
-
*
|
2207
|
-
* @param conversationId - The ID of the conversation
|
2208
|
-
* @param clientIds - Array of Client IDs to remove.
|
2209
|
-
*
|
2210
|
-
* @returns A {@link CommitBundle} byte array to fan out to the Delivery Service, or `undefined` if for any reason, the operation would result in an empty commit
|
2211
|
-
*/
|
2212
|
-
async finalRemoveClientsFromConversation(conversationId, clientIds) {
|
2213
|
-
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").remove_clients_from_conversation(conversationId, clientIds);
|
2214
|
-
}
|
2215
|
-
/**
|
2216
|
-
* Creates an update commit which forces every client to update their keypackages in the conversation
|
2217
|
-
*
|
2218
|
-
* The returned {@link CommitBundle} is a TLS struct that needs to be fanned out to Delivery Service in order to validate the commit.
|
2219
|
-
* It also contains a Welcome message the Delivery Service will forward to invited clients and
|
2220
|
-
* an updated PublicGroupState required by clients willing to join the group by an external commit.
|
2221
|
-
*
|
2222
|
-
* **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
|
2223
|
-
* '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
|
2224
|
-
* epoch, use new encryption secrets etc...
|
2225
|
-
*
|
2226
|
-
* @param conversationId - The ID of the conversation
|
2227
|
-
*
|
2228
|
-
* @returns A {@link CommitBundle} byte array to fan out to the Delivery Service
|
2229
|
-
*/
|
2230
|
-
async finalUpdateKeyingMaterial(conversationId) {
|
2231
|
-
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").update_keying_material(conversationId);
|
2232
|
-
}
|
2233
|
-
/**
|
2234
|
-
* Commits the local pending proposals and returns the {@link CommitBundle} object containing what can result from this operation.
|
2235
|
-
*
|
2236
|
-
* The returned {@link CommitBundle} is a TLS struct that needs to be fanned out to Delivery Service in order to validate the commit.
|
2237
|
-
* It also contains a Welcome message the Delivery Service will forward to invited clients and
|
2238
|
-
* an updated PublicGroupState required by clients willing to join the group by an external commit.
|
2239
|
-
*
|
2240
|
-
* **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
|
2241
|
-
* '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
|
2242
|
-
* epoch, use new encryption secrets etc...
|
2243
|
-
*
|
2244
|
-
* @param conversationId - The ID of the conversation
|
2245
|
-
*
|
2246
|
-
* @returns A {@link CommitBundle} byte array to fan out to the Delivery Service or `undefined` when there was no pending proposal to commit
|
2247
|
-
*/
|
2248
|
-
async finalCommitPendingProposals(conversationId) {
|
2249
|
-
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").commit_pending_proposals(conversationId);
|
2250
|
-
}
|
2251
2499
|
/**
|
2252
2500
|
* Creates a new proposal for the provided Conversation ID
|
2253
2501
|
*
|
@@ -2302,25 +2550,34 @@ class CoreCrypto {
|
|
2302
2550
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").export_group_state(conversationId);
|
2303
2551
|
}
|
2304
2552
|
/**
|
2305
|
-
* Allows to create an external commit to "apply" to join a group through its public group state
|
2553
|
+
* Allows to create an external commit to "apply" to join a group through its public group state.
|
2306
2554
|
*
|
2307
|
-
*
|
2555
|
+
* If the Delivery Service accepts the external commit, you have to {@link CoreCrypto.mergePendingGroupFromExternalCommit}
|
2556
|
+
* in order to get back a functional MLS group. On the opposite, if it rejects it, you can either retry by just
|
2557
|
+
* calling again {@link CoreCrypto.joinByExternalCommit}, no need to {@link CoreCrypto.clearPendingGroupFromExternalCommit}.
|
2558
|
+
* If you want to abort the operation (too many retries or the user decided to abort), you can use
|
2559
|
+
* {@link CoreCrypto.clearPendingGroupFromExternalCommit} in order not to bloat the user's storage but nothing
|
2560
|
+
* bad can happen if you forget to except some storage space wasted.
|
2308
2561
|
*
|
2309
|
-
* @param publicGroupState -
|
2310
|
-
* @returns see {@link
|
2562
|
+
* @param publicGroupState - a TLS encoded PublicGroupState fetched from the Delivery Service
|
2563
|
+
* @returns see {@link ConversationInitBundle}
|
2311
2564
|
*/
|
2312
2565
|
async joinByExternalCommit(publicGroupState) {
|
2313
2566
|
const ffiInitMessage = await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").join_by_external_commit(publicGroupState);
|
2314
2567
|
const ret = {
|
2315
|
-
|
2568
|
+
conversationId: ffiInitMessage.conversation_id,
|
2316
2569
|
commit: ffiInitMessage.commit,
|
2570
|
+
publicGroupState: {
|
2571
|
+
encryptionType: ffiInitMessage.public_group_state.encryption_type,
|
2572
|
+
ratchetTreeType: ffiInitMessage.public_group_state.ratchet_tree_type,
|
2573
|
+
payload: ffiInitMessage.public_group_state.payload
|
2574
|
+
},
|
2317
2575
|
};
|
2318
2576
|
return ret;
|
2319
2577
|
}
|
2320
2578
|
/**
|
2321
|
-
* This
|
2322
|
-
*
|
2323
|
-
* This step makes the group operational and ready to encrypt/decrypt message
|
2579
|
+
* This merges the commit generated by {@link CoreCrypto.joinByExternalCommit}, persists the group permanently
|
2580
|
+
* and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
|
2324
2581
|
*
|
2325
2582
|
* @param conversationId - The ID of the conversation
|
2326
2583
|
* @param configuration - Configuration of the group, see {@link ConversationConfiguration}
|
@@ -2330,6 +2587,16 @@ class CoreCrypto {
|
|
2330
2587
|
const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(admins, ciphersuite, keyRotationSpan, externalSenders);
|
2331
2588
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").merge_pending_group_from_external_commit(conversationId, config);
|
2332
2589
|
}
|
2590
|
+
/**
|
2591
|
+
* In case the external commit generated by {@link CoreCrypto.joinByExternalCommit} is rejected by the Delivery Service, and we
|
2592
|
+
* want to abort this external commit once for all, we can wipe out the pending group from the keystore in order
|
2593
|
+
* not to waste space
|
2594
|
+
*
|
2595
|
+
* @param conversationId - The ID of the conversation
|
2596
|
+
*/
|
2597
|
+
async clearPendingGroupFromExternalCommit(conversationId) {
|
2598
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").clear_pending_group_from_external_commit(conversationId);
|
2599
|
+
}
|
2333
2600
|
/**
|
2334
2601
|
* Allows to mark the latest commit produced as "accepted" and be able to safely merge it
|
2335
2602
|
* into the local group state
|
@@ -2366,6 +2633,28 @@ class CoreCrypto {
|
|
2366
2633
|
async clearPendingCommit(conversationId) {
|
2367
2634
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").clear_pending_commit(conversationId);
|
2368
2635
|
}
|
2636
|
+
/**
|
2637
|
+
* Derives a new key from the group
|
2638
|
+
*
|
2639
|
+
* @param conversationId - The group's ID
|
2640
|
+
* @param keyLength - the length of the key to be derived. If the value is higher than the
|
2641
|
+
* bounds of `u16` or the context hash * 255, an error will be returned
|
2642
|
+
*
|
2643
|
+
* @returns A `Uint8Array` representing the derived key
|
2644
|
+
*/
|
2645
|
+
async exportSecretKey(conversationId, keyLength) {
|
2646
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").export_secret_key(conversationId, keyLength);
|
2647
|
+
}
|
2648
|
+
/**
|
2649
|
+
* Returns all clients from group's members
|
2650
|
+
*
|
2651
|
+
* @param conversationId - The group's ID
|
2652
|
+
*
|
2653
|
+
* @returns A list of clients from the members of the group
|
2654
|
+
*/
|
2655
|
+
async getClientIds(conversationId) {
|
2656
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").get_client_ids(conversationId);
|
2657
|
+
}
|
2369
2658
|
/**
|
2370
2659
|
* Allows {@link CoreCrypto} to act as a CSPRNG provider
|
2371
2660
|
* @note The underlying CSPRNG algorithm is ChaCha20 and takes in account the external seed provider either at init time or provided with {@link CoreCrypto.reseedRng}
|
@@ -2388,6 +2677,104 @@ class CoreCrypto {
|
|
2388
2677
|
}
|
2389
2678
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").reseed_rng(seed);
|
2390
2679
|
}
|
2680
|
+
/**
|
2681
|
+
* Initiailizes the proteus client
|
2682
|
+
*/
|
2683
|
+
async proteusInit() {
|
2684
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_init();
|
2685
|
+
}
|
2686
|
+
/**
|
2687
|
+
* Create a Proteus session using a prekey
|
2688
|
+
*
|
2689
|
+
* @param sessionId - ID of the Proteus session
|
2690
|
+
* @param prekey - CBOR-encoded Proteus prekey of the other client
|
2691
|
+
*/
|
2692
|
+
async proteusSessionFromPrekey(sessionId, prekey) {
|
2693
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_from_prekey(sessionId, prekey);
|
2694
|
+
}
|
2695
|
+
/**
|
2696
|
+
* Create a Proteus session from a handshake message
|
2697
|
+
*
|
2698
|
+
* @param sessionId - ID of the Proteus session
|
2699
|
+
* @param envelope - CBOR-encoded Proteus message
|
2700
|
+
*/
|
2701
|
+
async proteusSessionFromMessage(sessionId, envelope) {
|
2702
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_from_message(sessionId, envelope);
|
2703
|
+
}
|
2704
|
+
/**
|
2705
|
+
* Locally persists a session to the keystore
|
2706
|
+
*
|
2707
|
+
* @param sessionId - ID of the Proteus session
|
2708
|
+
*/
|
2709
|
+
async proteusSessionSave(sessionId) {
|
2710
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_save(sessionId);
|
2711
|
+
}
|
2712
|
+
/**
|
2713
|
+
* Deletes a session
|
2714
|
+
* Note: this also deletes the persisted data within the keystore
|
2715
|
+
*
|
2716
|
+
* @param sessionId - ID of the Proteus session
|
2717
|
+
*/
|
2718
|
+
async proteusSessionDelete(sessionId) {
|
2719
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_delete(sessionId);
|
2720
|
+
}
|
2721
|
+
/**
|
2722
|
+
* Decrypt an incoming message for an existing Proteus session
|
2723
|
+
*
|
2724
|
+
* @param sessionId - ID of the Proteus session
|
2725
|
+
* @param ciphertext - CBOR encoded, encrypted proteus message
|
2726
|
+
* @returns The decrypted payload contained within the message
|
2727
|
+
*/
|
2728
|
+
async proteusDecrypt(sessionId, ciphertext) {
|
2729
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_decrypt(sessionId, ciphertext);
|
2730
|
+
}
|
2731
|
+
/**
|
2732
|
+
* Encrypt a message for a given Proteus session
|
2733
|
+
*
|
2734
|
+
* @param sessionId - ID of the Proteus session
|
2735
|
+
* @param plaintext - payload to encrypt
|
2736
|
+
* @returns The CBOR-serialized encrypted message
|
2737
|
+
*/
|
2738
|
+
async proteusEncrypt(sessionId, plaintext) {
|
2739
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_encrypt(sessionId, plaintext);
|
2740
|
+
}
|
2741
|
+
/**
|
2742
|
+
* Batch encryption for proteus messages
|
2743
|
+
* This is used to minimize FFI roundtrips when used in the context of a multi-client session (i.e. conversation)
|
2744
|
+
*
|
2745
|
+
* @param sessions - List of Proteus session IDs to encrypt the message for
|
2746
|
+
* @param plaintext - payload to encrypt
|
2747
|
+
* @returns A map indexed by each session ID and the corresponding CBOR-serialized encrypted message for this session
|
2748
|
+
*/
|
2749
|
+
async proteusEncryptBatched(sessions, plaintext) {
|
2750
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_encrypt_batched(sessions, plaintext);
|
2751
|
+
}
|
2752
|
+
/**
|
2753
|
+
* Creates a new prekey with the requested ID.
|
2754
|
+
*
|
2755
|
+
* @param prekeyId - ID of the PreKey to generate. This cannot be bigger than a u16
|
2756
|
+
* @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
|
2757
|
+
*/
|
2758
|
+
async proteusNewPrekey(prekeyId) {
|
2759
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_new_prekey(prekeyId);
|
2760
|
+
}
|
2761
|
+
/**
|
2762
|
+
* Proteus public key fingerprint
|
2763
|
+
* It's basically the public key encoded as an hex string
|
2764
|
+
*
|
2765
|
+
* @returns Hex-encoded public key string
|
2766
|
+
*/
|
2767
|
+
async proteusFingerprint() {
|
2768
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_fingerprint();
|
2769
|
+
}
|
2770
|
+
/**
|
2771
|
+
* Imports all the data stored by Cryptobox into the CoreCrypto keystore
|
2772
|
+
*
|
2773
|
+
* @param storeName - The name of the IndexedDB store where the data is stored
|
2774
|
+
*/
|
2775
|
+
async proteusCryptoboxMigrate(storeName) {
|
2776
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_cryptobox_migrate(storeName);
|
2777
|
+
}
|
2391
2778
|
/**
|
2392
2779
|
* Returns the current version of {@link CoreCrypto}
|
2393
2780
|
*
|
@@ -2404,4 +2791,4 @@ _a = CoreCrypto, _CoreCrypto_cc = new WeakMap();
|
|
2404
2791
|
/** @hidden */
|
2405
2792
|
_CoreCrypto_module = { value: void 0 };
|
2406
2793
|
|
2407
|
-
export { Ciphersuite, CoreCrypto, ExternalProposalType, ProposalType };
|
2794
|
+
export { Ciphersuite, CoreCrypto, ExternalProposalType, ProposalType, PublicGroupStateEncryptionType, RatchetTreeType };
|