@wireapp/core-crypto 0.6.0-pre.4 → 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/README.md
CHANGED
@@ -101,7 +101,7 @@ cargo make wasm
|
|
101
101
|
|
102
102
|
### Versioning
|
103
103
|
|
104
|
-
* Run `cargo xtask bump [major|minor|patch|rc|pre]`
|
104
|
+
* Run `cargo xtask release bump [major|minor|patch|rc|pre]`
|
105
105
|
* Update the internal dependencies of the updated crates to use the new version
|
106
106
|
* Update the version in the `package.json`
|
107
107
|
* Update the version in the `build.gradle.kts` inside `./kotlin/android` and `./kotlin/jvm`
|
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
|
@@ -423,6 +445,19 @@ export declare class CoreCrypto {
|
|
423
445
|
* ````
|
424
446
|
*/
|
425
447
|
static init({ databaseName, key, clientId, wasmFilePath, entropySeed }: CoreCryptoParams): Promise<CoreCrypto>;
|
448
|
+
/**
|
449
|
+
* Almost identical to {@link CoreCrypto.init} but allows a 2 phase initialization of MLS.
|
450
|
+
* First, calling this will set up the keystore and will allow generating proteus prekeys.
|
451
|
+
* Then, those keys can be traded for a clientId.
|
452
|
+
* Use this clientId to initialize MLS with {@link CoreCrypto.mlsInit}.
|
453
|
+
*/
|
454
|
+
static deferredInit(databaseName: string, key: string, entropySeed?: Uint8Array, wasmFilePath?: string): Promise<CoreCrypto>;
|
455
|
+
/**
|
456
|
+
* Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
|
457
|
+
*
|
458
|
+
* @param clientId - {@link CoreCryptoParams#clientId} but required
|
459
|
+
*/
|
460
|
+
mlsInit(clientId: ClientId): Promise<void>;
|
426
461
|
/** @hidden */
|
427
462
|
private constructor();
|
428
463
|
/**
|
@@ -484,10 +519,10 @@ export declare class CoreCrypto {
|
|
484
519
|
* You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
|
485
520
|
*
|
486
521
|
* @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
|
487
|
-
* @param configuration
|
522
|
+
* @param configuration - configuration of the MLS group
|
488
523
|
* @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
|
489
|
-
* @param configuration.keyRotationSpan - The amount of time in milliseconds after which the MLS Keypackages will be rotated
|
490
524
|
* @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
|
525
|
+
* @param configuration.custom - {@link CustomConfiguration}
|
491
526
|
*/
|
492
527
|
createConversation(conversationId: ConversationId, configuration?: ConversationConfiguration): Promise<any>;
|
493
528
|
/**
|
@@ -509,12 +544,13 @@ export declare class CoreCrypto {
|
|
509
544
|
*/
|
510
545
|
encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
|
511
546
|
/**
|
512
|
-
* Ingest a TLS-serialized MLS welcome message to join
|
547
|
+
* Ingest a TLS-serialized MLS welcome message to join an existing MLS group
|
513
548
|
*
|
514
549
|
* @param welcomeMessage - TLS-serialized MLS Welcome message
|
550
|
+
* @param configuration - configuration of the MLS group
|
515
551
|
* @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
|
516
552
|
*/
|
517
|
-
processWelcomeMessage(welcomeMessage: Uint8Array): Promise<ConversationId>;
|
553
|
+
processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration): Promise<ConversationId>;
|
518
554
|
/**
|
519
555
|
* @returns The client's public key
|
520
556
|
*/
|
@@ -609,17 +645,17 @@ export declare class CoreCrypto {
|
|
609
645
|
* bad can happen if you forget to except some storage space wasted.
|
610
646
|
*
|
611
647
|
* @param publicGroupState - a TLS encoded PublicGroupState fetched from the Delivery Service
|
648
|
+
* @param configuration - configuration of the MLS group
|
612
649
|
* @returns see {@link ConversationInitBundle}
|
613
650
|
*/
|
614
|
-
joinByExternalCommit(publicGroupState: Uint8Array): Promise<ConversationInitBundle>;
|
651
|
+
joinByExternalCommit(publicGroupState: Uint8Array, configuration?: CustomConfiguration): Promise<ConversationInitBundle>;
|
615
652
|
/**
|
616
653
|
* This merges the commit generated by {@link CoreCrypto.joinByExternalCommit}, persists the group permanently
|
617
654
|
* and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
|
618
655
|
*
|
619
656
|
* @param conversationId - The ID of the conversation
|
620
|
-
* @param configuration - Configuration of the group, see {@link ConversationConfiguration}
|
621
657
|
*/
|
622
|
-
mergePendingGroupFromExternalCommit(conversationId: ConversationId
|
658
|
+
mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<void>;
|
623
659
|
/**
|
624
660
|
* In case the external commit generated by {@link CoreCrypto.joinByExternalCommit} is rejected by the Delivery Service, and we
|
625
661
|
* want to abort this external commit once for all, we can wipe out the pending group from the keystore in order
|
@@ -707,8 +743,10 @@ export declare class CoreCrypto {
|
|
707
743
|
*
|
708
744
|
* @param sessionId - ID of the Proteus session
|
709
745
|
* @param envelope - CBOR-encoded Proteus message
|
746
|
+
*
|
747
|
+
* @returns A `Uint8Array` containing the message that was sent along with the session handshake
|
710
748
|
*/
|
711
|
-
proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<
|
749
|
+
proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<Uint8Array>;
|
712
750
|
/**
|
713
751
|
* Locally persists a session to the keystore
|
714
752
|
*
|
@@ -726,8 +764,10 @@ export declare class CoreCrypto {
|
|
726
764
|
* Checks if a session exists
|
727
765
|
*
|
728
766
|
* @param sessionId - ID of the Proteus session
|
767
|
+
*
|
768
|
+
* @returns whether the session exists or not
|
729
769
|
*/
|
730
|
-
proteusSessionExists(sessionId: string): Promise<
|
770
|
+
proteusSessionExists(sessionId: string): Promise<boolean>;
|
731
771
|
/**
|
732
772
|
* Decrypt an incoming message for an existing Proteus session
|
733
773
|
*
|
@@ -767,6 +807,27 @@ export declare class CoreCrypto {
|
|
767
807
|
* @returns Hex-encoded public key string
|
768
808
|
*/
|
769
809
|
proteusFingerprint(): Promise<string>;
|
810
|
+
/**
|
811
|
+
* Proteus session local fingerprint
|
812
|
+
*
|
813
|
+
* @param sessionId - ID of the Proteus session
|
814
|
+
* @returns Hex-encoded public key string
|
815
|
+
*/
|
816
|
+
proteusFingerprintLocal(sessionId: string): Promise<string>;
|
817
|
+
/**
|
818
|
+
* Proteus session remote fingerprint
|
819
|
+
*
|
820
|
+
* @param sessionId - ID of the Proteus session
|
821
|
+
* @returns Hex-encoded public key string
|
822
|
+
*/
|
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;
|
770
831
|
/**
|
771
832
|
* Imports all the data stored by Cryptobox into the CoreCrypto keystore
|
772
833
|
*
|
@@ -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;
|
@@ -519,6 +529,34 @@ class CoreCrypto$1 {
|
|
519
529
|
return takeObject(ret);
|
520
530
|
}
|
521
531
|
/**
|
532
|
+
* see [core_crypto::MlsCentral::try_new]
|
533
|
+
* @param {string} path
|
534
|
+
* @param {string} key
|
535
|
+
* @param {Uint8Array | undefined} entropy_seed
|
536
|
+
* @returns {Promise<CoreCrypto>}
|
537
|
+
*/
|
538
|
+
static deferred_init(path, key, entropy_seed) {
|
539
|
+
const ptr0 = passStringToWasm0(path, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
540
|
+
const len0 = WASM_VECTOR_LEN;
|
541
|
+
const ptr1 = passStringToWasm0(key, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
542
|
+
const len1 = WASM_VECTOR_LEN;
|
543
|
+
var ptr2 = isLikeNone(entropy_seed) ? 0 : passArray8ToWasm0(entropy_seed, wasm$1.__wbindgen_malloc);
|
544
|
+
var len2 = WASM_VECTOR_LEN;
|
545
|
+
const ret = wasm$1.corecrypto_deferred_init(ptr0, len0, ptr1, len1, ptr2, len2);
|
546
|
+
return takeObject(ret);
|
547
|
+
}
|
548
|
+
/**
|
549
|
+
* see [core_crypto::MlsCentral::mls_init]
|
550
|
+
* @param {Uint8Array} client_id
|
551
|
+
* @returns {Promise<Promise<any>>}
|
552
|
+
*/
|
553
|
+
mls_init(client_id) {
|
554
|
+
const ptr0 = passArray8ToWasm0(client_id, wasm$1.__wbindgen_malloc);
|
555
|
+
const len0 = WASM_VECTOR_LEN;
|
556
|
+
const ret = wasm$1.corecrypto_mls_init(this.ptr, ptr0, len0);
|
557
|
+
return takeObject(ret);
|
558
|
+
}
|
559
|
+
/**
|
522
560
|
* Returns: [`WasmCryptoResult<()>`]
|
523
561
|
*
|
524
562
|
* see [core_crypto::MlsCentral::close]
|
@@ -633,12 +671,16 @@ class CoreCrypto$1 {
|
|
633
671
|
*
|
634
672
|
* see [core_crypto::MlsCentral::process_raw_welcome_message]
|
635
673
|
* @param {Uint8Array} welcome_message
|
674
|
+
* @param {CustomConfiguration} custom_configuration
|
636
675
|
* @returns {Promise<any>}
|
637
676
|
*/
|
638
|
-
process_welcome_message(welcome_message) {
|
677
|
+
process_welcome_message(welcome_message, custom_configuration) {
|
639
678
|
const ptr0 = passArray8ToWasm0(welcome_message, wasm$1.__wbindgen_malloc);
|
640
679
|
const len0 = WASM_VECTOR_LEN;
|
641
|
-
|
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);
|
642
684
|
return takeObject(ret);
|
643
685
|
}
|
644
686
|
/**
|
@@ -836,12 +878,16 @@ class CoreCrypto$1 {
|
|
836
878
|
*
|
837
879
|
* see [core_crypto::MlsCentral::join_by_external_commit]
|
838
880
|
* @param {Uint8Array} public_group_state
|
881
|
+
* @param {CustomConfiguration} custom_configuration
|
839
882
|
* @returns {Promise<any>}
|
840
883
|
*/
|
841
|
-
join_by_external_commit(public_group_state) {
|
884
|
+
join_by_external_commit(public_group_state, custom_configuration) {
|
842
885
|
const ptr0 = passArray8ToWasm0(public_group_state, wasm$1.__wbindgen_malloc);
|
843
886
|
const len0 = WASM_VECTOR_LEN;
|
844
|
-
|
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);
|
845
891
|
return takeObject(ret);
|
846
892
|
}
|
847
893
|
/**
|
@@ -849,16 +895,12 @@ class CoreCrypto$1 {
|
|
849
895
|
*
|
850
896
|
* see [core_crypto::MlsCentral::merge_pending_group_from_external_commit]
|
851
897
|
* @param {Uint8Array} conversation_id
|
852
|
-
* @param {ConversationConfiguration} configuration
|
853
898
|
* @returns {Promise<any>}
|
854
899
|
*/
|
855
|
-
merge_pending_group_from_external_commit(conversation_id
|
900
|
+
merge_pending_group_from_external_commit(conversation_id) {
|
856
901
|
const ptr0 = passArray8ToWasm0(conversation_id, wasm$1.__wbindgen_malloc);
|
857
902
|
const len0 = WASM_VECTOR_LEN;
|
858
|
-
|
859
|
-
var ptr1 = configuration.ptr;
|
860
|
-
configuration.ptr = 0;
|
861
|
-
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);
|
862
904
|
return takeObject(ret);
|
863
905
|
}
|
864
906
|
/**
|
@@ -1085,6 +1127,61 @@ class CoreCrypto$1 {
|
|
1085
1127
|
return takeObject(ret);
|
1086
1128
|
}
|
1087
1129
|
/**
|
1130
|
+
* Returns: [`WasmCryptoResult<String>`]
|
1131
|
+
*
|
1132
|
+
* see [core_crypto::proteus::ProteusCentral::fingerprint_local]
|
1133
|
+
* @param {string} session_id
|
1134
|
+
* @returns {Promise<string>}
|
1135
|
+
*/
|
1136
|
+
proteus_fingerprint_local(session_id) {
|
1137
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1138
|
+
const len0 = WASM_VECTOR_LEN;
|
1139
|
+
const ret = wasm$1.corecrypto_proteus_fingerprint_local(this.ptr, ptr0, len0);
|
1140
|
+
return takeObject(ret);
|
1141
|
+
}
|
1142
|
+
/**
|
1143
|
+
* Returns: [`WasmCryptoResult<String>`]
|
1144
|
+
*
|
1145
|
+
* see [core_crypto::proteus::ProteusCentral::fingerprint_remote]
|
1146
|
+
* @param {string} session_id
|
1147
|
+
* @returns {Promise<string>}
|
1148
|
+
*/
|
1149
|
+
proteus_fingerprint_remote(session_id) {
|
1150
|
+
const ptr0 = passStringToWasm0(session_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
|
1151
|
+
const len0 = WASM_VECTOR_LEN;
|
1152
|
+
const ret = wasm$1.corecrypto_proteus_fingerprint_remote(this.ptr, ptr0, len0);
|
1153
|
+
return takeObject(ret);
|
1154
|
+
}
|
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
|
+
/**
|
1088
1185
|
* Returns: [`WasmCryptoResult<()>`]
|
1089
1186
|
*
|
1090
1187
|
* see [core_crypto::proteus::ProteusCentral::cryptobox_migrate]
|
@@ -1159,6 +1256,38 @@ class CoreCryptoWasmCallbacks {
|
|
1159
1256
|
}
|
1160
1257
|
}
|
1161
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
|
+
/**
|
1162
1291
|
* see [core_crypto::prelude::decrypt::MlsConversationDecryptMessage]
|
1163
1292
|
*/
|
1164
1293
|
class DecryptedMessage {
|
@@ -1467,48 +1596,6 @@ function getImports() {
|
|
1467
1596
|
const ret = getObject(arg0) in getObject(arg1);
|
1468
1597
|
return ret;
|
1469
1598
|
};
|
1470
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
1471
|
-
const ret = arg0;
|
1472
|
-
return addHeapObject(ret);
|
1473
|
-
};
|
1474
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
1475
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
1476
|
-
return addHeapObject(ret);
|
1477
|
-
};
|
1478
|
-
imports.wbg.__wbg_new_1d9a920c6bfc44a8 = function() {
|
1479
|
-
const ret = new Array();
|
1480
|
-
return addHeapObject(ret);
|
1481
|
-
};
|
1482
|
-
imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) {
|
1483
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
1484
|
-
};
|
1485
|
-
imports.wbg.__wbg_new_268f7b7dd3430798 = function() {
|
1486
|
-
const ret = new Map();
|
1487
|
-
return addHeapObject(ret);
|
1488
|
-
};
|
1489
|
-
imports.wbg.__wbg_new_0b9bfdd97583284e = function() {
|
1490
|
-
const ret = new Object();
|
1491
|
-
return addHeapObject(ret);
|
1492
|
-
};
|
1493
|
-
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
1494
|
-
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
1495
|
-
return addHeapObject(ret);
|
1496
|
-
};
|
1497
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
1498
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
1499
|
-
return ret;
|
1500
|
-
};
|
1501
|
-
imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
1502
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
1503
|
-
};
|
1504
|
-
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
1505
|
-
const ret = BigInt.asUintN(64, arg0);
|
1506
|
-
return addHeapObject(ret);
|
1507
|
-
};
|
1508
|
-
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
|
1509
|
-
const ret = arg0;
|
1510
|
-
return addHeapObject(ret);
|
1511
|
-
};
|
1512
1599
|
imports.wbg.__wbg_objectStoreNames_8c06c40d2b05141c = function(arg0) {
|
1513
1600
|
const ret = getObject(arg0).objectStoreNames;
|
1514
1601
|
return addHeapObject(ret);
|
@@ -1517,6 +1604,10 @@ function getImports() {
|
|
1517
1604
|
const ret = getObject(arg0).length;
|
1518
1605
|
return ret;
|
1519
1606
|
};
|
1607
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
1608
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
1609
|
+
return addHeapObject(ret);
|
1610
|
+
};
|
1520
1611
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
1521
1612
|
const obj = getObject(arg1);
|
1522
1613
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
@@ -1570,10 +1661,18 @@ function getImports() {
|
|
1570
1661
|
getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0n : ret;
|
1571
1662
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
1572
1663
|
};
|
1664
|
+
imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
|
1665
|
+
const ret = arg0;
|
1666
|
+
return addHeapObject(ret);
|
1667
|
+
};
|
1573
1668
|
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
|
1574
1669
|
const ret = getObject(arg0) === getObject(arg1);
|
1575
1670
|
return ret;
|
1576
1671
|
};
|
1672
|
+
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
|
1673
|
+
const ret = BigInt.asUintN(64, arg0);
|
1674
|
+
return addHeapObject(ret);
|
1675
|
+
};
|
1577
1676
|
imports.wbg.__wbg_isArray_27c46c67f498e15d = function(arg0) {
|
1578
1677
|
const ret = Array.isArray(getObject(arg0));
|
1579
1678
|
return ret;
|
@@ -1586,30 +1685,29 @@ function getImports() {
|
|
1586
1685
|
const ret = getObject(arg0)[arg1 >>> 0];
|
1587
1686
|
return addHeapObject(ret);
|
1588
1687
|
};
|
1589
|
-
imports.wbg.__wbg_new_8c3f0052272a457a = function(arg0) {
|
1590
|
-
const ret = new Uint8Array(getObject(arg0));
|
1591
|
-
return addHeapObject(ret);
|
1592
|
-
};
|
1593
|
-
imports.wbg.__wbg_call_168da88779e35f61 = function() { return handleError(function (arg0, arg1, arg2) {
|
1594
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
1595
|
-
return addHeapObject(ret);
|
1596
|
-
}, arguments) };
|
1597
1688
|
imports.wbg.__wbg_corecrypto_new = function(arg0) {
|
1598
1689
|
const ret = CoreCrypto$1.__wrap(arg0);
|
1599
1690
|
return addHeapObject(ret);
|
1600
1691
|
};
|
1601
|
-
imports.wbg.
|
1602
|
-
const ret =
|
1603
|
-
return ret;
|
1692
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
1693
|
+
const ret = arg0;
|
1694
|
+
return addHeapObject(ret);
|
1604
1695
|
};
|
1605
|
-
imports.wbg.
|
1606
|
-
|
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();
|
1607
1701
|
return addHeapObject(ret);
|
1608
|
-
}
|
1609
|
-
imports.wbg.
|
1610
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2)
|
1702
|
+
};
|
1703
|
+
imports.wbg.__wbg_call_168da88779e35f61 = function() { return handleError(function (arg0, arg1, arg2) {
|
1704
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
1611
1705
|
return addHeapObject(ret);
|
1612
1706
|
}, arguments) };
|
1707
|
+
imports.wbg.__wbg_new_8c3f0052272a457a = function(arg0) {
|
1708
|
+
const ret = new Uint8Array(getObject(arg0));
|
1709
|
+
return addHeapObject(ret);
|
1710
|
+
};
|
1613
1711
|
imports.wbg.__wbg_new_9962f939219f1820 = function(arg0, arg1) {
|
1614
1712
|
try {
|
1615
1713
|
var state0 = {a: arg0, b: arg1};
|
@@ -1617,7 +1715,7 @@ function getImports() {
|
|
1617
1715
|
const a = state0.a;
|
1618
1716
|
state0.a = 0;
|
1619
1717
|
try {
|
1620
|
-
return
|
1718
|
+
return __wbg_adapter_219(a, state0.b, arg0, arg1);
|
1621
1719
|
} finally {
|
1622
1720
|
state0.a = a;
|
1623
1721
|
}
|
@@ -1628,6 +1726,33 @@ function getImports() {
|
|
1628
1726
|
state0.a = state0.b = 0;
|
1629
1727
|
}
|
1630
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
|
+
};
|
1748
|
+
imports.wbg.__wbg_call_3999bee59e9f7719 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
1749
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
1750
|
+
return addHeapObject(ret);
|
1751
|
+
}, arguments) };
|
1752
|
+
imports.wbg.__wbg_call_e1f72c051cdab859 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
1753
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
|
1754
|
+
return addHeapObject(ret);
|
1755
|
+
}, arguments) };
|
1631
1756
|
imports.wbg.__wbg_reject_72477563edad55b7 = function(arg0) {
|
1632
1757
|
const ret = Promise.reject(getObject(arg0));
|
1633
1758
|
return addHeapObject(ret);
|
@@ -1687,34 +1812,22 @@ function getImports() {
|
|
1687
1812
|
const ret = false;
|
1688
1813
|
return ret;
|
1689
1814
|
};
|
1690
|
-
imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
|
1691
|
-
const ret = getObject(arg0).get(getObject(arg1));
|
1692
|
-
return addHeapObject(ret);
|
1693
|
-
}, arguments) };
|
1694
|
-
imports.wbg.__wbg_openCursor_e036069f0e326708 = function() { return handleError(function (arg0, arg1) {
|
1695
|
-
const ret = getObject(arg0).openCursor(getObject(arg1));
|
1696
|
-
return addHeapObject(ret);
|
1697
|
-
}, arguments) };
|
1698
|
-
imports.wbg.__wbg_openCursor_f055654a98eeab7f = function() { return handleError(function (arg0) {
|
1699
|
-
const ret = getObject(arg0).openCursor();
|
1700
|
-
return addHeapObject(ret);
|
1701
|
-
}, arguments) };
|
1702
1815
|
imports.wbg.__wbg_setonsuccess_5f71593bc51653a3 = function(arg0, arg1) {
|
1703
1816
|
getObject(arg0).onsuccess = getObject(arg1);
|
1704
1817
|
};
|
1705
|
-
imports.wbg.
|
1706
|
-
|
1818
|
+
imports.wbg.__wbg_setonerror_d5771cc5bf9ea74c = function(arg0, arg1) {
|
1819
|
+
getObject(arg0).onerror = getObject(arg1);
|
1820
|
+
};
|
1821
|
+
imports.wbg.__wbg_open_a31c3fe1fdc244eb = function() { return handleError(function (arg0, arg1, arg2) {
|
1822
|
+
const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2));
|
1707
1823
|
return addHeapObject(ret);
|
1708
1824
|
}, arguments) };
|
1709
|
-
imports.wbg.
|
1710
|
-
const ret = getObject(arg0).
|
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);
|
1711
1827
|
return addHeapObject(ret);
|
1712
1828
|
}, arguments) };
|
1713
|
-
imports.wbg.
|
1714
|
-
getObject(arg0).
|
1715
|
-
};
|
1716
|
-
imports.wbg.__wbg_setonerror_d5771cc5bf9ea74c = function(arg0, arg1) {
|
1717
|
-
getObject(arg0).onerror = getObject(arg1);
|
1829
|
+
imports.wbg.__wbg_setonupgradeneeded_17d0b9530f1e0cac = function(arg0, arg1) {
|
1830
|
+
getObject(arg0).onupgradeneeded = getObject(arg1);
|
1718
1831
|
};
|
1719
1832
|
imports.wbg.__wbg_put_84e7fc93eee27b28 = function() { return handleError(function (arg0, arg1, arg2) {
|
1720
1833
|
const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
|
@@ -1724,17 +1837,22 @@ function getImports() {
|
|
1724
1837
|
const ret = getObject(arg0).put(getObject(arg1));
|
1725
1838
|
return addHeapObject(ret);
|
1726
1839
|
}, arguments) };
|
1727
|
-
imports.wbg.
|
1728
|
-
const ret = getObject(arg0).
|
1840
|
+
imports.wbg.__wbg_delete_8abedd1043b4105d = function() { return handleError(function (arg0, arg1) {
|
1841
|
+
const ret = getObject(arg0).delete(getObject(arg1));
|
1729
1842
|
return addHeapObject(ret);
|
1730
1843
|
}, arguments) };
|
1731
|
-
imports.wbg.
|
1732
|
-
const ret = getObject(arg0).
|
1844
|
+
imports.wbg.__wbg_openCursor_e036069f0e326708 = function() { return handleError(function (arg0, arg1) {
|
1845
|
+
const ret = getObject(arg0).openCursor(getObject(arg1));
|
1846
|
+
return addHeapObject(ret);
|
1847
|
+
}, arguments) };
|
1848
|
+
imports.wbg.__wbg_openCursor_f055654a98eeab7f = function() { return handleError(function (arg0) {
|
1849
|
+
const ret = getObject(arg0).openCursor();
|
1850
|
+
return addHeapObject(ret);
|
1851
|
+
}, arguments) };
|
1852
|
+
imports.wbg.__wbg_get_6285bf458a1ee758 = function() { return handleError(function (arg0, arg1) {
|
1853
|
+
const ret = getObject(arg0).get(getObject(arg1));
|
1733
1854
|
return addHeapObject(ret);
|
1734
1855
|
}, arguments) };
|
1735
|
-
imports.wbg.__wbg_setonupgradeneeded_17d0b9530f1e0cac = function(arg0, arg1) {
|
1736
|
-
getObject(arg0).onupgradeneeded = getObject(arg1);
|
1737
|
-
};
|
1738
1856
|
imports.wbg.__wbg_index_86861edf1478f49c = function() { return handleError(function (arg0, arg1, arg2) {
|
1739
1857
|
const ret = getObject(arg0).index(getStringFromWasm0(arg1, arg2));
|
1740
1858
|
return addHeapObject(ret);
|
@@ -1755,6 +1873,13 @@ function getImports() {
|
|
1755
1873
|
const ret = getObject(arg0).openCursor(getObject(arg1));
|
1756
1874
|
return addHeapObject(ret);
|
1757
1875
|
}, arguments) };
|
1876
|
+
imports.wbg.__wbg_close_5a04b9ce11dade22 = function(arg0) {
|
1877
|
+
getObject(arg0).close();
|
1878
|
+
};
|
1879
|
+
imports.wbg.__wbg_deleteDatabase_f6454de6a88aebde = function() { return handleError(function (arg0, arg1, arg2) {
|
1880
|
+
const ret = getObject(arg0).deleteDatabase(getStringFromWasm0(arg1, arg2));
|
1881
|
+
return addHeapObject(ret);
|
1882
|
+
}, arguments) };
|
1758
1883
|
imports.wbg.__wbg_count_b0e88953a0ea909c = function() { return handleError(function (arg0) {
|
1759
1884
|
const ret = getObject(arg0).count();
|
1760
1885
|
return addHeapObject(ret);
|
@@ -1793,6 +1918,10 @@ function getImports() {
|
|
1793
1918
|
const ret = getObject(arg0).node;
|
1794
1919
|
return addHeapObject(ret);
|
1795
1920
|
};
|
1921
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
1922
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
1923
|
+
return ret;
|
1924
|
+
};
|
1796
1925
|
imports.wbg.__wbg_require_78a3dcfbdba9cbce = function() { return handleError(function () {
|
1797
1926
|
const ret = module.require;
|
1798
1927
|
return addHeapObject(ret);
|
@@ -1880,10 +2009,6 @@ function getImports() {
|
|
1880
2009
|
const ret = getObject(arg0).result;
|
1881
2010
|
return addHeapObject(ret);
|
1882
2011
|
}, arguments) };
|
1883
|
-
imports.wbg.__wbg_error_aacf5ac191e54ed0 = function() { return handleError(function (arg0) {
|
1884
|
-
const ret = getObject(arg0).error;
|
1885
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
1886
|
-
}, arguments) };
|
1887
2012
|
imports.wbg.__wbg_contains_6cf516181cd86571 = function(arg0, arg1, arg2) {
|
1888
2013
|
const ret = getObject(arg0).contains(getStringFromWasm0(arg1, arg2));
|
1889
2014
|
return ret;
|
@@ -1910,6 +2035,10 @@ function getImports() {
|
|
1910
2035
|
imports.wbg.__wbg_deleteObjectStore_1b698c5fd1bc077d = function() { return handleError(function (arg0, arg1, arg2) {
|
1911
2036
|
getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
|
1912
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) };
|
1913
2042
|
imports.wbg.__wbindgen_is_falsy = function(arg0) {
|
1914
2043
|
const ret = !getObject(arg0);
|
1915
2044
|
return ret;
|
@@ -2010,12 +2139,12 @@ function getImports() {
|
|
2010
2139
|
const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
|
2011
2140
|
return addHeapObject(ret);
|
2012
2141
|
}, arguments) };
|
2013
|
-
imports.wbg.
|
2014
|
-
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);
|
2015
2144
|
return addHeapObject(ret);
|
2016
2145
|
};
|
2017
|
-
imports.wbg.
|
2018
|
-
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);
|
2019
2148
|
return addHeapObject(ret);
|
2020
2149
|
};
|
2021
2150
|
|
@@ -2065,12 +2194,14 @@ async function init(input) {
|
|
2065
2194
|
var exports = /*#__PURE__*/Object.freeze({
|
2066
2195
|
__proto__: null,
|
2067
2196
|
version: version,
|
2197
|
+
WirePolicy: WirePolicy$1,
|
2068
2198
|
Ciphersuite: Ciphersuite$1,
|
2069
2199
|
CommitBundle: CommitBundle,
|
2070
2200
|
ConversationConfiguration: ConversationConfiguration,
|
2071
2201
|
ConversationInitBundle: ConversationInitBundle,
|
2072
2202
|
CoreCrypto: CoreCrypto$1,
|
2073
2203
|
CoreCryptoWasmCallbacks: CoreCryptoWasmCallbacks,
|
2204
|
+
CustomConfiguration: CustomConfiguration,
|
2074
2205
|
DecryptedMessage: DecryptedMessage,
|
2075
2206
|
Invitee: Invitee,
|
2076
2207
|
MemberAddedMessages: MemberAddedMessages,
|
@@ -2083,7 +2214,7 @@ var exports = /*#__PURE__*/Object.freeze({
|
|
2083
2214
|
var wasm = async (opt = {}) => {
|
2084
2215
|
let {importHook, serverPath} = opt;
|
2085
2216
|
|
2086
|
-
let path = "assets/core_crypto_ffi-
|
2217
|
+
let path = "assets/core_crypto_ffi-b8c4f151.wasm";
|
2087
2218
|
|
2088
2219
|
if (serverPath != null) {
|
2089
2220
|
path = serverPath + /[^\/\\]*$/.exec(path)[0];
|
@@ -2134,6 +2265,20 @@ var Ciphersuite;
|
|
2134
2265
|
*/
|
2135
2266
|
Ciphersuite[Ciphersuite["MLS_256_DHKEMP384_AES256GCM_SHA384_P384"] = 7] = "MLS_256_DHKEMP384_AES256GCM_SHA384_P384";
|
2136
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 = {}));
|
2137
2282
|
/**
|
2138
2283
|
* Informs whether the PublicGroupState is confidential
|
2139
2284
|
* see [core_crypto::mls::conversation::public_group_state::PublicGroupStateEncryptionType]
|
@@ -2204,12 +2349,6 @@ var ExternalProposalType;
|
|
2204
2349
|
* Wrapper for the WASM-compiled version of CoreCrypto
|
2205
2350
|
*/
|
2206
2351
|
class CoreCrypto {
|
2207
|
-
/** @hidden */
|
2208
|
-
constructor(cc) {
|
2209
|
-
/** @hidden */
|
2210
|
-
_CoreCrypto_cc.set(this, void 0);
|
2211
|
-
__classPrivateFieldSet(this, _CoreCrypto_cc, cc, "f");
|
2212
|
-
}
|
2213
2352
|
/**
|
2214
2353
|
* This is your entrypoint to initialize {@link CoreCrypto}!
|
2215
2354
|
*
|
@@ -2252,6 +2391,35 @@ class CoreCrypto {
|
|
2252
2391
|
const cc = await __classPrivateFieldGet(this, _a, "f", _CoreCrypto_module).CoreCrypto._internal_new(databaseName, key, clientId, entropySeed);
|
2253
2392
|
return new this(cc);
|
2254
2393
|
}
|
2394
|
+
/**
|
2395
|
+
* Almost identical to {@link CoreCrypto.init} but allows a 2 phase initialization of MLS.
|
2396
|
+
* First, calling this will set up the keystore and will allow generating proteus prekeys.
|
2397
|
+
* Then, those keys can be traded for a clientId.
|
2398
|
+
* Use this clientId to initialize MLS with {@link CoreCrypto.mlsInit}.
|
2399
|
+
*/
|
2400
|
+
static async deferredInit(databaseName, key, entropySeed, wasmFilePath) {
|
2401
|
+
if (!__classPrivateFieldGet(this, _a, "f", _CoreCrypto_module)) {
|
2402
|
+
const wasmImportArgs = wasmFilePath ? { importHook: () => wasmFilePath } : undefined;
|
2403
|
+
const exports = (await wasm(wasmImportArgs));
|
2404
|
+
__classPrivateFieldSet(this, _a, exports, "f", _CoreCrypto_module);
|
2405
|
+
}
|
2406
|
+
const cc = await __classPrivateFieldGet(this, _a, "f", _CoreCrypto_module).CoreCrypto.deferred_init(databaseName, key, entropySeed);
|
2407
|
+
return new this(cc);
|
2408
|
+
}
|
2409
|
+
/**
|
2410
|
+
* Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
|
2411
|
+
*
|
2412
|
+
* @param clientId - {@link CoreCryptoParams#clientId} but required
|
2413
|
+
*/
|
2414
|
+
async mlsInit(clientId) {
|
2415
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").mls_init(clientId);
|
2416
|
+
}
|
2417
|
+
/** @hidden */
|
2418
|
+
constructor(cc) {
|
2419
|
+
/** @hidden */
|
2420
|
+
_CoreCrypto_cc.set(this, void 0);
|
2421
|
+
__classPrivateFieldSet(this, _CoreCrypto_cc, cc, "f");
|
2422
|
+
}
|
2255
2423
|
/**
|
2256
2424
|
* Wipes the {@link CoreCrypto} backing storage (i.e. {@link https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API | IndexedDB} database)
|
2257
2425
|
*
|
@@ -2324,14 +2492,14 @@ class CoreCrypto {
|
|
2324
2492
|
* You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
|
2325
2493
|
*
|
2326
2494
|
* @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
|
2327
|
-
* @param configuration
|
2495
|
+
* @param configuration - configuration of the MLS group
|
2328
2496
|
* @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
|
2329
|
-
* @param configuration.keyRotationSpan - The amount of time in milliseconds after which the MLS Keypackages will be rotated
|
2330
2497
|
* @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
|
2498
|
+
* @param configuration.custom - {@link CustomConfiguration}
|
2331
2499
|
*/
|
2332
2500
|
async createConversation(conversationId, configuration = {}) {
|
2333
|
-
const {
|
2334
|
-
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);
|
2335
2503
|
const ret = await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").create_conversation(conversationId, config);
|
2336
2504
|
return ret;
|
2337
2505
|
}
|
@@ -2370,13 +2538,16 @@ class CoreCrypto {
|
|
2370
2538
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").encrypt_message(conversationId, message);
|
2371
2539
|
}
|
2372
2540
|
/**
|
2373
|
-
* Ingest a TLS-serialized MLS welcome message to join
|
2541
|
+
* Ingest a TLS-serialized MLS welcome message to join an existing MLS group
|
2374
2542
|
*
|
2375
2543
|
* @param welcomeMessage - TLS-serialized MLS Welcome message
|
2544
|
+
* @param configuration - configuration of the MLS group
|
2376
2545
|
* @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
|
2377
2546
|
*/
|
2378
|
-
async processWelcomeMessage(welcomeMessage) {
|
2379
|
-
|
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);
|
2380
2551
|
}
|
2381
2552
|
/**
|
2382
2553
|
* @returns The client's public key
|
@@ -2570,10 +2741,13 @@ class CoreCrypto {
|
|
2570
2741
|
* bad can happen if you forget to except some storage space wasted.
|
2571
2742
|
*
|
2572
2743
|
* @param publicGroupState - a TLS encoded PublicGroupState fetched from the Delivery Service
|
2744
|
+
* @param configuration - configuration of the MLS group
|
2573
2745
|
* @returns see {@link ConversationInitBundle}
|
2574
2746
|
*/
|
2575
|
-
async joinByExternalCommit(publicGroupState) {
|
2576
|
-
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);
|
2577
2751
|
const pgs = ffiInitMessage.public_group_state;
|
2578
2752
|
const ret = {
|
2579
2753
|
conversationId: ffiInitMessage.conversation_id,
|
@@ -2591,12 +2765,9 @@ class CoreCrypto {
|
|
2591
2765
|
* and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
|
2592
2766
|
*
|
2593
2767
|
* @param conversationId - The ID of the conversation
|
2594
|
-
* @param configuration - Configuration of the group, see {@link ConversationConfiguration}
|
2595
2768
|
*/
|
2596
|
-
async mergePendingGroupFromExternalCommit(conversationId
|
2597
|
-
|
2598
|
-
const config = new (__classPrivateFieldGet(CoreCrypto, _a, "f", _CoreCrypto_module).ConversationConfiguration)(admins, ciphersuite, keyRotationSpan, externalSenders);
|
2599
|
-
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);
|
2600
2771
|
}
|
2601
2772
|
/**
|
2602
2773
|
* In case the external commit generated by {@link CoreCrypto.joinByExternalCommit} is rejected by the Delivery Service, and we
|
@@ -2708,6 +2879,8 @@ class CoreCrypto {
|
|
2708
2879
|
*
|
2709
2880
|
* @param sessionId - ID of the Proteus session
|
2710
2881
|
* @param envelope - CBOR-encoded Proteus message
|
2882
|
+
*
|
2883
|
+
* @returns A `Uint8Array` containing the message that was sent along with the session handshake
|
2711
2884
|
*/
|
2712
2885
|
async proteusSessionFromMessage(sessionId, envelope) {
|
2713
2886
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_from_message(sessionId, envelope);
|
@@ -2733,6 +2906,8 @@ class CoreCrypto {
|
|
2733
2906
|
* Checks if a session exists
|
2734
2907
|
*
|
2735
2908
|
* @param sessionId - ID of the Proteus session
|
2909
|
+
*
|
2910
|
+
* @returns whether the session exists or not
|
2736
2911
|
*/
|
2737
2912
|
async proteusSessionExists(sessionId) {
|
2738
2913
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_session_exists(sessionId);
|
@@ -2786,6 +2961,33 @@ class CoreCrypto {
|
|
2786
2961
|
async proteusFingerprint() {
|
2787
2962
|
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_fingerprint();
|
2788
2963
|
}
|
2964
|
+
/**
|
2965
|
+
* Proteus session local fingerprint
|
2966
|
+
*
|
2967
|
+
* @param sessionId - ID of the Proteus session
|
2968
|
+
* @returns Hex-encoded public key string
|
2969
|
+
*/
|
2970
|
+
async proteusFingerprintLocal(sessionId) {
|
2971
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_fingerprint_local(sessionId);
|
2972
|
+
}
|
2973
|
+
/**
|
2974
|
+
* Proteus session remote fingerprint
|
2975
|
+
*
|
2976
|
+
* @param sessionId - ID of the Proteus session
|
2977
|
+
* @returns Hex-encoded public key string
|
2978
|
+
*/
|
2979
|
+
async proteusFingerprintRemote(sessionId) {
|
2980
|
+
return await __classPrivateFieldGet(this, _CoreCrypto_cc, "f").proteus_fingerprint_remote(sessionId);
|
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
|
+
}
|
2789
2991
|
/**
|
2790
2992
|
* Imports all the data stored by Cryptobox into the CoreCrypto keystore
|
2791
2993
|
*
|
@@ -2810,4 +3012,4 @@ _a = CoreCrypto, _CoreCrypto_cc = new WeakMap();
|
|
2810
3012
|
/** @hidden */
|
2811
3013
|
_CoreCrypto_module = { value: void 0 };
|
2812
3014
|
|
2813
|
-
export { Ciphersuite, CoreCrypto, ExternalProposalType, ProposalType, PublicGroupStateEncryptionType, RatchetTreeType };
|
3015
|
+
export { Ciphersuite, CoreCrypto, ExternalProposalType, ProposalType, PublicGroupStateEncryptionType, RatchetTreeType, WirePolicy };
|
Binary file
|