@wireapp/core-crypto 3.0.2 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,29 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ export interface CoreCryptoRichError {
4
+ message: string;
5
+ error_name?: string;
6
+ error_stack?: string[];
7
+ proteus_error_code?: number;
8
+ }
9
+ /**
10
+ * Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
11
+ *
12
+ * Whenever you're supposed to get this class (that extends `Error`) you might end up with a base `Error`
13
+ * in case the parsing of the message structure fails. This is unlikely but the case is still covered and fall backs automatically.
14
+ * More information will be found in the base `Error.cause` to inform you why the parsing has failed.
15
+ *
16
+ * Please note that in this case the extra properties will not be available.
17
+ */
18
+ export declare class CoreCryptoError extends Error {
19
+ errorStack: string[];
20
+ proteusErrorCode: number | null;
21
+ private constructor();
22
+ private static fallback;
23
+ static build(msg: string, ...params: unknown[]): CoreCryptoError | Error;
24
+ static fromStdError(e: Error): CoreCryptoError | Error;
25
+ static asyncMapErr<T>(p: Promise<T>): Promise<T>;
26
+ }
1
27
  declare enum CredentialType {
2
28
  /**
3
29
  * Just a KeyPair
@@ -8,6 +34,16 @@ declare enum CredentialType {
8
34
  */
9
35
  X509 = 2
10
36
  }
37
+ declare enum WirePolicy {
38
+ /**
39
+ * Handshake messages are never encrypted
40
+ */
41
+ Plaintext = 1,
42
+ /**
43
+ * Handshake messages are always encrypted
44
+ */
45
+ Ciphertext = 2
46
+ }
11
47
  declare enum Ciphersuite {
12
48
  /**
13
49
  * DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
@@ -38,21 +74,7 @@ declare enum Ciphersuite {
38
74
  */
39
75
  MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
40
76
  }
41
- declare enum WirePolicy {
42
- /**
43
- * Handshake messages are never encrypted
44
- */
45
- Plaintext = 1,
46
- /**
47
- * Handshake messages are always encrypted
48
- */
49
- Ciphertext = 2
50
- }
51
- /**
52
- * For creating a challenge.
53
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
54
- */
55
- export class AcmeChallenge {
77
+ declare class AcmeChallenge {
56
78
  free(): void;
57
79
  /**
58
80
  * Contains raw JSON data of this challenge. This is parsed by the underlying Rust library hence should not be accessed
@@ -68,7 +90,10 @@ export class AcmeChallenge {
68
90
  */
69
91
  readonly url: string;
70
92
  }
71
- declare class BuildMetadata {
93
+ /**
94
+ * Metadata describing the conditions of the build of this software.
95
+ */
96
+ export class BuildMetadata {
72
97
  /**
73
98
  ** Return copy of self without private attributes.
74
99
  */
@@ -116,9 +141,10 @@ declare class BuildMetadata {
116
141
  readonly timestamp: string;
117
142
  }
118
143
  /**
144
+ * Configuration object for new conversations
119
145
  * see [core_crypto::prelude::MlsConversationConfiguration]
120
146
  */
121
- declare class ConversationConfiguration {
147
+ export class ConversationConfiguration {
122
148
  free(): void;
123
149
  /**
124
150
  * @param {Ciphersuite | undefined} [ciphersuite]
@@ -127,9 +153,19 @@ declare class ConversationConfiguration {
127
153
  * @param {WirePolicy | undefined} [wire_policy]
128
154
  */
129
155
  constructor(ciphersuite?: Ciphersuite, external_senders?: (Uint8Array)[], key_rotation_span?: number, wire_policy?: WirePolicy);
156
+ /**
157
+ * Conversation ciphersuite
158
+ */
159
+ readonly ciphersuite: Ciphersuite | undefined;
160
+ /**
161
+ * Additional configuration
162
+ */
163
+ readonly custom: CustomConfiguration;
164
+ /**
165
+ * List of client IDs that are allowed to be external senders
166
+ */
167
+ readonly externalSenders: Array<any>;
130
168
  }
131
- /**
132
- */
133
169
  declare class CoreCryptoContext {
134
170
  free(): void;
135
171
  /**
@@ -253,7 +289,7 @@ declare class CoreCryptoContext {
253
289
  */
254
290
  process_welcome_message(welcome_message: Uint8Array, custom_configuration: CustomConfiguration): Promise<any>;
255
291
  /**
256
- * Returns: [`WasmCryptoResult<Option<MemberAddedMessages>>`]
292
+ * Returns: [`WasmCryptoResult<Option<Vec<String>>>`]
257
293
  *
258
294
  * see [core_crypto::mls::context::CentralContext::add_members_to_conversation]
259
295
  * @param {Uint8Array} conversation_id
@@ -262,7 +298,7 @@ declare class CoreCryptoContext {
262
298
  */
263
299
  add_clients_to_conversation(conversation_id: Uint8Array, key_packages: (Uint8Array)[]): Promise<any>;
264
300
  /**
265
- * Returns: [`WasmCryptoResult<Option<js_sys::Uint8Array>>`]
301
+ * Returns: [`WasmCryptoResult<()>`]
266
302
  *
267
303
  * see [core_crypto::mls::context::CentralContext::remove_members_from_conversation]
268
304
  * @param {Uint8Array} conversation_id
@@ -280,7 +316,7 @@ declare class CoreCryptoContext {
280
316
  */
281
317
  mark_conversation_as_child_of(child_id: Uint8Array, parent_id: Uint8Array): Promise<any>;
282
318
  /**
283
- * Returns: [`WasmCryptoResult<CommitBundle>`]
319
+ * Returns: [`WasmCryptoResult()`]
284
320
  *
285
321
  * see [core_crypto::mls::context::CentralContext::update_keying_material]
286
322
  * @param {Uint8Array} conversation_id
@@ -288,6 +324,8 @@ declare class CoreCryptoContext {
288
324
  */
289
325
  update_keying_material(conversation_id: Uint8Array): Promise<any>;
290
326
  /**
327
+ * Returns: [`WasmCryptoResult()`]
328
+ *
291
329
  * see [core_crypto::mls::context::CentralContext::commit_pending_proposals]
292
330
  * @param {Uint8Array} conversation_id
293
331
  * @returns {Promise<any>}
@@ -320,44 +358,7 @@ declare class CoreCryptoContext {
320
358
  */
321
359
  encrypt_message(conversation_id: Uint8Array, message: Uint8Array): Promise<any>;
322
360
  /**
323
- * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
324
- *
325
- * see [core_crypto::mls::context::CentralContext::new_add_proposal]
326
- * @param {Uint8Array} conversation_id
327
- * @param {Uint8Array} keypackage
328
- * @returns {Promise<any>}
329
- */
330
- new_add_proposal(conversation_id: Uint8Array, keypackage: Uint8Array): Promise<any>;
331
- /**
332
- * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
333
- *
334
- * see [core_crypto::mls::context::CentralContext::new_update_proposal]
335
- * @param {Uint8Array} conversation_id
336
- * @returns {Promise<any>}
337
- */
338
- new_update_proposal(conversation_id: Uint8Array): Promise<any>;
339
- /**
340
- * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
341
- *
342
- * see [core_crypto::mls::context::CentralContext::new_remove_proposal]
343
- * @param {Uint8Array} conversation_id
344
- * @param {Uint8Array} client_id
345
- * @returns {Promise<any>}
346
- */
347
- new_remove_proposal(conversation_id: Uint8Array, client_id: Uint8Array): Promise<any>;
348
- /**
349
- * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
350
- *
351
- * see [core_crypto::mls::context::CentralContext::new_external_add_proposal]
352
- * @param {Uint8Array} conversation_id
353
- * @param {number} epoch
354
- * @param {Ciphersuite} ciphersuite
355
- * @param {CredentialType} credential_type
356
- * @returns {Promise<any>}
357
- */
358
- new_external_add_proposal(conversation_id: Uint8Array, epoch: number, ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<any>;
359
- /**
360
- * Returns: [`WasmCryptoResult<ConversationInitBundle>`]
361
+ * Returns: [`WasmCryptoResult<WelcomeBundle>`]
361
362
  *
362
363
  * see [core_crypto::mls::context::CentralContext::join_by_external_commit]
363
364
  * @param {Uint8Array} group_info
@@ -367,41 +368,6 @@ declare class CoreCryptoContext {
367
368
  */
368
369
  join_by_external_commit(group_info: Uint8Array, custom_configuration: CustomConfiguration, credential_type: CredentialType): Promise<any>;
369
370
  /**
370
- * Returns: [`WasmCryptoResult<()>`]
371
- *
372
- * see [core_crypto::mls::context::CentralContext::merge_pending_group_from_external_commit]
373
- * @param {Uint8Array} conversation_id
374
- * @returns {Promise<any>}
375
- */
376
- merge_pending_group_from_external_commit(conversation_id: Uint8Array): Promise<any>;
377
- /**
378
- * Returns: [`WasmCryptoResult<()>`]
379
- *
380
- * see [core_crypto::mls::context::CentralContext::clear_pending_group_from_external_commit]
381
- * @param {Uint8Array} conversation_id
382
- * @returns {Promise<any>}
383
- */
384
- clear_pending_group_from_external_commit(conversation_id: Uint8Array): Promise<any>;
385
- /**
386
- * see [core_crypto::mls::context::CentralContext::commit_accepted]
387
- * @param {Uint8Array} conversation_id
388
- * @returns {Promise<any>}
389
- */
390
- commit_accepted(conversation_id: Uint8Array): Promise<any>;
391
- /**
392
- * see [core_crypto::mls::context::CentralContext::clear_pending_proposal]
393
- * @param {Uint8Array} conversation_id
394
- * @param {Uint8Array} proposal_ref
395
- * @returns {Promise<any>}
396
- */
397
- clear_pending_proposal(conversation_id: Uint8Array, proposal_ref: Uint8Array): Promise<any>;
398
- /**
399
- * see [core_crypto::mls::context::CentralContext::clear_pending_commit]
400
- * @param {Uint8Array} conversation_id
401
- * @returns {Promise<any>}
402
- */
403
- clear_pending_commit(conversation_id: Uint8Array): Promise<any>;
404
- /**
405
371
  * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
406
372
  *
407
373
  * see [core_crypto::mls::context::CentralContext::random_bytes]
@@ -581,13 +547,6 @@ declare class CoreCryptoContext {
581
547
  */
582
548
  proteus_cryptobox_migrate(path: string): Promise<any>;
583
549
  /**
584
- * Returns: [`WasmCryptoResult<u32>`]
585
- *
586
- * NOTE: This will clear the last error code.
587
- * @returns {Promise<any>}
588
- */
589
- proteus_last_error_code(): Promise<any>;
590
- /**
591
550
  * Returns: [`WasmCryptoResult<E2eiEnrollment>`]
592
551
  *
593
552
  * see [core_crypto::mls::context::CentralContext::e2ei_new_enrollment]
@@ -662,7 +621,7 @@ declare class CoreCryptoContext {
662
621
  */
663
622
  e2ei_mls_init_only(enrollment: FfiWireE2EIdentity, certificate_chain: string, nb_key_package?: number): Promise<any>;
664
623
  /**
665
- * Returns: [`WasmCryptoResult<CommitBundle>`]
624
+ * Returns: [`WasmCryptoResult<()>`]
666
625
  *
667
626
  * see [core_crypto::context::CentralContext::e2ei_rotate]
668
627
  * @param {Uint8Array} conversation_id
@@ -670,13 +629,22 @@ declare class CoreCryptoContext {
670
629
  */
671
630
  e2ei_rotate(conversation_id: Uint8Array): Promise<any>;
672
631
  /**
673
- * see [core_crypto::mls::context::CentralContext::e2ei_rotate_all]
632
+ * Returns: [`WasmCryptoResult<Option<Vec<String>>>`]
633
+ *
634
+ * see [core_crypto::mls::context::CentralContext::save_x509_credential]
674
635
  * @param {FfiWireE2EIdentity} enrollment
675
636
  * @param {string} certificate_chain
676
- * @param {number} new_key_packages_count
677
637
  * @returns {Promise<any>}
678
638
  */
679
- e2ei_rotate_all(enrollment: FfiWireE2EIdentity, certificate_chain: string, new_key_packages_count: number): Promise<any>;
639
+ save_x509_credential(enrollment: FfiWireE2EIdentity, certificate_chain: string): Promise<any>;
640
+ /**
641
+ * Returns: [`WasmCryptoResult<()>`]
642
+ *
643
+ * see [core_crypto::context::CentralContext::delete_stale_key_packages]
644
+ * @param {Ciphersuite} cipher_suite
645
+ * @returns {Promise<any>}
646
+ */
647
+ delete_stale_key_packages(cipher_suite: Ciphersuite): Promise<any>;
680
648
  /**
681
649
  * see [core_crypto::mls::context::CentralContext::e2ei_enrollment_stash]
682
650
  * @param {FfiWireE2EIdentity} enrollment
@@ -744,18 +712,25 @@ declare class CoreCryptoWasmLogger {
744
712
  /**
745
713
  * see [core_crypto::prelude::MlsCustomConfiguration]
746
714
  */
747
- declare class CustomConfiguration {
715
+ export class CustomConfiguration {
748
716
  free(): void;
749
717
  /**
750
718
  * @param {number | undefined} [key_rotation_span]
751
719
  * @param {WirePolicy | undefined} [wire_policy]
752
720
  */
753
721
  constructor(key_rotation_span?: number, wire_policy?: WirePolicy);
722
+ /**
723
+ * Duration in seconds after which we will automatically force a self-update commit
724
+ * Note: This isn't currently implemented
725
+ */
726
+ keyRotationSpan?: number;
727
+ /**
728
+ * Defines if handshake messages are encrypted or not
729
+ * Note: encrypted handshake messages are not supported by wire-server
730
+ */
731
+ wirePolicy?: WirePolicy;
754
732
  }
755
- /**
756
- * Dump of the PKI environemnt as PEM
757
- */
758
- export class E2eiDumpedPkiEnv {
733
+ declare class E2eiDumpedPkiEnv {
759
734
  free(): void;
760
735
  /**
761
736
  * CRLs registered in the PKI env
@@ -880,11 +855,7 @@ declare class FfiWireE2EIdentity {
880
855
  */
881
856
  certificate_request(previous_nonce: string): Promise<any>;
882
857
  }
883
- /**
884
- * Result of an authorization creation.
885
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
886
- */
887
- export class NewAcmeAuthz {
858
+ declare class NewAcmeAuthz {
888
859
  free(): void;
889
860
  /**
890
861
  * Associated ACME Challenge
@@ -899,11 +870,7 @@ export class NewAcmeAuthz {
899
870
  */
900
871
  readonly keyauth: string | undefined;
901
872
  }
902
- /**
903
- * Result of an order creation.
904
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
905
- */
906
- export class NewAcmeOrder {
873
+ declare class NewAcmeOrder {
907
874
  free(): void;
908
875
  /**
909
876
  */
@@ -913,811 +880,572 @@ export class NewAcmeOrder {
913
880
  */
914
881
  readonly delegate: Uint8Array;
915
882
  }
883
+ /**
884
+ */
885
+ export class WelcomeBundle {
886
+ free(): void;
887
+ /**
888
+ * New CRL Distribution of members of this group
889
+ */
890
+ readonly crlNewDistributionPoints: Array<any> | undefined;
891
+ /**
892
+ * Identifier of the joined conversation
893
+ */
894
+ readonly id: Uint8Array;
895
+ }
916
896
  declare class WireIdentity {
917
897
  free(): void;
918
898
  /**
899
+ * Unique client identifier e.g. `T4Coy4vdRzianwfOgXpn6A:6add501bacd1d90e@whitehouse.gov`
919
900
  */
920
- readonly client_id: string;
901
+ readonly clientId: string;
921
902
  /**
922
903
  */
923
- readonly credential_type: number;
904
+ readonly credentialType: number;
924
905
  /**
906
+ * Status of the Credential at the moment this object is created
925
907
  */
926
908
  readonly status: number;
927
909
  /**
910
+ * MLS thumbprint
928
911
  */
929
912
  readonly thumbprint: string;
930
913
  /**
931
914
  */
932
- readonly x509_identity: X509Identity | undefined;
915
+ readonly x509Identity: X509Identity | undefined;
933
916
  }
934
917
  declare class X509Identity {
935
918
  free(): void;
936
919
  /**
920
+ * X509 certificate identifying this client in the MLS group ; PEM encoded
937
921
  */
938
922
  readonly certificate: string;
939
923
  /**
924
+ * Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
940
925
  */
941
- readonly display_name: string;
926
+ readonly displayName: string;
942
927
  /**
928
+ * DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
943
929
  */
944
930
  readonly domain: string;
945
931
  /**
932
+ * user handle e.g. `john_wire`
946
933
  */
947
934
  readonly handle: string;
948
935
  /**
936
+ * X509 certificate not after as Unix timestamp
949
937
  */
950
- readonly not_after: bigint;
938
+ readonly notAfter: bigint;
951
939
  /**
940
+ * X509 certificate not before as Unix timestamp
952
941
  */
953
- readonly not_before: bigint;
942
+ readonly notBefore: bigint;
954
943
  /**
944
+ * X509 certificate serial number
955
945
  */
956
- readonly serial_number: string;
946
+ readonly serialNumber: string;
957
947
  }
958
- declare class CoreCryptoContext$1 {
959
- #private;
960
- /** @hidden */
961
- private constructor();
962
- /** @hidden */
963
- static fromFfiContext(ctx: CoreCryptoContext): CoreCryptoContext$1;
948
+ /**
949
+ * see [core_crypto::prelude::CiphersuiteName]
950
+ */
951
+ declare enum Ciphersuite$1 {
964
952
  /**
965
- * Set arbitrary data to be retrieved by {@link getData}.
966
- * This is meant to be used as a check point at the end of a transaction.
967
- * The data should be limited to a reasonable size.
953
+ * DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
968
954
  */
969
- setData(data: Uint8Array): Promise<void>;
955
+ MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1,
970
956
  /**
971
- * Get data if it has previously been set by {@link setData}, or `undefined` otherwise.
972
- * This is meant to be used as a check point at the end of a transaction.
957
+ * DH KEM P256 | AES-GCM 128 | SHA2-256 | EcDSA P256
973
958
  */
974
- getData(): Promise<Uint8Array | undefined>;
959
+ MLS_128_DHKEMP256_AES128GCM_SHA256_P256 = 2,
975
960
  /**
976
- * Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
977
- *
978
- * @param clientId - {@link CoreCryptoParams#clientId} but required
979
- * @param ciphersuites - All the ciphersuites supported by this MLS client
980
- * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
961
+ * DH KEM x25519 | Chacha20Poly1305 | SHA2-256 | Ed25519
981
962
  */
982
- mlsInit(clientId: ClientId, ciphersuites: Ciphersuite$1[], nbKeyPackage?: number): Promise<void>;
963
+ MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519 = 3,
983
964
  /**
984
- * Generates a MLS KeyPair/CredentialBundle with a temporary, random client ID.
985
- * This method is designed to be used in conjunction with {@link CoreCryptoContext.mlsInitWithClientId} and represents the first step in this process
986
- *
987
- * @param ciphersuites - All the ciphersuites supported by this MLS client
988
- * @returns This returns the TLS-serialized identity key (i.e. the signature keypair's public key)
965
+ * DH KEM x448 | AES-GCM 256 | SHA2-512 | Ed448
989
966
  */
990
- mlsGenerateKeypair(ciphersuites: Ciphersuite$1[]): Promise<Uint8Array[]>;
967
+ MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448 = 4,
991
968
  /**
992
- * Updates the current temporary Client ID with the newly provided one. This is the second step in the externally-generated clients process
993
- *
994
- * Important: This is designed to be called after {@link CoreCryptoContext.mlsGenerateKeypair}
995
- *
996
- * @param clientId - The newly-allocated client ID by the MLS Authentication Service
997
- * @param signaturePublicKeys - The public key you were given at the first step; This is for authentication purposes
998
- * @param ciphersuites - All the ciphersuites supported by this MLS client
969
+ * DH KEM P521 | AES-GCM 256 | SHA2-512 | EcDSA P521
999
970
  */
1000
- mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite$1[]): Promise<void>;
971
+ MLS_256_DHKEMP521_AES256GCM_SHA512_P521 = 5,
1001
972
  /**
1002
- * Checks if the Client is member of a given conversation and if the MLS Group is loaded up
1003
- *
1004
- * @returns Whether the given conversation ID exists
1005
- *
1006
- * @example
1007
- * ```ts
1008
- * const cc = await CoreCrypto.init({ databaseName: "test", key: "test", clientId: "test" });
1009
- * const encoder = new TextEncoder();
1010
- * if (await cc.conversationExists(encoder.encode("my super chat"))) {
1011
- * // Do something
1012
- * } else {
1013
- * // Do something else
1014
- * }
1015
- * ```
973
+ * DH KEM x448 | Chacha20Poly1305 | SHA2-512 | Ed448
1016
974
  */
1017
- conversationExists(conversationId: ConversationId): Promise<boolean>;
975
+ MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448 = 6,
1018
976
  /**
1019
- * Marks a conversation as child of another one
1020
- * This will mostly affect the behavior of the callbacks (the parentConversationClients parameter will be filled)
1021
- *
1022
- * @param childId - conversation identifier of the child conversation
1023
- * @param parentId - conversation identifier of the parent conversation
977
+ * DH KEM P384 | AES-GCM 256 | SHA2-384 | EcDSA P384
1024
978
  */
1025
- markConversationAsChildOf(childId: ConversationId, parentId: ConversationId): Promise<void>;
979
+ MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
980
+ }
981
+ declare enum CredentialType$1 {
1026
982
  /**
1027
- * Returns the current epoch of a conversation
1028
- *
1029
- * @returns the epoch of the conversation
1030
- *
1031
- * @example
1032
- * ```ts
1033
- * const cc = await CoreCrypto.init({ databaseName: "test", key: "test", clientId: "test" });
1034
- * const encoder = new TextEncoder();
1035
- * console.log(await cc.conversationEpoch(encoder.encode("my super chat")))
1036
- * ```
983
+ * Just a KeyPair
1037
984
  */
1038
- conversationEpoch(conversationId: ConversationId): Promise<number>;
985
+ Basic = 1,
1039
986
  /**
1040
- * Returns the ciphersuite of a conversation
1041
- *
1042
- * @returns the ciphersuite of the conversation
987
+ * A certificate obtained through e2e identity enrollment process
1043
988
  */
1044
- conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite$1>;
989
+ X509 = 2
990
+ }
991
+ /**
992
+ * see [core_crypto::prelude::MlsWirePolicy]
993
+ */
994
+ declare enum WirePolicy$1 {
1045
995
  /**
1046
- * Wipes and destroys the local storage of a given conversation / MLS group
1047
- *
1048
- * @param conversationId - The ID of the conversation to remove
996
+ * Handshake messages are never encrypted
1049
997
  */
1050
- wipeConversation(conversationId: ConversationId): Promise<void>;
998
+ Plaintext = 1,
1051
999
  /**
1052
- * Creates a new conversation with the current client being the sole member
1053
- * You will want to use {@link addClientsToConversation} afterwards to add clients to this conversation
1054
- *
1055
- * @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
1056
- * @param creatorCredentialType - kind of credential the creator wants to create the group with
1057
- * @param configuration - configuration of the MLS group
1058
- * @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
1059
- * @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
1060
- * @param configuration.custom - {@link CustomConfiguration}
1000
+ * Handshake messages are always encrypted
1061
1001
  */
1062
- createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType$1, configuration?: ConversationConfiguration$1): Promise<any>;
1063
- /**
1064
- * Decrypts a message for a given conversation.
1065
- *
1066
- * Note: you should catch & ignore the following error reasons:
1067
- * * "We already decrypted this message once"
1068
- * * "You tried to join with an external commit but did not merge it yet. We will reapply this message for you when you merge your external commit"
1069
- * * "Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives"
1070
- *
1071
- * @param conversationId - The ID of the conversation
1072
- * @param payload - The encrypted message buffer
1073
- *
1074
- * @returns a {@link DecryptedMessage}. Note that {@link DecryptedMessage#message} is `undefined` when the encrypted payload contains a system message such a proposal or commit
1075
- */
1076
- decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
1002
+ Ciphertext = 2
1003
+ }
1004
+ /**
1005
+ * Alias for conversation IDs.
1006
+ * This is a freeform, uninspected buffer.
1007
+ */
1008
+ export type ConversationId = Uint8Array;
1009
+ /**
1010
+ * Alias for client identifier.
1011
+ * This is a freeform, uninspected buffer.
1012
+ */
1013
+ export type ClientId = Uint8Array;
1014
+ /**
1015
+ * Alias for proposal reference. It is a byte array of size 16.
1016
+ */
1017
+ export type ProposalRef = Uint8Array;
1018
+ /**
1019
+ * Data shape for a MLS generic commit + optional bundle (aka stapled commit & welcome)
1020
+ */
1021
+ export interface CommitBundle {
1077
1022
  /**
1078
- * Encrypts a message for a given conversation
1079
- *
1080
- * @param conversationId - The ID of the conversation
1081
- * @param message - The plaintext message to encrypt
1023
+ * TLS-serialized MLS Commit that needs to be fanned out to other (existing) members of the conversation
1082
1024
  *
1083
- * @returns The encrypted payload for the given group. This needs to be fanned out to the other members of the group.
1025
+ * @readonly
1084
1026
  */
1085
- encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
1027
+ commit: Uint8Array;
1086
1028
  /**
1087
- * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
1088
- *
1089
- * Important: you have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
1090
- * it references has already been deleted locally. Join this group with an external commit", ignore it and then try
1091
- * to join this group with an external commit.
1029
+ * Optional TLS-serialized MLS Welcome message that needs to be fanned out to the clients newly added to the conversation
1092
1030
  *
1093
- * @param welcomeMessage - TLS-serialized MLS Welcome message
1094
- * @param configuration - configuration of the MLS group
1095
- * @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
1031
+ * @readonly
1096
1032
  */
1097
- processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration$1): Promise<WelcomeBundle>;
1033
+ welcome?: Uint8Array;
1098
1034
  /**
1099
- * Get the client's public signature key. To upload to the DS for further backend side validation
1035
+ * MLS GroupInfo which is required for joining a group by external commit
1100
1036
  *
1101
- * @param ciphersuite - of the signature key to get
1102
- * @param credentialType - of the public key to look for
1103
- * @returns the client's public signature key
1037
+ * @readonly
1104
1038
  */
1105
- clientPublicKey(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<Uint8Array>;
1039
+ groupInfo: GroupInfoBundle;
1040
+ }
1041
+ /**
1042
+ * Wraps a GroupInfo in order to efficiently upload it to the Delivery Service.
1043
+ * This is not part of MLS protocol but parts might be standardized at some point.
1044
+ */
1045
+ export interface GroupInfoBundle {
1106
1046
  /**
1107
- *
1108
- * @param ciphersuite - of the KeyPackages to count
1109
- * @param credentialType - of the KeyPackages to count
1110
- * @returns The amount of valid, non-expired KeyPackages that are persisted in the backing storage
1047
+ * see {@link GroupInfoEncryptionType}
1111
1048
  */
1112
- clientValidKeypackagesCount(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<number>;
1049
+ encryptionType: GroupInfoEncryptionType;
1113
1050
  /**
1114
- * Fetches a requested amount of keypackages
1115
- *
1116
- * @param ciphersuite - of the KeyPackages to generate
1117
- * @param credentialType - of the KeyPackages to generate
1118
- * @param amountRequested - The amount of keypackages requested
1119
- * @returns An array of length `amountRequested` containing TLS-serialized KeyPackages
1051
+ * see {@link RatchetTreeType}
1120
1052
  */
1121
- clientKeypackages(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1, amountRequested: number): Promise<Array<Uint8Array>>;
1053
+ ratchetTreeType: RatchetTreeType;
1122
1054
  /**
1123
- * Prunes local KeyPackages after making sure they also have been deleted on the backend side
1124
- * You should only use this after {@link CoreCryptoContext.e2eiRotateAll}
1125
- *
1126
- * @param refs - KeyPackage references to delete obtained from a {RotateBundle}
1055
+ * TLS-serialized GroupInfo
1127
1056
  */
1128
- deleteKeypackages(refs: Uint8Array[]): Promise<void>;
1057
+ payload: Uint8Array;
1058
+ }
1059
+ /**
1060
+ * Informs whether the GroupInfo is confidential
1061
+ * see [core_crypto::mls::conversation::group_info::GroupInfoEncryptionType]
1062
+ */
1063
+ export declare enum GroupInfoEncryptionType {
1129
1064
  /**
1130
- * Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
1131
- *
1132
- * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1133
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1134
- * epoch, use new encryption secrets etc...
1135
- *
1136
- * @param conversationId - The ID of the conversation
1137
- * @param keyPackages - KeyPackages of the new clients to add
1138
- *
1139
- * @returns A {@link CommitBundle}
1065
+ * Unencrypted
1140
1066
  */
1141
- addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<MemberAddedMessages>;
1067
+ Plaintext = 1,
1142
1068
  /**
1143
- * Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
1144
- * to do so, otherwise this operation does nothing.
1145
- *
1146
- * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1147
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1148
- * epoch, use new encryption secrets etc...
1149
- *
1150
- * @param conversationId - The ID of the conversation
1151
- * @param clientIds - Array of Client IDs to remove.
1152
- *
1153
- * @returns A {@link CommitBundle}
1069
+ * Encrypted in a JWE (not yet implemented)
1154
1070
  */
1155
- removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId[]): Promise<CommitBundle>;
1071
+ JweEncrypted = 2
1072
+ }
1073
+ /**
1074
+ * Represents different ways of carrying the Ratchet Tree with some optimizations to save some space
1075
+ * see [core_crypto::mls::conversation::group_info::RatchetTreeType]
1076
+ */
1077
+ export declare enum RatchetTreeType {
1156
1078
  /**
1157
- * Creates an update commit which forces every client to update their LeafNode in the conversation
1158
- *
1159
- * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1160
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1161
- * epoch, use new encryption secrets etc...
1162
- *
1163
- * @param conversationId - The ID of the conversation
1164
- *
1165
- * @returns A {@link CommitBundle}
1079
+ * Complete GroupInfo
1166
1080
  */
1167
- updateKeyingMaterial(conversationId: ConversationId): Promise<CommitBundle>;
1081
+ Full = 1,
1168
1082
  /**
1169
- * Commits the local pending proposals and returns the {@link CommitBundle} object containing what can result from this operation.
1170
- *
1171
- * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
1172
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1173
- * epoch, use new encryption secrets etc...
1174
- *
1175
- * @param conversationId - The ID of the conversation
1176
- *
1177
- * @returns A {@link CommitBundle} or `undefined` when there was no pending proposal to commit
1083
+ * Contains the difference since previous epoch (not yet implemented)
1178
1084
  */
1179
- commitPendingProposals(conversationId: ConversationId): Promise<CommitBundle | undefined>;
1085
+ Delta = 2,
1180
1086
  /**
1181
- * Creates a new proposal for the provided Conversation ID
1182
- *
1183
- * @param proposalType - The type of proposal, see {@link ProposalType}
1184
- * @param args - The arguments of the proposal, see {@link ProposalArgs}, {@link AddProposalArgs} or {@link RemoveProposalArgs}
1185
- *
1186
- * @returns A {@link ProposalBundle} containing the Proposal and its reference in order to roll it back if necessary
1087
+ * To define (not yet implemented)
1187
1088
  */
1188
- newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<ProposalBundle>;
1089
+ ByRef = 3
1090
+ }
1091
+ /**
1092
+ * This is a wrapper for all the possible outcomes you can get after decrypting a message
1093
+ */
1094
+ export interface DecryptedMessage {
1189
1095
  /**
1190
- * Creates a new external Add proposal for self client to join a conversation.
1096
+ * Raw decrypted application message, if the decrypted MLS message is an application message
1191
1097
  */
1192
- newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
1098
+ message?: Uint8Array;
1193
1099
  /**
1194
- * Allows to create an external commit to "apply" to join a group through its GroupInfo.
1195
- *
1196
- * If the Delivery Service accepts the external commit, you have to {@link CoreCryptoContext.mergePendingGroupFromExternalCommit}
1197
- * in order to get back a functional MLS group. On the opposite, if it rejects it, you can either retry by just
1198
- * calling again {@link CoreCryptoContext.joinByExternalCommit}, no need to {@link CoreCryptoContext.clearPendingGroupFromExternalCommit}.
1199
- * If you want to abort the operation (too many retries or the user decided to abort), you can use
1200
- * {@link CoreCryptoContext.clearPendingGroupFromExternalCommit} in order not to bloat the user's storage but nothing
1201
- * bad can happen if you forget to except some storage space wasted.
1202
- *
1203
- * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1204
- * @param credentialType - kind of Credential to use for joining this group. If {@link CredentialType.Basic} is
1205
- * chosen and no Credential has been created yet for it, a new one will be generated.
1206
- * @param configuration - configuration of the MLS group
1207
- * When {@link CredentialType.X509} is chosen, it fails when no Credential has been created for the given {@link Ciphersuite}.
1208
- * @returns see {@link ConversationInitBundle}
1100
+ * Only when decrypted message is a commit, CoreCrypto will renew local proposal which could not make it in the commit.
1101
+ * This will contain either:
1102
+ * * local pending proposal not in the accepted commit
1103
+ * * If there is a pending commit, its proposals which are not in the accepted commit
1209
1104
  */
1210
- joinByExternalCommit(groupInfo: Uint8Array, credentialType: CredentialType$1, configuration?: CustomConfiguration$1): Promise<ConversationInitBundle>;
1105
+ proposals: ProposalBundle[];
1211
1106
  /**
1212
- * This merges the commit generated by {@link CoreCryptoContext.joinByExternalCommit}, persists the group permanently
1213
- * and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
1214
- *
1215
- * @param conversationId - The ID of the conversation
1216
- * @returns eventually decrypted buffered messages if any
1107
+ * It is set to false if ingesting this MLS message has resulted in the client being removed from the group (i.e. a Remove commit)
1217
1108
  */
1218
- mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
1109
+ isActive: boolean;
1219
1110
  /**
1220
- * In case the external commit generated by {@link CoreCryptoContext.joinByExternalCommit} is rejected by the Delivery Service, and we
1221
- * want to abort this external commit once for all, we can wipe out the pending group from the keystore in order
1222
- * not to waste space
1223
- *
1224
- * @param conversationId - The ID of the conversation
1111
+ * Commit delay hint (in milliseconds) to prevent clients from hammering the server with epoch changes
1225
1112
  */
1226
- clearPendingGroupFromExternalCommit(conversationId: ConversationId): Promise<void>;
1113
+ commitDelay?: number;
1227
1114
  /**
1228
- * Allows to mark the latest commit produced as "accepted" and be able to safely merge it into the local group state
1229
- *
1230
- * @param conversationId - The group's ID
1231
- * @returns the messages from current epoch which had been buffered, if any
1115
+ * Client identifier of the sender of the message being decrypted. Only present for application messages.
1232
1116
  */
1233
- commitAccepted(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
1117
+ senderClientId?: ClientId;
1234
1118
  /**
1235
- * Allows to remove a pending proposal (rollback). Use this when backend rejects the proposal you just sent e.g. if permissions have changed meanwhile.
1236
- *
1237
- * **CAUTION**: only use this when you had an explicit response from the Delivery Service
1238
- * e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc…
1239
- *
1240
- * @param conversationId - The group's ID
1241
- * @param proposalRef - A reference to the proposal to delete. You get one when using {@link CoreCryptoContext.newProposal}
1119
+ * true when the decrypted message resulted in an epoch change i.e. it was a commit
1242
1120
  */
1243
- clearPendingProposal(conversationId: ConversationId, proposalRef: ProposalRef): Promise<void>;
1121
+ hasEpochChanged: boolean;
1244
1122
  /**
1245
- * Allows to remove a pending commit (rollback). Use this when backend rejects the commit you just sent e.g. if permissions have changed meanwhile.
1246
- *
1247
- * **CAUTION**: only use this when you had an explicit response from the Delivery Service
1248
- * e.g. 403. Do not use otherwise e.g. 5xx responses, timeout etc..
1249
- * **DO NOT** use when Delivery Service responds 409, pending state will be renewed
1250
- * in {@link CoreCryptoContext.decryptMessage}
1251
- *
1252
- * @param conversationId - The group's ID
1123
+ * Identity claims present in the sender credential
1124
+ * Only present when the credential is a x509 certificate
1125
+ * Present for all messages
1253
1126
  */
1254
- clearPendingCommit(conversationId: ConversationId): Promise<void>;
1127
+ identity?: WireIdentity;
1255
1128
  /**
1256
- * Derives a new key from the group
1257
- *
1258
- * @param conversationId - The group's ID
1259
- * @param keyLength - the length of the key to be derived. If the value is higher than the
1260
- * bounds of `u16` or the context hash * 255, an error will be returned
1261
- *
1262
- * @returns A `Uint8Array` representing the derived key
1129
+ * Only set when the decrypted message is a commit.
1130
+ * Contains buffered messages for next epoch which were received before the commit creating the epoch
1131
+ * because the DS did not fan them out in order.
1263
1132
  */
1264
- exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<Uint8Array>;
1133
+ bufferedMessages?: BufferedDecryptedMessage[];
1265
1134
  /**
1266
- * Returns the raw public key of the single external sender present in this group.
1267
- * This should be used to initialize a subconversation
1268
- *
1269
- * @param conversationId - The group's ID
1270
- *
1271
- * @returns A `Uint8Array` representing the external sender raw public key
1135
+ * New CRL distribution points that appeared by the introduction of a new credential
1272
1136
  */
1273
- getExternalSender(conversationId: ConversationId): Promise<Uint8Array>;
1137
+ crlNewDistributionPoints?: string[];
1138
+ }
1139
+ /**
1140
+ * Almost same as {@link DecryptedMessage} but avoids recursion
1141
+ */
1142
+ export interface BufferedDecryptedMessage {
1274
1143
  /**
1275
- * Returns all clients from group's members
1276
- *
1277
- * @param conversationId - The group's ID
1278
- *
1279
- * @returns A list of clients from the members of the group
1144
+ * see {@link DecryptedMessage.message}
1280
1145
  */
1281
- getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
1146
+ message?: Uint8Array;
1282
1147
  /**
1283
- * Allows {@link CoreCryptoContext} to act as a CSPRNG provider
1284
- * @note The underlying CSPRNG algorithm is ChaCha20 and takes in account the external seed provider.
1285
- *
1286
- * @param length - The number of bytes to be returned in the `Uint8Array`
1287
- *
1288
- * @returns A `Uint8Array` buffer that contains `length` cryptographically-secure random bytes
1148
+ * see {@link DecryptedMessage.proposals}
1289
1149
  */
1290
- randomBytes(length: number): Promise<Uint8Array>;
1150
+ proposals: ProposalBundle[];
1291
1151
  /**
1292
- * Initializes the proteus client
1152
+ * see {@link DecryptedMessage.isActive}
1293
1153
  */
1294
- proteusInit(): Promise<void>;
1154
+ isActive: boolean;
1295
1155
  /**
1296
- * Create a Proteus session using a prekey
1297
- *
1298
- * @param sessionId - ID of the Proteus session
1299
- * @param prekey - CBOR-encoded Proteus prekey of the other client
1156
+ * see {@link DecryptedMessage.commitDelay}
1300
1157
  */
1301
- proteusSessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<void>;
1158
+ commitDelay?: number;
1302
1159
  /**
1303
- * Create a Proteus session from a handshake message
1304
- *
1305
- * @param sessionId - ID of the Proteus session
1306
- * @param envelope - CBOR-encoded Proteus message
1307
- *
1308
- * @returns A `Uint8Array` containing the message that was sent along with the session handshake
1160
+ * see {@link DecryptedMessage.senderClientId}
1309
1161
  */
1310
- proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<Uint8Array>;
1162
+ senderClientId?: ClientId;
1311
1163
  /**
1312
- * Locally persists a session to the keystore
1313
- *
1314
- * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
1315
- *
1316
- * @param sessionId - ID of the Proteus session
1164
+ * see {@link DecryptedMessage.hasEpochChanged}
1317
1165
  */
1318
- proteusSessionSave(sessionId: string): Promise<void>;
1166
+ hasEpochChanged: boolean;
1319
1167
  /**
1320
- * Deletes a session
1321
- * Note: this also deletes the persisted data within the keystore
1322
- *
1323
- * @param sessionId - ID of the Proteus session
1168
+ * see {@link DecryptedMessage.identity}
1324
1169
  */
1325
- proteusSessionDelete(sessionId: string): Promise<void>;
1170
+ identity?: WireIdentity;
1326
1171
  /**
1327
- * Checks if a session exists
1328
- *
1329
- * @param sessionId - ID of the Proteus session
1330
- *
1331
- * @returns whether the session exists or not
1172
+ * see {@link DecryptedMessage.crlNewDistributionPoints}
1332
1173
  */
1333
- proteusSessionExists(sessionId: string): Promise<boolean>;
1174
+ crlNewDistributionPoints?: string[];
1175
+ }
1176
+ /**
1177
+ * Indicates the standalone status of a device Credential in a MLS group at a moment T.
1178
+ * This does not represent the states where a device is not using MLS or is not using end-to-end identity
1179
+ */
1180
+ export declare enum DeviceStatus {
1334
1181
  /**
1335
- * Decrypt an incoming message for an existing Proteus session
1336
- *
1337
- * @param sessionId - ID of the Proteus session
1338
- * @param ciphertext - CBOR encoded, encrypted proteus message
1339
- * @returns The decrypted payload contained within the message
1182
+ * All is fine
1340
1183
  */
1341
- proteusDecrypt(sessionId: string, ciphertext: Uint8Array): Promise<Uint8Array>;
1184
+ Valid = 1,
1342
1185
  /**
1343
- * Encrypt a message for a given Proteus session
1344
- *
1345
- * @param sessionId - ID of the Proteus session
1346
- * @param plaintext - payload to encrypt
1347
- * @returns The CBOR-serialized encrypted message
1186
+ * The Credential's certificate is expired
1348
1187
  */
1349
- proteusEncrypt(sessionId: string, plaintext: Uint8Array): Promise<Uint8Array>;
1188
+ Expired = 2,
1350
1189
  /**
1351
- * Batch encryption for proteus messages
1352
- * This is used to minimize FFI roundtrips when used in the context of a multi-client session (i.e. conversation)
1353
- *
1354
- * @param sessions - List of Proteus session IDs to encrypt the message for
1355
- * @param plaintext - payload to encrypt
1356
- * @returns A map indexed by each session ID and the corresponding CBOR-serialized encrypted message for this session
1190
+ * The Credential's certificate is revoked
1357
1191
  */
1358
- proteusEncryptBatched(sessions: string[], plaintext: Uint8Array): Promise<Map<string, Uint8Array>>;
1192
+ Revoked = 3
1193
+ }
1194
+ /**
1195
+ * Returned by all methods creating proposals. Contains a proposal message and an identifier to roll back the proposal
1196
+ */
1197
+ export interface ProposalBundle {
1359
1198
  /**
1360
- * Creates a new prekey with the requested ID.
1199
+ * TLS-serialized MLS proposal that needs to be fanned out to other (existing) members of the conversation
1361
1200
  *
1362
- * @param prekeyId - ID of the PreKey to generate. This cannot be bigger than a u16
1363
- * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
1201
+ * @readonly
1364
1202
  */
1365
- proteusNewPrekey(prekeyId: number): Promise<Uint8Array>;
1203
+ proposal: Uint8Array;
1366
1204
  /**
1367
- * Creates a new prekey with an automatically generated ID..
1205
+ * Unique identifier of a proposal.
1368
1206
  *
1369
- * @returns A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey accompanied by its ID
1207
+ * @readonly
1370
1208
  */
1371
- proteusNewPrekeyAuto(): Promise<ProteusAutoPrekeyBundle>;
1209
+ proposalRef: ProposalRef;
1372
1210
  /**
1373
- * Proteus last resort prekey stuff
1211
+ * New CRL Distribution of members of this group
1374
1212
  *
1375
- * @returns A CBOR-serialize version of the PreKeyBundle associated with the last resort PreKey (holding the last resort prekey id)
1213
+ * @readonly
1376
1214
  */
1377
- proteusLastResortPrekey(): Promise<Uint8Array>;
1215
+ crlNewDistributionPoints?: string[];
1216
+ }
1217
+ /**
1218
+ * Returned by {@link MlsTransport} callbacks.
1219
+ */
1220
+ export type MlsTransportResponse = "success" | "retry" | {
1378
1221
  /**
1379
- * @returns The last resort PreKey id
1222
+ * The message was rejected by the delivery service and there's no recovery.
1380
1223
  */
1381
- static proteusLastResortPrekeyId(): number;
1224
+ abort: {
1225
+ reason: string;
1226
+ };
1227
+ };
1228
+ /**
1229
+ * An interface that must be implemented and provided to CoreCrypto via
1230
+ * {@link CoreCrypto.provideTransport}.
1231
+ */
1232
+ export interface MlsTransport {
1382
1233
  /**
1383
- * Proteus public key fingerprint
1384
- * It's basically the public key encoded as an hex string
1234
+ * This callback is called by CoreCrypto to send a commit bundle to the delivery service.
1385
1235
  *
1386
- * @returns Hex-encoded public key string
1236
+ * @param commitBundle - the commit bundle
1237
+ * @returns a promise resolving to a {@link MlsTransportResponse}
1387
1238
  */
1388
- proteusFingerprint(): Promise<string>;
1239
+ sendCommitBundle: (commitBundle: CommitBundle) => Promise<MlsTransportResponse>;
1389
1240
  /**
1390
- * Proteus session local fingerprint
1391
- *
1392
- * @param sessionId - ID of the Proteus session
1393
- * @returns Hex-encoded public key string
1241
+ * This callback is called by CoreCrypto to send a regular message to the delivery service.
1242
+ * @param message
1243
+ * @returns a promise resolving to a {@link MlsTransportResponse}
1394
1244
  */
1395
- proteusFingerprintLocal(sessionId: string): Promise<string>;
1245
+ sendMessage: (message: Uint8Array) => Promise<MlsTransportResponse>;
1246
+ }
1247
+ /**
1248
+ * Supporting struct for CRL registration result
1249
+ */
1250
+ export interface CRLRegistration {
1396
1251
  /**
1397
- * Proteus session remote fingerprint
1252
+ * Whether this CRL modifies the old CRL (i.e. has a different revocated cert list)
1398
1253
  *
1399
- * @param sessionId - ID of the Proteus session
1400
- * @returns Hex-encoded public key string
1254
+ * @readonly
1401
1255
  */
1402
- proteusFingerprintRemote(sessionId: string): Promise<string>;
1256
+ dirty: boolean;
1403
1257
  /**
1404
- * Hex-encoded fingerprint of the given prekey
1258
+ * Optional expiration timestamp
1405
1259
  *
1406
- * @param prekey - the prekey bundle to get the fingerprint from
1407
- * @returns Hex-encoded public key string
1408
- **/
1409
- static proteusFingerprintPrekeybundle(prekey: Uint8Array): string;
1260
+ * @readonly
1261
+ */
1262
+ expiration?: number;
1263
+ }
1264
+ export interface AcmeDirectory {
1410
1265
  /**
1411
- * Imports all the data stored by Cryptobox into the CoreCrypto keystore
1412
- *
1413
- * @param storeName - The name of the IndexedDB store where the data is stored
1266
+ * URL for fetching a new nonce. Use this only for creating a new account.
1414
1267
  */
1415
- proteusCryptoboxMigrate(storeName: string): Promise<void>;
1268
+ newNonce: string;
1416
1269
  /**
1417
- * Note: this call clears out the code and resets it to 0 (aka no error)
1418
- * @returns the last proteus error code that occured.
1270
+ * URL for creating a new account.
1419
1271
  */
1420
- proteusLastErrorCode(): Promise<number>;
1272
+ newAccount: string;
1421
1273
  /**
1422
- * Creates an enrollment instance with private key material you can use in order to fetch
1423
- * a new x509 certificate from the acme server.
1424
- *
1425
- * @param clientId - client identifier e.g. `b7ac11a4-8f01-4527-af88-1c30885a7931:6add501bacd1d90e@example.com`
1426
- * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1427
- * @param handle - user handle e.g. `alice.smith.qa@example.com`
1428
- * @param expirySec - generated x509 certificate expiry
1429
- * @param ciphersuite - for generating signing key material
1430
- * @param team - name of the Wire team a user belongs to
1431
- * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiMlsInitOnly}
1274
+ * URL for creating a new order.
1432
1275
  */
1433
- e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
1276
+ newOrder: string;
1434
1277
  /**
1435
- * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1436
- * Once the enrollment is finished, use the instance in {@link CoreCryptoContext.e2eiRotateAll} to do the rotation.
1437
- *
1438
- * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1439
- * @param handle - user handle e.g. `alice.smith.qa@example.com`
1440
- * @param expirySec - generated x509 certificate expiry
1441
- * @param ciphersuite - for generating signing key material
1442
- * @param team - name of the Wire team a user belongs to
1443
- * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotateAll}
1278
+ * Revocation URL
1444
1279
  */
1445
- e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
1280
+ revokeCert: string;
1281
+ }
1282
+ /**
1283
+ * Returned by APIs whose code paths potentially discover new certificate revocation list distribution URLs.
1284
+ */
1285
+ export type NewCrlDistributionPoints = string[] | undefined;
1286
+ export type JsonRawData = Uint8Array;
1287
+ export declare class E2eiEnrollment {
1288
+ #private;
1289
+ /** @hidden */
1290
+ constructor(e2ei: unknown);
1291
+ free(): void;
1446
1292
  /**
1447
- * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1448
- * having to change/rotate their credential, either because the former one is expired or it
1449
- * has been revoked. It lets you change the DisplayName or the handle
1450
- * if you need to. Once the enrollment is finished, use the instance in {@link CoreCryptoContext.e2eiRotateAll} to do the rotation.
1451
- *
1452
- * @param expirySec - generated x509 certificate expiry
1453
- * @param ciphersuite - for generating signing key material
1454
- * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1455
- * @param handle - user handle e.g. `alice.smith.qa@example.com`
1456
- * @param team - name of the Wire team a user belongs to
1457
- * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotateAll}
1293
+ * Should only be used internally
1458
1294
  */
1459
- e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite$1, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
1295
+ inner(): unknown;
1460
1296
  /**
1461
- * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
1462
- * that means he cannot initialize with a Basic credential
1297
+ * Parses the response from `GET /acme/{provisioner-name}/directory`.
1298
+ * Use this {@link AcmeDirectory} in the next step to fetch the first nonce from the acme server. Use
1299
+ * {@link AcmeDirectory.newNonce}.
1463
1300
  *
1464
- * @param enrollment - the enrollment instance used to fetch the certificates
1465
- * @param certificateChain - the raw response from ACME server
1466
- * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
1467
- * @returns a MlsClient initialized with only a x509 credential
1301
+ * @param directory HTTP response body
1302
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.1.1
1468
1303
  */
1469
- e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<string[] | undefined>;
1304
+ directoryResponse(directory: JsonRawData): Promise<AcmeDirectory>;
1470
1305
  /**
1471
- * Dumps the PKI environment as PEM
1306
+ * For creating a new acme account. This returns a signed JWS-alike request body to send to
1307
+ * `POST /acme/{provisioner-name}/new-account`.
1472
1308
  *
1473
- * @returns a struct with different fields representing the PKI environment as PEM strings
1309
+ * @param previousNonce you got from calling `HEAD {@link AcmeDirectory.newNonce}`
1310
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
1474
1311
  */
1475
- e2eiDumpPKIEnv(): Promise<E2eiDumpedPkiEnv | undefined>;
1312
+ newAccountRequest(previousNonce: string): Promise<JsonRawData>;
1476
1313
  /**
1477
- * @returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
1314
+ * Parses the response from `POST /acme/{provisioner-name}/new-account`.
1315
+ * @param account HTTP response body
1316
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
1478
1317
  */
1479
- e2eiIsPKIEnvSetup(): Promise<boolean>;
1318
+ newAccountResponse(account: JsonRawData): Promise<void>;
1480
1319
  /**
1481
- * Registers a Root Trust Anchor CA for the use in E2EI processing.
1482
- *
1483
- * Please note that without a Root Trust Anchor, all validations *will* fail;
1484
- * So this is the first step to perform after initializing your E2EI client
1320
+ * Creates a new acme order for the handle (userId + display name) and the clientId.
1485
1321
  *
1486
- * @param trustAnchorPEM - PEM certificate to anchor as a Trust Root
1322
+ * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/new-account`
1323
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1487
1324
  */
1488
- e2eiRegisterAcmeCA(trustAnchorPEM: string): Promise<void>;
1325
+ newOrderRequest(previousNonce: string): Promise<JsonRawData>;
1489
1326
  /**
1490
- * Registers an Intermediate CA for the use in E2EI processing.
1491
- *
1492
- * Please note that a Root Trust Anchor CA is needed to validate Intermediate CAs;
1493
- * You **need** to have a Root CA registered before calling this
1327
+ * Parses the response from `POST /acme/{provisioner-name}/new-order`.
1494
1328
  *
1495
- * @param certPEM - PEM certificate to register as an Intermediate CA
1329
+ * @param order HTTP response body
1330
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1496
1331
  */
1497
- e2eiRegisterIntermediateCA(certPEM: string): Promise<string[] | undefined>;
1332
+ newOrderResponse(order: JsonRawData): Promise<NewAcmeOrder>;
1498
1333
  /**
1499
- * Registers a CRL for the use in E2EI processing.
1500
- *
1501
- * Please note that a Root Trust Anchor CA is needed to validate CRLs;
1502
- * You **need** to have a Root CA registered before calling this
1503
- *
1504
- * @param crlDP - CRL Distribution Point; Basically the URL you fetched it from
1505
- * @param crlDER - DER representation of the CRL
1334
+ * Creates a new authorization request.
1506
1335
  *
1507
- * @returns a {@link CRLRegistration} with the dirty state of the new CRL (see struct) and its expiration timestamp
1336
+ * @param url one of the URL in new order's authorizations from {@link newOrderResponse})
1337
+ * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/new-order` (or from the
1338
+ * previous to this method if you are creating the second authorization)
1339
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
1508
1340
  */
1509
- e2eiRegisterCRL(crlDP: string, crlDER: Uint8Array): Promise<CRLRegistration>;
1341
+ newAuthzRequest(url: string, previousNonce: string): Promise<JsonRawData>;
1510
1342
  /**
1511
- * Creates an update commit which replaces your leaf containing basic credentials with a leaf node containing x509 credentials in the conversation.
1512
- *
1513
- * NOTE: you can only call this after you've completed the enrollment for an end-to-end identity, calling this without
1514
- * a valid end-to-end identity will result in an error.
1343
+ * Parses the response from `POST /acme/{provisioner-name}/authz/{authz-id}`
1515
1344
  *
1516
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1517
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1518
- * epoch, use new encryption secrets etc...
1345
+ * @param authz HTTP response body
1346
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
1347
+ */
1348
+ newAuthzResponse(authz: JsonRawData): Promise<NewAcmeAuthz>;
1349
+ /**
1350
+ * Generates a new client Dpop JWT token. It demonstrates proof of possession of the nonces
1351
+ * (from wire-server & acme server) and will be verified by the acme server when verifying the
1352
+ * challenge (in order to deliver a certificate).
1519
1353
  *
1520
- * @param conversationId - The ID of the conversation
1354
+ * Then send it to `POST /clients/{id}/access-token`
1355
+ * {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token} on wire-server.
1521
1356
  *
1522
- * @returns A {@link CommitBundle}
1357
+ * @param expirySecs of the client Dpop JWT. This should be equal to the grace period set in Team Management
1358
+ * @param backendNonce you get by calling `GET /clients/token/nonce` on wire-server as defined here {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_clients__client__nonce}
1523
1359
  */
1524
- e2eiRotate(conversationId: ConversationId): Promise<CommitBundle>;
1360
+ createDpopToken(expirySecs: number, backendNonce: string): Promise<Uint8Array>;
1525
1361
  /**
1526
- * Creates a commit in all local conversations for changing the credential. Requires first
1527
- * having enrolled a new X509 certificate with either {@link CoreCryptoContext.e2eiNewActivationEnrollment}
1528
- * or {@link CoreCryptoContext.e2eiNewRotateEnrollment}
1362
+ * Creates a new challenge request for Wire Dpop challenge.
1529
1363
  *
1530
- * @param enrollment - the enrollment instance used to fetch the certificates
1531
- * @param certificateChain - the raw response from ACME server
1532
- * @param newKeyPackageCount - number of KeyPackages with new identity to generate
1533
- * @returns a {@link RotateBundle} with commits to fan-out to other group members, KeyPackages to upload and old ones to delete
1364
+ * @param accessToken returned by wire-server from https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token
1365
+ * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
1366
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1534
1367
  */
1535
- e2eiRotateAll(enrollment: E2eiEnrollment, certificateChain: string, newKeyPackageCount: number): Promise<RotateBundle>;
1368
+ newDpopChallengeRequest(accessToken: string, previousNonce: string): Promise<JsonRawData>;
1536
1369
  /**
1537
- * Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
1538
- * it later with {@link e2eiEnrollmentStashPop}
1370
+ * Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}` for the DPoP challenge.
1539
1371
  *
1540
- * @param enrollment the enrollment instance to persist
1541
- * @returns a handle to fetch the enrollment later with {@link e2eiEnrollmentStashPop}
1372
+ * @param challenge HTTP response body
1373
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1542
1374
  */
1543
- e2eiEnrollmentStash(enrollment: E2eiEnrollment): Promise<Uint8Array>;
1375
+ newDpopChallengeResponse(challenge: JsonRawData): Promise<void>;
1544
1376
  /**
1545
- * Fetches the persisted enrollment and deletes it from the keystore
1377
+ * Creates a new challenge request for Wire Oidc challenge.
1546
1378
  *
1547
- * @param handle returned by {@link e2eiEnrollmentStash}
1548
- * @returns the persisted enrollment instance
1379
+ * @param idToken you get back from Identity Provider
1380
+ * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
1381
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1549
1382
  */
1550
- e2eiEnrollmentStashPop(handle: Uint8Array): Promise<E2eiEnrollment>;
1383
+ newOidcChallengeRequest(idToken: string, previousNonce: string): Promise<JsonRawData>;
1551
1384
  /**
1552
- * Indicates when to mark a conversation as not verified i.e. when not all its members have a X509.
1553
- * Credential generated by Wire's end-to-end identity enrollment
1385
+ * Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}` for the OIDC challenge.
1554
1386
  *
1555
- * @param conversationId The group's ID
1556
- * @returns the conversation state given current members
1387
+ * @param challenge HTTP response body
1388
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1557
1389
  */
1558
- e2eiConversationState(conversationId: ConversationId): Promise<E2eiConversationState>;
1390
+ newOidcChallengeResponse(challenge: JsonRawData): Promise<void>;
1559
1391
  /**
1560
- * Returns true when end-to-end-identity is enabled for the given Ciphersuite
1392
+ * Verifies that the previous challenge has been completed.
1561
1393
  *
1562
- * @param ciphersuite of the credential to check
1563
- * @returns true if end-to-end identity is enabled for the given ciphersuite
1394
+ * @param orderUrl `location` header from http response you got from {@link newOrderResponse}
1395
+ * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/challenge/{challenge-id}`
1396
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1564
1397
  */
1565
- e2eiIsEnabled(ciphersuite: Ciphersuite$1): Promise<boolean>;
1398
+ checkOrderRequest(orderUrl: string, previousNonce: string): Promise<JsonRawData>;
1566
1399
  /**
1567
- * From a given conversation, get the identity of the members supplied. Identity is only present for members with a
1568
- * Certificate Credential (after turning on end-to-end identity).
1400
+ * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}`.
1569
1401
  *
1570
- * @param conversationId - identifier of the conversation
1571
- * @param deviceIds - identifiers of the devices
1572
- * @returns identities or if no member has a x509 certificate, it will return an empty List
1402
+ * @param order HTTP response body
1403
+ * @return finalize url to use with {@link finalizeRequest}
1404
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1573
1405
  */
1574
- getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity$1[]>;
1406
+ checkOrderResponse(order: JsonRawData): Promise<string>;
1575
1407
  /**
1576
- * From a given conversation, get the identity of the users (device holders) supplied.
1577
- * Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity).
1578
- * If no member has a x509 certificate, it will return an empty Vec.
1408
+ * Final step before fetching the certificate.
1579
1409
  *
1580
- * @param conversationId - identifier of the conversation
1581
- * @param userIds - user identifiers hyphenated UUIDv4 e.g. 'bd4c7053-1c5a-4020-9559-cd7bf7961954'
1582
- * @returns a Map with all the identities for a given users. Consumers are then recommended to reduce those identities to determine the actual status of a user.
1410
+ * @param previousNonce - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
1411
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1583
1412
  */
1584
- getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity$1[]>>;
1413
+ finalizeRequest(previousNonce: string): Promise<JsonRawData>;
1585
1414
  /**
1586
- * Gets the e2ei conversation state from a `GroupInfo`. Useful to check if the group has e2ei
1587
- * turned on or not before joining it.
1415
+ * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}/finalize`.
1588
1416
  *
1589
- * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1590
- * @param credentialType - kind of Credential to check usage of. Defaults to X509 for now as no other value will give any result.
1591
- * @returns see {@link E2eiConversationState}
1592
- */
1593
- getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType$1): Promise<E2eiConversationState>;
1594
- }
1595
- export interface CoreCryptoRichError {
1596
- message: string;
1597
- error_name?: string;
1598
- error_stack?: string[];
1599
- proteus_error_code?: number;
1600
- }
1601
- /**
1602
- * Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
1603
- *
1604
- * Whenever you're supposed to get this class (that extends `Error`) you might end up with a base `Error`
1605
- * in case the parsing of the message structure fails. This is unlikely but the case is still covered and fall backs automatically.
1606
- * More information will be found in the base `Error.cause` to inform you why the parsing has failed.
1607
- *
1608
- * Please note that in this case the extra properties will not be available.
1609
- */
1610
- export declare class CoreCryptoError extends Error {
1611
- errorStack: string[];
1612
- proteusErrorCode: number | null;
1613
- private constructor();
1614
- private static fallback;
1615
- static build(msg: string, ...params: unknown[]): CoreCryptoError | Error;
1616
- static fromStdError(e: Error): CoreCryptoError | Error;
1617
- static asyncMapErr<T>(p: Promise<T>): Promise<T>;
1618
- }
1619
- /**
1620
- * see [core_crypto::prelude::CiphersuiteName]
1621
- */
1622
- declare enum Ciphersuite$1 {
1623
- /**
1624
- * DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
1625
- */
1626
- MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1,
1627
- /**
1628
- * DH KEM P256 | AES-GCM 128 | SHA2-256 | EcDSA P256
1629
- */
1630
- MLS_128_DHKEMP256_AES128GCM_SHA256_P256 = 2,
1631
- /**
1632
- * DH KEM x25519 | Chacha20Poly1305 | SHA2-256 | Ed25519
1633
- */
1634
- MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519 = 3,
1635
- /**
1636
- * DH KEM x448 | AES-GCM 256 | SHA2-512 | Ed448
1637
- */
1638
- MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448 = 4,
1639
- /**
1640
- * DH KEM P521 | AES-GCM 256 | SHA2-512 | EcDSA P521
1641
- */
1642
- MLS_256_DHKEMP521_AES256GCM_SHA512_P521 = 5,
1643
- /**
1644
- * DH KEM x448 | Chacha20Poly1305 | SHA2-512 | Ed448
1645
- */
1646
- MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448 = 6,
1647
- /**
1648
- * DH KEM P384 | AES-GCM 256 | SHA2-384 | EcDSA P384
1649
- */
1650
- MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
1651
- }
1652
- declare enum CredentialType$1 {
1653
- /**
1654
- * Just a KeyPair
1655
- */
1656
- Basic = 1,
1657
- /**
1658
- * A certificate obtained through e2e identity enrollment process
1659
- */
1660
- X509 = 2
1661
- }
1662
- /**
1663
- * Configuration object for new conversations
1664
- */
1665
- interface ConversationConfiguration$1 {
1666
- /**
1667
- * Conversation ciphersuite
1668
- */
1669
- ciphersuite?: Ciphersuite$1;
1670
- /**
1671
- * List of client IDs that are allowed to be external senders of commits
1417
+ * @param finalize HTTP response body
1418
+ * @return the certificate url to use with {@link certificateRequest}
1419
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1672
1420
  */
1673
- externalSenders?: Uint8Array[];
1421
+ finalizeResponse(finalize: JsonRawData): Promise<string>;
1674
1422
  /**
1675
- * Implementation specific configuration
1423
+ * Creates a request for finally fetching the x509 certificate.
1424
+ *
1425
+ * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}/finalize`
1426
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4.2
1676
1427
  */
1677
- custom?: CustomConfiguration$1;
1428
+ certificateRequest(previousNonce: string): Promise<JsonRawData>;
1678
1429
  }
1679
1430
  /**
1680
- * see [core_crypto::prelude::MlsWirePolicy]
1431
+ * Indicates the state of a Conversation regarding end-to-end identity.
1432
+ * Note: this does not check pending state (pending commit, pending proposals) so it does not
1433
+ * consider members about to be added/removed
1681
1434
  */
1682
- declare enum WirePolicy$1 {
1683
- /**
1684
- * Handshake messages are never encrypted
1685
- */
1686
- Plaintext = 1,
1435
+ export declare enum E2eiConversationState {
1687
1436
  /**
1688
- * Handshake messages are always encrypted
1437
+ * All clients have a valid E2EI certificate
1689
1438
  */
1690
- Ciphertext = 2
1691
- }
1692
- /**
1693
- * Implementation specific configuration object for a conversation
1694
- */
1695
- interface CustomConfiguration$1 {
1439
+ Verified = 1,
1696
1440
  /**
1697
- * Duration in seconds after which we will automatically force a self_update commit
1698
- * Note: This isn't currently implemented
1441
+ * Some clients are either still Basic or their certificate is expired
1699
1442
  */
1700
- keyRotationSpan?: number;
1443
+ NotVerified = 2,
1701
1444
  /**
1702
- * Defines if handshake messages are encrypted or not
1703
- * Note: Ciphertext is not currently supported by wire-server
1445
+ * All clients are still Basic. If all client have expired certificates, NotVerified is returned.
1704
1446
  */
1705
- wirePolicy?: WirePolicy$1;
1447
+ NotEnabled = 3
1706
1448
  }
1707
- /**
1708
- * Alias for conversation IDs.
1709
- * This is a freeform, uninspected buffer.
1710
- */
1711
- export type ConversationId = Uint8Array;
1712
- /**
1713
- * Alias for client identifier.
1714
- * This is a freeform, uninspected buffer.
1715
- */
1716
- export type ClientId = Uint8Array;
1717
- /**
1718
- * Alias for proposal reference. It is a byte array of size 16.
1719
- */
1720
- export type ProposalRef = Uint8Array;
1721
1449
  /**
1722
1450
  * Data shape for proteusNewPrekeyAuto() call returns.
1723
1451
  */
@@ -1735,547 +1463,624 @@ export interface ProteusAutoPrekeyBundle {
1735
1463
  */
1736
1464
  pkb: Uint8Array;
1737
1465
  }
1738
- /**
1739
- * Data shape for the returned MLS commit & welcome message tuple upon adding clients to a conversation
1740
- */
1741
- export interface MemberAddedMessages {
1466
+ declare class CoreCryptoContext$1 {
1467
+ #private;
1468
+ /** @hidden */
1469
+ private constructor();
1470
+ /** @hidden */
1471
+ static fromFfiContext(ctx: CoreCryptoContext): CoreCryptoContext$1;
1742
1472
  /**
1743
- * TLS-serialized MLS Commit that needs to be fanned out to other (existing) members of the conversation
1744
- *
1745
- * @readonly
1473
+ * Set arbitrary data to be retrieved by {@link getData}.
1474
+ * This is meant to be used as a check point at the end of a transaction.
1475
+ * The data should be limited to a reasonable size.
1746
1476
  */
1747
- commit: Uint8Array;
1477
+ setData(data: Uint8Array): Promise<void>;
1748
1478
  /**
1749
- * TLS-serialized MLS Welcome message that needs to be fanned out to the clients newly added to the conversation
1750
- *
1751
- * @readonly
1479
+ * Get data if it has previously been set by {@link setData}, or `undefined` otherwise.
1480
+ * This is meant to be used as a check point at the end of a transaction.
1752
1481
  */
1753
- welcome: Uint8Array;
1482
+ getData(): Promise<Uint8Array | undefined>;
1754
1483
  /**
1755
- * MLS GroupInfo which is required for joining a group by external commit
1484
+ * Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
1756
1485
  *
1757
- * @readonly
1486
+ * @param clientId - {@link CoreCryptoParams#clientId} but required
1487
+ * @param ciphersuites - All the ciphersuites supported by this MLS client
1488
+ * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
1758
1489
  */
1759
- groupInfo: GroupInfoBundle;
1490
+ mlsInit(clientId: ClientId, ciphersuites: Ciphersuite$1[], nbKeyPackage?: number): Promise<void>;
1760
1491
  /**
1761
- * New CRL distribution points that appeared by the introduction of a new credential
1492
+ * Generates a MLS KeyPair/CredentialBundle with a temporary, random client ID.
1493
+ * This method is designed to be used in conjunction with {@link CoreCryptoContext.mlsInitWithClientId} and represents the first step in this process
1494
+ *
1495
+ * @param ciphersuites - All the ciphersuites supported by this MLS client
1496
+ * @returns This returns the TLS-serialized identity key (i.e. the signature keypair's public key)
1762
1497
  */
1763
- crlNewDistributionPoints?: string[];
1764
- }
1765
- /**
1766
- * Data shape for a MLS generic commit + optional bundle (aka stapled commit & welcome)
1767
- */
1768
- export interface CommitBundle {
1498
+ mlsGenerateKeypair(ciphersuites: Ciphersuite$1[]): Promise<Uint8Array[]>;
1769
1499
  /**
1770
- * TLS-serialized MLS Commit that needs to be fanned out to other (existing) members of the conversation
1500
+ * Updates the current temporary Client ID with the newly provided one. This is the second step in the externally-generated clients process
1771
1501
  *
1772
- * @readonly
1502
+ * Important: This is designed to be called after {@link CoreCryptoContext.mlsGenerateKeypair}
1503
+ *
1504
+ * @param clientId - The newly-allocated client ID by the MLS Authentication Service
1505
+ * @param signaturePublicKeys - The public key you were given at the first step; This is for authentication purposes
1506
+ * @param ciphersuites - All the ciphersuites supported by this MLS client
1773
1507
  */
1774
- commit: Uint8Array;
1508
+ mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite$1[]): Promise<void>;
1775
1509
  /**
1776
- * Optional TLS-serialized MLS Welcome message that needs to be fanned out to the clients newly added to the conversation
1510
+ * Checks if the Client is member of a given conversation and if the MLS Group is loaded up
1777
1511
  *
1778
- * @readonly
1512
+ * @returns Whether the given conversation ID exists
1513
+ *
1514
+ * @example
1515
+ * ```ts
1516
+ * const cc = await CoreCrypto.init({ databaseName: "test", key: "test", clientId: "test" });
1517
+ * const encoder = new TextEncoder();
1518
+ * if (await cc.conversationExists(encoder.encode("my super chat"))) {
1519
+ * // Do something
1520
+ * } else {
1521
+ * // Do something else
1522
+ * }
1523
+ * ```
1779
1524
  */
1780
- welcome?: Uint8Array;
1525
+ conversationExists(conversationId: ConversationId): Promise<boolean>;
1781
1526
  /**
1782
- * MLS GroupInfo which is required for joining a group by external commit
1527
+ * Marks a conversation as child of another one
1528
+ * This will mostly affect the behavior of the callbacks (the parentConversationClients parameter will be filled)
1783
1529
  *
1784
- * @readonly
1530
+ * @param childId - conversation identifier of the child conversation
1531
+ * @param parentId - conversation identifier of the parent conversation
1785
1532
  */
1786
- groupInfo: GroupInfoBundle;
1787
- }
1788
- /**
1789
- * Wraps a GroupInfo in order to efficiently upload it to the Delivery Service.
1790
- * This is not part of MLS protocol but parts might be standardized at some point.
1791
- */
1792
- export interface GroupInfoBundle {
1533
+ markConversationAsChildOf(childId: ConversationId, parentId: ConversationId): Promise<void>;
1793
1534
  /**
1794
- * see {@link GroupInfoEncryptionType}
1535
+ * Returns the current epoch of a conversation
1536
+ *
1537
+ * @returns the epoch of the conversation
1538
+ *
1539
+ * @example
1540
+ * ```ts
1541
+ * const cc = await CoreCrypto.init({ databaseName: "test", key: "test", clientId: "test" });
1542
+ * const encoder = new TextEncoder();
1543
+ * console.log(await cc.conversationEpoch(encoder.encode("my super chat")))
1544
+ * ```
1795
1545
  */
1796
- encryptionType: GroupInfoEncryptionType;
1546
+ conversationEpoch(conversationId: ConversationId): Promise<number>;
1797
1547
  /**
1798
- * see {@link RatchetTreeType}
1799
- */
1800
- ratchetTreeType: RatchetTreeType;
1801
- /**
1802
- * TLS-serialized GroupInfo
1803
- */
1804
- payload: Uint8Array;
1805
- }
1806
- /**
1807
- * Informs whether the GroupInfo is confidential
1808
- * see [core_crypto::mls::conversation::group_info::GroupInfoEncryptionType]
1809
- */
1810
- export declare enum GroupInfoEncryptionType {
1811
- /**
1812
- * Unencrypted
1813
- */
1814
- Plaintext = 1,
1815
- /**
1816
- * Encrypted in a JWE (not yet implemented)
1817
- */
1818
- JweEncrypted = 2
1819
- }
1820
- /**
1821
- * Represents different ways of carrying the Ratchet Tree with some optimizations to save some space
1822
- * see [core_crypto::mls::conversation::group_info::RatchetTreeType]
1823
- */
1824
- export declare enum RatchetTreeType {
1825
- /**
1826
- * Complete GroupInfo
1827
- */
1828
- Full = 1,
1829
- /**
1830
- * Contains the difference since previous epoch (not yet implemented)
1831
- */
1832
- Delta = 2,
1833
- /**
1834
- * To define (not yet implemented)
1835
- */
1836
- ByRef = 3
1837
- }
1838
- /**
1839
- * Result returned after rotating the Credential of the current client in all the local conversations
1840
- */
1841
- export interface RotateBundle {
1842
- /**
1843
- * An Update commit for each conversation
1548
+ * Returns the ciphersuite of a conversation
1844
1549
  *
1845
- * @readonly
1550
+ * @returns the ciphersuite of the conversation
1846
1551
  */
1847
- commits: Map<string, CommitBundle>;
1552
+ conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite$1>;
1848
1553
  /**
1849
- * Fresh KeyPackages with the new Credential
1554
+ * Wipes and destroys the local storage of a given conversation / MLS group
1850
1555
  *
1851
- * @readonly
1556
+ * @param conversationId - The ID of the conversation to remove
1852
1557
  */
1853
- newKeyPackages: Uint8Array[];
1558
+ wipeConversation(conversationId: ConversationId): Promise<void>;
1854
1559
  /**
1855
- * All the now deprecated KeyPackages. Once deleted remotely, delete them locally with {@link CoreCrypto.deleteKeyPackages}
1560
+ * Creates a new conversation with the current client being the sole member
1561
+ * You will want to use {@link addClientsToConversation} afterwards to add clients to this conversation
1856
1562
  *
1857
- * @readonly
1858
- */
1859
- keyPackageRefsToRemove: Uint8Array[];
1860
- /**
1861
- * New CRL distribution points that appeared by the introduction of a new credential
1862
- */
1863
- crlNewDistributionPoints?: string[];
1864
- }
1865
- /**
1866
- * Params for CoreCrypto deferred initialization
1867
- * Please note that the `entropySeed` parameter MUST be exactly 32 bytes
1868
- */
1869
- export interface CoreCryptoDeferredParams {
1870
- /**
1871
- * Name of the IndexedDB database
1872
- */
1873
- databaseName: string;
1874
- /**
1875
- * Encryption master key
1876
- * This should be appropriately stored in a secure location (i.e. WebCrypto private key storage)
1877
- */
1878
- key: string;
1879
- /**
1880
- * External PRNG entropy pool seed.
1881
- * This **must** be exactly 32 bytes
1882
- */
1883
- entropySeed?: Uint8Array;
1884
- /**
1885
- * .wasm file path, this will be useful in case your bundling system likes to relocate files (i.e. what webpack does)
1886
- */
1887
- wasmFilePath?: string;
1888
- }
1889
- /**
1890
- * Params for CoreCrypto initialization
1891
- * Please note that the `entropySeed` parameter MUST be exactly 32 bytes
1892
- */
1893
- export interface CoreCryptoParams extends CoreCryptoDeferredParams {
1894
- /**
1895
- * MLS Client ID.
1896
- * This should stay consistent as it will be verified against the stored signature & identity to validate the persisted credential
1897
- */
1898
- clientId: ClientId;
1899
- /**
1900
- * All the ciphersuites this MLS client can support
1901
- */
1902
- ciphersuites: Ciphersuite$1[];
1903
- /**
1904
- * Number of initial KeyPackage to create when initializing the client
1563
+ * @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
1564
+ * @param creatorCredentialType - kind of credential the creator wants to create the group with
1565
+ * @param configuration - configuration of the MLS group
1566
+ * @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
1567
+ * @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
1568
+ * @param configuration.custom - {@link CustomConfiguration}
1905
1569
  */
1906
- nbKeyPackage?: number;
1907
- }
1908
- export interface ConversationInitBundle {
1570
+ createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType$1, configuration?: Partial<ConversationConfiguration>): Promise<any>;
1909
1571
  /**
1910
- * Conversation ID of the conversation created
1572
+ * Decrypts a message for a given conversation.
1911
1573
  *
1912
- * @readonly
1574
+ * Note: you should catch & ignore the following error reasons:
1575
+ * * "We already decrypted this message once"
1576
+ * * "You tried to join with an external commit but did not merge it yet. We will reapply this message for you when you merge your external commit"
1577
+ * * "Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives"
1578
+ *
1579
+ * @param conversationId - The ID of the conversation
1580
+ * @param payload - The encrypted message buffer
1581
+ *
1582
+ * @returns a {@link DecryptedMessage}. Note that {@link DecryptedMessage#message} is `undefined` when the encrypted payload contains a system message such a proposal or commit
1913
1583
  */
1914
- conversationId: ConversationId;
1584
+ decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
1915
1585
  /**
1916
- * TLS-serialized MLS External Commit that needs to be fanned out
1586
+ * Encrypts a message for a given conversation
1917
1587
  *
1918
- * @readonly
1588
+ * @param conversationId - The ID of the conversation
1589
+ * @param message - The plaintext message to encrypt
1590
+ *
1591
+ * @returns The encrypted payload for the given group. This needs to be fanned out to the other members of the group.
1919
1592
  */
1920
- commit: Uint8Array;
1593
+ encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
1921
1594
  /**
1922
- * MLS Public Group State (aka Group Info) which becomes valid when the external commit is accepted by the Delivery Service
1923
- * with {@link CoreCrypto.mergePendingGroupFromExternalCommit}
1595
+ * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
1924
1596
  *
1925
- * @readonly
1597
+ * You have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
1598
+ * it references has already been deleted locally. Join this group with an external commit", ignore it and then
1599
+ * join this group via {@link CoreCryptoContext.joinByExternalCommit}.
1600
+ *
1601
+ * @param welcomeMessage - TLS-serialized MLS Welcome message
1602
+ * @param configuration - configuration of the MLS group
1603
+ * @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
1926
1604
  */
1927
- groupInfo: GroupInfoBundle;
1605
+ processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: Partial<CustomConfiguration>): Promise<WelcomeBundle>;
1928
1606
  /**
1929
- * New CRL distribution points that appeared by the introduction of a new credential
1607
+ * Get the client's public signature key. To upload to the DS for further backend side validation
1608
+ *
1609
+ * @param ciphersuite - of the signature key to get
1610
+ * @param credentialType - of the public key to look for
1611
+ * @returns the client's public signature key
1930
1612
  */
1931
- crlNewDistributionPoints?: string[];
1932
- }
1933
- /**
1934
- * Supporting struct for CRL registration result
1935
- */
1936
- export interface CRLRegistration {
1613
+ clientPublicKey(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<Uint8Array>;
1937
1614
  /**
1938
- * Whether this CRL modifies the old CRL (i.e. has a different revocated cert list)
1939
1615
  *
1940
- * @readonly
1616
+ * @param ciphersuite - of the KeyPackages to count
1617
+ * @param credentialType - of the KeyPackages to count
1618
+ * @returns The amount of valid, non-expired KeyPackages that are persisted in the backing storage
1941
1619
  */
1942
- dirty: boolean;
1620
+ clientValidKeypackagesCount(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<number>;
1943
1621
  /**
1944
- * Optional expiration timestamp
1622
+ * Fetches a requested amount of keypackages
1945
1623
  *
1946
- * @readonly
1624
+ * @param ciphersuite - of the KeyPackages to generate
1625
+ * @param credentialType - of the KeyPackages to generate
1626
+ * @param amountRequested - The amount of keypackages requested
1627
+ * @returns An array of length `amountRequested` containing TLS-serialized KeyPackages
1947
1628
  */
1948
- expiration?: number;
1949
- }
1950
- /**
1951
- * This is a wrapper for all the possible outcomes you can get after decrypting a message
1952
- */
1953
- export interface DecryptedMessage {
1629
+ clientKeypackages(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1, amountRequested: number): Promise<Array<Uint8Array>>;
1954
1630
  /**
1955
- * Raw decrypted application message, if the decrypted MLS message is an application message
1631
+ * Prunes local KeyPackages after making sure they also have been deleted on the backend side
1632
+ * You should only use this after calling {@link CoreCryptoContext.e2eiRotate} on all conversations.
1633
+ *
1634
+ * @param refs - KeyPackage references to delete obtained from a {RotateBundle}
1956
1635
  */
1957
- message?: Uint8Array;
1636
+ deleteKeypackages(refs: Uint8Array[]): Promise<void>;
1958
1637
  /**
1959
- * Only when decrypted message is a commit, CoreCrypto will renew local proposal which could not make it in the commit.
1960
- * This will contain either:
1961
- * * local pending proposal not in the accepted commit
1962
- * * If there is a pending commit, its proposals which are not in the accepted commit
1638
+ * Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
1639
+ *
1640
+ * Sends the corresponding commit via {@link MlsTransport.sendCommitBundle} and merges it if the call is successful.
1641
+ *
1642
+ * @param conversationId - The ID of the conversation
1643
+ * @param keyPackages - KeyPackages of the new clients to add
1644
+ *
1645
+ * @returns Potentially a list of newly discovered crl distribution points
1963
1646
  */
1964
- proposals: ProposalBundle[];
1647
+ addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<NewCrlDistributionPoints>;
1965
1648
  /**
1966
- * It is set to false if ingesting this MLS message has resulted in the client being removed from the group (i.e. a Remove commit)
1649
+ * Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
1650
+ * to do so, otherwise this operation does nothing.
1651
+ *
1652
+ * @param conversationId - The ID of the conversation
1653
+ * @param clientIds - Array of Client IDs to remove.
1967
1654
  */
1968
- isActive: boolean;
1655
+ removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId[]): Promise<void>;
1969
1656
  /**
1970
- * Commit delay hint (in milliseconds) to prevent clients from hammering the server with epoch changes
1657
+ * Update the keying material of the conversation.
1658
+ *
1659
+ * @param conversationId - The ID of the conversation
1971
1660
  */
1972
- commitDelay?: number;
1661
+ updateKeyingMaterial(conversationId: ConversationId): Promise<void>;
1973
1662
  /**
1974
- * Client identifier of the sender of the message being decrypted. Only present for application messages.
1663
+ * Commits the local pending proposals.
1664
+ *
1665
+ * Sends the corresponding commit via {@link MlsTransport.sendCommitBundle}
1666
+ * and merges it if the call is successful.
1667
+ *
1668
+ * @param conversationId - The ID of the conversation
1975
1669
  */
1976
- senderClientId?: ClientId;
1670
+ commitPendingProposals(conversationId: ConversationId): Promise<void>;
1977
1671
  /**
1978
- * true when the decrypted message resulted in an epoch change i.e. it was a commit
1672
+ * "Apply" to join a group through its GroupInfo.
1673
+ *
1674
+ * Sends the corresponding commit via {@link MlsTransport.sendCommitBundle}
1675
+ * and creates the group if the call is successful.
1676
+ *
1677
+ * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1678
+ * @param credentialType - kind of Credential to use for joining this group. If {@link CredentialType.Basic} is
1679
+ * chosen and no Credential has been created yet for it, a new one will be generated.
1680
+ * @param configuration - configuration of the MLS group
1681
+ * When {@link CredentialType.X509} is chosen, it fails when no Credential has been created for the given {@link Ciphersuite}.
1682
+ *
1683
+ * @return see {@link WelcomeBundle}
1979
1684
  */
1980
- hasEpochChanged: boolean;
1685
+ joinByExternalCommit(groupInfo: Uint8Array, credentialType: CredentialType$1, configuration?: Partial<CustomConfiguration>): Promise<WelcomeBundle>;
1981
1686
  /**
1982
- * Identity claims present in the sender credential
1983
- * Only present when the credential is a x509 certificate
1984
- * Present for all messages
1687
+ * Derives a new key from the group
1688
+ *
1689
+ * @param conversationId - The group's ID
1690
+ * @param keyLength - the length of the key to be derived. If the value is higher than the
1691
+ * bounds of `u16` or the context hash * 255, an error will be returned
1692
+ *
1693
+ * @returns A `Uint8Array` representing the derived key
1985
1694
  */
1986
- identity?: WireIdentity$1;
1695
+ exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<Uint8Array>;
1987
1696
  /**
1988
- * Only set when the decrypted message is a commit.
1989
- * Contains buffered messages for next epoch which were received before the commit creating the epoch
1990
- * because the DS did not fan them out in order.
1697
+ * Returns the raw public key of the single external sender present in this group.
1698
+ * This should be used to initialize a subconversation
1699
+ *
1700
+ * @param conversationId - The group's ID
1701
+ *
1702
+ * @returns A `Uint8Array` representing the external sender raw public key
1991
1703
  */
1992
- bufferedMessages?: BufferedDecryptedMessage[];
1704
+ getExternalSender(conversationId: ConversationId): Promise<Uint8Array>;
1993
1705
  /**
1994
- * New CRL distribution points that appeared by the introduction of a new credential
1706
+ * Returns all clients from group's members
1707
+ *
1708
+ * @param conversationId - The group's ID
1709
+ *
1710
+ * @returns A list of clients from the members of the group
1995
1711
  */
1996
- crlNewDistributionPoints?: string[];
1997
- }
1998
- /**
1999
- * Almost same as {@link DecryptedMessage} but avoids recursion
2000
- */
2001
- export interface BufferedDecryptedMessage {
1712
+ getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
2002
1713
  /**
2003
- * see {@link DecryptedMessage.message}
1714
+ * Allows {@link CoreCryptoContext} to act as a CSPRNG provider
1715
+ *
1716
+ * The underlying CSPRNG algorithm is ChaCha20 and takes in account the external seed provider.
1717
+ *
1718
+ * @param length - The number of bytes to be returned in the `Uint8Array`
1719
+ *
1720
+ * @returns A `Uint8Array` buffer that contains `length` cryptographically-secure random bytes
2004
1721
  */
2005
- message?: Uint8Array;
1722
+ randomBytes(length: number): Promise<Uint8Array>;
2006
1723
  /**
2007
- * see {@link DecryptedMessage.proposals}
1724
+ * Initializes the proteus client
2008
1725
  */
2009
- proposals: ProposalBundle[];
1726
+ proteusInit(): Promise<void>;
2010
1727
  /**
2011
- * see {@link DecryptedMessage.isActive}
1728
+ * Create a Proteus session using a prekey
1729
+ *
1730
+ * @param sessionId - ID of the Proteus session
1731
+ * @param prekey - CBOR-encoded Proteus prekey of the other client
2012
1732
  */
2013
- isActive: boolean;
1733
+ proteusSessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<void>;
2014
1734
  /**
2015
- * see {@link DecryptedMessage.commitDelay}
1735
+ * Create a Proteus session from a handshake message
1736
+ *
1737
+ * @param sessionId - ID of the Proteus session
1738
+ * @param envelope - CBOR-encoded Proteus message
1739
+ *
1740
+ * @returns A `Uint8Array` containing the message that was sent along with the session handshake
2016
1741
  */
2017
- commitDelay?: number;
1742
+ proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<Uint8Array>;
2018
1743
  /**
2019
- * see {@link DecryptedMessage.senderClientId}
1744
+ * Locally persists a session to the keystore
1745
+ *
1746
+ * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
1747
+ *
1748
+ * @param sessionId - ID of the Proteus session
2020
1749
  */
2021
- senderClientId?: ClientId;
1750
+ proteusSessionSave(sessionId: string): Promise<void>;
2022
1751
  /**
2023
- * see {@link DecryptedMessage.hasEpochChanged}
1752
+ * Deletes a session
1753
+ * Note: this also deletes the persisted data within the keystore
1754
+ *
1755
+ * @param sessionId - ID of the Proteus session
2024
1756
  */
2025
- hasEpochChanged: boolean;
1757
+ proteusSessionDelete(sessionId: string): Promise<void>;
2026
1758
  /**
2027
- * see {@link DecryptedMessage.identity}
1759
+ * Checks if a session exists
1760
+ *
1761
+ * @param sessionId - ID of the Proteus session
1762
+ *
1763
+ * @returns whether the session exists or not
2028
1764
  */
2029
- identity?: WireIdentity$1;
1765
+ proteusSessionExists(sessionId: string): Promise<boolean>;
2030
1766
  /**
2031
- * see {@link DecryptedMessage.crlNewDistributionPoints}
1767
+ * Decrypt an incoming message for an existing Proteus session
1768
+ *
1769
+ * @param sessionId - ID of the Proteus session
1770
+ * @param ciphertext - CBOR encoded, encrypted proteus message
1771
+ * @returns The decrypted payload contained within the message
2032
1772
  */
2033
- crlNewDistributionPoints?: string[];
2034
- }
2035
- /**
2036
- * Represents the identity claims identifying a client
2037
- * Those claims are verifiable by any member in the group
2038
- */
2039
- interface WireIdentity$1 {
1773
+ proteusDecrypt(sessionId: string, ciphertext: Uint8Array): Promise<Uint8Array>;
2040
1774
  /**
2041
- * Unique client identifier
1775
+ * Encrypt a message for a given Proteus session
1776
+ *
1777
+ * @param sessionId - ID of the Proteus session
1778
+ * @param plaintext - payload to encrypt
1779
+ * @returns The CBOR-serialized encrypted message
2042
1780
  */
2043
- clientId: string;
1781
+ proteusEncrypt(sessionId: string, plaintext: Uint8Array): Promise<Uint8Array>;
2044
1782
  /**
2045
- * Status of the Credential at the moment T when this object is created
1783
+ * Batch encryption for proteus messages
1784
+ * This is used to minimize FFI roundtrips when used in the context of a multi-client session (i.e. conversation)
1785
+ *
1786
+ * @param sessions - List of Proteus session IDs to encrypt the message for
1787
+ * @param plaintext - payload to encrypt
1788
+ * @returns A map indexed by each session ID and the corresponding CBOR-serialized encrypted message for this session
2046
1789
  */
2047
- status: DeviceStatus;
1790
+ proteusEncryptBatched(sessions: string[], plaintext: Uint8Array): Promise<Map<string, Uint8Array>>;
2048
1791
  /**
2049
- * MLS thumbprint
1792
+ * Creates a new prekey with the requested ID.
1793
+ *
1794
+ * @param prekeyId - ID of the PreKey to generate. This cannot be bigger than a u16
1795
+ * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
2050
1796
  */
2051
- thumbprint: string;
1797
+ proteusNewPrekey(prekeyId: number): Promise<Uint8Array>;
2052
1798
  /**
2053
- * Indicates whether the credential is Basic or X509
1799
+ * Creates a new prekey with an automatically generated ID..
1800
+ *
1801
+ * @returns A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey accompanied by its ID
2054
1802
  */
2055
- credentialType: CredentialType$1;
1803
+ proteusNewPrekeyAuto(): Promise<ProteusAutoPrekeyBundle>;
2056
1804
  /**
2057
- * In case {@link credentialType} is {@link CredentialType.X509} this is populated
1805
+ * Proteus last resort prekey stuff
1806
+ *
1807
+ * @returns A CBOR-serialize version of the PreKeyBundle associated with the last resort PreKey (holding the last resort prekey id)
2058
1808
  */
2059
- x509Identity?: X509Identity$1;
2060
- }
2061
- /**
2062
- * Represents the parts of {@link WireIdentity} that are specific to a X509 certificate (and not a Basic one).
2063
- */
2064
- interface X509Identity$1 {
1809
+ proteusLastResortPrekey(): Promise<Uint8Array>;
2065
1810
  /**
2066
- * User handle e.g. `john_wire`
1811
+ * @returns The last resort PreKey id
2067
1812
  */
2068
- handle: string;
1813
+ static proteusLastResortPrekeyId(): number;
2069
1814
  /**
2070
- * Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
1815
+ * Proteus public key fingerprint
1816
+ * It's basically the public key encoded as an hex string
1817
+ *
1818
+ * @returns Hex-encoded public key string
2071
1819
  */
2072
- displayName: string;
1820
+ proteusFingerprint(): Promise<string>;
2073
1821
  /**
2074
- * DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
1822
+ * Proteus session local fingerprint
1823
+ *
1824
+ * @param sessionId - ID of the Proteus session
1825
+ * @returns Hex-encoded public key string
2075
1826
  */
2076
- domain: string;
1827
+ proteusFingerprintLocal(sessionId: string): Promise<string>;
2077
1828
  /**
2078
- * X509 certificate identifying this client in the MLS group ; PEM encoded
1829
+ * Proteus session remote fingerprint
1830
+ *
1831
+ * @param sessionId - ID of the Proteus session
1832
+ * @returns Hex-encoded public key string
2079
1833
  */
2080
- certificate: string;
1834
+ proteusFingerprintRemote(sessionId: string): Promise<string>;
2081
1835
  /**
2082
- * X509 certificate serial number
2083
- */
2084
- serialNumber: string;
1836
+ * Hex-encoded fingerprint of the given prekey
1837
+ *
1838
+ * @param prekey - the prekey bundle to get the fingerprint from
1839
+ * @returns Hex-encoded public key string
1840
+ **/
1841
+ static proteusFingerprintPrekeybundle(prekey: Uint8Array): string;
2085
1842
  /**
2086
- * X509 certificate not before as Unix timestamp
1843
+ * Imports all the data stored by Cryptobox into the CoreCrypto keystore
1844
+ *
1845
+ * @param storeName - The name of the IndexedDB store where the data is stored
2087
1846
  */
2088
- notBefore: bigint;
1847
+ proteusCryptoboxMigrate(storeName: string): Promise<void>;
2089
1848
  /**
2090
- * X509 certificate not after as Unix timestamp
1849
+ * Creates an enrollment instance with private key material you can use in order to fetch
1850
+ * a new x509 certificate from the acme server.
1851
+ *
1852
+ * @param clientId - client identifier e.g. `b7ac11a4-8f01-4527-af88-1c30885a7931:6add501bacd1d90e@example.com`
1853
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1854
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1855
+ * @param expirySec - generated x509 certificate expiry
1856
+ * @param ciphersuite - for generating signing key material
1857
+ * @param team - name of the Wire team a user belongs to
1858
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiMlsInitOnly}
2091
1859
  */
2092
- notAfter: bigint;
2093
- }
2094
- export declare function normalizeEnum<T>(enumType: T, value: number): T[keyof T];
2095
- export declare const mapWireIdentity: (ffiIdentity?: WireIdentity) => WireIdentity$1 | undefined;
2096
- export interface AcmeDirectory {
1860
+ e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
2097
1861
  /**
2098
- * URL for fetching a new nonce. Use this only for creating a new account.
1862
+ * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1863
+ * Once the enrollment is finished, use {@link CoreCryptoContext.e2eiRotate} to do key rotation.
1864
+ *
1865
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1866
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1867
+ * @param expirySec - generated x509 certificate expiry
1868
+ * @param ciphersuite - for generating signing key material
1869
+ * @param team - name of the Wire team a user belongs to
1870
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotate}
2099
1871
  */
2100
- newNonce: string;
1872
+ e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
2101
1873
  /**
2102
- * URL for creating a new account.
1874
+ * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1875
+ * having to change/rotate their credential, either because the former one is expired or it
1876
+ * has been revoked. It lets you change the DisplayName or the handle
1877
+ * if you need to. Once the enrollment is finished, use {@link CoreCryptoContext.e2eiRotate}
1878
+ * to do key rotation.
1879
+ *
1880
+ * @param expirySec - generated x509 certificate expiry
1881
+ * @param ciphersuite - for generating signing key material
1882
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1883
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1884
+ * @param team - name of the Wire team a user belongs to
1885
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotate}
2103
1886
  */
2104
- newAccount: string;
1887
+ e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite$1, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
2105
1888
  /**
2106
- * URL for creating a new order.
1889
+ * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
1890
+ * that means he cannot initialize with a Basic credential
1891
+ *
1892
+ * @param enrollment - the enrollment instance used to fetch the certificates
1893
+ * @param certificateChain - the raw response from ACME server
1894
+ * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
1895
+ * @returns a MlsClient initialized with only a x509 credential
2107
1896
  */
2108
- newOrder: string;
1897
+ e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<NewCrlDistributionPoints>;
2109
1898
  /**
2110
- * Revocation URL
1899
+ * Dumps the PKI environment as PEM
1900
+ *
1901
+ * @returns a struct with different fields representing the PKI environment as PEM strings
2111
1902
  */
2112
- revokeCert: string;
2113
- }
2114
- /**
2115
- * Indicates the standalone status of a device Credential in a MLS group at a moment T.
2116
- * This does not represent the states where a device is not using MLS or is not using end-to-end identity
2117
- */
2118
- export declare enum DeviceStatus {
1903
+ e2eiDumpPKIEnv(): Promise<E2eiDumpedPkiEnv | undefined>;
2119
1904
  /**
2120
- * All is fine
1905
+ * @returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
2121
1906
  */
2122
- Valid = 1,
1907
+ e2eiIsPKIEnvSetup(): Promise<boolean>;
2123
1908
  /**
2124
- * The Credential's certificate is expired
1909
+ * Registers a Root Trust Anchor CA for the use in E2EI processing.
1910
+ *
1911
+ * Please note that without a Root Trust Anchor, all validations *will* fail;
1912
+ * So this is the first step to perform after initializing your E2EI client
1913
+ *
1914
+ * @param trustAnchorPEM - PEM certificate to anchor as a Trust Root
2125
1915
  */
2126
- Expired = 2,
1916
+ e2eiRegisterAcmeCA(trustAnchorPEM: string): Promise<void>;
2127
1917
  /**
2128
- * The Credential's certificate is revoked
1918
+ * Registers an Intermediate CA for the use in E2EI processing.
1919
+ *
1920
+ * Please note that a Root Trust Anchor CA is needed to validate Intermediate CAs;
1921
+ * You **need** to have a Root CA registered before calling this
1922
+ *
1923
+ * @param certPEM - PEM certificate to register as an Intermediate CA
2129
1924
  */
2130
- Revoked = 3
2131
- }
2132
- /**
2133
- * Returned by all methods creating proposals. Contains a proposal message and an identifier to roll back the proposal
2134
- */
2135
- export interface ProposalBundle {
1925
+ e2eiRegisterIntermediateCA(certPEM: string): Promise<NewCrlDistributionPoints>;
2136
1926
  /**
2137
- * TLS-serialized MLS proposal that needs to be fanned out to other (existing) members of the conversation
1927
+ * Registers a CRL for the use in E2EI processing.
2138
1928
  *
2139
- * @readonly
1929
+ * Please note that a Root Trust Anchor CA is needed to validate CRLs;
1930
+ * You **need** to have a Root CA registered before calling this
1931
+ *
1932
+ * @param crlDP - CRL Distribution Point; Basically the URL you fetched it from
1933
+ * @param crlDER - DER representation of the CRL
1934
+ *
1935
+ * @returns a {@link CRLRegistration} with the dirty state of the new CRL (see struct) and its expiration timestamp
2140
1936
  */
2141
- proposal: Uint8Array;
1937
+ e2eiRegisterCRL(crlDP: string, crlDER: Uint8Array): Promise<CRLRegistration>;
2142
1938
  /**
2143
- * Unique identifier of a proposal. Use this in {@link CoreCrypto.clearPendingProposal} to roll back (delete) the proposal
1939
+ * Creates an update commit which replaces your leaf containing basic credentials with a leaf node containing x509 credentials in the conversation.
2144
1940
  *
2145
- * @readonly
1941
+ * NOTE: you can only call this after you've completed the enrollment for an end-to-end identity, and saved the
1942
+ * resulting credential with {@link CoreCryptoContext.saveX509Credential}.
1943
+ * Calling this without a valid end-to-end identity will result in an error.
1944
+ *
1945
+ * Sends the corresponding commit via {@link MlsTransport.sendCommitBundle} and merges it if the call is successful.
1946
+ *
1947
+ * @param conversationId - The ID of the conversation
2146
1948
  */
2147
- proposalRef: ProposalRef;
1949
+ e2eiRotate(conversationId: ConversationId): Promise<void>;
2148
1950
  /**
2149
- * New CRL Distribution of members of this group
1951
+ * Saves a new X509 credential. Requires first
1952
+ * having enrolled a new X509 certificate with either {@link CoreCryptoContext.e2eiNewActivationEnrollment}
1953
+ * or {@link CoreCryptoContext.e2eiNewRotateEnrollment}
2150
1954
  *
2151
- * @readonly
1955
+ * # Expected actions to perform after this function (in this order)
1956
+ * 1. Rotate credentials for each conversation using {@link CoreCryptoContext.e2eiRotate}
1957
+ * 2. Generate new key packages with {@link CoreCryptoContext.clientKeypackages}
1958
+ * 3. Use these to replace the stale ones the in the backend
1959
+ * 4. Delete the stale ones locally using {@link CoreCryptoContext.deleteStaleKeyPackages}
1960
+ * * This is the last step because you might still need the old key packages to avoid
1961
+ * an orphan welcome message
1962
+ *
1963
+ * @param enrollment - the enrollment instance used to fetch the certificates
1964
+ * @param certificateChain - the raw response from ACME server
1965
+ * @returns Potentially a list of new crl distribution points discovered in the certificate chain
2152
1966
  */
2153
- crlNewDistributionPoints?: string[];
2154
- }
2155
- export interface WelcomeBundle {
1967
+ saveX509Credential(enrollment: E2eiEnrollment, certificateChain: string): Promise<NewCrlDistributionPoints>;
2156
1968
  /**
2157
- * Conversation ID
2158
- *
2159
- * @readonly
1969
+ * Deletes all key packages whose credential does not match the most recently
1970
+ * saved x509 credential and the provided signature scheme.
1971
+ * @param cipherSuite
2160
1972
  */
2161
- id: Uint8Array;
1973
+ deleteStaleKeyPackages(cipherSuite: Ciphersuite$1): Promise<void>;
2162
1974
  /**
2163
- * New CRL Distribution of members of this group
1975
+ * Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
1976
+ * it later with {@link e2eiEnrollmentStashPop}
2164
1977
  *
2165
- * @readonly
1978
+ * @param enrollment the enrollment instance to persist
1979
+ * @returns a handle to fetch the enrollment later with {@link e2eiEnrollmentStashPop}
2166
1980
  */
2167
- crlNewDistributionPoints?: string[];
2168
- }
2169
- /**
2170
- * MLS Proposal type
2171
- */
2172
- export declare enum ProposalType {
1981
+ e2eiEnrollmentStash(enrollment: E2eiEnrollment): Promise<Uint8Array>;
2173
1982
  /**
2174
- * This allows to propose the addition of other clients to the MLS group/conversation
1983
+ * Fetches the persisted enrollment and deletes it from the keystore
1984
+ *
1985
+ * @param handle returned by {@link e2eiEnrollmentStash}
1986
+ * @returns the persisted enrollment instance
2175
1987
  */
2176
- Add = 0,
1988
+ e2eiEnrollmentStashPop(handle: Uint8Array): Promise<E2eiEnrollment>;
2177
1989
  /**
2178
- * This allows to propose the removal of clients from the MLS group/conversation
1990
+ * Indicates when to mark a conversation as not verified i.e. when not all its members have a X509.
1991
+ * Credential generated by Wire's end-to-end identity enrollment
1992
+ *
1993
+ * @param conversationId The group's ID
1994
+ * @returns the conversation state given current members
2179
1995
  */
2180
- Remove = 1,
1996
+ e2eiConversationState(conversationId: ConversationId): Promise<E2eiConversationState>;
2181
1997
  /**
2182
- * This allows to propose to update the client keying material (i.e. keypackage rotation) and the group root key
1998
+ * Returns true when end-to-end-identity is enabled for the given Ciphersuite
1999
+ *
2000
+ * @param ciphersuite of the credential to check
2001
+ * @returns true if end-to-end identity is enabled for the given ciphersuite
2183
2002
  */
2184
- Update = 2
2185
- }
2186
- /**
2187
- * Common arguments for proposals
2188
- */
2189
- export interface ProposalArgs {
2003
+ e2eiIsEnabled(ciphersuite: Ciphersuite$1): Promise<boolean>;
2190
2004
  /**
2191
- * Conversation ID that is targeted by the proposal
2005
+ * From a given conversation, get the identity of the members supplied. Identity is only present for members with a
2006
+ * Certificate Credential (after turning on end-to-end identity).
2007
+ *
2008
+ * @param conversationId - identifier of the conversation
2009
+ * @param deviceIds - identifiers of the devices
2010
+ * @returns identities or if no member has a x509 certificate, it will return an empty List
2192
2011
  */
2193
- conversationId: ConversationId;
2194
- }
2195
- /**
2196
- * Arguments for a proposal of type `Add`
2197
- */
2198
- export interface AddProposalArgs extends ProposalArgs {
2012
+ getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity[]>;
2199
2013
  /**
2200
- * TLS-serialized MLS KeyPackage to be added
2201
- */
2202
- kp: Uint8Array;
2203
- }
2204
- /**
2205
- * Arguments for a proposal of type `Remove`
2206
- */
2207
- export interface RemoveProposalArgs extends ProposalArgs {
2014
+ * From a given conversation, get the identity of the users (device holders) supplied.
2015
+ * Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity).
2016
+ * If no member has a x509 certificate, it will return an empty Vec.
2017
+ *
2018
+ * @param conversationId - identifier of the conversation
2019
+ * @param userIds - user identifiers hyphenated UUIDv4 e.g. 'bd4c7053-1c5a-4020-9559-cd7bf7961954'
2020
+ * @returns a Map with all the identities for a given users. Consumers are then recommended to reduce those identities to determine the actual status of a user.
2021
+ */
2022
+ getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
2208
2023
  /**
2209
- * Client ID to be removed from the conversation
2024
+ * Gets the e2ei conversation state from a `GroupInfo`. Useful to check if the group has e2ei
2025
+ * turned on or not before joining it.
2026
+ *
2027
+ * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
2028
+ * @param credentialType - kind of Credential to check usage of. Defaults to X509 for now as no other value will give any result.
2029
+ * @returns see {@link E2eiConversationState}
2210
2030
  */
2211
- clientId: ClientId;
2031
+ getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType$1): Promise<E2eiConversationState>;
2212
2032
  }
2213
2033
  /**
2214
- * MLS External Proposal type
2034
+ * Params for CoreCrypto deferred initialization
2035
+ * Please note that the `entropySeed` parameter MUST be exactly 32 bytes
2215
2036
  */
2216
- export declare enum ExternalProposalType {
2217
- /**
2218
- * This allows to propose the addition of other clients to the MLS group/conversation
2219
- */
2220
- Add = 0
2221
- }
2222
- export interface ExternalProposalArgs {
2037
+ export interface CoreCryptoDeferredParams {
2223
2038
  /**
2224
- * Conversation ID that is targeted by the external proposal
2039
+ * Name of the IndexedDB database
2225
2040
  */
2226
- conversationId: ConversationId;
2041
+ databaseName: string;
2227
2042
  /**
2228
- * MLS Group epoch for the external proposal.
2229
- * This needs to be the current epoch of the group or this proposal **will** be rejected
2043
+ * Encryption master key
2044
+ * This should be appropriately stored in a secure location (i.e. WebCrypto private key storage)
2230
2045
  */
2231
- epoch: number;
2232
- }
2233
- export interface ExternalAddProposalArgs extends ExternalProposalArgs {
2046
+ key: string;
2234
2047
  /**
2235
- * {@link Ciphersuite} to propose to join the MLS group with.
2048
+ * External PRNG entropy pool seed.
2049
+ * This **must** be exactly 32 bytes
2236
2050
  */
2237
- ciphersuite: Ciphersuite$1;
2051
+ entropySeed?: Uint8Array;
2238
2052
  /**
2239
- * Fails when it is {@link CredentialType.X509} and no Credential has been created
2240
- * for it beforehand with {@link CoreCrypto.e2eiMlsInit} or variants.
2053
+ * .wasm file path, this will be useful in case your bundling system likes to relocate files (i.e. what webpack does)
2241
2054
  */
2242
- credentialType: CredentialType$1;
2055
+ wasmFilePath?: string;
2243
2056
  }
2244
- export interface CoreCryptoCallbacks {
2057
+ /**
2058
+ * Params for CoreCrypto initialization
2059
+ * Please note that the `entropySeed` parameter MUST be exactly 32 bytes
2060
+ */
2061
+ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
2245
2062
  /**
2246
- * This callback is called by CoreCrypto to know whether a given clientId is authorized to "write"
2247
- * in the given conversationId. Think of it as a "isAdmin" callback conceptually
2248
- *
2249
- * This callback exists because there are many business cases where CoreCrypto doesn't have enough knowledge
2250
- * (such as what can exist on a backend) to inform the decision
2251
- *
2252
- * @param conversationId - id of the group/conversation
2253
- * @param clientId - id of the client performing an operation requiring authorization
2254
- * @returns whether the user is authorized by the logic layer to perform the operation
2063
+ * MLS Client ID.
2064
+ * This should stay consistent as it will be verified against the stored signature & identity to validate the persisted credential
2255
2065
  */
2256
- authorize: (conversationId: Uint8Array, clientId: Uint8Array) => Promise<boolean>;
2066
+ clientId: ClientId;
2257
2067
  /**
2258
- * A mix between {@link authorize} and {@link clientIsExistingGroupUser}. We currently use this callback to verify
2259
- * external commits to join a group ; in such case, the client has to:
2260
- * * first, belong to a user which is already in the MLS group (similar to {@link clientIsExistingGroupUser})
2261
- * * then, this user should be authorized to "write" in the given conversation (similar to {@link authorize})
2262
- *
2263
- * @param conversationId - id of the group/conversation
2264
- * @param externalClientId - id of the client performing an operation requiring authorization
2265
- * @param existingClients - all the clients currently within the MLS group
2266
- * @returns true if the external client is authorized to write to the conversation
2068
+ * All the ciphersuites this MLS client can support
2267
2069
  */
2268
- userAuthorize: (conversationId: Uint8Array, externalClientId: Uint8Array, existingClients: Uint8Array[]) => Promise<boolean>;
2070
+ ciphersuites: Ciphersuite$1[];
2269
2071
  /**
2270
- * Callback to ensure that the given `clientId` belongs to one of the provided `existingClients`
2271
- * This basically allows to defer the client ID parsing logic to the caller - because CoreCrypto is oblivious to such things
2272
- *
2273
- * @param conversationId - id of the group/conversation
2274
- * @param clientId - id of a client
2275
- * @param existingClients - all the clients currently within the MLS group
2072
+ * Number of initial KeyPackage to create when initializing the client
2276
2073
  */
2277
- clientIsExistingGroupUser: (conversationId: Uint8Array, clientId: Uint8Array, existingClients: Uint8Array[], parent_conversation_clients?: Uint8Array[]) => Promise<boolean>;
2074
+ nbKeyPackage?: number;
2278
2075
  }
2076
+ /**
2077
+ * Initializes the global logger for Core Crypto and registers the callback.
2078
+ *
2079
+ * **NOTE:** you must call this after `await CoreCrypto.init(params)` or `await CoreCrypto.deferredInit(params)`.
2080
+ *
2081
+ * @param logger - the interface to be called when something is going to be logged
2082
+ **/
2083
+ export declare function setLogger(logger: CoreCryptoLogger, ctx?: unknown): void;
2279
2084
  /**
2280
2085
  * An interface to register a logger in CoreCrypto
2281
2086
  **/
@@ -2300,30 +2105,23 @@ export declare enum CoreCryptoLogLevel {
2300
2105
  Error = 6
2301
2106
  }
2302
2107
  /**
2303
- * Initializes the global logger for Core Crypto and registers the callback.
2304
- *
2305
- * **NOTE:** you must call this after `await CoreCrypto.init(params)` or `await CoreCrypto.deferredInit(params)`.
2306
- *
2307
- * @deprecated use {@link CoreCrypto.setLogger} instead.
2108
+ * Sets maximum log level for logs forwarded to the logger, defaults to `Warn`.
2308
2109
  *
2309
- * @param logger - the interface to be called when something is going to be logged
2310
2110
  * @param level - the max level that should be logged
2311
- **/
2312
- export declare function initLogger(logger: CoreCryptoLogger, level: CoreCryptoLogLevel, ctx?: unknown): void;
2111
+ */
2112
+ export declare function setMaxLogLevel(level: CoreCryptoLogLevel): void;
2313
2113
  /**
2314
- * Initializes the global logger for Core Crypto and registers the callback.
2315
- *
2316
- * **NOTE:** you must call this after `await CoreCrypto.init(params)` or `await CoreCrypto.deferredInit(params)`.
2114
+ * Returns build metadata for the {@link CoreCrypto} libary.
2317
2115
  *
2318
- * @param logger - the interface to be called when something is going to be logged
2319
- **/
2320
- export declare function setLogger(logger: CoreCryptoLogger, ctx?: unknown): void;
2116
+ * @returns varous build metadata for `core-crypto`.
2117
+ */
2118
+ export declare function buildMetadata(): BuildMetadata;
2321
2119
  /**
2322
- * Sets maximum log level for logs forwarded to the logger, defaults to `Warn`.
2120
+ * Returns the current version of {@link CoreCrypto}
2323
2121
  *
2324
- * @param level - the max level that should be logged
2122
+ * @returns the CoreCrypto version as a string (e.g. "3.1.2")
2325
2123
  */
2326
- export declare function setMaxLogLevel(level: CoreCryptoLogLevel): void;
2124
+ export declare function version(): string;
2327
2125
  /**
2328
2126
  * Wrapper for the WASM-compiled version of CoreCrypto
2329
2127
  */
@@ -2368,12 +2166,13 @@ export declare class CoreCrypto {
2368
2166
  * });
2369
2167
  * ````
2370
2168
  */
2371
- static init({ databaseName, key, clientId, wasmFilePath, ciphersuites, entropySeed, nbKeyPackage, }: CoreCryptoParams): Promise<CoreCrypto>;
2169
+ static init({ databaseName, key, clientId, wasmFilePath, // eslint-disable-line @typescript-eslint/no-unused-vars
2170
+ ciphersuites, entropySeed, nbKeyPackage, }: CoreCryptoParams): Promise<CoreCrypto>;
2372
2171
  /**
2373
2172
  * Almost identical to {@link CoreCrypto.init} but allows a 2 phase initialization of MLS.
2374
2173
  * First, calling this will set up the keystore and will allow generating proteus prekeys.
2375
2174
  * Then, those keys can be traded for a clientId.
2376
- * Use this clientId to initialize MLS with {@link CoreCrypto.mlsInit}.
2175
+ * Use this clientId to initialize MLS with {@link CoreCryptoContext.mlsInit}.
2377
2176
  * @param params - {@link CoreCryptoDeferredParams}
2378
2177
  */
2379
2178
  static deferredInit({ databaseName, key, entropySeed, wasmFilePath, }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
@@ -2386,42 +2185,15 @@ export declare class CoreCrypto {
2386
2185
  * @returns the result of the callback will be returned from this call
2387
2186
  */
2388
2187
  transaction<R>(callback: (ctx: CoreCryptoContext$1) => Promise<R>): Promise<R>;
2389
- /**
2390
- * See {@link CoreCryptoContext.mlsInit}.
2391
- *
2392
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2393
- * and use {@link CoreCryptoContext.mlsInit} instead.
2394
- */
2395
- mlsInit(clientId: ClientId, ciphersuites: Ciphersuite$1[], nbKeyPackage?: number): Promise<void>;
2396
- /**
2397
- * See {@link CoreCryptoContext.mlsGenerateKeypair}.
2398
- *
2399
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2400
- * and use {@link CoreCryptoContext.mlsGenerateKeypair} instead.
2401
- */
2402
- mlsGenerateKeypair(ciphersuites: Ciphersuite$1[]): Promise<Uint8Array[]>;
2403
- /**
2404
- * See {@link CoreCryptoContext.mlsInitWithClientId}.
2405
- *
2406
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2407
- * and use {@link CoreCryptoContext.mlsInitWithClientId} instead.
2408
- */
2409
- mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite$1[]): Promise<void>;
2410
2188
  /** @hidden */
2411
2189
  private constructor();
2412
2190
  /**
2413
- * If this returns `true` you **cannot** call {@link CoreCrypto.wipe} or {@link CoreCrypto.close} as they will produce an error because of the
2191
+ * If this returns `true` you **cannot** call {@link CoreCrypto.close} as it will produce an error because of the
2414
2192
  * outstanding references that were detected.
2415
2193
  *
2416
- * @returns the count of strong refs for this CoreCrypto instance
2194
+ * @returns whether the CoreCrypto instance is locked
2417
2195
  */
2418
2196
  isLocked(): boolean;
2419
- /**
2420
- * Wipes the {@link CoreCrypto} backing storage (i.e. {@link https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API | IndexedDB} database)
2421
- *
2422
- * **CAUTION**: This {@link CoreCrypto} instance won't be useable after a call to this method, but there's no way to express this requirement in TypeScript so you'll get errors instead!
2423
- */
2424
- wipe(): Promise<void>;
2425
2197
  /**
2426
2198
  * Closes this {@link CoreCrypto} instance and deallocates all loaded resources
2427
2199
  *
@@ -2429,22 +2201,16 @@ export declare class CoreCrypto {
2429
2201
  */
2430
2202
  close(): Promise<void>;
2431
2203
  /**
2432
- * Registers the callbacks for CoreCrypto to use in order to gain additional information
2204
+ * Registers the transport callbacks for core crypto to give it access to backend endpoints for sending
2205
+ * a commit bundle or a message, respectively.
2433
2206
  *
2434
- * @param callbacks - Any interface following the {@link CoreCryptoCallbacks} interface
2207
+ * @param transportProvider - Any implementor of the {@link MlsTransport} interface
2435
2208
  */
2436
- registerCallbacks(callbacks: CoreCryptoCallbacks, ctx?: unknown): Promise<void>;
2209
+ provideTransport(transportProvider: MlsTransport, ctx?: unknown): Promise<void>;
2437
2210
  /**
2438
2211
  * See {@link CoreCryptoContext.conversationExists}.
2439
2212
  */
2440
2213
  conversationExists(conversationId: ConversationId): Promise<boolean>;
2441
- /**
2442
- * See {@link CoreCryptoContext.markConversationAsChildOf}.
2443
- *
2444
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2445
- * and use {@link CoreCryptoContext.markConversationAsChildOf} instead.
2446
- */
2447
- markConversationAsChildOf(childId: ConversationId, parentId: ConversationId): Promise<void>;
2448
2214
  /**
2449
2215
  * See {@link CoreCryptoContext.conversationEpoch}.
2450
2216
  *
@@ -2464,41 +2230,6 @@ export declare class CoreCrypto {
2464
2230
  * @returns the ciphersuite of the conversation
2465
2231
  */
2466
2232
  conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite$1>;
2467
- /**
2468
- * See {@link CoreCryptoContext.wipeConversation}.
2469
- *
2470
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2471
- * and use {@link CoreCryptoContext.wipeConversation} instead.
2472
- */
2473
- wipeConversation(conversationId: ConversationId): Promise<void>;
2474
- /**
2475
- * See {@link CoreCryptoContext.createConversation}.
2476
- *
2477
- * @deprecated Create a transaction with {@link transaction}
2478
- * and use {@link CoreCryptoContext.createConversation} instead.
2479
- */
2480
- createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType$1, configuration?: ConversationConfiguration$1): Promise<any>;
2481
- /**
2482
- * See {@link CoreCryptoContext.decryptMessage}.
2483
- *
2484
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2485
- * and use {@link CoreCryptoContext.decryptMessage} instead.
2486
- */
2487
- decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
2488
- /**
2489
- * See {@link CoreCryptoContext.encryptMessage}.
2490
- *
2491
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2492
- * and use {@link CoreCryptoContext.encryptMessage} instead.
2493
- */
2494
- encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
2495
- /**
2496
- * See {@link CoreCryptoContext.processWelcomeMessage}.
2497
- *
2498
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2499
- * and use {@link CoreCryptoContext.processWelcomeMessage} instead.
2500
- */
2501
- processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration$1): Promise<WelcomeBundle>;
2502
2233
  /**
2503
2234
  * See {@link CoreCryptoContext.clientPublicKey}.
2504
2235
  *
@@ -2507,129 +2238,6 @@ export declare class CoreCrypto {
2507
2238
  * @returns the client's public signature key
2508
2239
  */
2509
2240
  clientPublicKey(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<Uint8Array>;
2510
- /**
2511
- * See {@link CoreCryptoContext.clientValidKeypackagesCount}.
2512
- *
2513
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2514
- * and use {@link CoreCryptoContext.clientValidKeypackagesCount} instead.
2515
- */
2516
- clientValidKeypackagesCount(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<number>;
2517
- /**
2518
- * See {@link CoreCryptoContext.clientKeypackages}.
2519
- *
2520
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2521
- * and use {@link CoreCryptoContext.clientKeypackages} instead.
2522
- */
2523
- clientKeypackages(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1, amountRequested: number): Promise<Array<Uint8Array>>;
2524
- /**
2525
- * See {@link CoreCryptoContext.deleteKeypackages}.
2526
- *
2527
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2528
- * and use {@link CoreCryptoContext.deleteKeypackages} instead.
2529
- */
2530
- deleteKeypackages(refs: Uint8Array[]): Promise<void>;
2531
- /**
2532
- * See {@link CoreCryptoContext.addClientsToConversation}.
2533
- *
2534
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2535
- * and use {@link CoreCryptoContext.addClientsToConversation} instead.
2536
- */
2537
- addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<MemberAddedMessages>;
2538
- /**
2539
- * See {@link CoreCryptoContext.removeClientsFromConversation}.
2540
- *
2541
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2542
- * and use {@link CoreCryptoContext.removeClientsFromConversation} instead.
2543
- */
2544
- removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId[]): Promise<CommitBundle>;
2545
- /**
2546
- * See {@link CoreCryptoContext.updateKeyingMaterial}.
2547
- *
2548
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2549
- * and use {@link CoreCryptoContext.updateKeyingMaterial} instead.
2550
- */
2551
- updateKeyingMaterial(conversationId: ConversationId): Promise<CommitBundle>;
2552
- /**
2553
- * Creates an update commit which replaces your leaf containing basic credentials with a leaf node containing x509 credentials in the conversation.
2554
- *
2555
- * NOTE: you can only call this after you've completed the enrollment for an end-to-end identity, calling this without
2556
- * a valid end-to-end identity will result in an error.
2557
- *
2558
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
2559
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
2560
- * epoch, use new encryption secrets etc...
2561
- *
2562
- * @param conversationId - The ID of the conversation
2563
- *
2564
- * @returns A {@link CommitBundle}
2565
- *
2566
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2567
- * and use {@link CoreCryptoContext.e2eiRotate} instead.
2568
- */
2569
- e2eiRotate(conversationId: ConversationId): Promise<CommitBundle>;
2570
- /**
2571
- * See {@link CoreCryptoContext.commitPendingProposals}.
2572
- *
2573
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2574
- * and use {@link CoreCryptoContext.commitPendingProposals} instead.
2575
- */
2576
- commitPendingProposals(conversationId: ConversationId): Promise<CommitBundle | undefined>;
2577
- /**
2578
- * See {@link CoreCryptoContext.newProposal}.
2579
- *
2580
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2581
- * and use {@link CoreCryptoContext.newProposal} instead.
2582
- */
2583
- newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<ProposalBundle>;
2584
- /**
2585
- * See {@link CoreCryptoContext.newExternalProposal}.
2586
- *
2587
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2588
- * and use {@link CoreCryptoContext.newExternalProposal} instead.
2589
- */
2590
- newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
2591
- /**
2592
- * See {@link CoreCryptoContext.joinByExternalCommit}.
2593
- *
2594
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2595
- * and use {@link CoreCryptoContext.joinByExternalCommit} instead.
2596
- */
2597
- joinByExternalCommit(groupInfo: Uint8Array, credentialType: CredentialType$1, configuration?: CustomConfiguration$1): Promise<ConversationInitBundle>;
2598
- /**
2599
- * See {@link CoreCryptoContext.mergePendingGroupFromExternalCommit}.
2600
- *
2601
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2602
- * and use {@link CoreCryptoContext.mergePendingGroupFromExternalCommit} instead.
2603
- */
2604
- mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
2605
- /**
2606
- * See {@link CoreCryptoContext.clearPendingGroupFromExternalCommit}.
2607
- *
2608
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2609
- * and use {@link CoreCryptoContext.clearPendingGroupFromExternalCommit} instead.
2610
- */
2611
- clearPendingGroupFromExternalCommit(conversationId: ConversationId): Promise<void>;
2612
- /**
2613
- * See {@link CoreCryptoContext.commitAccepted}.
2614
- *
2615
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2616
- * and use {@link CoreCryptoContext.commitAccepted} instead.
2617
- */
2618
- commitAccepted(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
2619
- /**
2620
- * See {@link CoreCryptoContext.clearPendingProposal}.
2621
- *
2622
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2623
- * and use {@link CoreCryptoContext.clearPendingProposal} instead.
2624
- */
2625
- clearPendingProposal(conversationId: ConversationId, proposalRef: ProposalRef): Promise<void>;
2626
- /**
2627
- * See {@link CoreCryptoContext.clearPendingCommit}.
2628
- *
2629
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2630
- * and use {@link CoreCryptoContext.clearPendingCommit} instead.
2631
- */
2632
- clearPendingCommit(conversationId: ConversationId): Promise<void>;
2633
2241
  /**
2634
2242
  * See {@link CoreCryptoContext.exportSecretKey}.
2635
2243
  *
@@ -2641,154 +2249,43 @@ export declare class CoreCrypto {
2641
2249
  */
2642
2250
  exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<Uint8Array>;
2643
2251
  /**
2644
- * See {@link CoreCryptoContext.getExternalSender}.
2645
- *
2646
- * @param conversationId - The group's ID
2647
- *
2648
- * @returns A `Uint8Array` representing the external sender raw public key
2649
- */
2650
- getExternalSender(conversationId: ConversationId): Promise<Uint8Array>;
2651
- /**
2652
- * See {@link CoreCryptoContext.getClientIds}.
2653
- *
2654
- * @param conversationId - The group's ID
2655
- *
2656
- * @returns A list of clients from the members of the group
2657
- */
2658
- getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
2659
- /**
2660
- * See {@link CoreCryptoContext.randomBytes}.
2661
- *
2662
- * @param length - The number of bytes to be returned in the `Uint8Array`
2663
- *
2664
- * @returns A `Uint8Array` buffer that contains `length` cryptographically-secure random bytes
2665
- */
2666
- randomBytes(length: number): Promise<Uint8Array>;
2667
- /**
2668
- * Allows to reseed {@link CoreCrypto}'s internal CSPRNG with a new seed.
2669
- *
2670
- * @param seed - **exactly 32** bytes buffer seed
2671
- */
2672
- reseedRng(seed: Uint8Array): Promise<void>;
2673
- /**
2674
- * Initializes the proteus client
2675
- *
2676
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2677
- * and use {@link CoreCryptoContext.proteusInit} instead.
2678
- */
2679
- proteusInit(): Promise<void>;
2680
- /**
2681
- * Create a Proteus session using a prekey
2682
- *
2683
- * @param sessionId - ID of the Proteus session
2684
- * @param prekey - CBOR-encoded Proteus prekey of the other client
2685
- *
2686
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2687
- * and use {@link CoreCryptoContext.proteusSessionFromPrekey} instead.
2688
- */
2689
- proteusSessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<void>;
2690
- /**
2691
- * Create a Proteus session from a handshake message
2692
- *
2693
- * @param sessionId - ID of the Proteus session
2694
- * @param envelope - CBOR-encoded Proteus message
2695
- *
2696
- * @returns A `Uint8Array` containing the message that was sent along with the session handshake
2697
- *
2698
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2699
- * and use {@link CoreCryptoContext.proteusSessionFromMessage} instead.
2700
- */
2701
- proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<Uint8Array>;
2702
- /**
2703
- * Locally persists a session to the keystore
2704
- *
2705
- * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
2706
- *
2707
- * @param sessionId - ID of the Proteus session
2708
- *
2709
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2710
- * and use {@link CoreCryptoContext.proteusSessionSave} instead.
2711
- */
2712
- proteusSessionSave(sessionId: string): Promise<void>;
2713
- /**
2714
- * Deletes a session
2715
- * Note: this also deletes the persisted data within the keystore
2716
- *
2717
- * @param sessionId - ID of the Proteus session
2718
- *
2719
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2720
- * and use {@link CoreCryptoContext.proteusSessionDelete} instead.
2721
- */
2722
- proteusSessionDelete(sessionId: string): Promise<void>;
2723
- /**
2724
- * Checks if a session exists
2725
- *
2726
- * @param sessionId - ID of the Proteus session
2727
- *
2728
- * @returns whether the session exists or not
2729
- */
2730
- proteusSessionExists(sessionId: string): Promise<boolean>;
2731
- /**
2732
- * Decrypt an incoming message for an existing Proteus session
2733
- *
2734
- * @param sessionId - ID of the Proteus session
2735
- * @param ciphertext - CBOR encoded, encrypted proteus message
2736
- * @returns The decrypted payload contained within the message
2737
- *
2738
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2739
- * and use {@link CoreCryptoContext.proteusDecrypt} instead.
2740
- */
2741
- proteusDecrypt(sessionId: string, ciphertext: Uint8Array): Promise<Uint8Array>;
2742
- /**
2743
- * Encrypt a message for a given Proteus session
2744
- *
2745
- * @param sessionId - ID of the Proteus session
2746
- * @param plaintext - payload to encrypt
2747
- * @returns The CBOR-serialized encrypted message
2252
+ * See {@link CoreCryptoContext.getExternalSender}.
2253
+ *
2254
+ * @param conversationId - The group's ID
2748
2255
  *
2749
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2750
- * and use {@link CoreCryptoContext.proteusEncrypt} instead.
2256
+ * @returns A `Uint8Array` representing the external sender raw public key
2751
2257
  */
2752
- proteusEncrypt(sessionId: string, plaintext: Uint8Array): Promise<Uint8Array>;
2258
+ getExternalSender(conversationId: ConversationId): Promise<Uint8Array>;
2753
2259
  /**
2754
- * Batch encryption for proteus messages
2755
- * This is used to minimize FFI roundtrips when used in the context of a multi-client session (i.e. conversation)
2260
+ * See {@link CoreCryptoContext.getClientIds}.
2756
2261
  *
2757
- * @param sessions - List of Proteus session IDs to encrypt the message for
2758
- * @param plaintext - payload to encrypt
2759
- * @returns A map indexed by each session ID and the corresponding CBOR-serialized encrypted message for this session
2760
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2761
- * and use {@link CoreCryptoContext.proteusEncryptBatched} instead.
2262
+ * @param conversationId - The group's ID
2263
+ *
2264
+ * @returns A list of clients from the members of the group
2762
2265
  */
2763
- proteusEncryptBatched(sessions: string[], plaintext: Uint8Array): Promise<Map<string, Uint8Array>>;
2266
+ getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
2764
2267
  /**
2765
- * Creates a new prekey with the requested ID.
2268
+ * See {@link CoreCryptoContext.randomBytes}.
2766
2269
  *
2767
- * @param prekeyId - ID of the PreKey to generate. This cannot be bigger than a u16
2768
- * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
2270
+ * @param length - The number of bytes to be returned in the `Uint8Array`
2769
2271
  *
2770
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2771
- * and use {@link CoreCryptoContext.proteusNewPrekey} instead.
2272
+ * @returns A `Uint8Array` buffer that contains `length` cryptographically-secure random bytes
2772
2273
  */
2773
- proteusNewPrekey(prekeyId: number): Promise<Uint8Array>;
2274
+ randomBytes(length: number): Promise<Uint8Array>;
2774
2275
  /**
2775
- * Creates a new prekey with an automatically generated ID..
2776
- *
2777
- * @returns A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey accompanied by its ID
2276
+ * Allows to reseed {@link CoreCrypto}'s internal CSPRNG with a new seed.
2778
2277
  *
2779
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2780
- * and use {@link CoreCryptoContext.proteusNewPrekeyAuto} instead.
2278
+ * @param seed - **exactly 32** bytes buffer seed
2781
2279
  */
2782
- proteusNewPrekeyAuto(): Promise<ProteusAutoPrekeyBundle>;
2280
+ reseedRng(seed: Uint8Array): Promise<void>;
2783
2281
  /**
2784
- * Proteus last resort prekey stuff
2282
+ * Checks if a session exists
2785
2283
  *
2786
- * @returns A CBOR-serialize version of the PreKeyBundle associated with the last resort PreKey (holding the last resort prekey id)
2284
+ * @param sessionId - ID of the Proteus session
2787
2285
  *
2788
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2789
- * and use {@link CoreCryptoContext.proteusLastResortPrekey} instead.
2286
+ * @returns whether the session exists or not
2790
2287
  */
2791
- proteusLastResortPrekey(): Promise<Uint8Array>;
2288
+ proteusSessionExists(sessionId: string): Promise<boolean>;
2792
2289
  /**
2793
2290
  * @returns The last resort PreKey id
2794
2291
  */
@@ -2821,48 +2318,6 @@ export declare class CoreCrypto {
2821
2318
  * @returns Hex-encoded public key string
2822
2319
  **/
2823
2320
  static proteusFingerprintPrekeybundle(prekey: Uint8Array): string;
2824
- /**
2825
- * Imports all the data stored by Cryptobox into the CoreCrypto keystore
2826
- *
2827
- * @param storeName - The name of the IndexedDB store where the data is stored
2828
- *
2829
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2830
- * and use {@link CoreCryptoContext.proteusCryptoboxMigrate} instead.
2831
- */
2832
- proteusCryptoboxMigrate(storeName: string): Promise<void>;
2833
- /**
2834
- * Note: this call clears out the code and resets it to 0 (aka no error)
2835
- * @returns the last proteus error code that occured.
2836
- */
2837
- proteusLastErrorCode(): Promise<number>;
2838
- /**
2839
- * See {@link CoreCryptoContext.e2eiNewEnrollment}.
2840
- *
2841
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2842
- * and use {@link CoreCryptoContext.e2eiNewEnrollment} instead.
2843
- */
2844
- e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
2845
- /**
2846
- * See {@link CoreCryptoContext.e2eiNewActivationEnrollment}.
2847
- *
2848
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2849
- * and use {@link CoreCryptoContext.e2eiNewActivationEnrollment} instead.
2850
- */
2851
- e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
2852
- /**
2853
- * See {@link CoreCryptoContext.e2eiNewRotateEnrollment}.
2854
- *
2855
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2856
- * and use {@link CoreCryptoContext.e2eiNewRotateEnrollment} instead.
2857
- */
2858
- e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite$1, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
2859
- /**
2860
- * See {@link CoreCryptoContext.e2eiMlsInitOnly}.
2861
- *
2862
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2863
- * and use {@link CoreCryptoContext.e2eiMlsInitOnly} instead.
2864
- */
2865
- e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<string[] | undefined>;
2866
2321
  /**
2867
2322
  * See {@link CoreCryptoContext.e2eiDumpPKIEnv}.
2868
2323
  *
@@ -2874,55 +2329,6 @@ export declare class CoreCrypto {
2874
2329
  * @returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
2875
2330
  */
2876
2331
  e2eiIsPKIEnvSetup(): Promise<boolean>;
2877
- /**
2878
- * See {@link CoreCryptoContext.e2eiRegisterAcmeCA}.
2879
- *
2880
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2881
- * and use {@link CoreCryptoContext.e2eiRegisterAcmeCA} instead.
2882
- */
2883
- e2eiRegisterAcmeCA(trustAnchorPEM: string): Promise<void>;
2884
- /**
2885
- * See {@link CoreCryptoContext.e2eiRegisterIntermediateCA}.
2886
- *
2887
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2888
- * and use {@link CoreCryptoContext.e2eiRegisterIntermediateCA} instead.
2889
- */
2890
- e2eiRegisterIntermediateCA(certPEM: string): Promise<string[] | undefined>;
2891
- /**
2892
- * See {@link CoreCryptoContext.e2eiRegisterCRL}.
2893
- *
2894
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2895
- * and use {@link CoreCryptoContext.e2eiRegisterCRL} instead.
2896
- */
2897
- e2eiRegisterCRL(crlDP: string, crlDER: Uint8Array): Promise<CRLRegistration>;
2898
- /**
2899
- * See {@link CoreCryptoContext.e2eiRotateAll}.
2900
- *
2901
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2902
- * and use {@link CoreCryptoContext.e2eiRotateAll} instead.
2903
- */
2904
- e2eiRotateAll(enrollment: E2eiEnrollment, certificateChain: string, newKeyPackageCount: number): Promise<RotateBundle>;
2905
- /**
2906
- * See {@link CoreCryptoContext.e2eiEnrollmentStash}.
2907
- *
2908
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2909
- * and use {@link CoreCryptoContext.e2eiEnrollmentStash} instead.
2910
- */
2911
- e2eiEnrollmentStash(enrollment: E2eiEnrollment): Promise<Uint8Array>;
2912
- /**
2913
- * See {@link CoreCryptoContext.e2eiEnrollmentStashPop}.
2914
- *
2915
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2916
- * and use {@link CoreCryptoContext.e2eiEnrollmentStashPop} instead.
2917
- */
2918
- e2eiEnrollmentStashPop(handle: Uint8Array): Promise<E2eiEnrollment>;
2919
- /**
2920
- * See {@link CoreCryptoContext.e2eiConversationState}.
2921
- *
2922
- * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2923
- * and use {@link CoreCryptoContext.e2eiConversationState} instead.
2924
- */
2925
- e2eiConversationState(conversationId: ConversationId): Promise<E2eiConversationState>;
2926
2332
  /**
2927
2333
  * See {@link CoreCryptoContext.e2eiIsEnabled}.
2928
2334
  *
@@ -2937,7 +2343,7 @@ export declare class CoreCrypto {
2937
2343
  * @param deviceIds - identifiers of the devices
2938
2344
  * @returns identities or if no member has a x509 certificate, it will return an empty List
2939
2345
  */
2940
- getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity$1[]>;
2346
+ getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity[]>;
2941
2347
  /**
2942
2348
  * See {@link CoreCryptoContext.getUserIdentities}.
2943
2349
  *
@@ -2945,7 +2351,7 @@ export declare class CoreCrypto {
2945
2351
  * @param userIds - user identifiers hyphenated UUIDv4 e.g. 'bd4c7053-1c5a-4020-9559-cd7bf7961954'
2946
2352
  * @returns a Map with all the identities for a given users. Consumers are then recommended to reduce those identities to determine the actual status of a user.
2947
2353
  */
2948
- getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity$1[]>>;
2354
+ getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
2949
2355
  /**
2950
2356
  * See {@link CoreCryptoContext.getCredentialInUse}.
2951
2357
  *
@@ -2954,196 +2360,13 @@ export declare class CoreCrypto {
2954
2360
  * @returns see {@link E2eiConversationState}
2955
2361
  */
2956
2362
  getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType$1): Promise<E2eiConversationState>;
2957
- /**
2958
- * Returns the current version of {@link CoreCrypto}
2959
- *
2960
- * @returns The `core-crypto-ffi` version as defined in its `Cargo.toml` file
2961
- */
2962
- static version(): string;
2963
- /**
2964
- * Returns build metadata for the {@link CoreCrypto} libary.
2965
- *
2966
- * @returns varous build metadata for `core-crypto`.
2967
- */
2968
- static buildMetadata(): BuildMetadata;
2969
- }
2970
- type JsonRawData = Uint8Array;
2971
- export declare class E2eiEnrollment {
2972
- #private;
2973
- /** @hidden */
2974
- constructor(e2ei: unknown);
2975
- free(): void;
2976
- /**
2977
- * Should only be used internally
2978
- */
2979
- inner(): unknown;
2980
- /**
2981
- * Parses the response from `GET /acme/{provisioner-name}/directory`.
2982
- * Use this {@link AcmeDirectory} in the next step to fetch the first nonce from the acme server. Use
2983
- * {@link AcmeDirectory.newNonce}.
2984
- *
2985
- * @param directory HTTP response body
2986
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.1.1
2987
- */
2988
- directoryResponse(directory: JsonRawData): Promise<AcmeDirectory>;
2989
- /**
2990
- * For creating a new acme account. This returns a signed JWS-alike request body to send to
2991
- * `POST /acme/{provisioner-name}/new-account`.
2992
- *
2993
- * @param previousNonce you got from calling `HEAD {@link AcmeDirectory.newNonce}`
2994
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
2995
- */
2996
- newAccountRequest(previousNonce: string): Promise<JsonRawData>;
2997
- /**
2998
- * Parses the response from `POST /acme/{provisioner-name}/new-account`.
2999
- * @param account HTTP response body
3000
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
3001
- */
3002
- newAccountResponse(account: JsonRawData): Promise<void>;
3003
- /**
3004
- * Creates a new acme order for the handle (userId + display name) and the clientId.
3005
- *
3006
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/new-account`
3007
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
3008
- */
3009
- newOrderRequest(previousNonce: string): Promise<JsonRawData>;
3010
- /**
3011
- * Parses the response from `POST /acme/{provisioner-name}/new-order`.
3012
- *
3013
- * @param order HTTP response body
3014
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
3015
- */
3016
- newOrderResponse(order: JsonRawData): Promise<NewAcmeOrder>;
3017
- /**
3018
- * Creates a new authorization request.
3019
- *
3020
- * @param url one of the URL in new order's authorizations (use {@link NewAcmeOrder.authorizations} from {@link newOrderResponse})
3021
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/new-order` (or from the
3022
- * previous to this method if you are creating the second authorization)
3023
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
3024
- */
3025
- newAuthzRequest(url: string, previousNonce: string): Promise<JsonRawData>;
3026
- /**
3027
- * Parses the response from `POST /acme/{provisioner-name}/authz/{authz-id}`
3028
- *
3029
- * @param authz HTTP response body
3030
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
3031
- */
3032
- newAuthzResponse(authz: JsonRawData): Promise<NewAcmeAuthz>;
3033
- /**
3034
- * Generates a new client Dpop JWT token. It demonstrates proof of possession of the nonces
3035
- * (from wire-server & acme server) and will be verified by the acme server when verifying the
3036
- * challenge (in order to deliver a certificate).
3037
- *
3038
- * Then send it to `POST /clients/{id}/access-token`
3039
- * {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token} on wire-server.
3040
- *
3041
- * @param expirySecs of the client Dpop JWT. This should be equal to the grace period set in Team Management
3042
- * @param backendNonce you get by calling `GET /clients/token/nonce` on wire-server as defined here {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_clients__client__nonce}
3043
- */
3044
- createDpopToken(expirySecs: number, backendNonce: string): Promise<Uint8Array>;
3045
- /**
3046
- * Creates a new challenge request for Wire Dpop challenge.
3047
- *
3048
- * @param accessToken returned by wire-server from https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token
3049
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
3050
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
3051
- */
3052
- newDpopChallengeRequest(accessToken: string, previousNonce: string): Promise<JsonRawData>;
3053
- /**
3054
- * Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}` for the DPoP challenge.
3055
- *
3056
- * @param challenge HTTP response body
3057
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
3058
- */
3059
- newDpopChallengeResponse(challenge: JsonRawData): Promise<void>;
3060
- /**
3061
- * Creates a new challenge request for Wire Oidc challenge.
3062
- *
3063
- * @param idToken you get back from Identity Provider
3064
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
3065
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
3066
- */
3067
- newOidcChallengeRequest(idToken: string, previousNonce: string): Promise<JsonRawData>;
3068
- /**
3069
- * Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}` for the OIDC challenge.
3070
- *
3071
- * @param cc the CoreCrypto instance
3072
- * @param challenge HTTP response body
3073
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
3074
- */
3075
- newOidcChallengeResponse(challenge: JsonRawData): Promise<void>;
3076
- /**
3077
- * Verifies that the previous challenge has been completed.
3078
- *
3079
- * @param orderUrl `location` header from http response you got from {@link newOrderResponse}
3080
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/challenge/{challenge-id}`
3081
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
3082
- */
3083
- checkOrderRequest(orderUrl: string, previousNonce: string): Promise<JsonRawData>;
3084
- /**
3085
- * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}`.
3086
- *
3087
- * @param order HTTP response body
3088
- * @return finalize url to use with {@link finalizeRequest}
3089
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
3090
- */
3091
- checkOrderResponse(order: JsonRawData): Promise<string>;
3092
- /**
3093
- * Final step before fetching the certificate.
3094
- *
3095
- * @param previousNonce - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
3096
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
3097
- */
3098
- finalizeRequest(previousNonce: string): Promise<JsonRawData>;
3099
- /**
3100
- * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}/finalize`.
3101
- *
3102
- * @param finalize HTTP response body
3103
- * @return the certificate url to use with {@link certificateRequest}
3104
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
3105
- */
3106
- finalizeResponse(finalize: JsonRawData): Promise<string>;
3107
- /**
3108
- * Creates a request for finally fetching the x509 certificate.
3109
- *
3110
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}/finalize`
3111
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4.2
3112
- */
3113
- certificateRequest(previousNonce: string): Promise<JsonRawData>;
3114
- }
3115
- /**
3116
- * Indicates the state of a Conversation regarding end-to-end identity.
3117
- * Note: this does not check pending state (pending commit, pending proposals) so it does not
3118
- * consider members about to be added/removed
3119
- */
3120
- export declare enum E2eiConversationState {
3121
- /**
3122
- * All clients have a valid E2EI certificate
3123
- */
3124
- Verified = 1,
3125
- /**
3126
- * Some clients are either still Basic or their certificate is expired
3127
- */
3128
- NotVerified = 2,
3129
- /**
3130
- * All clients are still Basic. If all client have expired certificates, NotVerified is returned.
3131
- */
3132
- NotEnabled = 3
3133
2363
  }
3134
2364
 
3135
2365
  export {
3136
2366
  Ciphersuite$1 as Ciphersuite,
3137
- ConversationConfiguration as ConversationConfigurationFfi,
3138
- ConversationConfiguration$1 as ConversationConfiguration,
3139
- CoreCryptoContext as CoreCryptoContextFfi,
3140
2367
  CoreCryptoContext$1 as CoreCryptoContext,
3141
2368
  CredentialType$1 as CredentialType,
3142
- CustomConfiguration as CustomConfigurationFfi,
3143
- CustomConfiguration$1 as CustomConfiguration,
3144
- WireIdentity$1 as WireIdentity,
3145
2369
  WirePolicy$1 as WirePolicy,
3146
- X509Identity$1 as X509Identity,
3147
2370
  };
3148
2371
 
3149
2372
  export {};