@wireapp/core-crypto 0.6.0-pre.5 → 0.6.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
Binary file
|
@@ -35,39 +35,61 @@ export declare enum Ciphersuite {
|
|
35
35
|
* Configuration object for new conversations
|
36
36
|
*/
|
37
37
|
export interface ConversationConfiguration {
|
38
|
-
/**
|
39
|
-
* List of client IDs with administrative permissions
|
40
|
-
* Note: This is currently unused
|
41
|
-
*/
|
42
|
-
admins?: Uint8Array[];
|
43
38
|
/**
|
44
39
|
* Conversation ciphersuite
|
45
40
|
*/
|
46
41
|
ciphersuite?: Ciphersuite;
|
42
|
+
/**
|
43
|
+
* List of client IDs that are allowed to be external senders of commits
|
44
|
+
*/
|
45
|
+
externalSenders?: Uint8Array[];
|
46
|
+
/**
|
47
|
+
* Implementation specific configuration
|
48
|
+
*/
|
49
|
+
custom?: CustomConfiguration;
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* see [core_crypto::prelude::MlsWirePolicy]
|
53
|
+
*/
|
54
|
+
export declare enum WirePolicy {
|
55
|
+
/**
|
56
|
+
* Handshake messages are never encrypted
|
57
|
+
*/
|
58
|
+
Plaintext = 1,
|
59
|
+
/**
|
60
|
+
* Handshake messages are always encrypted
|
61
|
+
*/
|
62
|
+
Ciphertext = 2
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* Implementation specific configuration object for a conversation
|
66
|
+
*/
|
67
|
+
export interface CustomConfiguration {
|
47
68
|
/**
|
48
69
|
* Duration in seconds after which we will automatically force a self_update commit
|
49
70
|
* Note: This isn't currently implemented
|
50
71
|
*/
|
51
72
|
keyRotationSpan?: number;
|
52
73
|
/**
|
53
|
-
*
|
74
|
+
* Defines if handshake messages are encrypted or not
|
75
|
+
* Note: Ciphertext is not currently supported by wire-server
|
54
76
|
*/
|
55
|
-
|
77
|
+
wirePolicy?: WirePolicy;
|
56
78
|
}
|
57
79
|
/**
|
58
80
|
* Alias for conversation IDs.
|
59
81
|
* This is a freeform, uninspected buffer.
|
60
82
|
*/
|
61
|
-
export
|
83
|
+
export type ConversationId = Uint8Array;
|
62
84
|
/**
|
63
85
|
* Alias for client identifier.
|
64
86
|
* This is a freeform, uninspected buffer.
|
65
87
|
*/
|
66
|
-
export
|
88
|
+
export type ClientId = Uint8Array;
|
67
89
|
/**
|
68
90
|
* Alias for proposal reference. It is a byte array of size 16.
|
69
91
|
*/
|
70
|
-
export
|
92
|
+
export type ProposalRef = Uint8Array;
|
71
93
|
/**
|
72
94
|
* Data shape for the returned MLS commit & welcome message tuple upon adding clients to a conversation
|
73
95
|
*/
|
@@ -182,7 +204,7 @@ export interface CoreCryptoParams {
|
|
182
204
|
* MLS Client ID.
|
183
205
|
* This should stay consistent as it will be verified against the stored signature & identity to validate the persisted credential
|
184
206
|
*/
|
185
|
-
clientId:
|
207
|
+
clientId: ClientId;
|
186
208
|
/**
|
187
209
|
* External PRNG entropy pool seed.
|
188
210
|
* This **must** be exactly 32 bytes
|
@@ -435,7 +457,7 @@ export declare class CoreCrypto {
|
|
435
457
|
*
|
436
458
|
* @param clientId - {@link CoreCryptoParams#clientId} but required
|
437
459
|
*/
|
438
|
-
mlsInit(clientId:
|
460
|
+
mlsInit(clientId: ClientId): Promise<void>;
|
439
461
|
/** @hidden */
|
440
462
|
private constructor();
|
441
463
|
/**
|
@@ -497,10 +519,10 @@ export declare class CoreCrypto {
|
|
497
519
|
* You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
|
498
520
|
*
|
499
521
|
* @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
|
500
|
-
* @param configuration
|
522
|
+
* @param configuration - configuration of the MLS group
|
501
523
|
* @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
|
502
|
-
* @param configuration.keyRotationSpan - The amount of time in milliseconds after which the MLS Keypackages will be rotated
|
503
524
|
* @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
|
525
|
+
* @param configuration.custom - {@link CustomConfiguration}
|
504
526
|
*/
|
505
527
|
createConversation(conversationId: ConversationId, configuration?: ConversationConfiguration): Promise<any>;
|
506
528
|
/**
|
@@ -522,12 +544,13 @@ export declare class CoreCrypto {
|
|
522
544
|
*/
|
523
545
|
encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
|
524
546
|
/**
|
525
|
-
* Ingest a TLS-serialized MLS welcome message to join
|
547
|
+
* Ingest a TLS-serialized MLS welcome message to join an existing MLS group
|
526
548
|
*
|
527
549
|
* @param welcomeMessage - TLS-serialized MLS Welcome message
|
550
|
+
* @param configuration - configuration of the MLS group
|
528
551
|
* @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
|
529
552
|
*/
|
530
|
-
processWelcomeMessage(welcomeMessage: Uint8Array): Promise<ConversationId>;
|
553
|
+
processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration): Promise<ConversationId>;
|
531
554
|
/**
|
532
555
|
* @returns The client's public key
|
533
556
|
*/
|
@@ -622,17 +645,17 @@ export declare class CoreCrypto {
|
|
622
645
|
* bad can happen if you forget to except some storage space wasted.
|
623
646
|
*
|
624
647
|
* @param publicGroupState - a TLS encoded PublicGroupState fetched from the Delivery Service
|
648
|
+
* @param configuration - configuration of the MLS group
|
625
649
|
* @returns see {@link ConversationInitBundle}
|
626
650
|
*/
|
627
|
-
joinByExternalCommit(publicGroupState: Uint8Array): Promise<ConversationInitBundle>;
|
651
|
+
joinByExternalCommit(publicGroupState: Uint8Array, configuration?: CustomConfiguration): Promise<ConversationInitBundle>;
|
628
652
|
/**
|
629
653
|
* This merges the commit generated by {@link CoreCrypto.joinByExternalCommit}, persists the group permanently
|
630
654
|
* and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
|
631
655
|
*
|
632
656
|
* @param conversationId - The ID of the conversation
|
633
|
-
* @param configuration - Configuration of the group, see {@link ConversationConfiguration}
|
634
657
|
*/
|
635
|
-
mergePendingGroupFromExternalCommit(conversationId: ConversationId
|
658
|
+
mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<void>;
|
636
659
|
/**
|
637
660
|
* In case the external commit generated by {@link CoreCrypto.joinByExternalCommit} is rejected by the Delivery Service, and we
|
638
661
|
* want to abort this external commit once for all, we can wipe out the pending group from the keystore in order
|
@@ -720,8 +743,10 @@ export declare class CoreCrypto {
|
|
720
743
|
*
|
721
744
|
* @param sessionId - ID of the Proteus session
|
722
745
|
* @param envelope - CBOR-encoded Proteus message
|
746
|
+
*
|
747
|
+
* @returns A `Uint8Array` containing the message that was sent along with the session handshake
|
723
748
|
*/
|
724
|
-
proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<
|
749
|
+
proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<Uint8Array>;
|
725
750
|
/**
|
726
751
|
* Locally persists a session to the keystore
|
727
752
|
*
|
@@ -739,8 +764,10 @@ export declare class CoreCrypto {
|
|
739
764
|
* Checks if a session exists
|
740
765
|
*
|
741
766
|
* @param sessionId - ID of the Proteus session
|
767
|
+
*
|
768
|
+
* @returns whether the session exists or not
|
742
769
|
*/
|
743
|
-
proteusSessionExists(sessionId: string): Promise<
|
770
|
+
proteusSessionExists(sessionId: string): Promise<boolean>;
|
744
771
|
/**
|
745
772
|
* Decrypt an incoming message for an existing Proteus session
|
746
773
|
*
|
@@ -783,15 +810,24 @@ export declare class CoreCrypto {
|
|
783
810
|
/**
|
784
811
|
* Proteus session local fingerprint
|
785
812
|
*
|
813
|
+
* @param sessionId - ID of the Proteus session
|
786
814
|
* @returns Hex-encoded public key string
|
787
815
|
*/
|
788
816
|
proteusFingerprintLocal(sessionId: string): Promise<string>;
|
789
817
|
/**
|
790
818
|
* Proteus session remote fingerprint
|
791
819
|
*
|
820
|
+
* @param sessionId - ID of the Proteus session
|
792
821
|
* @returns Hex-encoded public key string
|
793
822
|
*/
|
794
823
|
proteusFingerprintRemote(sessionId: string): Promise<string>;
|
824
|
+
/**
|
825
|
+
* Hex-encoded fingerprint of the given prekey
|
826
|
+
*
|
827
|
+
* @param prekey - the prekey bundle to get the fingerprint from
|
828
|
+
* @returns Hex-encoded public key string
|
829
|
+
**/
|
830
|
+
static proteusFingerprintPrekeybundle(prekey: Uint8Array): string;
|
795
831
|
/**
|
796
832
|
* Imports all the data stored by Cryptobox into the CoreCrypto keystore
|
797
833
|
*
|
@@ -36,6 +36,15 @@ function getObject(idx) { return heap[idx]; }
|
|
36
36
|
|
37
37
|
let heap_next = heap.length;
|
38
38
|
|
39
|
+
function addHeapObject(obj) {
|
40
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
41
|
+
const idx = heap_next;
|
42
|
+
heap_next = heap[idx];
|
43
|
+
|
44
|
+
heap[idx] = obj;
|
45
|
+
return idx;
|
46
|
+
}
|
47
|
+
|
39
48
|
function dropObject(idx) {
|
40
49
|
if (idx < 36) return;
|
41
50
|
heap[idx] = heap_next;
|
@@ -48,15 +57,6 @@ function takeObject(idx) {
|
|
48
57
|
return ret;
|
49
58
|
}
|
50
59
|
|
51
|
-
function addHeapObject(obj) {
|
52
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
53
|
-
const idx = heap_next;
|
54
|
-
heap_next = heap[idx];
|
55
|
-
|
56
|
-
heap[idx] = obj;
|
57
|
-
return idx;
|
58
|
-
}
|
59
|
-
|
60
60
|
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
61
61
|
|
62
62
|
cachedTextDecoder.decode();
|
@@ -252,7 +252,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
252
252
|
function __wbg_adapter_52(arg0, arg1, arg2) {
|
253
253
|
try {
|
254
254
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
255
|
-
wasm$1.
|
255
|
+
wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h150b30eeb1e9e4d8(retptr, arg0, arg1, addHeapObject(arg2));
|
256
256
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
257
257
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
258
258
|
if (r1) {
|
@@ -264,7 +264,7 @@ function __wbg_adapter_52(arg0, arg1, arg2) {
|
|
264
264
|
}
|
265
265
|
|
266
266
|
function __wbg_adapter_55(arg0, arg1, arg2) {
|
267
|
-
wasm$1.
|
267
|
+
wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heba224c0328f088b(arg0, arg1, addHeapObject(arg2));
|
268
268
|
}
|
269
269
|
|
270
270
|
/**
|
@@ -328,10 +328,22 @@ function handleError(f, args) {
|
|
328
328
|
function getArrayU8FromWasm0(ptr, len) {
|
329
329
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
330
330
|
}
|
331
|
-
function
|
332
|
-
wasm$1.
|
331
|
+
function __wbg_adapter_219(arg0, arg1, arg2, arg3) {
|
332
|
+
wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h35e2dd043ef02cb8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
333
333
|
}
|
334
334
|
|
335
|
+
/**
|
336
|
+
* see [core_crypto::prelude::MlsWirePolicy]
|
337
|
+
*/
|
338
|
+
const WirePolicy$1 = Object.freeze({
|
339
|
+
/**
|
340
|
+
* Handshake messages are never encrypted
|
341
|
+
*/
|
342
|
+
Plaintext:1,"1":"Plaintext",
|
343
|
+
/**
|
344
|
+
* Handshake messages are always encrypted
|
345
|
+
*/
|
346
|
+
Ciphertext:2,"2":"Ciphertext", });
|
335
347
|
/**
|
336
348
|
* see [core_crypto::prelude::CiphersuiteName]
|
337
349
|
*/
|
@@ -425,17 +437,15 @@ class ConversationConfiguration {
|
|
425
437
|
wasm$1.__wbg_conversationconfiguration_free(ptr);
|
426
438
|
}
|
427
439
|
/**
|
428
|
-
* @param {(Uint8Array)[] | undefined} admins
|
429
440
|
* @param {number | undefined} ciphersuite
|
430
|
-
* @param {number | undefined} key_rotation_span
|
431
441
|
* @param {(Uint8Array)[] | undefined} external_senders
|
442
|
+
* @param {number | undefined} key_rotation_span
|
443
|
+
* @param {number | undefined} wire_policy
|
432
444
|
*/
|
433
|
-
constructor(
|
434
|
-
var ptr0 = isLikeNone(
|
445
|
+
constructor(ciphersuite, external_senders, key_rotation_span, wire_policy) {
|
446
|
+
var ptr0 = isLikeNone(external_senders) ? 0 : passArrayJsValueToWasm0(external_senders, wasm$1.__wbindgen_malloc);
|
435
447
|
var len0 = WASM_VECTOR_LEN;
|
436
|
-
|
437
|
-
var len1 = WASM_VECTOR_LEN;
|
438
|
-
const ret = wasm$1.conversationconfiguration_new(ptr0, len0, isLikeNone(ciphersuite) ? 8 : ciphersuite, !isLikeNone(key_rotation_span), isLikeNone(key_rotation_span) ? 0 : key_rotation_span, ptr1, len1);
|
448
|
+
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);
|
439
449
|
return ConversationConfiguration.__wrap(ret);
|
440
450
|
}
|
441
451
|
}
|
@@ -502,7 +512,7 @@ class CoreCrypto$1 {
|
|
502
512
|
* see [core_crypto::MlsCentral::try_new]
|
503
513
|
* @param {string} path
|
504
514
|
* @param {string} key
|
505
|
-
* @param {
|
515
|
+
* @param {Uint8Array} client_id
|
506
516
|
* @param {Uint8Array | undefined} entropy_seed
|
507
517
|
* @returns {Promise<CoreCrypto>}
|
508
518
|
*/
|
@@ -511,7 +521,7 @@ class CoreCrypto$1 {
|
|
511
521
|
const len0 = WASM_VECTOR_LEN;
|
512
522
|
const ptr1 = passStringToWasm0(key, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
513
523
|
const len1 = WASM_VECTOR_LEN;
|
514
|
-
const ptr2 =
|
524
|
+
const ptr2 = passArray8ToWasm0(client_id, wasm$1.__wbindgen_malloc);
|
515
525
|
const len2 = WASM_VECTOR_LEN;
|
516
526
|
var ptr3 = isLikeNone(entropy_seed) ? 0 : passArray8ToWasm0(entropy_seed, wasm$1.__wbindgen_malloc);
|
517
527
|
var len3 = WASM_VECTOR_LEN;
|
@@ -537,11 +547,11 @@ class CoreCrypto$1 {
|
|
537
547
|
}
|
538
548
|
/**
|
539
549
|
* see [core_crypto::MlsCentral::mls_init]
|
540
|
-
* @param {
|
550
|
+
* @param {Uint8Array} client_id
|
541
551
|
* @returns {Promise<Promise<any>>}
|
542
552
|
*/
|
543
553
|
mls_init(client_id) {
|
544
|
-
const ptr0 =
|
554
|
+
const ptr0 = passArray8ToWasm0(client_id, wasm$1.__wbindgen_malloc);
|
545
555
|
const len0 = WASM_VECTOR_LEN;
|
546
556
|
const ret = wasm$1.corecrypto_mls_init(this.ptr, ptr0, len0);
|
547
557
|
return takeObject(ret);
|
@@ -661,12 +671,16 @@ class CoreCrypto$1 {
|
|
661
671
|
*
|
662
672
|
* see [core_crypto::MlsCentral::process_raw_welcome_message]
|
663
673
|
* @param {Uint8Array} welcome_message
|
674
|
+
* @param {CustomConfiguration} custom_configuration
|
664
675
|
* @returns {Promise<any>}
|
665
676
|
*/
|
666
|
-
process_welcome_message(welcome_message) {
|
677
|
+
process_welcome_message(welcome_message, custom_configuration) {
|
667
678
|
const ptr0 = passArray8ToWasm0(welcome_message, wasm$1.__wbindgen_malloc);
|
668
679
|
const len0 = WASM_VECTOR_LEN;
|
669
|
-
|
680
|
+
_assertClass(custom_configuration, CustomConfiguration);
|
681
|
+
var ptr1 = custom_configuration.ptr;
|
682
|
+
custom_configuration.ptr = 0;
|
683
|
+
const ret = wasm$1.corecrypto_process_welcome_message(this.ptr, ptr0, len0, ptr1);
|
670
684
|
return takeObject(ret);
|
671
685
|
}
|
672
686
|
/**
|
@@ -864,12 +878,16 @@ class CoreCrypto$1 {
|
|
864
878
|
*
|
865
879
|
* see [core_crypto::MlsCentral::join_by_external_commit]
|
866
880
|
* @param {Uint8Array} public_group_state
|
881
|
+
* @param {CustomConfiguration} custom_configuration
|
867
882
|
* @returns {Promise<any>}
|
868
883
|
*/
|
869
|
-
join_by_external_commit(public_group_state) {
|
884
|
+
join_by_external_commit(public_group_state, custom_configuration) {
|
870
885
|
const ptr0 = passArray8ToWasm0(public_group_state, wasm$1.__wbindgen_malloc);
|
871
886
|
const len0 = WASM_VECTOR_LEN;
|
872
|
-
|
887
|
+
_assertClass(custom_configuration, CustomConfiguration);
|
888
|
+
var ptr1 = custom_configuration.ptr;
|
889
|
+
custom_configuration.ptr = 0;
|
890
|
+
const ret = wasm$1.corecrypto_join_by_external_commit(this.ptr, ptr0, len0, ptr1);
|
873
891
|
return takeObject(ret);
|
874
892
|
}
|
875
893
|
/**
|
@@ -877,16 +895,12 @@ class CoreCrypto$1 {
|
|
877
895
|
*
|
878
896
|
* see [core_crypto::MlsCentral::merge_pending_group_from_external_commit]
|
879
897
|
* @param {Uint8Array} conversation_id
|
880
|
-
* @param {ConversationConfiguration} configuration
|
881
898
|
* @returns {Promise<any>}
|
882
899
|
*/
|
883
|
-
merge_pending_group_from_external_commit(conversation_id
|
900
|
+
merge_pending_group_from_external_commit(conversation_id) {
|
884
901
|
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
885
902
|
const len0 = WASM_VECTOR_LEN;
|
886
|
-
|
887
|
-
var ptr1 = configuration.ptr;
|
888
|
-
configuration.ptr = 0;
|
889
|
-
const ret = wasm$1.corecrypto_merge_pending_group_from_external_commit(this.ptr, ptr0, len0, ptr1);
|
903
|
+
const ret = wasm$1.corecrypto_merge_pending_group_from_external_commit(this.ptr, ptr0, len0);
|
890
904
|
return takeObject(ret);
|
891
905
|
}
|
892
906
|
/**
|
@@ -1139,6 +1153,35 @@ class CoreCrypto$1 {
|
|
1139
1153
|
return takeObject(ret);
|
1140
1154
|
}
|
1141
1155
|
/**
|
1156
|
+
* Returns: [`WasmCryptoResult<String>`]
|
1157
|
+
*
|
1158
|
+
* see [core_crypto::proteus::ProteusCproteus_fingerprint_prekeybundle]
|
1159
|
+
* @param {Uint8Array} prekey
|
1160
|
+
* @returns {string}
|
1161
|
+
*/
|
1162
|
+
static proteus_fingerprint_prekeybundle(prekey) {
|
1163
|
+
try {
|
1164
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
1165
|
+
const ptr0 = passArray8ToWasm0(prekey, wasm$1.__wbindgen_malloc);
|
1166
|
+
const len0 = WASM_VECTOR_LEN;
|
1167
|
+
wasm$1.corecrypto_proteus_fingerprint_prekeybundle(retptr, ptr0, len0);
|
1168
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
1169
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
1170
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
1171
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
1172
|
+
var ptr1 = r0;
|
1173
|
+
var len1 = r1;
|
1174
|
+
if (r3) {
|
1175
|
+
ptr1 = 0; len1 = 0;
|
1176
|
+
throw takeObject(r2);
|
1177
|
+
}
|
1178
|
+
return getStringFromWasm0(ptr1, len1);
|
1179
|
+
} finally {
|
1180
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
1181
|
+
wasm$1.__wbindgen_free(ptr1, len1);
|
1182
|
+
}
|
1183
|
+
}
|
1184
|
+
/**
|
1142
1185
|
* Returns: [`WasmCryptoResult<()>`]
|
1143
1186
|
*
|
1144
1187
|
* see [core_crypto::proteus::ProteusCentral::cryptobox_migrate]
|
@@ -1213,6 +1256,38 @@ class CoreCryptoWasmCallbacks {
|
|
1213
1256
|
}
|
1214
1257
|
}
|
1215
1258
|
/**
|
1259
|
+
* see [core_crypto::prelude::MlsCustomConfiguration]
|
1260
|
+
*/
|
1261
|
+
class CustomConfiguration {
|
1262
|
+
|
1263
|
+
static __wrap(ptr) {
|
1264
|
+
const obj = Object.create(CustomConfiguration.prototype);
|
1265
|
+
obj.ptr = ptr;
|
1266
|
+
|
1267
|
+
return obj;
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
__destroy_into_raw() {
|
1271
|
+
const ptr = this.ptr;
|
1272
|
+
this.ptr = 0;
|
1273
|
+
|
1274
|
+
return ptr;
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
free() {
|
1278
|
+
const ptr = this.__destroy_into_raw();
|
1279
|
+
wasm$1.__wbg_customconfiguration_free(ptr);
|
1280
|
+
}
|
1281
|
+
/**
|
1282
|
+
* @param {number | undefined} key_rotation_span
|
1283
|
+
* @param {number | undefined} wire_policy
|
1284
|
+
*/
|
1285
|
+
constructor(key_rotation_span, wire_policy) {
|
1286
|
+
const ret = wasm$1.customconfiguration_new(!isLikeNone(key_rotation_span), isLikeNone(key_rotation_span) ? 0 : key_rotation_span, isLikeNone(wire_policy) ? 3 : wire_policy);
|
1287
|
+
return CustomConfiguration.__wrap(ret);
|
1288
|
+
}
|
1289
|
+
}
|
1290
|
+
/**
|
1216
1291
|
* see [core_crypto::prelude::decrypt::MlsConversationDecryptMessage]
|
1217
1292
|
*/
|
1218
1293
|
class DecryptedMessage {
|
@@ -1497,9 +1572,6 @@ async function load(module, imports) {
|
|
1497
1572
|
function getImports() {
|
1498
1573
|
const imports = {};
|
1499
1574
|
imports.wbg = {};
|
1500
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
1501
|
-
takeObject(arg0);
|
1502
|
-
};
|
1503
1575
|
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
1504
1576
|
const ret = getObject(arg0);
|
1505
1577
|
return addHeapObject(ret);
|
@@ -1509,6 +1581,9 @@ function getImports() {
|
|
1509
1581
|
const ret = typeof(val) === 'object' && val !== null;
|
1510
1582
|
return ret;
|
1511
1583
|
};
|
1584
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
1585
|
+
takeObject(arg0);
|
1586
|
+
};
|
1512
1587
|
imports.wbg.__wbg_getwithrefkey_15c62c2b8546208d = function(arg0, arg1) {
|
1513
1588
|
const ret = getObject(arg0)[getObject(arg1)];
|
1514
1589
|
return addHeapObject(ret);
|
@@ -1521,48 +1596,6 @@ function getImports() {
|
|
1521
1596
|
const ret = getObject(arg0) in getObject(arg1);
|
1522
1597
|
return ret;
|
1523
1598
|
};
|
1524
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
1525
|
-
const ret = arg0;
|
1526
|
-
return addHeapObject(ret);
|
1527
|
-
};
|
1528
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
1529
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
1530
|
-
return addHeapObject(ret);
|
1531
|
-
};
|
1532
|
-
imports.wbg.__wbg_new_1d9a920c6bfc44a8 = function() {
|
1533
|
-
const ret = new Array();
|
1534
|
-
return addHeapObject(ret);
|
1535
|
-
};
|
1536
|
-
imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
|
1537
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
1538
|
-
};
|
1539
|
-
imports.wbg.__wbg_new_268f7b7dd3430798 = function() {
|
1540
|
-
const ret = new Map();
|
1541
|
-
return addHeapObject(ret);
|
1542
|
-
};
|
1543
|
-
imports.wbg.__wbg_new_0b9bfdd97583284e = function() {
|
1544
|
-
const ret = new Object();
|
1545
|
-
return addHeapObject(ret);
|
1546
|
-
};
|
1547
|
-
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
1548
|
-
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
1549
|
-
return addHeapObject(ret);
|
1550
|
-
};
|
1551
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
1552
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
1553
|
-
return ret;
|
1554
|
-
};
|
1555
|
-
imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
1556
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
1557
|
-
};
|
1558
|
-
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
1559
|
-
const ret = BigInt.asUintN(64, arg0);
|
1560
|
-
return addHeapObject(ret);
|
1561
|
-
};
|
1562
|
-
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
|
1563
|
-
const ret = arg0;
|
1564
|
-
return addHeapObject(ret);
|
1565
|
-
};
|
1566
1599
|
imports.wbg.__wbg_objectStoreNames_8c06c40d2b05141c = function(arg0) {
|
1567
1600
|
const ret = getObject(arg0).objectStoreNames;
|
1568
1601
|
return addHeapObject(ret);
|
@@ -1571,6 +1604,10 @@ function getImports() {
|
|
1571
1604
|
const ret = getObject(arg0).length;
|
1572
1605
|
return ret;
|
1573
1606
|
};
|
1607
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
1608
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
1609
|
+
return addHeapObject(ret);
|
1610
|
+
};
|
1574
1611
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
1575
1612
|
const obj = getObject(arg1);
|
1576
1613
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
@@ -1624,10 +1661,18 @@ function getImports() {
|
|
1624
1661
|
getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0n : ret;
|
1625
1662
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
1626
1663
|
};
|
1664
|
+
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
|
1665
|
+
const ret = arg0;
|
1666
|
+
return addHeapObject(ret);
|
1667
|
+
};
|
1627
1668
|
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
|
1628
1669
|
const ret = getObject(arg0) === getObject(arg1);
|
1629
1670
|
return ret;
|
1630
1671
|
};
|
1672
|
+
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
1673
|
+
const ret = BigInt.asUintN(64, arg0);
|
1674
|
+
return addHeapObject(ret);
|
1675
|
+
};
|
1631
1676
|
imports.wbg.__wbg_isArray_27c46c67f498e15d = function(arg0) {
|
1632
1677
|
const ret = Array.isArray(getObject(arg0));
|
1633
1678
|
return ret;
|
@@ -1644,6 +1689,17 @@ function getImports() {
|
|
1644
1689
|
const ret = CoreCrypto$1.__wrap(arg0);
|
1645
1690
|
return addHeapObject(ret);
|
1646
1691
|
};
|
1692
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
1693
|
+
const ret = arg0;
|
1694
|
+
return addHeapObject(ret);
|
1695
|
+
};
|
1696
|
+
imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
1697
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
1698
|
+
};
|
1699
|
+
imports.wbg.__wbg_new_0b9bfdd97583284e = function() {
|
1700
|
+
const ret = new Object();
|
1701
|
+
return addHeapObject(ret);
|
1702
|
+
};
|
1647
1703
|
imports.wbg.__wbg_call_168da88779e35f61 = function() { return handleError(function (arg0, arg1, arg2) {
|
1648
1704
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
1649
1705
|
return addHeapObject(ret);
|
@@ -1652,10 +1708,6 @@ function getImports() {
|
|
1652
1708
|
const ret = new Uint8Array(getObject(arg0));
|
1653
1709
|
return addHeapObject(ret);
|
1654
1710
|
};
|
1655
|
-
imports.wbg.__wbg_push_740e4b286702d964 = function(arg0, arg1) {
|
1656
|
-
const ret = getObject(arg0).push(getObject(arg1));
|
1657
|
-
return ret;
|
1658
|
-
};
|
1659
1711
|
imports.wbg.__wbg_new_9962f939219f1820 = function(arg0, arg1) {
|
1660
1712
|
try {
|
1661
1713
|
var state0 = {a: arg0, b: arg1};
|
@@ -1663,7 +1715,7 @@ function getImports() {
|
|
1663
1715
|
const a = state0.a;
|
1664
1716
|
state0.a = 0;
|
1665
1717
|
try {
|
1666
|
-
return
|
1718
|
+
return __wbg_adapter_219(a, state0.b, arg0, arg1);
|
1667
1719
|
} finally {
|
1668
1720
|
state0.a = a;
|
1669
1721
|
}
|
@@ -1674,6 +1726,25 @@ function getImports() {
|
|
1674
1726
|
state0.a = state0.b = 0;
|
1675
1727
|
}
|
1676
1728
|
};
|
1729
|
+
imports.wbg.__wbg_new_1d9a920c6bfc44a8 = function() {
|
1730
|
+
const ret = new Array();
|
1731
|
+
return addHeapObject(ret);
|
1732
|
+
};
|
1733
|
+
imports.wbg.__wbg_push_740e4b286702d964 = function(arg0, arg1) {
|
1734
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
1735
|
+
return ret;
|
1736
|
+
};
|
1737
|
+
imports.wbg.__wbg_new_268f7b7dd3430798 = function() {
|
1738
|
+
const ret = new Map();
|
1739
|
+
return addHeapObject(ret);
|
1740
|
+
};
|
1741
|
+
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
1742
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
1743
|
+
return addHeapObject(ret);
|
1744
|
+
};
|
1745
|
+
imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
|
1746
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
1747
|
+
};
|
1677
1748
|
imports.wbg.__wbg_call_3999bee59e9f7719 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
1678
1749
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
1679
1750
|
return addHeapObject(ret);
|
@@ -1747,6 +1818,17 @@ function getImports() {
|
|
1747
1818
|
imports.wbg.__wbg_setonerror_d5771cc5bf9ea74c = function(arg0, arg1) {
|
1748
1819
|
getObject(arg0).onerror = getObject(arg1);
|
1749
1820
|
};
|
1821
|
+
imports.wbg.__wbg_open_a31c3fe1fdc244eb = function() { return handleError(function (arg0, arg1, arg2) {
|
1822
|
+
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2));
|
1823
|
+
return addHeapObject(ret);
|
1824
|
+
}, arguments) };
|
1825
|
+
imports.wbg.__wbg_open_c5d5fb2df44b9d10 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
1826
|
+
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
|
1827
|
+
return addHeapObject(ret);
|
1828
|
+
}, arguments) };
|
1829
|
+
imports.wbg.__wbg_setonupgradeneeded_17d0b9530f1e0cac = function(arg0, arg1) {
|
1830
|
+
getObject(arg0).onupgradeneeded = getObject(arg1);
|
1831
|
+
};
|
1750
1832
|
imports.wbg.__wbg_put_84e7fc93eee27b28 = function() { return handleError(function (arg0, arg1, arg2) {
|
1751
1833
|
const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
|
1752
1834
|
return addHeapObject(ret);
|
@@ -1755,6 +1837,10 @@ function getImports() {
|
|
1755
1837
|
const ret = getObject(arg0).put(getObject(arg1));
|
1756
1838
|
return addHeapObject(ret);
|
1757
1839
|
}, arguments) };
|
1840
|
+
imports.wbg.__wbg_delete_8abedd1043b4105d = function() { return handleError(function (arg0, arg1) {
|
1841
|
+
const ret = getObject(arg0).delete(getObject(arg1));
|
1842
|
+
return addHeapObject(ret);
|
1843
|
+
}, arguments) };
|
1758
1844
|
imports.wbg.__wbg_openCursor_e036069f0e326708 = function() { return handleError(function (arg0, arg1) {
|
1759
1845
|
const ret = getObject(arg0).openCursor(getObject(arg1));
|
1760
1846
|
return addHeapObject(ret);
|
@@ -1763,18 +1849,6 @@ function getImports() {
|
|
1763
1849
|
const ret = getObject(arg0).openCursor();
|
1764
1850
|
return addHeapObject(ret);
|
1765
1851
|
}, arguments) };
|
1766
|
-
imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
|
1767
|
-
const ret = getObject(arg0).count();
|
1768
|
-
return addHeapObject(ret);
|
1769
|
-
}, arguments) };
|
1770
|
-
imports.wbg.__wbg_count_46eda68a16dbe30e = function() { return handleError(function (arg0, arg1) {
|
1771
|
-
const ret = getObject(arg0).count(getObject(arg1));
|
1772
|
-
return addHeapObject(ret);
|
1773
|
-
}, arguments) };
|
1774
|
-
imports.wbg.__wbg_delete_8abedd1043b4105d = function() { return handleError(function (arg0, arg1) {
|
1775
|
-
const ret = getObject(arg0).delete(getObject(arg1));
|
1776
|
-
return addHeapObject(ret);
|
1777
|
-
}, arguments) };
|
1778
1852
|
imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
|
1779
1853
|
const ret = getObject(arg0).get(getObject(arg1));
|
1780
1854
|
return addHeapObject(ret);
|
@@ -1799,24 +1873,21 @@ function getImports() {
|
|
1799
1873
|
const ret = getObject(arg0).openCursor(getObject(arg1));
|
1800
1874
|
return addHeapObject(ret);
|
1801
1875
|
}, arguments) };
|
1876
|
+
imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
|
1877
|
+
getObject(arg0).close();
|
1878
|
+
};
|
1802
1879
|
imports.wbg.__wbg_deleteDatabase_f6454de6a88aebde = function() { return handleError(function (arg0, arg1, arg2) {
|
1803
1880
|
const ret = getObject(arg0).deleteDatabase(getStringFromWasm0(arg1, arg2));
|
1804
1881
|
return addHeapObject(ret);
|
1805
1882
|
}, arguments) };
|
1806
|
-
imports.wbg.
|
1807
|
-
getObject(arg0).
|
1808
|
-
};
|
1809
|
-
imports.wbg.__wbg_open_a31c3fe1fdc244eb = function() { return handleError(function (arg0, arg1, arg2) {
|
1810
|
-
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2));
|
1883
|
+
imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
|
1884
|
+
const ret = getObject(arg0).count();
|
1811
1885
|
return addHeapObject(ret);
|
1812
1886
|
}, arguments) };
|
1813
|
-
imports.wbg.
|
1814
|
-
const ret = getObject(arg0).
|
1887
|
+
imports.wbg.__wbg_count_46eda68a16dbe30e = function() { return handleError(function (arg0, arg1) {
|
1888
|
+
const ret = getObject(arg0).count(getObject(arg1));
|
1815
1889
|
return addHeapObject(ret);
|
1816
1890
|
}, arguments) };
|
1817
|
-
imports.wbg.__wbg_setonupgradeneeded_17d0b9530f1e0cac = function(arg0, arg1) {
|
1818
|
-
getObject(arg0).onupgradeneeded = getObject(arg1);
|
1819
|
-
};
|
1820
1891
|
imports.wbg.__wbg_randomFillSync_6894564c2c334c42 = function() { return handleError(function (arg0, arg1, arg2) {
|
1821
1892
|
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
1822
1893
|
}, arguments) };
|
@@ -1847,6 +1918,10 @@ function getImports() {
|
|
1847
1918
|
const ret = getObject(arg0).node;
|
1848
1919
|
return addHeapObject(ret);
|
1849
1920
|
};
|
1921
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
1922
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
1923
|
+
return ret;
|
1924
|
+
};
|
1850
1925
|
imports.wbg.__wbg_require_78a3dcfbdba9cbce = function() { return handleError(function () {
|
1851
1926
|
const ret = module.require;
|
1852
1927
|
return addHeapObject(ret);
|
@@ -1934,10 +2009,6 @@ function getImports() {
|
|
1934
2009
|
const ret = getObject(arg0).result;
|
1935
2010
|
return addHeapObject(ret);
|
1936
2011
|
}, arguments) };
|
1937
|
-
imports.wbg.__wbg_error_aacf5ac191e54ed0 = function() { return handleError(function (arg0) {
|
1938
|
-
const ret = getObject(arg0).error;
|
1939
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
1940
|
-
}, arguments) };
|
1941
2012
|
imports.wbg.__wbg_contains_6cf516181cd86571 = function(arg0, arg1, arg2) {
|
1942
2013
|
const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
|
1943
2014
|
return ret;
|
@@ -1964,6 +2035,10 @@ function getImports() {
|
|
1964
2035
|
imports.wbg.__wbg_deleteObjectStore_1b698c5fd1bc077d = function() { return handleError(function (arg0, arg1, arg2) {
|
1965
2036
|
getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
|
1966
2037
|
}, arguments) };
|
2038
|
+
imports.wbg.__wbg_error_aacf5ac191e54ed0 = function() { return handleError(function (arg0) {
|
2039
|
+
const ret = getObject(arg0).error;
|
2040
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
2041
|
+
}, arguments) };
|
1967
2042
|
imports.wbg.__wbindgen_is_falsy = function(arg0) {
|
1968
2043
|
const ret = !getObject(arg0);
|
1969
2044
|
return ret;
|
@@ -2064,12 +2139,12 @@ function getImports() {
|
|
2064
2139
|
const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
|
2065
2140
|
return addHeapObject(ret);
|
2066
2141
|
}, arguments) };
|
2067
|
-
imports.wbg.
|
2068
|
-
const ret = makeMutClosure(arg0, arg1,
|
2142
|
+
imports.wbg.__wbindgen_closure_wrapper2363 = function(arg0, arg1, arg2) {
|
2143
|
+
const ret = makeMutClosure(arg0, arg1, 122, __wbg_adapter_52);
|
2069
2144
|
return addHeapObject(ret);
|
2070
2145
|
};
|
2071
|
-
imports.wbg.
|
2072
|
-
const ret = makeMutClosure(arg0, arg1,
|
2146
|
+
imports.wbg.__wbindgen_closure_wrapper3837 = function(arg0, arg1, arg2) {
|
2147
|
+
const ret = makeMutClosure(arg0, arg1, 122, __wbg_adapter_55);
|
2073
2148
|
return addHeapObject(ret);
|
2074
2149
|
};
|
2075
2150
|
|
@@ -2119,12 +2194,14 @@ async function init(input) {
|
|
2119
2194
|
var exports = /*#__PURE__*/Object.freeze({
|
2120
2195
|
__proto__: null,
|
2121
2196
|
version: version,
|
2197
|
+
WirePolicy: WirePolicy$1,
|
2122
2198
|
Ciphersuite: Ciphersuite$1,
|
2123
2199
|
CommitBundle: CommitBundle,
|
2124
2200
|
ConversationConfiguration: ConversationConfiguration,
|
2125
2201
|
ConversationInitBundle: ConversationInitBundle,
|
2126
2202
|
CoreCrypto: CoreCrypto$1,
|
2127
2203
|
CoreCryptoWasmCallbacks: CoreCryptoWasmCallbacks,
|
2204
|
+
CustomConfiguration: CustomConfiguration,
|
2128
2205
|
DecryptedMessage: DecryptedMessage,
|
2129
2206
|
Invitee: Invitee,
|
2130
2207
|
MemberAddedMessages: MemberAddedMessages,
|
@@ -2137,7 +2214,7 @@ var exports = /*#__PURE__*/Object.freeze({
|
|
2137
2214
|
var wasm = async (opt = {}) => {
|
2138
2215
|
let {importHook, serverPath} = opt;
|
2139
2216
|
|
2140
|
-
let path = "assets/core_crypto_ffi-
|
2217
|
+
let path = "assets/core_crypto_ffi-b8c4f151.wasm";
|
2141
2218
|
|
2142
2219
|
if (serverPath != null) {
|
2143
2220
|
path = serverPath + /[^\/\\]*$/.exec(path)[0];
|
@@ -2188,6 +2265,20 @@ var Ciphersuite;
|
|
2188
2265
|
*/
|
2189
2266
|
Ciphersuite[Ciphersuite["MLS_256_DHKEMP384_AES256GCM_SHA384_P384"] = 7] = "MLS_256_DHKEMP384_AES256GCM_SHA384_P384";
|
2190
2267
|
})(Ciphersuite || (Ciphersuite = {}));
|
2268
|
+
/**
|
2269
|
+
* see [core_crypto::prelude::MlsWirePolicy]
|
2270
|
+
*/
|
2271
|
+
var WirePolicy;
|
2272
|
+
(function (WirePolicy) {
|
2273
|
+
/**
|
2274
|
+
* Handshake messages are never encrypted
|
2275
|
+
*/
|
2276
|
+
WirePolicy[WirePolicy["Plaintext"] = 1] = "Plaintext";
|
2277
|
+
/**
|
2278
|
+
* Handshake messages are always encrypted
|
2279
|
+
*/
|
2280
|
+
WirePolicy[WirePolicy["Ciphertext"] = 2] = "Ciphertext";
|
2281
|
+
})(WirePolicy || (WirePolicy = {}));
|
2191
2282
|
/**
|
2192
2283
|
* Informs whether the PublicGroupState is confidential
|
2193
2284
|
* see [core_crypto::mls::conversation::public_group_state::PublicGroupStateEncryptionType]
|
@@ -2258,12 +2349,6 @@ var ExternalProposalType;
|
|
2258
2349
|
* Wrapper for the WASM-compiled version of CoreCrypto
|
2259
2350
|
*/
|
2260
2351
|
class CoreCrypto {
|
2261
|
-
/** @hidden */
|
2262
|
-
constructor(cc) {
|
2263
|
-
/** @hidden */
|
2264
|
-
_CoreCrypto_cc.set(this, void 0);
|
2265
|
-
__classPrivateFieldSet(this, _CoreCrypto_cc, cc, "f");
|
2266
|
-
}
|
2267
2352
|
/**
|
2268
2353
|
* This is your entrypoint to initialize {@link CoreCrypto}!
|
2269
2354
|
*
|
@@ -2329,6 +2414,12 @@ class CoreCrypto {
|
|
2329
2414
|
async mlsInit(clientId) {
|
2330
2415
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").mls_init(clientId);
|
2331
2416
|
}
|
2417
|
+
/** @hidden */
|
2418
|
+
constructor(cc) {
|
2419
|
+
/** @hidden */
|
2420
|
+
_CoreCrypto_cc.set(this, void 0);
|
2421
|
+
__classPrivateFieldSet(this, _CoreCrypto_cc, cc, "f");
|
2422
|
+
}
|
2332
2423
|
/**
|
2333
2424
|
* Wipes the {@link CoreCrypto} backing storage (i.e. {@link https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API | IndexedDB} database)
|
2334
2425
|
*
|
@@ -2401,14 +2492,14 @@ class CoreCrypto {
|
|
2401
2492
|
* You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
|
2402
2493
|
*
|
2403
2494
|
* @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
|
2404
|
-
* @param configuration
|
2495
|
+
* @param configuration - configuration of the MLS group
|
2405
2496
|
* @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
|
2406
|
-
* @param configuration.keyRotationSpan - The amount of time in milliseconds after which the MLS Keypackages will be rotated
|
2407
2497
|
* @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
|
2498
|
+
* @param configuration.custom - {@link CustomConfiguration}
|
2408
2499
|
*/
|
2409
2500
|
async createConversation(conversationId, configuration = {}) {
|
2410
|
-
const {
|
2411
|
-
const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(
|
2501
|
+
const { ciphersuite, externalSenders, custom = {} } = configuration || {};
|
2502
|
+
const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(ciphersuite, externalSenders, custom?.keyRotationSpan);
|
2412
2503
|
const ret = await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").create_conversation(conversationId, config);
|
2413
2504
|
return ret;
|
2414
2505
|
}
|
@@ -2447,13 +2538,16 @@ class CoreCrypto {
|
|
2447
2538
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").encrypt_message(conversationId, message);
|
2448
2539
|
}
|
2449
2540
|
/**
|
2450
|
-
* Ingest a TLS-serialized MLS welcome message to join
|
2541
|
+
* Ingest a TLS-serialized MLS welcome message to join an existing MLS group
|
2451
2542
|
*
|
2452
2543
|
* @param welcomeMessage - TLS-serialized MLS Welcome message
|
2544
|
+
* @param configuration - configuration of the MLS group
|
2453
2545
|
* @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
|
2454
2546
|
*/
|
2455
|
-
async processWelcomeMessage(welcomeMessage) {
|
2456
|
-
|
2547
|
+
async processWelcomeMessage(welcomeMessage, configuration = {}) {
|
2548
|
+
const { keyRotationSpan, wirePolicy } = configuration || {};
|
2549
|
+
const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).CustomConfiguration)(keyRotationSpan, wirePolicy);
|
2550
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").process_welcome_message(welcomeMessage, config);
|
2457
2551
|
}
|
2458
2552
|
/**
|
2459
2553
|
* @returns The client's public key
|
@@ -2647,10 +2741,13 @@ class CoreCrypto {
|
|
2647
2741
|
* bad can happen if you forget to except some storage space wasted.
|
2648
2742
|
*
|
2649
2743
|
* @param publicGroupState - a TLS encoded PublicGroupState fetched from the Delivery Service
|
2744
|
+
* @param configuration - configuration of the MLS group
|
2650
2745
|
* @returns see {@link ConversationInitBundle}
|
2651
2746
|
*/
|
2652
|
-
async joinByExternalCommit(publicGroupState) {
|
2653
|
-
const
|
2747
|
+
async joinByExternalCommit(publicGroupState, configuration = {}) {
|
2748
|
+
const { keyRotationSpan, wirePolicy } = configuration || {};
|
2749
|
+
const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).CustomConfiguration)(keyRotationSpan, wirePolicy);
|
2750
|
+
const ffiInitMessage = await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").join_by_external_commit(publicGroupState, config);
|
2654
2751
|
const pgs = ffiInitMessage.public_group_state;
|
2655
2752
|
const ret = {
|
2656
2753
|
conversationId: ffiInitMessage.conversation_id,
|
@@ -2668,12 +2765,9 @@ class CoreCrypto {
|
|
2668
2765
|
* and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
|
2669
2766
|
*
|
2670
2767
|
* @param conversationId - The ID of the conversation
|
2671
|
-
* @param configuration - Configuration of the group, see {@link ConversationConfiguration}
|
2672
2768
|
*/
|
2673
|
-
async mergePendingGroupFromExternalCommit(conversationId
|
2674
|
-
|
2675
|
-
const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(admins, ciphersuite, keyRotationSpan, externalSenders);
|
2676
|
-
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").merge_pending_group_from_external_commit(conversationId, config);
|
2769
|
+
async mergePendingGroupFromExternalCommit(conversationId) {
|
2770
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").merge_pending_group_from_external_commit(conversationId);
|
2677
2771
|
}
|
2678
2772
|
/**
|
2679
2773
|
* In case the external commit generated by {@link CoreCrypto.joinByExternalCommit} is rejected by the Delivery Service, and we
|
@@ -2785,6 +2879,8 @@ class CoreCrypto {
|
|
2785
2879
|
*
|
2786
2880
|
* @param sessionId - ID of the Proteus session
|
2787
2881
|
* @param envelope - CBOR-encoded Proteus message
|
2882
|
+
*
|
2883
|
+
* @returns A `Uint8Array` containing the message that was sent along with the session handshake
|
2788
2884
|
*/
|
2789
2885
|
async proteusSessionFromMessage(sessionId, envelope) {
|
2790
2886
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_from_message(sessionId, envelope);
|
@@ -2810,6 +2906,8 @@ class CoreCrypto {
|
|
2810
2906
|
* Checks if a session exists
|
2811
2907
|
*
|
2812
2908
|
* @param sessionId - ID of the Proteus session
|
2909
|
+
*
|
2910
|
+
* @returns whether the session exists or not
|
2813
2911
|
*/
|
2814
2912
|
async proteusSessionExists(sessionId) {
|
2815
2913
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_exists(sessionId);
|
@@ -2866,6 +2964,7 @@ class CoreCrypto {
|
|
2866
2964
|
/**
|
2867
2965
|
* Proteus session local fingerprint
|
2868
2966
|
*
|
2967
|
+
* @param sessionId - ID of the Proteus session
|
2869
2968
|
* @returns Hex-encoded public key string
|
2870
2969
|
*/
|
2871
2970
|
async proteusFingerprintLocal(sessionId) {
|
@@ -2874,11 +2973,21 @@ class CoreCrypto {
|
|
2874
2973
|
/**
|
2875
2974
|
* Proteus session remote fingerprint
|
2876
2975
|
*
|
2976
|
+
* @param sessionId - ID of the Proteus session
|
2877
2977
|
* @returns Hex-encoded public key string
|
2878
2978
|
*/
|
2879
2979
|
async proteusFingerprintRemote(sessionId) {
|
2880
2980
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_fingerprint_remote(sessionId);
|
2881
2981
|
}
|
2982
|
+
/**
|
2983
|
+
* Hex-encoded fingerprint of the given prekey
|
2984
|
+
*
|
2985
|
+
* @param prekey - the prekey bundle to get the fingerprint from
|
2986
|
+
* @returns Hex-encoded public key string
|
2987
|
+
**/
|
2988
|
+
static proteusFingerprintPrekeybundle(prekey) {
|
2989
|
+
return __classPrivateFieldGet(this, _a, "f", _CoreCrypto_module).CoreCrypto.proteus_fingerprint_prekeybundle(prekey);
|
2990
|
+
}
|
2882
2991
|
/**
|
2883
2992
|
* Imports all the data stored by Cryptobox into the CoreCrypto keystore
|
2884
2993
|
*
|
@@ -2903,4 +3012,4 @@ _a = CoreCrypto, _CoreCrypto_cc = new WeakMap();
|
|
2903
3012
|
/** @hidden */
|
2904
3013
|
_CoreCrypto_module = { value: void 0 };
|
2905
3014
|
|
2906
|
-
export { Ciphersuite, CoreCrypto, ExternalProposalType, ProposalType, PublicGroupStateEncryptionType, RatchetTreeType };
|
3015
|
+
export { Ciphersuite, CoreCrypto, ExternalProposalType, ProposalType, PublicGroupStateEncryptionType, RatchetTreeType, WirePolicy };
|
Binary file
|