@wireapp/core-crypto 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,53 @@
1
+ declare enum Ciphersuite {
2
+ /**
3
+ * DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
4
+ */
5
+ MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1,
6
+ /**
7
+ * DH KEM P256 | AES-GCM 128 | SHA2-256 | EcDSA P256
8
+ */
9
+ MLS_128_DHKEMP256_AES128GCM_SHA256_P256 = 2,
10
+ /**
11
+ * DH KEM x25519 | Chacha20Poly1305 | SHA2-256 | Ed25519
12
+ */
13
+ MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519 = 3,
14
+ /**
15
+ * DH KEM x448 | AES-GCM 256 | SHA2-512 | Ed448
16
+ */
17
+ MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448 = 4,
18
+ /**
19
+ * DH KEM P521 | AES-GCM 256 | SHA2-512 | EcDSA P521
20
+ */
21
+ MLS_256_DHKEMP521_AES256GCM_SHA512_P521 = 5,
22
+ /**
23
+ * DH KEM x448 | Chacha20Poly1305 | SHA2-512 | Ed448
24
+ */
25
+ MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448 = 6,
26
+ /**
27
+ * DH KEM P384 | AES-GCM 256 | SHA2-384 | EcDSA P384
28
+ */
29
+ MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
30
+ }
31
+ declare enum WirePolicy {
32
+ /**
33
+ * Handshake messages are never encrypted
34
+ */
35
+ Plaintext = 1,
36
+ /**
37
+ * Handshake messages are always encrypted
38
+ */
39
+ Ciphertext = 2
40
+ }
41
+ declare enum CredentialType {
42
+ /**
43
+ * Just a KeyPair
44
+ */
45
+ Basic = 1,
46
+ /**
47
+ * A certificate obtained through e2e identity enrollment process
48
+ */
49
+ X509 = 2
50
+ }
1
51
  /**
2
52
  * For creating a challenge.
3
53
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
@@ -19,6 +69,635 @@ export class AcmeChallenge {
19
69
  readonly url: string;
20
70
  }
21
71
  /**
72
+ * see [core_crypto::prelude::MlsConversationConfiguration]
73
+ */
74
+ declare class ConversationConfiguration {
75
+ free(): void;
76
+ /**
77
+ * @param {Ciphersuite | undefined} [ciphersuite]
78
+ * @param {(Uint8Array)[] | undefined} [external_senders]
79
+ * @param {number | undefined} [key_rotation_span]
80
+ * @param {WirePolicy | undefined} [wire_policy]
81
+ */
82
+ constructor(ciphersuite?: Ciphersuite, external_senders?: (Uint8Array)[], key_rotation_span?: number, wire_policy?: WirePolicy);
83
+ }
84
+ /**
85
+ */
86
+ declare class CoreCryptoContext {
87
+ free(): void;
88
+ /**
89
+ * Returns: [`WasmCryptoResult<()>`]
90
+ *
91
+ * see [core_crypto::context::CentralContext::set_data]
92
+ * @param {Uint8Array} data
93
+ * @returns {Promise<any>}
94
+ */
95
+ set_data(data: Uint8Array): Promise<any>;
96
+ /**
97
+ * Returns: [`WasmCryptoResult<Option<js_sys::Uint8Array>>`]
98
+ *
99
+ * see [core_crypto::context::CentralContext::get_data]
100
+ * @returns {Promise<any>}
101
+ */
102
+ get_data(): Promise<any>;
103
+ /**
104
+ * see [core_crypto::mls::context::CentralContext::mls_init]
105
+ * @param {Uint8Array} client_id
106
+ * @param {Uint16Array} ciphersuites
107
+ * @param {number | undefined} [nb_key_package]
108
+ * @returns {Promise<any>}
109
+ */
110
+ mls_init(client_id: Uint8Array, ciphersuites: Uint16Array, nb_key_package?: number): Promise<any>;
111
+ /**
112
+ * Returns [`WasmCryptoResult<Vec<u8>>`]
113
+ *
114
+ * See [core_crypto::mls::context::CentralContext::mls_generate_keypairs]
115
+ * @param {Uint16Array} ciphersuites
116
+ * @returns {Promise<any>}
117
+ */
118
+ mls_generate_keypair(ciphersuites: Uint16Array): Promise<any>;
119
+ /**
120
+ * Returns [`WasmCryptoResult<()>`]
121
+ *
122
+ * See [core_crypto::mls::context::CentralContext::mls_init_with_client_id]
123
+ * @param {Uint8Array} client_id
124
+ * @param {(Uint8Array)[]} signature_public_keys
125
+ * @param {Uint16Array} ciphersuites
126
+ * @returns {Promise<any>}
127
+ */
128
+ mls_init_with_client_id(client_id: Uint8Array, signature_public_keys: (Uint8Array)[], ciphersuites: Uint16Array): Promise<any>;
129
+ /**
130
+ * Returns:: [`WasmCryptoResult<js_sys::Uint8Array>`]
131
+ *
132
+ * see [core_crypto::mls::context::CentralContext::client_public_key]
133
+ * @param {Ciphersuite} ciphersuite
134
+ * @param {CredentialType} credential_type
135
+ * @returns {Promise<any>}
136
+ */
137
+ client_public_key(ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<any>;
138
+ /**
139
+ * Returns: [`WasmCryptoResult<js_sys::Array<js_sys::Uint8Array>>`]
140
+ *
141
+ * see [core_crypto::mls::context::CentralContext::get_or_create_client_keypackages]
142
+ * @param {Ciphersuite} ciphersuite
143
+ * @param {CredentialType} credential_type
144
+ * @param {number} amount_requested
145
+ * @returns {Promise<any>}
146
+ */
147
+ client_keypackages(ciphersuite: Ciphersuite, credential_type: CredentialType, amount_requested: number): Promise<any>;
148
+ /**
149
+ * Returns: [`WasmCryptoResult<usize>`]
150
+ *
151
+ * see [core_crypto::mls::context::CentralContext::client_valid_key_packages_count]
152
+ * @param {Ciphersuite} ciphersuite
153
+ * @param {CredentialType} credential_type
154
+ * @returns {Promise<any>}
155
+ */
156
+ client_valid_keypackages_count(ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<any>;
157
+ /**
158
+ * Returns: [`WasmCryptoResult<usize>`]
159
+ *
160
+ * see [core_crypto::mls::context::CentralContext::delete_keypackages]
161
+ * @param {(Uint8Array)[]} refs
162
+ * @returns {Promise<any>}
163
+ */
164
+ delete_keypackages(refs: (Uint8Array)[]): Promise<any>;
165
+ /**
166
+ * Returns: [`WasmCryptoResult<()>`]
167
+ *
168
+ * see [core_crypto::mls::context::CentralContext::new_conversation]
169
+ * @param {Uint8Array} conversation_id
170
+ * @param {CredentialType} creator_credential_type
171
+ * @param {ConversationConfiguration} config
172
+ * @returns {Promise<any>}
173
+ */
174
+ create_conversation(conversation_id: Uint8Array, creator_credential_type: CredentialType, config: ConversationConfiguration): Promise<any>;
175
+ /**
176
+ * Returns [`WasmCryptoResult<u64>`]
177
+ *
178
+ * see [core_crypto::mls::context::CentralContext::conversation_epoch]
179
+ * @param {Uint8Array} conversation_id
180
+ * @returns {Promise<any>}
181
+ */
182
+ conversation_epoch(conversation_id: Uint8Array): Promise<any>;
183
+ /**
184
+ * Returns [`WasmCryptoResult<Ciphersuite>`]
185
+ *
186
+ * see [core_crypto::mls::context::CentralContext::conversation_ciphersuite]
187
+ * @param {Uint8Array} conversation_id
188
+ * @returns {Promise<any>}
189
+ */
190
+ conversation_ciphersuite(conversation_id: Uint8Array): Promise<any>;
191
+ /**
192
+ * Returns: [`bool`]
193
+ *
194
+ * see [core_crypto::mls::context::CentralContext::conversation_exists]
195
+ * @param {Uint8Array} conversation_id
196
+ * @returns {Promise<any>}
197
+ */
198
+ conversation_exists(conversation_id: Uint8Array): Promise<any>;
199
+ /**
200
+ * Returns: [`WasmCryptoResult<Uint8Array>`]
201
+ *
202
+ * see [core_crypto::mls::context::CentralContext::process_raw_welcome_message]
203
+ * @param {Uint8Array} welcome_message
204
+ * @param {CustomConfiguration} custom_configuration
205
+ * @returns {Promise<any>}
206
+ */
207
+ process_welcome_message(welcome_message: Uint8Array, custom_configuration: CustomConfiguration): Promise<any>;
208
+ /**
209
+ * Returns: [`WasmCryptoResult<Option<MemberAddedMessages>>`]
210
+ *
211
+ * see [core_crypto::mls::context::CentralContext::add_members_to_conversation]
212
+ * @param {Uint8Array} conversation_id
213
+ * @param {(Uint8Array)[]} key_packages
214
+ * @returns {Promise<any>}
215
+ */
216
+ add_clients_to_conversation(conversation_id: Uint8Array, key_packages: (Uint8Array)[]): Promise<any>;
217
+ /**
218
+ * Returns: [`WasmCryptoResult<Option<js_sys::Uint8Array>>`]
219
+ *
220
+ * see [core_crypto::mls::context::CentralContext::remove_members_from_conversation]
221
+ * @param {Uint8Array} conversation_id
222
+ * @param {(Uint8Array)[]} clients
223
+ * @returns {Promise<any>}
224
+ */
225
+ remove_clients_from_conversation(conversation_id: Uint8Array, clients: (Uint8Array)[]): Promise<any>;
226
+ /**
227
+ * Returns: [`WasmCryptoResult<()>`]
228
+ *
229
+ * see [core_crypto::mls::context::CentralContext::mark_conversation_as_child_of]
230
+ * @param {Uint8Array} child_id
231
+ * @param {Uint8Array} parent_id
232
+ * @returns {Promise<any>}
233
+ */
234
+ mark_conversation_as_child_of(child_id: Uint8Array, parent_id: Uint8Array): Promise<any>;
235
+ /**
236
+ * Returns: [`WasmCryptoResult<CommitBundle>`]
237
+ *
238
+ * see [core_crypto::mls::context::CentralContext::update_keying_material]
239
+ * @param {Uint8Array} conversation_id
240
+ * @returns {Promise<any>}
241
+ */
242
+ update_keying_material(conversation_id: Uint8Array): Promise<any>;
243
+ /**
244
+ * see [core_crypto::mls::context::CentralContext::commit_pending_proposals]
245
+ * @param {Uint8Array} conversation_id
246
+ * @returns {Promise<any>}
247
+ */
248
+ commit_pending_proposals(conversation_id: Uint8Array): Promise<any>;
249
+ /**
250
+ * Returns: [`WasmCryptoResult<()>`]
251
+ *
252
+ * see [core_crypto::mls::context::CentralContext::wipe_conversation]
253
+ * @param {Uint8Array} conversation_id
254
+ * @returns {Promise<any>}
255
+ */
256
+ wipe_conversation(conversation_id: Uint8Array): Promise<any>;
257
+ /**
258
+ * Returns: [`WasmCryptoResult<DecryptedMessage>`]
259
+ *
260
+ * see [core_crypto::mls::context::CentralContext::decrypt_message]
261
+ * @param {Uint8Array} conversation_id
262
+ * @param {Uint8Array} payload
263
+ * @returns {Promise<any>}
264
+ */
265
+ decrypt_message(conversation_id: Uint8Array, payload: Uint8Array): Promise<any>;
266
+ /**
267
+ * Returns: [`WasmCryptoResult<Uint8Array>`]
268
+ *
269
+ * see [core_crypto::mls::context::CentralContext::encrypt_message]
270
+ * @param {Uint8Array} conversation_id
271
+ * @param {Uint8Array} message
272
+ * @returns {Promise<any>}
273
+ */
274
+ encrypt_message(conversation_id: Uint8Array, message: Uint8Array): Promise<any>;
275
+ /**
276
+ * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
277
+ *
278
+ * see [core_crypto::mls::context::CentralContext::new_add_proposal]
279
+ * @param {Uint8Array} conversation_id
280
+ * @param {Uint8Array} keypackage
281
+ * @returns {Promise<any>}
282
+ */
283
+ new_add_proposal(conversation_id: Uint8Array, keypackage: Uint8Array): Promise<any>;
284
+ /**
285
+ * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
286
+ *
287
+ * see [core_crypto::mls::context::CentralContext::new_update_proposal]
288
+ * @param {Uint8Array} conversation_id
289
+ * @returns {Promise<any>}
290
+ */
291
+ new_update_proposal(conversation_id: Uint8Array): Promise<any>;
292
+ /**
293
+ * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
294
+ *
295
+ * see [core_crypto::mls::context::CentralContext::new_remove_proposal]
296
+ * @param {Uint8Array} conversation_id
297
+ * @param {Uint8Array} client_id
298
+ * @returns {Promise<any>}
299
+ */
300
+ new_remove_proposal(conversation_id: Uint8Array, client_id: Uint8Array): Promise<any>;
301
+ /**
302
+ * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
303
+ *
304
+ * see [core_crypto::mls::context::CentralContext::new_external_add_proposal]
305
+ * @param {Uint8Array} conversation_id
306
+ * @param {number} epoch
307
+ * @param {Ciphersuite} ciphersuite
308
+ * @param {CredentialType} credential_type
309
+ * @returns {Promise<any>}
310
+ */
311
+ new_external_add_proposal(conversation_id: Uint8Array, epoch: number, ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<any>;
312
+ /**
313
+ * Returns: [`WasmCryptoResult<ConversationInitBundle>`]
314
+ *
315
+ * see [core_crypto::mls::context::CentralContext::join_by_external_commit]
316
+ * @param {Uint8Array} group_info
317
+ * @param {CustomConfiguration} custom_configuration
318
+ * @param {CredentialType} credential_type
319
+ * @returns {Promise<any>}
320
+ */
321
+ join_by_external_commit(group_info: Uint8Array, custom_configuration: CustomConfiguration, credential_type: CredentialType): Promise<any>;
322
+ /**
323
+ * Returns: [`WasmCryptoResult<()>`]
324
+ *
325
+ * see [core_crypto::mls::context::CentralContext::merge_pending_group_from_external_commit]
326
+ * @param {Uint8Array} conversation_id
327
+ * @returns {Promise<any>}
328
+ */
329
+ merge_pending_group_from_external_commit(conversation_id: Uint8Array): Promise<any>;
330
+ /**
331
+ * Returns: [`WasmCryptoResult<()>`]
332
+ *
333
+ * see [core_crypto::mls::context::CentralContext::clear_pending_group_from_external_commit]
334
+ * @param {Uint8Array} conversation_id
335
+ * @returns {Promise<any>}
336
+ */
337
+ clear_pending_group_from_external_commit(conversation_id: Uint8Array): Promise<any>;
338
+ /**
339
+ * see [core_crypto::mls::context::CentralContext::commit_accepted]
340
+ * @param {Uint8Array} conversation_id
341
+ * @returns {Promise<any>}
342
+ */
343
+ commit_accepted(conversation_id: Uint8Array): Promise<any>;
344
+ /**
345
+ * see [core_crypto::mls::context::CentralContext::clear_pending_proposal]
346
+ * @param {Uint8Array} conversation_id
347
+ * @param {Uint8Array} proposal_ref
348
+ * @returns {Promise<any>}
349
+ */
350
+ clear_pending_proposal(conversation_id: Uint8Array, proposal_ref: Uint8Array): Promise<any>;
351
+ /**
352
+ * see [core_crypto::mls::context::CentralContext::clear_pending_commit]
353
+ * @param {Uint8Array} conversation_id
354
+ * @returns {Promise<any>}
355
+ */
356
+ clear_pending_commit(conversation_id: Uint8Array): Promise<any>;
357
+ /**
358
+ * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
359
+ *
360
+ * see [core_crypto::mls::context::CentralContext::random_bytes]
361
+ * @param {number} len
362
+ * @returns {Promise<any>}
363
+ */
364
+ random_bytes(len: number): Promise<any>;
365
+ /**
366
+ * Returns: [`WasmCryptoResult<Vec<u8>>`]
367
+ *
368
+ * see [core_crypto::mls::context::CentralContext::export_secret_key]
369
+ * @param {Uint8Array} conversation_id
370
+ * @param {number} key_length
371
+ * @returns {Promise<any>}
372
+ */
373
+ export_secret_key(conversation_id: Uint8Array, key_length: number): Promise<any>;
374
+ /**
375
+ * Returns: [`WasmCryptoResult<Vec<u8>>`]
376
+ *
377
+ * see [core_crypto::mls::context::CentralContext::get_external_sender]
378
+ * @param {Uint8Array} id
379
+ * @returns {Promise<any>}
380
+ */
381
+ get_external_sender(id: Uint8Array): Promise<any>;
382
+ /**
383
+ * Returns: [`WasmCryptoResult<Box<[js_sys::Uint8Array]>`]
384
+ *
385
+ * see [core_crypto::mls::context::CentralContext::get_client_ids]
386
+ * @param {Uint8Array} conversation_id
387
+ * @returns {Promise<any>}
388
+ */
389
+ get_client_ids(conversation_id: Uint8Array): Promise<any>;
390
+ /**
391
+ * Returns: [`WasmCryptoResult<()>`]
392
+ *
393
+ * See [core_crypto::context::CentralContext::proteus_session_from_prekey]
394
+ * @param {string} session_id
395
+ * @param {Uint8Array} prekey
396
+ * @returns {Promise<any>}
397
+ */
398
+ proteus_session_from_prekey(session_id: string, prekey: Uint8Array): Promise<any>;
399
+ /**
400
+ * Returns: [`WasmCryptoResult<Vec<u8>>`]
401
+ *
402
+ * See [core_crypto::context::CentralContext::proteus_session_from_message]
403
+ * @param {string} session_id
404
+ * @param {Uint8Array} envelope
405
+ * @returns {Promise<any>}
406
+ */
407
+ proteus_session_from_message(session_id: string, envelope: Uint8Array): Promise<any>;
408
+ /**
409
+ * Returns: [`WasmCryptoResult<()>`]
410
+ *
411
+ * /// **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
412
+ *
413
+ * See [core_crypto::context::CentralContext::proteus_session_save]
414
+ * @param {string} session_id
415
+ * @returns {Promise<any>}
416
+ */
417
+ proteus_session_save(session_id: string): Promise<any>;
418
+ /**
419
+ * Returns: [`WasmCryptoResult<()>`]
420
+ *
421
+ * See [core_crypto::context::CentralContext::proteus_session_delete]
422
+ * @param {string} session_id
423
+ * @returns {Promise<any>}
424
+ */
425
+ proteus_session_delete(session_id: string): Promise<any>;
426
+ /**
427
+ * Returns: [`WasmCryptoResult<bool>`]
428
+ *
429
+ * See [core_crypto::context::CentralContext::proteus_session_exists]
430
+ * @param {string} session_id
431
+ * @returns {Promise<any>}
432
+ */
433
+ proteus_session_exists(session_id: string): Promise<any>;
434
+ /**
435
+ * Returns: [`WasmCryptoResult<Vec<u8>>`]
436
+ *
437
+ * See [core_crypto::context::CentralContext::proteus_decrypt]
438
+ * @param {string} session_id
439
+ * @param {Uint8Array} ciphertext
440
+ * @returns {Promise<any>}
441
+ */
442
+ proteus_decrypt(session_id: string, ciphertext: Uint8Array): Promise<any>;
443
+ /**
444
+ * Returns: [`WasmCryptoResult<js_sys::Uint8Array>`]
445
+ *
446
+ * See [core_crypto::context::CentralContext::proteus_encrypt]
447
+ * @param {string} session_id
448
+ * @param {Uint8Array} plaintext
449
+ * @returns {Promise<any>}
450
+ */
451
+ proteus_encrypt(session_id: string, plaintext: Uint8Array): Promise<any>;
452
+ /**
453
+ * Returns: [`WasmCryptoResult<js_sys::Map<string, Uint8Array>>`]
454
+ *
455
+ * See [core_crypto::context::CentralContext::proteus_encrypt_batched]
456
+ * @param {(string)[]} sessions
457
+ * @param {Uint8Array} plaintext
458
+ * @returns {Promise<any>}
459
+ */
460
+ proteus_encrypt_batched(sessions: (string)[], plaintext: Uint8Array): Promise<any>;
461
+ /**
462
+ * Returns: [`WasmCryptoResult<Uint8Array>`]
463
+ *
464
+ * See [core_crypto::context::CentralContext::proteus_new_prekey]
465
+ * @param {number} prekey_id
466
+ * @returns {Promise<any>}
467
+ */
468
+ proteus_new_prekey(prekey_id: number): Promise<any>;
469
+ /**
470
+ * Returns: [`WasmCryptoResult<ProteusAutoPrekeyBundle>`]
471
+ *
472
+ * See [core_crypto::context::CentralContext::proteus_new_prekey_auto]
473
+ * @returns {Promise<any>}
474
+ */
475
+ proteus_new_prekey_auto(): Promise<any>;
476
+ /**
477
+ * Returns [`WasmCryptoResult<Uint8Array>`]
478
+ *
479
+ * See [core_crypto::context::CentralContext::proteus_last_resort_prekey]
480
+ * @returns {Promise<any>}
481
+ */
482
+ proteus_last_resort_prekey(): Promise<any>;
483
+ /**
484
+ * Returns: [`WasmCryptoResult<u16>`]
485
+ *
486
+ * See [core_crypto::context::CentralContext::proteus_last_resort_prekey_id]
487
+ * @returns {number}
488
+ */
489
+ static proteus_last_resort_prekey_id(): number;
490
+ /**
491
+ * Returns: [`WasmCryptoResult<String>`]
492
+ *
493
+ * See [core_crypto::context::CentralContext::proteus_fingerprint]
494
+ * @returns {Promise<string>}
495
+ */
496
+ proteus_fingerprint(): Promise<string>;
497
+ /**
498
+ * Returns: [`WasmCryptoResult<String>`]
499
+ *
500
+ * see [core_crypto::proteus::ProteusCentral::fingerprint_local]
501
+ * @param {string} session_id
502
+ * @returns {Promise<string>}
503
+ */
504
+ proteus_fingerprint_local(session_id: string): Promise<string>;
505
+ /**
506
+ * Returns: [`WasmCryptoResult<String>`]
507
+ *
508
+ * See [core_crypto::context::CentralContext::proteus_fingerprint_remote]
509
+ * @param {string} session_id
510
+ * @returns {Promise<string>}
511
+ */
512
+ proteus_fingerprint_remote(session_id: string): Promise<string>;
513
+ /**
514
+ * Returns: [`WasmCryptoResult<String>`]
515
+ *
516
+ * See [core_crypto::proteus::ProteusCentral::fingerprint_prekeybundle]
517
+ * @param {Uint8Array} prekey
518
+ * @returns {string}
519
+ */
520
+ static proteus_fingerprint_prekeybundle(prekey: Uint8Array): string;
521
+ /**
522
+ * Returns: [`WasmCryptoResult<()>`]
523
+ *
524
+ * See [core_crypto::context::CentralContext::proteus_cryptobox_migrate]
525
+ * @param {string} path
526
+ * @returns {Promise<any>}
527
+ */
528
+ proteus_cryptobox_migrate(path: string): Promise<any>;
529
+ /**
530
+ * Returns: [`WasmCryptoResult<u32>`]
531
+ *
532
+ * NOTE: This will clear the last error code.
533
+ * @returns {Promise<any>}
534
+ */
535
+ proteus_last_error_code(): Promise<any>;
536
+ /**
537
+ * Returns: [`WasmCryptoResult<E2eiEnrollment>`]
538
+ *
539
+ * see [core_crypto::mls::context::CentralContext::e2ei_new_enrollment]
540
+ * @param {string} client_id
541
+ * @param {string} display_name
542
+ * @param {string} handle
543
+ * @param {string | undefined} team
544
+ * @param {number} expiry_sec
545
+ * @param {Ciphersuite} ciphersuite
546
+ * @returns {Promise<any>}
547
+ */
548
+ e2ei_new_enrollment(client_id: string, display_name: string, handle: string, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<any>;
549
+ /**
550
+ * Returns: [`WasmCryptoResult<E2eiEnrollment>`]
551
+ *
552
+ * see [core_crypto::mls::context::CentralContext::e2ei_new_activation_enrollment]
553
+ * @param {string} display_name
554
+ * @param {string} handle
555
+ * @param {string | undefined} team
556
+ * @param {number} expiry_sec
557
+ * @param {Ciphersuite} ciphersuite
558
+ * @returns {Promise<any>}
559
+ */
560
+ e2ei_new_activation_enrollment(display_name: string, handle: string, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<any>;
561
+ /**
562
+ * Returns: [`WasmCryptoResult<E2eiEnrollment>`]
563
+ *
564
+ * see [core_crypto::mls::context::CentralContext::e2ei_new_rotate_enrollment]
565
+ * @param {string | undefined} display_name
566
+ * @param {string | undefined} handle
567
+ * @param {string | undefined} team
568
+ * @param {number} expiry_sec
569
+ * @param {Ciphersuite} ciphersuite
570
+ * @returns {Promise<any>}
571
+ */
572
+ e2ei_new_rotate_enrollment(display_name: string | undefined, handle: string | undefined, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<any>;
573
+ /**
574
+ * See [core_crypto::mls::context::CentralContext::e2ei_dump_pki_env]
575
+ * @returns {Promise<Promise<any>>}
576
+ */
577
+ e2ei_dump_pki_env(): Promise<Promise<any>>;
578
+ /**
579
+ * See [core_crypto::mls::context::CentralContext::e2ei_is_pki_env_setup]
580
+ * @returns {Promise<Promise<any>>}
581
+ */
582
+ e2ei_is_pki_env_setup(): Promise<Promise<any>>;
583
+ /**
584
+ * See [core_crypto::mls::context::CentralContext::e2ei_register_acme_ca]
585
+ * @param {string} trust_anchor_pem
586
+ * @returns {Promise<Promise<any>>}
587
+ */
588
+ e2ei_register_acme_ca(trust_anchor_pem: string): Promise<Promise<any>>;
589
+ /**
590
+ * See [core_crypto::mls::context::CentralContext::e2ei_register_intermediate_ca]
591
+ * @param {string} cert_pem
592
+ * @returns {Promise<Promise<any>>}
593
+ */
594
+ e2ei_register_intermediate_ca(cert_pem: string): Promise<Promise<any>>;
595
+ /**
596
+ * See [core_crypto::mls::context::CentralContext::e2ei_register_crl]
597
+ * @param {string} crl_dp
598
+ * @param {Uint8Array} crl_der
599
+ * @returns {Promise<Promise<any>>}
600
+ */
601
+ e2ei_register_crl(crl_dp: string, crl_der: Uint8Array): Promise<Promise<any>>;
602
+ /**
603
+ * see [core_crypto::mls::context::CentralContext::e2ei_mls_init_only]
604
+ * @param {FfiWireE2EIdentity} enrollment
605
+ * @param {string} certificate_chain
606
+ * @param {number | undefined} [nb_key_package]
607
+ * @returns {Promise<any>}
608
+ */
609
+ e2ei_mls_init_only(enrollment: FfiWireE2EIdentity, certificate_chain: string, nb_key_package?: number): Promise<any>;
610
+ /**
611
+ * Returns: [`WasmCryptoResult<CommitBundle>`]
612
+ * see [core_crypto::context::CentralContext::e2ei_rotate]
613
+ * @param {Uint8Array} conversation_id
614
+ * @returns {Promise<any>}
615
+ */
616
+ e2ei_rotate(conversation_id: Uint8Array): Promise<any>;
617
+ /**
618
+ * see [core_crypto::mls::context::CentralContext::e2ei_rotate_all]
619
+ * @param {FfiWireE2EIdentity} enrollment
620
+ * @param {string} certificate_chain
621
+ * @param {number} new_key_packages_count
622
+ * @returns {Promise<any>}
623
+ */
624
+ e2ei_rotate_all(enrollment: FfiWireE2EIdentity, certificate_chain: string, new_key_packages_count: number): Promise<any>;
625
+ /**
626
+ * see [core_crypto::mls::context::CentralContext::e2ei_enrollment_stash]
627
+ * @param {FfiWireE2EIdentity} enrollment
628
+ * @returns {Promise<any>}
629
+ */
630
+ e2ei_enrollment_stash(enrollment: FfiWireE2EIdentity): Promise<any>;
631
+ /**
632
+ * see [core_crypto::mls::context::CentralContext::e2ei_enrollment_stash_pop]
633
+ * @param {Uint8Array} handle
634
+ * @returns {Promise<any>}
635
+ */
636
+ e2ei_enrollment_stash_pop(handle: Uint8Array): Promise<any>;
637
+ /**
638
+ * Returns [`WasmCryptoResult<u8>`]
639
+ *
640
+ * see [core_crypto::mls::context::CentralContext::e2ei_conversation_state]
641
+ * @param {Uint8Array} conversation_id
642
+ * @returns {Promise<any>}
643
+ */
644
+ e2ei_conversation_state(conversation_id: Uint8Array): Promise<any>;
645
+ /**
646
+ * Returns [`WasmCryptoResult<bool>`]
647
+ *
648
+ * see [core_crypto::mls::context::CentralContext::e2ei_is_enabled]
649
+ * @param {Ciphersuite} ciphersuite
650
+ * @returns {Promise<any>}
651
+ */
652
+ e2ei_is_enabled(ciphersuite: Ciphersuite): Promise<any>;
653
+ /**
654
+ * Returns [`WasmCryptoResult<Vec<WireIdentity>>`]
655
+ *
656
+ * see [core_crypto::mls::context::CentralContext::get_device_identities]
657
+ * @param {Uint8Array} conversation_id
658
+ * @param {(Uint8Array)[]} device_ids
659
+ * @returns {Promise<any>}
660
+ */
661
+ get_device_identities(conversation_id: Uint8Array, device_ids: (Uint8Array)[]): Promise<any>;
662
+ /**
663
+ * Returns [`WasmCryptoResult<HashMap<String, Vec<WireIdentity>>>`]
664
+ *
665
+ * see [core_crypto::mls::context::CentralContext::get_user_identities]
666
+ * @param {Uint8Array} conversation_id
667
+ * @param {(string)[]} user_ids
668
+ * @returns {Promise<any>}
669
+ */
670
+ get_user_identities(conversation_id: Uint8Array, user_ids: (string)[]): Promise<any>;
671
+ /**
672
+ * Returns: [`WasmCryptoResult<u8>`]
673
+ *
674
+ * see [core_crypto::mls::context::CentralContext::get_credential_in_use]
675
+ * @param {Uint8Array} group_info
676
+ * @param {CredentialType} credential_type
677
+ * @returns {Promise<any>}
678
+ */
679
+ get_credential_in_use(group_info: Uint8Array, credential_type: CredentialType): Promise<any>;
680
+ }
681
+ declare class CoreCryptoWasmLogger {
682
+ free(): void;
683
+ /**
684
+ * @param {Function} logger
685
+ * @param {any} ctx
686
+ */
687
+ constructor(logger: Function, ctx: any);
688
+ }
689
+ /**
690
+ * see [core_crypto::prelude::MlsCustomConfiguration]
691
+ */
692
+ declare class CustomConfiguration {
693
+ free(): void;
694
+ /**
695
+ * @param {number | undefined} [key_rotation_span]
696
+ * @param {WirePolicy | undefined} [wire_policy]
697
+ */
698
+ constructor(key_rotation_span?: number, wire_policy?: WirePolicy);
699
+ }
700
+ /**
22
701
  * Dump of the PKI environemnt as PEM
23
702
  */
24
703
  export class E2eiDumpedPkiEnv {
@@ -36,6 +715,116 @@ export class E2eiDumpedPkiEnv {
36
715
  */
37
716
  readonly root_ca: string;
38
717
  }
718
+ declare class FfiWireE2EIdentity {
719
+ free(): void;
720
+ /**
721
+ * See [core_crypto::e2e_identity::WireE2eIdentity::directory_response]
722
+ * @param {Uint8Array} directory
723
+ * @returns {Promise<any>}
724
+ */
725
+ directory_response(directory: Uint8Array): Promise<any>;
726
+ /**
727
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_account_request]
728
+ * @param {string} previous_nonce
729
+ * @returns {Promise<any>}
730
+ */
731
+ new_account_request(previous_nonce: string): Promise<any>;
732
+ /**
733
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_account_response]
734
+ * @param {Uint8Array} account
735
+ * @returns {Promise<any>}
736
+ */
737
+ new_account_response(account: Uint8Array): Promise<any>;
738
+ /**
739
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_order_request]
740
+ * @param {string} previous_nonce
741
+ * @returns {Promise<any>}
742
+ */
743
+ new_order_request(previous_nonce: string): Promise<any>;
744
+ /**
745
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_order_response]
746
+ * @param {Uint8Array} order
747
+ * @returns {Promise<any>}
748
+ */
749
+ new_order_response(order: Uint8Array): Promise<any>;
750
+ /**
751
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_authz_request]
752
+ * @param {string} url
753
+ * @param {string} previous_nonce
754
+ * @returns {Promise<any>}
755
+ */
756
+ new_authz_request(url: string, previous_nonce: string): Promise<any>;
757
+ /**
758
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_authz_response]
759
+ * @param {Uint8Array} authz
760
+ * @returns {Promise<any>}
761
+ */
762
+ new_authz_response(authz: Uint8Array): Promise<any>;
763
+ /**
764
+ * See [core_crypto::e2e_identity::WireE2eIdentity::create_dpop_token]
765
+ * @param {number} expiry_secs
766
+ * @param {string} backend_nonce
767
+ * @returns {Promise<any>}
768
+ */
769
+ create_dpop_token(expiry_secs: number, backend_nonce: string): Promise<any>;
770
+ /**
771
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_dpop_challenge_request]
772
+ * @param {string} access_token
773
+ * @param {string} previous_nonce
774
+ * @returns {Promise<any>}
775
+ */
776
+ new_dpop_challenge_request(access_token: string, previous_nonce: string): Promise<any>;
777
+ /**
778
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_dpop_challenge_response]
779
+ * @param {Uint8Array} challenge
780
+ * @returns {Promise<any>}
781
+ */
782
+ new_dpop_challenge_response(challenge: Uint8Array): Promise<any>;
783
+ /**
784
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_oidc_challenge_request]
785
+ * @param {string} id_token
786
+ * @param {string} previous_nonce
787
+ * @returns {Promise<any>}
788
+ */
789
+ new_oidc_challenge_request(id_token: string, previous_nonce: string): Promise<any>;
790
+ /**
791
+ * See [core_crypto::e2e_identity::WireE2eIdentity::new_oidc_challenge_response]
792
+ * @param {Uint8Array} challenge
793
+ * @returns {Promise<any>}
794
+ */
795
+ new_oidc_challenge_response(challenge: Uint8Array): Promise<any>;
796
+ /**
797
+ * See [core_crypto::e2e_identity::WireE2eIdentity::check_order_request]
798
+ * @param {string} order_url
799
+ * @param {string} previous_nonce
800
+ * @returns {Promise<any>}
801
+ */
802
+ check_order_request(order_url: string, previous_nonce: string): Promise<any>;
803
+ /**
804
+ * See [core_crypto::e2e_identity::WireE2eIdentity::check_order_response]
805
+ * @param {Uint8Array} order
806
+ * @returns {Promise<any>}
807
+ */
808
+ check_order_response(order: Uint8Array): Promise<any>;
809
+ /**
810
+ * See [core_crypto::e2e_identity::WireE2eIdentity::finalize_request]
811
+ * @param {string} previous_nonce
812
+ * @returns {Promise<any>}
813
+ */
814
+ finalize_request(previous_nonce: string): Promise<any>;
815
+ /**
816
+ * See [core_crypto::e2e_identity::WireE2eIdentity::finalize_response]
817
+ * @param {Uint8Array} finalize
818
+ * @returns {Promise<any>}
819
+ */
820
+ finalize_response(finalize: Uint8Array): Promise<any>;
821
+ /**
822
+ * See [core_crypto::e2e_identity::WireE2eIdentity::certificate_request]
823
+ * @param {string} previous_nonce
824
+ * @returns {Promise<any>}
825
+ */
826
+ certificate_request(previous_nonce: string): Promise<any>;
827
+ }
39
828
  /**
40
829
  * Result of an authorization creation.
41
830
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
@@ -62,12 +851,687 @@ export class NewAcmeAuthz {
62
851
  export class NewAcmeOrder {
63
852
  free(): void;
64
853
  /**
65
- */
66
- readonly authorizations: (Uint8Array)[];
854
+ */
855
+ readonly authorizations: (Uint8Array)[];
856
+ /**
857
+ * Contains raw JSON data of this order. This is parsed by the underlying Rust library hence should not be accessed
858
+ */
859
+ readonly delegate: Uint8Array;
860
+ }
861
+ declare class WireIdentity {
862
+ free(): void;
863
+ /**
864
+ */
865
+ readonly client_id: string;
866
+ /**
867
+ */
868
+ readonly credential_type: number;
869
+ /**
870
+ */
871
+ readonly status: number;
872
+ /**
873
+ */
874
+ readonly thumbprint: string;
875
+ /**
876
+ */
877
+ readonly x509_identity: X509Identity | undefined;
878
+ }
879
+ declare class X509Identity {
880
+ free(): void;
881
+ /**
882
+ */
883
+ readonly certificate: string;
884
+ /**
885
+ */
886
+ readonly display_name: string;
887
+ /**
888
+ */
889
+ readonly domain: string;
890
+ /**
891
+ */
892
+ readonly handle: string;
893
+ /**
894
+ */
895
+ readonly not_after: bigint;
896
+ /**
897
+ */
898
+ readonly not_before: bigint;
899
+ /**
900
+ */
901
+ readonly serial_number: string;
902
+ }
903
+ declare class CoreCryptoContext$1 {
904
+ #private;
905
+ /** @hidden */
906
+ private constructor();
907
+ /** @hidden */
908
+ static fromFfiContext(ctx: CoreCryptoContext): CoreCryptoContext$1;
909
+ /**
910
+ * Set arbitrary data to be retrieved by {@link getData}.
911
+ * This is meant to be used as a check point at the end of a transaction.
912
+ * The data should be limited to a reasonable size.
913
+ */
914
+ setData(data: Uint8Array): Promise<void>;
915
+ /**
916
+ * Get data if it has previously been set by {@link setData}, or `undefined` otherwise.
917
+ * This is meant to be used as a check point at the end of a transaction.
918
+ */
919
+ getData(): Promise<Uint8Array | undefined>;
920
+ /**
921
+ * Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
922
+ *
923
+ * @param clientId - {@link CoreCryptoParams#clientId} but required
924
+ * @param ciphersuites - All the ciphersuites supported by this MLS client
925
+ * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
926
+ */
927
+ mlsInit(clientId: ClientId, ciphersuites: Ciphersuite$1[], nbKeyPackage?: number): Promise<void>;
928
+ /**
929
+ * Generates a MLS KeyPair/CredentialBundle with a temporary, random client ID.
930
+ * This method is designed to be used in conjunction with {@link CoreCryptoContext.mlsInitWithClientId} and represents the first step in this process
931
+ *
932
+ * @param ciphersuites - All the ciphersuites supported by this MLS client
933
+ * @returns This returns the TLS-serialized identity key (i.e. the signature keypair's public key)
934
+ */
935
+ mlsGenerateKeypair(ciphersuites: Ciphersuite$1[]): Promise<Uint8Array[]>;
936
+ /**
937
+ * Updates the current temporary Client ID with the newly provided one. This is the second step in the externally-generated clients process
938
+ *
939
+ * Important: This is designed to be called after {@link CoreCryptoContext.mlsGenerateKeypair}
940
+ *
941
+ * @param clientId - The newly-allocated client ID by the MLS Authentication Service
942
+ * @param signaturePublicKeys - The public key you were given at the first step; This is for authentication purposes
943
+ * @param ciphersuites - All the ciphersuites supported by this MLS client
944
+ */
945
+ mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite$1[]): Promise<void>;
946
+ /**
947
+ * Checks if the Client is member of a given conversation and if the MLS Group is loaded up
948
+ *
949
+ * @returns Whether the given conversation ID exists
950
+ *
951
+ * @example
952
+ * ```ts
953
+ * const cc = await CoreCrypto.init({ databaseName: "test", key: "test", clientId: "test" });
954
+ * const encoder = new TextEncoder();
955
+ * if (await cc.conversationExists(encoder.encode("my super chat"))) {
956
+ * // Do something
957
+ * } else {
958
+ * // Do something else
959
+ * }
960
+ * ```
961
+ */
962
+ conversationExists(conversationId: ConversationId): Promise<boolean>;
963
+ /**
964
+ * Marks a conversation as child of another one
965
+ * This will mostly affect the behavior of the callbacks (the parentConversationClients parameter will be filled)
966
+ *
967
+ * @param childId - conversation identifier of the child conversation
968
+ * @param parentId - conversation identifier of the parent conversation
969
+ */
970
+ markConversationAsChildOf(childId: ConversationId, parentId: ConversationId): Promise<void>;
971
+ /**
972
+ * Returns the current epoch of a conversation
973
+ *
974
+ * @returns the epoch of the conversation
975
+ *
976
+ * @example
977
+ * ```ts
978
+ * const cc = await CoreCrypto.init({ databaseName: "test", key: "test", clientId: "test" });
979
+ * const encoder = new TextEncoder();
980
+ * console.log(await cc.conversationEpoch(encoder.encode("my super chat")))
981
+ * ```
982
+ */
983
+ conversationEpoch(conversationId: ConversationId): Promise<number>;
984
+ /**
985
+ * Returns the ciphersuite of a conversation
986
+ *
987
+ * @returns the ciphersuite of the conversation
988
+ */
989
+ conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite$1>;
990
+ /**
991
+ * Wipes and destroys the local storage of a given conversation / MLS group
992
+ *
993
+ * @param conversationId - The ID of the conversation to remove
994
+ */
995
+ wipeConversation(conversationId: ConversationId): Promise<void>;
996
+ /**
997
+ * Creates a new conversation with the current client being the sole member
998
+ * You will want to use {@link addClientsToConversation} afterwards to add clients to this conversation
999
+ *
1000
+ * @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
1001
+ * @param creatorCredentialType - kind of credential the creator wants to create the group with
1002
+ * @param configuration - configuration of the MLS group
1003
+ * @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
1004
+ * @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
1005
+ * @param configuration.custom - {@link CustomConfiguration}
1006
+ */
1007
+ createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType$1, configuration?: ConversationConfiguration$1): Promise<any>;
1008
+ /**
1009
+ * Decrypts a message for a given conversation.
1010
+ *
1011
+ * Note: you should catch & ignore the following error reasons:
1012
+ * * "We already decrypted this message once"
1013
+ * * "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"
1014
+ * * "Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives"
1015
+ *
1016
+ * @param conversationId - The ID of the conversation
1017
+ * @param payload - The encrypted message buffer
1018
+ *
1019
+ * @returns a {@link DecryptedMessage}. Note that {@link DecryptedMessage#message} is `undefined` when the encrypted payload contains a system message such a proposal or commit
1020
+ */
1021
+ decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
1022
+ /**
1023
+ * Encrypts a message for a given conversation
1024
+ *
1025
+ * @param conversationId - The ID of the conversation
1026
+ * @param message - The plaintext message to encrypt
1027
+ *
1028
+ * @returns The encrypted payload for the given group. This needs to be fanned out to the other members of the group.
1029
+ */
1030
+ encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
1031
+ /**
1032
+ * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
1033
+ *
1034
+ * Important: you have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
1035
+ * it references has already been deleted locally. Join this group with an external commit", ignore it and then try
1036
+ * to join this group with an external commit.
1037
+ *
1038
+ * @param welcomeMessage - TLS-serialized MLS Welcome message
1039
+ * @param configuration - configuration of the MLS group
1040
+ * @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
1041
+ */
1042
+ processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration$1): Promise<WelcomeBundle>;
1043
+ /**
1044
+ * Get the client's public signature key. To upload to the DS for further backend side validation
1045
+ *
1046
+ * @param ciphersuite - of the signature key to get
1047
+ * @param credentialType - of the public key to look for
1048
+ * @returns the client's public signature key
1049
+ */
1050
+ clientPublicKey(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<Uint8Array>;
1051
+ /**
1052
+ *
1053
+ * @param ciphersuite - of the KeyPackages to count
1054
+ * @param credentialType - of the KeyPackages to count
1055
+ * @returns The amount of valid, non-expired KeyPackages that are persisted in the backing storage
1056
+ */
1057
+ clientValidKeypackagesCount(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<number>;
1058
+ /**
1059
+ * Fetches a requested amount of keypackages
1060
+ *
1061
+ * @param ciphersuite - of the KeyPackages to generate
1062
+ * @param credentialType - of the KeyPackages to generate
1063
+ * @param amountRequested - The amount of keypackages requested
1064
+ * @returns An array of length `amountRequested` containing TLS-serialized KeyPackages
1065
+ */
1066
+ clientKeypackages(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1, amountRequested: number): Promise<Array<Uint8Array>>;
1067
+ /**
1068
+ * Prunes local KeyPackages after making sure they also have been deleted on the backend side
1069
+ * You should only use this after {@link CoreCryptoContext.e2eiRotateAll}
1070
+ *
1071
+ * @param refs - KeyPackage references to delete obtained from a {RotateBundle}
1072
+ */
1073
+ deleteKeypackages(refs: Uint8Array[]): Promise<void>;
1074
+ /**
1075
+ * Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
1076
+ *
1077
+ * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1078
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1079
+ * epoch, use new encryption secrets etc...
1080
+ *
1081
+ * @param conversationId - The ID of the conversation
1082
+ * @param keyPackages - KeyPackages of the new clients to add
1083
+ *
1084
+ * @returns A {@link CommitBundle}
1085
+ */
1086
+ addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<MemberAddedMessages>;
1087
+ /**
1088
+ * Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
1089
+ * to do so, otherwise this operation does nothing.
1090
+ *
1091
+ * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1092
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1093
+ * epoch, use new encryption secrets etc...
1094
+ *
1095
+ * @param conversationId - The ID of the conversation
1096
+ * @param clientIds - Array of Client IDs to remove.
1097
+ *
1098
+ * @returns A {@link CommitBundle}
1099
+ */
1100
+ removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId[]): Promise<CommitBundle>;
1101
+ /**
1102
+ * Creates an update commit which forces every client to update their LeafNode in the conversation
1103
+ *
1104
+ * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1105
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1106
+ * epoch, use new encryption secrets etc...
1107
+ *
1108
+ * @param conversationId - The ID of the conversation
1109
+ *
1110
+ * @returns A {@link CommitBundle}
1111
+ */
1112
+ updateKeyingMaterial(conversationId: ConversationId): Promise<CommitBundle>;
1113
+ /**
1114
+ * Commits the local pending proposals and returns the {@link CommitBundle} object containing what can result from this operation.
1115
+ *
1116
+ * **CAUTION**: {@link CoreCryptoContext.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
1117
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1118
+ * epoch, use new encryption secrets etc...
1119
+ *
1120
+ * @param conversationId - The ID of the conversation
1121
+ *
1122
+ * @returns A {@link CommitBundle} or `undefined` when there was no pending proposal to commit
1123
+ */
1124
+ commitPendingProposals(conversationId: ConversationId): Promise<CommitBundle | undefined>;
1125
+ /**
1126
+ * Creates a new proposal for the provided Conversation ID
1127
+ *
1128
+ * @param proposalType - The type of proposal, see {@link ProposalType}
1129
+ * @param args - The arguments of the proposal, see {@link ProposalArgs}, {@link AddProposalArgs} or {@link RemoveProposalArgs}
1130
+ *
1131
+ * @returns A {@link ProposalBundle} containing the Proposal and its reference in order to roll it back if necessary
1132
+ */
1133
+ newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<ProposalBundle>;
1134
+ /**
1135
+ * Creates a new external Add proposal for self client to join a conversation.
1136
+ */
1137
+ newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
1138
+ /**
1139
+ * Allows to create an external commit to "apply" to join a group through its GroupInfo.
1140
+ *
1141
+ * If the Delivery Service accepts the external commit, you have to {@link CoreCryptoContext.mergePendingGroupFromExternalCommit}
1142
+ * in order to get back a functional MLS group. On the opposite, if it rejects it, you can either retry by just
1143
+ * calling again {@link CoreCryptoContext.joinByExternalCommit}, no need to {@link CoreCryptoContext.clearPendingGroupFromExternalCommit}.
1144
+ * If you want to abort the operation (too many retries or the user decided to abort), you can use
1145
+ * {@link CoreCryptoContext.clearPendingGroupFromExternalCommit} in order not to bloat the user's storage but nothing
1146
+ * bad can happen if you forget to except some storage space wasted.
1147
+ *
1148
+ * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1149
+ * @param credentialType - kind of Credential to use for joining this group. If {@link CredentialType.Basic} is
1150
+ * chosen and no Credential has been created yet for it, a new one will be generated.
1151
+ * @param configuration - configuration of the MLS group
1152
+ * When {@link CredentialType.X509} is chosen, it fails when no Credential has been created for the given {@link Ciphersuite}.
1153
+ * @returns see {@link ConversationInitBundle}
1154
+ */
1155
+ joinByExternalCommit(groupInfo: Uint8Array, credentialType: CredentialType$1, configuration?: CustomConfiguration$1): Promise<ConversationInitBundle>;
1156
+ /**
1157
+ * This merges the commit generated by {@link CoreCryptoContext.joinByExternalCommit}, persists the group permanently
1158
+ * and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
1159
+ *
1160
+ * @param conversationId - The ID of the conversation
1161
+ * @returns eventually decrypted buffered messages if any
1162
+ */
1163
+ mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
1164
+ /**
1165
+ * In case the external commit generated by {@link CoreCryptoContext.joinByExternalCommit} is rejected by the Delivery Service, and we
1166
+ * want to abort this external commit once for all, we can wipe out the pending group from the keystore in order
1167
+ * not to waste space
1168
+ *
1169
+ * @param conversationId - The ID of the conversation
1170
+ */
1171
+ clearPendingGroupFromExternalCommit(conversationId: ConversationId): Promise<void>;
1172
+ /**
1173
+ * Allows to mark the latest commit produced as "accepted" and be able to safely merge it into the local group state
1174
+ *
1175
+ * @param conversationId - The group's ID
1176
+ * @returns the messages from current epoch which had been buffered, if any
1177
+ */
1178
+ commitAccepted(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
1179
+ /**
1180
+ * Allows to remove a pending proposal (rollback). Use this when backend rejects the proposal you just sent e.g. if permissions have changed meanwhile.
1181
+ *
1182
+ * **CAUTION**: only use this when you had an explicit response from the Delivery Service
1183
+ * e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc…
1184
+ *
1185
+ * @param conversationId - The group's ID
1186
+ * @param proposalRef - A reference to the proposal to delete. You get one when using {@link CoreCryptoContext.newProposal}
1187
+ */
1188
+ clearPendingProposal(conversationId: ConversationId, proposalRef: ProposalRef): Promise<void>;
1189
+ /**
1190
+ * Allows to remove a pending commit (rollback). Use this when backend rejects the commit you just sent e.g. if permissions have changed meanwhile.
1191
+ *
1192
+ * **CAUTION**: only use this when you had an explicit response from the Delivery Service
1193
+ * e.g. 403. Do not use otherwise e.g. 5xx responses, timeout etc..
1194
+ * **DO NOT** use when Delivery Service responds 409, pending state will be renewed
1195
+ * in {@link CoreCryptoContext.decryptMessage}
1196
+ *
1197
+ * @param conversationId - The group's ID
1198
+ */
1199
+ clearPendingCommit(conversationId: ConversationId): Promise<void>;
1200
+ /**
1201
+ * Derives a new key from the group
1202
+ *
1203
+ * @param conversationId - The group's ID
1204
+ * @param keyLength - the length of the key to be derived. If the value is higher than the
1205
+ * bounds of `u16` or the context hash * 255, an error will be returned
1206
+ *
1207
+ * @returns A `Uint8Array` representing the derived key
1208
+ */
1209
+ exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<Uint8Array>;
1210
+ /**
1211
+ * Returns the raw public key of the single external sender present in this group.
1212
+ * This should be used to initialize a subconversation
1213
+ *
1214
+ * @param conversationId - The group's ID
1215
+ *
1216
+ * @returns A `Uint8Array` representing the external sender raw public key
1217
+ */
1218
+ getExternalSender(conversationId: ConversationId): Promise<Uint8Array>;
1219
+ /**
1220
+ * Returns all clients from group's members
1221
+ *
1222
+ * @param conversationId - The group's ID
1223
+ *
1224
+ * @returns A list of clients from the members of the group
1225
+ */
1226
+ getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
1227
+ /**
1228
+ * Allows {@link CoreCryptoContext} to act as a CSPRNG provider
1229
+ * @note The underlying CSPRNG algorithm is ChaCha20 and takes in account the external seed provider.
1230
+ *
1231
+ * @param length - The number of bytes to be returned in the `Uint8Array`
1232
+ *
1233
+ * @returns A `Uint8Array` buffer that contains `length` cryptographically-secure random bytes
1234
+ */
1235
+ randomBytes(length: number): Promise<Uint8Array>;
1236
+ /**
1237
+ * Create a Proteus session using a prekey
1238
+ *
1239
+ * @param sessionId - ID of the Proteus session
1240
+ * @param prekey - CBOR-encoded Proteus prekey of the other client
1241
+ */
1242
+ proteusSessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<void>;
1243
+ /**
1244
+ * Create a Proteus session from a handshake message
1245
+ *
1246
+ * @param sessionId - ID of the Proteus session
1247
+ * @param envelope - CBOR-encoded Proteus message
1248
+ *
1249
+ * @returns A `Uint8Array` containing the message that was sent along with the session handshake
1250
+ */
1251
+ proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<Uint8Array>;
1252
+ /**
1253
+ * Locally persists a session to the keystore
1254
+ *
1255
+ * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
1256
+ *
1257
+ * @param sessionId - ID of the Proteus session
1258
+ */
1259
+ proteusSessionSave(sessionId: string): Promise<void>;
1260
+ /**
1261
+ * Deletes a session
1262
+ * Note: this also deletes the persisted data within the keystore
1263
+ *
1264
+ * @param sessionId - ID of the Proteus session
1265
+ */
1266
+ proteusSessionDelete(sessionId: string): Promise<void>;
1267
+ /**
1268
+ * Checks if a session exists
1269
+ *
1270
+ * @param sessionId - ID of the Proteus session
1271
+ *
1272
+ * @returns whether the session exists or not
1273
+ */
1274
+ proteusSessionExists(sessionId: string): Promise<boolean>;
1275
+ /**
1276
+ * Decrypt an incoming message for an existing Proteus session
1277
+ *
1278
+ * @param sessionId - ID of the Proteus session
1279
+ * @param ciphertext - CBOR encoded, encrypted proteus message
1280
+ * @returns The decrypted payload contained within the message
1281
+ */
1282
+ proteusDecrypt(sessionId: string, ciphertext: Uint8Array): Promise<Uint8Array>;
1283
+ /**
1284
+ * Encrypt a message for a given Proteus session
1285
+ *
1286
+ * @param sessionId - ID of the Proteus session
1287
+ * @param plaintext - payload to encrypt
1288
+ * @returns The CBOR-serialized encrypted message
1289
+ */
1290
+ proteusEncrypt(sessionId: string, plaintext: Uint8Array): Promise<Uint8Array>;
1291
+ /**
1292
+ * Batch encryption for proteus messages
1293
+ * This is used to minimize FFI roundtrips when used in the context of a multi-client session (i.e. conversation)
1294
+ *
1295
+ * @param sessions - List of Proteus session IDs to encrypt the message for
1296
+ * @param plaintext - payload to encrypt
1297
+ * @returns A map indexed by each session ID and the corresponding CBOR-serialized encrypted message for this session
1298
+ */
1299
+ proteusEncryptBatched(sessions: string[], plaintext: Uint8Array): Promise<Map<string, Uint8Array>>;
1300
+ /**
1301
+ * Creates a new prekey with the requested ID.
1302
+ *
1303
+ * @param prekeyId - ID of the PreKey to generate. This cannot be bigger than a u16
1304
+ * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
1305
+ */
1306
+ proteusNewPrekey(prekeyId: number): Promise<Uint8Array>;
1307
+ /**
1308
+ * Creates a new prekey with an automatically generated ID..
1309
+ *
1310
+ * @returns A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey accompanied by its ID
1311
+ */
1312
+ proteusNewPrekeyAuto(): Promise<ProteusAutoPrekeyBundle>;
1313
+ /**
1314
+ * Proteus last resort prekey stuff
1315
+ *
1316
+ * @returns A CBOR-serialize version of the PreKeyBundle associated with the last resort PreKey (holding the last resort prekey id)
1317
+ */
1318
+ proteusLastResortPrekey(): Promise<Uint8Array>;
1319
+ /**
1320
+ * @returns The last resort PreKey id
1321
+ */
1322
+ static proteusLastResortPrekeyId(): number;
1323
+ /**
1324
+ * Proteus public key fingerprint
1325
+ * It's basically the public key encoded as an hex string
1326
+ *
1327
+ * @returns Hex-encoded public key string
1328
+ */
1329
+ proteusFingerprint(): Promise<string>;
1330
+ /**
1331
+ * Proteus session local fingerprint
1332
+ *
1333
+ * @param sessionId - ID of the Proteus session
1334
+ * @returns Hex-encoded public key string
1335
+ */
1336
+ proteusFingerprintLocal(sessionId: string): Promise<string>;
1337
+ /**
1338
+ * Proteus session remote fingerprint
1339
+ *
1340
+ * @param sessionId - ID of the Proteus session
1341
+ * @returns Hex-encoded public key string
1342
+ */
1343
+ proteusFingerprintRemote(sessionId: string): Promise<string>;
1344
+ /**
1345
+ * Hex-encoded fingerprint of the given prekey
1346
+ *
1347
+ * @param prekey - the prekey bundle to get the fingerprint from
1348
+ * @returns Hex-encoded public key string
1349
+ **/
1350
+ static proteusFingerprintPrekeybundle(prekey: Uint8Array): string;
1351
+ /**
1352
+ * Imports all the data stored by Cryptobox into the CoreCrypto keystore
1353
+ *
1354
+ * @param storeName - The name of the IndexedDB store where the data is stored
1355
+ */
1356
+ proteusCryptoboxMigrate(storeName: string): Promise<void>;
1357
+ /**
1358
+ * Note: this call clears out the code and resets it to 0 (aka no error)
1359
+ * @returns the last proteus error code that occured.
1360
+ */
1361
+ proteusLastErrorCode(): Promise<number>;
1362
+ /**
1363
+ * Creates an enrollment instance with private key material you can use in order to fetch
1364
+ * a new x509 certificate from the acme server.
1365
+ *
1366
+ * @param clientId - client identifier e.g. `b7ac11a4-8f01-4527-af88-1c30885a7931:6add501bacd1d90e@example.com`
1367
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1368
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1369
+ * @param expirySec - generated x509 certificate expiry
1370
+ * @param ciphersuite - for generating signing key material
1371
+ * @param team - name of the Wire team a user belongs to
1372
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiMlsInitOnly}
1373
+ */
1374
+ e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
1375
+ /**
1376
+ * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1377
+ * Once the enrollment is finished, use the instance in {@link CoreCryptoContext.e2eiRotateAll} to do the rotation.
1378
+ *
1379
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1380
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1381
+ * @param expirySec - generated x509 certificate expiry
1382
+ * @param ciphersuite - for generating signing key material
1383
+ * @param team - name of the Wire team a user belongs to
1384
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotateAll}
1385
+ */
1386
+ e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
1387
+ /**
1388
+ * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1389
+ * having to change/rotate their credential, either because the former one is expired or it
1390
+ * has been revoked. It lets you change the DisplayName or the handle
1391
+ * if you need to. Once the enrollment is finished, use the instance in {@link CoreCryptoContext.e2eiRotateAll} to do the rotation.
1392
+ *
1393
+ * @param expirySec - generated x509 certificate expiry
1394
+ * @param ciphersuite - for generating signing key material
1395
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1396
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1397
+ * @param team - name of the Wire team a user belongs to
1398
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotateAll}
1399
+ */
1400
+ e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite$1, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
1401
+ /**
1402
+ * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
1403
+ * that means he cannot initialize with a Basic credential
1404
+ *
1405
+ * @param enrollment - the enrollment instance used to fetch the certificates
1406
+ * @param certificateChain - the raw response from ACME server
1407
+ * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
1408
+ * @returns a MlsClient initialized with only a x509 credential
1409
+ */
1410
+ e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<string[] | undefined>;
1411
+ /**
1412
+ * Dumps the PKI environment as PEM
1413
+ *
1414
+ * @returns a struct with different fields representing the PKI environment as PEM strings
1415
+ */
1416
+ e2eiDumpPKIEnv(): Promise<E2eiDumpedPkiEnv | undefined>;
1417
+ /**
1418
+ * @returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
1419
+ */
1420
+ e2eiIsPKIEnvSetup(): Promise<boolean>;
1421
+ /**
1422
+ * Registers a Root Trust Anchor CA for the use in E2EI processing.
1423
+ *
1424
+ * Please note that without a Root Trust Anchor, all validations *will* fail;
1425
+ * So this is the first step to perform after initializing your E2EI client
1426
+ *
1427
+ * @param trustAnchorPEM - PEM certificate to anchor as a Trust Root
1428
+ */
1429
+ e2eiRegisterAcmeCA(trustAnchorPEM: string): Promise<void>;
1430
+ /**
1431
+ * Registers an Intermediate CA for the use in E2EI processing.
1432
+ *
1433
+ * Please note that a Root Trust Anchor CA is needed to validate Intermediate CAs;
1434
+ * You **need** to have a Root CA registered before calling this
1435
+ *
1436
+ * @param certPEM - PEM certificate to register as an Intermediate CA
1437
+ */
1438
+ e2eiRegisterIntermediateCA(certPEM: string): Promise<string[] | undefined>;
1439
+ /**
1440
+ * Registers a CRL for the use in E2EI processing.
1441
+ *
1442
+ * Please note that a Root Trust Anchor CA is needed to validate CRLs;
1443
+ * You **need** to have a Root CA registered before calling this
1444
+ *
1445
+ * @param crlDP - CRL Distribution Point; Basically the URL you fetched it from
1446
+ * @param crlDER - DER representation of the CRL
1447
+ *
1448
+ * @returns a {@link CRLRegistration} with the dirty state of the new CRL (see struct) and its expiration timestamp
1449
+ */
1450
+ e2eiRegisterCRL(crlDP: string, crlDER: Uint8Array): Promise<CRLRegistration>;
1451
+ /**
1452
+ * Creates an update commit which replaces your leaf containing basic credentials with a leaf node containing x509 credentials in the conversation.
1453
+ *
1454
+ * NOTE: you can only call this after you've completed the enrollment for an end-to-end identity, calling this without
1455
+ * a valid end-to-end identity will result in an error.
1456
+ *
1457
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1458
+ * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1459
+ * epoch, use new encryption secrets etc...
1460
+ *
1461
+ * @param conversationId - The ID of the conversation
1462
+ *
1463
+ * @returns A {@link CommitBundle}
1464
+ */
1465
+ e2eiRotate(conversationId: ConversationId): Promise<CommitBundle>;
1466
+ /**
1467
+ * Creates a commit in all local conversations for changing the credential. Requires first
1468
+ * having enrolled a new X509 certificate with either {@link CoreCryptoContext.e2eiNewActivationEnrollment}
1469
+ * or {@link CoreCryptoContext.e2eiNewRotateEnrollment}
1470
+ *
1471
+ * @param enrollment - the enrollment instance used to fetch the certificates
1472
+ * @param certificateChain - the raw response from ACME server
1473
+ * @param newKeyPackageCount - number of KeyPackages with new identity to generate
1474
+ * @returns a {@link RotateBundle} with commits to fan-out to other group members, KeyPackages to upload and old ones to delete
1475
+ */
1476
+ e2eiRotateAll(enrollment: E2eiEnrollment, certificateChain: string, newKeyPackageCount: number): Promise<RotateBundle>;
1477
+ /**
1478
+ * Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
1479
+ * it later with {@link e2eiEnrollmentStashPop}
1480
+ *
1481
+ * @param enrollment the enrollment instance to persist
1482
+ * @returns a handle to fetch the enrollment later with {@link e2eiEnrollmentStashPop}
1483
+ */
1484
+ e2eiEnrollmentStash(enrollment: E2eiEnrollment): Promise<Uint8Array>;
1485
+ /**
1486
+ * Fetches the persisted enrollment and deletes it from the keystore
1487
+ *
1488
+ * @param handle returned by {@link e2eiEnrollmentStash}
1489
+ * @returns the persisted enrollment instance
1490
+ */
1491
+ e2eiEnrollmentStashPop(handle: Uint8Array): Promise<E2eiEnrollment>;
1492
+ /**
1493
+ * Indicates when to mark a conversation as not verified i.e. when not all its members have a X509.
1494
+ * Credential generated by Wire's end-to-end identity enrollment
1495
+ *
1496
+ * @param conversationId The group's ID
1497
+ * @returns the conversation state given current members
1498
+ */
1499
+ e2eiConversationState(conversationId: ConversationId): Promise<E2eiConversationState>;
1500
+ /**
1501
+ * Returns true when end-to-end-identity is enabled for the given Ciphersuite
1502
+ *
1503
+ * @param ciphersuite of the credential to check
1504
+ * @returns true if end-to-end identity is enabled for the given ciphersuite
1505
+ */
1506
+ e2eiIsEnabled(ciphersuite: Ciphersuite$1): Promise<boolean>;
1507
+ /**
1508
+ * From a given conversation, get the identity of the members supplied. Identity is only present for members with a
1509
+ * Certificate Credential (after turning on end-to-end identity).
1510
+ *
1511
+ * @param conversationId - identifier of the conversation
1512
+ * @param deviceIds - identifiers of the devices
1513
+ * @returns identities or if no member has a x509 certificate, it will return an empty List
1514
+ */
1515
+ getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity$1[]>;
1516
+ /**
1517
+ * From a given conversation, get the identity of the users (device holders) supplied.
1518
+ * Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity).
1519
+ * If no member has a x509 certificate, it will return an empty Vec.
1520
+ *
1521
+ * @param conversationId - identifier of the conversation
1522
+ * @param userIds - user identifiers hyphenated UUIDv4 e.g. 'bd4c7053-1c5a-4020-9559-cd7bf7961954'
1523
+ * @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.
1524
+ */
1525
+ getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity$1[]>>;
67
1526
  /**
68
- * Contains raw JSON data of this order. This is parsed by the underlying Rust library hence should not be accessed
69
- */
70
- readonly delegate: Uint8Array;
1527
+ * Gets the e2ei conversation state from a `GroupInfo`. Useful to check if the group has e2ei
1528
+ * turned on or not before joining it.
1529
+ *
1530
+ * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1531
+ * @param credentialType - kind of Credential to check usage of. Defaults to X509 for now as no other value will give any result.
1532
+ * @returns see {@link E2eiConversationState}
1533
+ */
1534
+ getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType$1): Promise<E2eiConversationState>;
71
1535
  }
72
1536
  /**
73
1537
  * Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
@@ -83,14 +1547,14 @@ export declare class CoreCryptoError extends Error {
83
1547
  proteusErrorCode: number;
84
1548
  private constructor();
85
1549
  private static fallback;
86
- static build(msg: string, ...params: any[]): CoreCryptoError | Error;
1550
+ static build(msg: string, ...params: unknown[]): CoreCryptoError | Error;
87
1551
  static fromStdError(e: Error): CoreCryptoError | Error;
88
1552
  static asyncMapErr<T>(p: Promise<T>): Promise<T>;
89
1553
  }
90
1554
  /**
91
1555
  * see [core_crypto::prelude::CiphersuiteName]
92
1556
  */
93
- export declare enum Ciphersuite {
1557
+ declare enum Ciphersuite$1 {
94
1558
  /**
95
1559
  * DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
96
1560
  */
@@ -120,7 +1584,7 @@ export declare enum Ciphersuite {
120
1584
  */
121
1585
  MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
122
1586
  }
123
- export declare enum CredentialType {
1587
+ declare enum CredentialType$1 {
124
1588
  /**
125
1589
  * Just a KeyPair
126
1590
  */
@@ -133,11 +1597,11 @@ export declare enum CredentialType {
133
1597
  /**
134
1598
  * Configuration object for new conversations
135
1599
  */
136
- export interface ConversationConfiguration {
1600
+ interface ConversationConfiguration$1 {
137
1601
  /**
138
1602
  * Conversation ciphersuite
139
1603
  */
140
- ciphersuite?: Ciphersuite;
1604
+ ciphersuite?: Ciphersuite$1;
141
1605
  /**
142
1606
  * List of client IDs that are allowed to be external senders of commits
143
1607
  */
@@ -145,12 +1609,12 @@ export interface ConversationConfiguration {
145
1609
  /**
146
1610
  * Implementation specific configuration
147
1611
  */
148
- custom?: CustomConfiguration;
1612
+ custom?: CustomConfiguration$1;
149
1613
  }
150
1614
  /**
151
1615
  * see [core_crypto::prelude::MlsWirePolicy]
152
1616
  */
153
- export declare enum WirePolicy {
1617
+ declare enum WirePolicy$1 {
154
1618
  /**
155
1619
  * Handshake messages are never encrypted
156
1620
  */
@@ -163,7 +1627,7 @@ export declare enum WirePolicy {
163
1627
  /**
164
1628
  * Implementation specific configuration object for a conversation
165
1629
  */
166
- export interface CustomConfiguration {
1630
+ interface CustomConfiguration$1 {
167
1631
  /**
168
1632
  * Duration in seconds after which we will automatically force a self_update commit
169
1633
  * Note: This isn't currently implemented
@@ -173,7 +1637,7 @@ export interface CustomConfiguration {
173
1637
  * Defines if handshake messages are encrypted or not
174
1638
  * Note: Ciphertext is not currently supported by wire-server
175
1639
  */
176
- wirePolicy?: WirePolicy;
1640
+ wirePolicy?: WirePolicy$1;
177
1641
  }
178
1642
  /**
179
1643
  * Alias for conversation IDs.
@@ -370,7 +1834,7 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
370
1834
  /**
371
1835
  * All the ciphersuites this MLS client can support
372
1836
  */
373
- ciphersuites: Ciphersuite[];
1837
+ ciphersuites: Ciphersuite$1[];
374
1838
  /**
375
1839
  * Number of initial KeyPackage to create when initializing the client
376
1840
  */
@@ -454,7 +1918,7 @@ export interface DecryptedMessage {
454
1918
  * Only present when the credential is a x509 certificate
455
1919
  * Present for all messages
456
1920
  */
457
- identity?: WireIdentity;
1921
+ identity?: WireIdentity$1;
458
1922
  /**
459
1923
  * Only set when the decrypted message is a commit.
460
1924
  * Contains buffered messages for next epoch which were received before the commit creating the epoch
@@ -497,7 +1961,7 @@ export interface BufferedDecryptedMessage {
497
1961
  /**
498
1962
  * see {@link DecryptedMessage.identity}
499
1963
  */
500
- identity?: WireIdentity;
1964
+ identity?: WireIdentity$1;
501
1965
  /**
502
1966
  * see {@link DecryptedMessage.crlNewDistributionPoints}
503
1967
  */
@@ -507,7 +1971,7 @@ export interface BufferedDecryptedMessage {
507
1971
  * Represents the identity claims identifying a client
508
1972
  * Those claims are verifiable by any member in the group
509
1973
  */
510
- export interface WireIdentity {
1974
+ interface WireIdentity$1 {
511
1975
  /**
512
1976
  * Unique client identifier
513
1977
  */
@@ -523,16 +1987,16 @@ export interface WireIdentity {
523
1987
  /**
524
1988
  * Indicates whether the credential is Basic or X509
525
1989
  */
526
- credentialType: CredentialType;
1990
+ credentialType: CredentialType$1;
527
1991
  /**
528
1992
  * In case {@link credentialType} is {@link CredentialType.X509} this is populated
529
1993
  */
530
- x509Identity?: X509Identity;
1994
+ x509Identity?: X509Identity$1;
531
1995
  }
532
1996
  /**
533
1997
  * Represents the parts of {@link WireIdentity} that are specific to a X509 certificate (and not a Basic one).
534
1998
  */
535
- export interface X509Identity {
1999
+ interface X509Identity$1 {
536
2000
  /**
537
2001
  * User handle e.g. `john_wire`
538
2002
  */
@@ -562,6 +2026,8 @@ export interface X509Identity {
562
2026
  */
563
2027
  notAfter: bigint;
564
2028
  }
2029
+ export declare function normalizeEnum<T>(enumType: T, value: number): T[keyof T];
2030
+ export declare const mapWireIdentity: (ffiIdentity?: WireIdentity) => WireIdentity$1 | undefined;
565
2031
  export interface AcmeDirectory {
566
2032
  /**
567
2033
  * URL for fetching a new nonce. Use this only for creating a new account.
@@ -703,12 +2169,12 @@ export interface ExternalAddProposalArgs extends ExternalProposalArgs {
703
2169
  /**
704
2170
  * {@link Ciphersuite} to propose to join the MLS group with.
705
2171
  */
706
- ciphersuite: Ciphersuite;
2172
+ ciphersuite: Ciphersuite$1;
707
2173
  /**
708
2174
  * Fails when it is {@link CredentialType.X509} and no Credential has been created
709
2175
  * for it beforehand with {@link CoreCrypto.e2eiMlsInit} or variants.
710
2176
  */
711
- credentialType: CredentialType;
2177
+ credentialType: CredentialType$1;
712
2178
  }
713
2179
  export interface CoreCryptoCallbacks {
714
2180
  /**
@@ -771,8 +2237,10 @@ export declare enum CoreCryptoLogLevel {
771
2237
  * Initializes the global logger for Core Crypto and registers the callback. Can be called only once
772
2238
  * @param logger - the interface to be called when something is going to be logged
773
2239
  * @param level - the max level that should be logged
2240
+ *
2241
+ * NOTE: you must call this after `await CoreCrypto.init(params)` or `await CoreCrypto.deferredInit(params)`.
774
2242
  **/
775
- export declare function initLogger(logger: CoreCryptoLogger, level: CoreCryptoLogLevel, ctx?: any): void;
2243
+ export declare function initLogger(logger: CoreCryptoLogger, level: CoreCryptoLogLevel, ctx?: unknown): void;
776
2244
  /**
777
2245
  * Wrapper for the WASM-compiled version of CoreCrypto
778
2246
  */
@@ -782,6 +2250,7 @@ export declare class CoreCrypto {
782
2250
  * Should only be used internally
783
2251
  */
784
2252
  inner(): unknown;
2253
+ static setLogger(logger: CoreCryptoWasmLogger, level: CoreCryptoLogLevel): void;
785
2254
  /**
786
2255
  * This is your entrypoint to initialize {@link CoreCrypto}!
787
2256
  *
@@ -825,31 +2294,35 @@ export declare class CoreCrypto {
825
2294
  */
826
2295
  static deferredInit({ databaseName, key, entropySeed, wasmFilePath, }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
827
2296
  /**
828
- * Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
2297
+ * Starts a new transaction in Core Crypto. If the callback succeeds, it will be committed,
2298
+ * otherwise, every operation performed with the context will be discarded.
829
2299
  *
830
- * @param clientId - {@link CoreCryptoParams#clientId} but required
831
- * @param ciphersuites - All the ciphersuites supported by this MLS client
832
- * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
2300
+ * @param callback - The callback to execute within the transaction
2301
+ *
2302
+ * @returns the result of the callback will be returned from this call
833
2303
  */
834
- mlsInit(clientId: ClientId, ciphersuites: Ciphersuite[], nbKeyPackage?: number): Promise<void>;
2304
+ transaction<R>(callback: (ctx: CoreCryptoContext$1) => Promise<R>): Promise<R>;
835
2305
  /**
836
- * Generates a MLS KeyPair/CredentialBundle with a temporary, random client ID.
837
- * This method is designed to be used in conjunction with {@link CoreCrypto.mlsInitWithClientId} and represents the first step in this process
2306
+ * See {@link CoreCryptoContext.mlsInit}.
838
2307
  *
839
- * @param ciphersuites - All the ciphersuites supported by this MLS client
840
- * @returns This returns the TLS-serialized identity key (i.e. the signature keypair's public key)
2308
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2309
+ * and use {@link CoreCryptoContext.mlsInit} instead.
841
2310
  */
842
- mlsGenerateKeypair(ciphersuites: Ciphersuite[]): Promise<Uint8Array[]>;
2311
+ mlsInit(clientId: ClientId, ciphersuites: Ciphersuite$1[], nbKeyPackage?: number): Promise<void>;
843
2312
  /**
844
- * Updates the current temporary Client ID with the newly provided one. This is the second step in the externally-generated clients process
2313
+ * See {@link CoreCryptoContext.mlsGenerateKeypair}.
845
2314
  *
846
- * Important: This is designed to be called after {@link CoreCrypto.mlsGenerateKeypair}
2315
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2316
+ * and use {@link CoreCryptoContext.mlsGenerateKeypair} instead.
2317
+ */
2318
+ mlsGenerateKeypair(ciphersuites: Ciphersuite$1[]): Promise<Uint8Array[]>;
2319
+ /**
2320
+ * See {@link CoreCryptoContext.mlsInitWithClientId}.
847
2321
  *
848
- * @param clientId - The newly-allocated client ID by the MLS Authentication Service
849
- * @param signaturePublicKeys - The public key you were given at the first step; This is for authentication purposes
850
- * @param ciphersuites - All the ciphersuites supported by this MLS client
2322
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2323
+ * and use {@link CoreCryptoContext.mlsInitWithClientId} instead.
851
2324
  */
852
- mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite[]): Promise<void>;
2325
+ mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite$1[]): Promise<void>;
853
2326
  /** @hidden */
854
2327
  private constructor();
855
2328
  /**
@@ -876,34 +2349,20 @@ export declare class CoreCrypto {
876
2349
  *
877
2350
  * @param callbacks - Any interface following the {@link CoreCryptoCallbacks} interface
878
2351
  */
879
- registerCallbacks(callbacks: CoreCryptoCallbacks, ctx?: any): Promise<void>;
2352
+ registerCallbacks(callbacks: CoreCryptoCallbacks, ctx?: unknown): Promise<void>;
880
2353
  /**
881
- * Checks if the Client is member of a given conversation and if the MLS Group is loaded up
882
- *
883
- * @returns Whether the given conversation ID exists
884
- *
885
- * @example
886
- * ```ts
887
- * const cc = await CoreCrypto.init({ databaseName: "test", key: "test", clientId: "test" });
888
- * const encoder = new TextEncoder();
889
- * if (await cc.conversationExists(encoder.encode("my super chat"))) {
890
- * // Do something
891
- * } else {
892
- * // Do something else
893
- * }
894
- * ```
2354
+ * See {@link CoreCryptoContext.conversationExists}.
895
2355
  */
896
2356
  conversationExists(conversationId: ConversationId): Promise<boolean>;
897
2357
  /**
898
- * Marks a conversation as child of another one
899
- * This will mostly affect the behavior of the callbacks (the parentConversationClients parameter will be filled)
2358
+ * See {@link CoreCryptoContext.markConversationAsChildOf}.
900
2359
  *
901
- * @param childId - conversation identifier of the child conversation
902
- * @param parentId - conversation identifier of the parent conversation
2360
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2361
+ * and use {@link CoreCryptoContext.markConversationAsChildOf} instead.
903
2362
  */
904
2363
  markConversationAsChildOf(childId: ConversationId, parentId: ConversationId): Promise<void>;
905
2364
  /**
906
- * Returns the current epoch of a conversation
2365
+ * See {@link CoreCryptoContext.conversationEpoch}.
907
2366
  *
908
2367
  * @returns the epoch of the conversation
909
2368
  *
@@ -916,124 +2375,101 @@ export declare class CoreCrypto {
916
2375
  */
917
2376
  conversationEpoch(conversationId: ConversationId): Promise<number>;
918
2377
  /**
919
- * Returns the ciphersuite of a conversation
2378
+ * See {@link CoreCryptoContext.conversationCiphersuite}.
920
2379
  *
921
2380
  * @returns the ciphersuite of the conversation
922
2381
  */
923
- conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite>;
2382
+ conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite$1>;
924
2383
  /**
925
- * Wipes and destroys the local storage of a given conversation / MLS group
2384
+ * See {@link CoreCryptoContext.wipeConversation}.
926
2385
  *
927
- * @param conversationId - The ID of the conversation to remove
2386
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2387
+ * and use {@link CoreCryptoContext.wipeConversation} instead.
928
2388
  */
929
2389
  wipeConversation(conversationId: ConversationId): Promise<void>;
930
2390
  /**
931
- * Creates a new conversation with the current client being the sole member
932
- * You will want to use {@link CoreCrypto.addClientsToConversation} afterwards to add clients to this conversation
2391
+ * See {@link CoreCryptoContext.createConversation}.
933
2392
  *
934
- * @param conversationId - The conversation ID; You can either make them random or let the backend attribute MLS group IDs
935
- * @param creatorCredentialType - kind of credential the creator wants to create the group with
936
- * @param configuration - configuration of the MLS group
937
- * @param configuration.ciphersuite - The {@link Ciphersuite} that is chosen to be the group's
938
- * @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
939
- * @param configuration.custom - {@link CustomConfiguration}
2393
+ * @deprecated Create a transaction with {@link transaction}
2394
+ * and use {@link CoreCryptoContext.createConversation} instead.
940
2395
  */
941
- createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType, configuration?: ConversationConfiguration): Promise<any>;
2396
+ createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType$1, configuration?: ConversationConfiguration$1): Promise<any>;
942
2397
  /**
943
- * Decrypts a message for a given conversation.
944
- *
945
- * Note: you should catch & ignore the following error reasons:
946
- * * "We already decrypted this message once"
947
- * * "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"
948
- * * "Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives"
949
- *
950
- * @param conversationId - The ID of the conversation
951
- * @param payload - The encrypted message buffer
2398
+ * See {@link CoreCryptoContext.decryptMessage}.
952
2399
  *
953
- * @returns a {@link DecryptedMessage}. Note that {@link DecryptedMessage#message} is `undefined` when the encrypted payload contains a system message such a proposal or commit
2400
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2401
+ * and use {@link CoreCryptoContext.decryptMessage} instead.
954
2402
  */
955
2403
  decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
956
2404
  /**
957
- * Encrypts a message for a given conversation
958
- *
959
- * @param conversationId - The ID of the conversation
960
- * @param message - The plaintext message to encrypt
2405
+ * See {@link CoreCryptoContext.encryptMessage}.
961
2406
  *
962
- * @returns The encrypted payload for the given group. This needs to be fanned out to the other members of the group.
2407
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2408
+ * and use {@link CoreCryptoContext.encryptMessage} instead.
963
2409
  */
964
2410
  encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
965
2411
  /**
966
- * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
2412
+ * See {@link CoreCryptoContext.processWelcomeMessage}.
967
2413
  *
968
- * Important: you have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
969
- * it references has already been deleted locally. Join this group with an external commit", ignore it and then try
970
- * to join this group with an external commit.
971
- *
972
- * @param welcomeMessage - TLS-serialized MLS Welcome message
973
- * @param configuration - configuration of the MLS group
974
- * @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
2414
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2415
+ * and use {@link CoreCryptoContext.processWelcomeMessage} instead.
975
2416
  */
976
- processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration): Promise<WelcomeBundle>;
2417
+ processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration$1): Promise<WelcomeBundle>;
977
2418
  /**
978
- * Get the client's public signature key. To upload to the DS for further backend side validation
2419
+ * See {@link CoreCryptoContext.clientPublicKey}.
979
2420
  *
980
2421
  * @param ciphersuite - of the signature key to get
981
2422
  * @param credentialType - of the public key to look for
982
2423
  * @returns the client's public signature key
983
2424
  */
984
- clientPublicKey(ciphersuite: Ciphersuite, credentialType: CredentialType): Promise<Uint8Array>;
2425
+ clientPublicKey(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<Uint8Array>;
985
2426
  /**
2427
+ * See {@link CoreCryptoContext.clientValidKeypackagesCount}.
986
2428
  *
987
- * @param ciphersuite - of the KeyPackages to count
988
- * @param credentialType - of the KeyPackages to count
989
- * @returns The amount of valid, non-expired KeyPackages that are persisted in the backing storage
2429
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2430
+ * and use {@link CoreCryptoContext.clientValidKeypackagesCount} instead.
990
2431
  */
991
- clientValidKeypackagesCount(ciphersuite: Ciphersuite, credentialType: CredentialType): Promise<number>;
2432
+ clientValidKeypackagesCount(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1): Promise<number>;
992
2433
  /**
993
- * Fetches a requested amount of keypackages
2434
+ * See {@link CoreCryptoContext.clientKeypackages}.
994
2435
  *
995
- * @param ciphersuite - of the KeyPackages to generate
996
- * @param credentialType - of the KeyPackages to generate
997
- * @param amountRequested - The amount of keypackages requested
998
- * @returns An array of length `amountRequested` containing TLS-serialized KeyPackages
2436
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2437
+ * and use {@link CoreCryptoContext.clientKeypackages} instead.
999
2438
  */
1000
- clientKeypackages(ciphersuite: Ciphersuite, credentialType: CredentialType, amountRequested: number): Promise<Array<Uint8Array>>;
2439
+ clientKeypackages(ciphersuite: Ciphersuite$1, credentialType: CredentialType$1, amountRequested: number): Promise<Array<Uint8Array>>;
1001
2440
  /**
1002
- * Prunes local KeyPackages after making sure they also have been deleted on the backend side
1003
- * You should only use this after {@link CoreCrypto.e2eiRotateAll}
2441
+ * See {@link CoreCryptoContext.deleteKeypackages}.
1004
2442
  *
1005
- * @param refs - KeyPackage references to delete obtained from a {RotateBundle}
2443
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2444
+ * and use {@link CoreCryptoContext.deleteKeypackages} instead.
1006
2445
  */
1007
2446
  deleteKeypackages(refs: Uint8Array[]): Promise<void>;
1008
2447
  /**
1009
- * Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
1010
- *
1011
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1012
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1013
- * epoch, use new encryption secrets etc...
1014
- *
1015
- * @param conversationId - The ID of the conversation
1016
- * @param keyPackages - KeyPackages of the new clients to add
2448
+ * See {@link CoreCryptoContext.addClientsToConversation}.
1017
2449
  *
1018
- * @returns A {@link CommitBundle}
2450
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2451
+ * and use {@link CoreCryptoContext.addClientsToConversation} instead.
1019
2452
  */
1020
2453
  addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<MemberAddedMessages>;
1021
2454
  /**
1022
- * Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
1023
- * to do so, otherwise this operation does nothing.
1024
- *
1025
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1026
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1027
- * epoch, use new encryption secrets etc...
1028
- *
1029
- * @param conversationId - The ID of the conversation
1030
- * @param clientIds - Array of Client IDs to remove.
2455
+ * See {@link CoreCryptoContext.removeClientsFromConversation}.
1031
2456
  *
1032
- * @returns A {@link CommitBundle}
2457
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2458
+ * and use {@link CoreCryptoContext.removeClientsFromConversation} instead.
1033
2459
  */
1034
2460
  removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId[]): Promise<CommitBundle>;
1035
2461
  /**
1036
- * Creates an update commit which forces every client to update their LeafNode in the conversation
2462
+ * See {@link CoreCryptoContext.updateKeyingMaterial}.
2463
+ *
2464
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2465
+ * and use {@link CoreCryptoContext.updateKeyingMaterial} instead.
2466
+ */
2467
+ updateKeyingMaterial(conversationId: ConversationId): Promise<CommitBundle>;
2468
+ /**
2469
+ * Creates an update commit which replaces your leaf containing basic credentials with a leaf node containing x509 credentials in the conversation.
2470
+ *
2471
+ * NOTE: you can only call this after you've completed the enrollment for an end-to-end identity, calling this without
2472
+ * a valid end-to-end identity will result in an error.
1037
2473
  *
1038
2474
  * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
1039
2475
  * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
@@ -1042,97 +2478,76 @@ export declare class CoreCrypto {
1042
2478
  * @param conversationId - The ID of the conversation
1043
2479
  *
1044
2480
  * @returns A {@link CommitBundle}
2481
+ *
2482
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2483
+ * and use {@link CoreCryptoContext.e2eiRotate} instead.
1045
2484
  */
1046
- updateKeyingMaterial(conversationId: ConversationId): Promise<CommitBundle>;
2485
+ e2eiRotate(conversationId: ConversationId): Promise<CommitBundle>;
1047
2486
  /**
1048
- * Commits the local pending proposals and returns the {@link CommitBundle} object containing what can result from this operation.
1049
- *
1050
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
1051
- * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
1052
- * epoch, use new encryption secrets etc...
1053
- *
1054
- * @param conversationId - The ID of the conversation
2487
+ * See {@link CoreCryptoContext.commitPendingProposals}.
1055
2488
  *
1056
- * @returns A {@link CommitBundle} or `undefined` when there was no pending proposal to commit
2489
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2490
+ * and use {@link CoreCryptoContext.commitPendingProposals} instead.
1057
2491
  */
1058
2492
  commitPendingProposals(conversationId: ConversationId): Promise<CommitBundle | undefined>;
1059
2493
  /**
1060
- * Creates a new proposal for the provided Conversation ID
1061
- *
1062
- * @param proposalType - The type of proposal, see {@link ProposalType}
1063
- * @param args - The arguments of the proposal, see {@link ProposalArgs}, {@link AddProposalArgs} or {@link RemoveProposalArgs}
2494
+ * See {@link CoreCryptoContext.newProposal}.
1064
2495
  *
1065
- * @returns A {@link ProposalBundle} containing the Proposal and its reference in order to roll it back if necessary
2496
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2497
+ * and use {@link CoreCryptoContext.newProposal} instead.
1066
2498
  */
1067
2499
  newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<ProposalBundle>;
1068
2500
  /**
1069
- * Creates a new external Add proposal for self client to join a conversation.
2501
+ * See {@link CoreCryptoContext.newExternalProposal}.
2502
+ *
2503
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2504
+ * and use {@link CoreCryptoContext.newExternalProposal} instead.
1070
2505
  */
1071
2506
  newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
1072
2507
  /**
1073
- * Allows to create an external commit to "apply" to join a group through its GroupInfo.
1074
- *
1075
- * If the Delivery Service accepts the external commit, you have to {@link CoreCrypto.mergePendingGroupFromExternalCommit}
1076
- * in order to get back a functional MLS group. On the opposite, if it rejects it, you can either retry by just
1077
- * calling again {@link CoreCrypto.joinByExternalCommit}, no need to {@link CoreCrypto.clearPendingGroupFromExternalCommit}.
1078
- * If you want to abort the operation (too many retries or the user decided to abort), you can use
1079
- * {@link CoreCrypto.clearPendingGroupFromExternalCommit} in order not to bloat the user's storage but nothing
1080
- * bad can happen if you forget to except some storage space wasted.
2508
+ * See {@link CoreCryptoContext.joinByExternalCommit}.
1081
2509
  *
1082
- * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1083
- * @param credentialType - kind of Credential to use for joining this group. If {@link CredentialType.Basic} is
1084
- * chosen and no Credential has been created yet for it, a new one will be generated.
1085
- * @param configuration - configuration of the MLS group
1086
- * When {@link CredentialType.X509} is chosen, it fails when no Credential has been created for the given {@link Ciphersuite}.
1087
- * @returns see {@link ConversationInitBundle}
2510
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2511
+ * and use {@link CoreCryptoContext.joinByExternalCommit} instead.
1088
2512
  */
1089
- joinByExternalCommit(groupInfo: Uint8Array, credentialType: CredentialType, configuration?: CustomConfiguration): Promise<ConversationInitBundle>;
2513
+ joinByExternalCommit(groupInfo: Uint8Array, credentialType: CredentialType$1, configuration?: CustomConfiguration$1): Promise<ConversationInitBundle>;
1090
2514
  /**
1091
- * This merges the commit generated by {@link CoreCrypto.joinByExternalCommit}, persists the group permanently
1092
- * and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
2515
+ * See {@link CoreCryptoContext.mergePendingGroupFromExternalCommit}.
1093
2516
  *
1094
- * @param conversationId - The ID of the conversation
1095
- * @returns eventually decrypted buffered messages if any
2517
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2518
+ * and use {@link CoreCryptoContext.mergePendingGroupFromExternalCommit} instead.
1096
2519
  */
1097
2520
  mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
1098
2521
  /**
1099
- * In case the external commit generated by {@link CoreCrypto.joinByExternalCommit} is rejected by the Delivery Service, and we
1100
- * want to abort this external commit once for all, we can wipe out the pending group from the keystore in order
1101
- * not to waste space
2522
+ * See {@link CoreCryptoContext.clearPendingGroupFromExternalCommit}.
1102
2523
  *
1103
- * @param conversationId - The ID of the conversation
2524
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2525
+ * and use {@link CoreCryptoContext.clearPendingGroupFromExternalCommit} instead.
1104
2526
  */
1105
2527
  clearPendingGroupFromExternalCommit(conversationId: ConversationId): Promise<void>;
1106
2528
  /**
1107
- * Allows to mark the latest commit produced as "accepted" and be able to safely merge it into the local group state
2529
+ * See {@link CoreCryptoContext.commitAccepted}.
1108
2530
  *
1109
- * @param conversationId - The group's ID
1110
- * @returns the messages from current epoch which had been buffered, if any
2531
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2532
+ * and use {@link CoreCryptoContext.commitAccepted} instead.
1111
2533
  */
1112
2534
  commitAccepted(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
1113
2535
  /**
1114
- * Allows to remove a pending proposal (rollback). Use this when backend rejects the proposal you just sent e.g. if permissions have changed meanwhile.
2536
+ * See {@link CoreCryptoContext.clearPendingProposal}.
1115
2537
  *
1116
- * **CAUTION**: only use this when you had an explicit response from the Delivery Service
1117
- * e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc…
1118
- *
1119
- * @param conversationId - The group's ID
1120
- * @param proposalRef - A reference to the proposal to delete. You get one when using {@link CoreCrypto.newProposal}
2538
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2539
+ * and use {@link CoreCryptoContext.clearPendingProposal} instead.
1121
2540
  */
1122
2541
  clearPendingProposal(conversationId: ConversationId, proposalRef: ProposalRef): Promise<void>;
1123
2542
  /**
1124
- * Allows to remove a pending commit (rollback). Use this when backend rejects the commit you just sent e.g. if permissions have changed meanwhile.
1125
- *
1126
- * **CAUTION**: only use this when you had an explicit response from the Delivery Service
1127
- * e.g. 403. Do not use otherwise e.g. 5xx responses, timeout etc..
1128
- * **DO NOT** use when Delivery Service responds 409, pending state will be renewed
1129
- * in {@link CoreCrypto.decryptMessage}
2543
+ * See {@link CoreCryptoContext.clearPendingCommit}.
1130
2544
  *
1131
- * @param conversationId - The group's ID
2545
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2546
+ * and use {@link CoreCryptoContext.clearPendingCommit} instead.
1132
2547
  */
1133
2548
  clearPendingCommit(conversationId: ConversationId): Promise<void>;
1134
2549
  /**
1135
- * Derives a new key from the group
2550
+ * See {@link CoreCryptoContext.exportSecretKey}.
1136
2551
  *
1137
2552
  * @param conversationId - The group's ID
1138
2553
  * @param keyLength - the length of the key to be derived. If the value is higher than the
@@ -1142,8 +2557,7 @@ export declare class CoreCrypto {
1142
2557
  */
1143
2558
  exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<Uint8Array>;
1144
2559
  /**
1145
- * Returns the raw public key of the single external sender present in this group.
1146
- * This should be used to initialize a subconversation
2560
+ * See {@link CoreCryptoContext.getExternalSender}.
1147
2561
  *
1148
2562
  * @param conversationId - The group's ID
1149
2563
  *
@@ -1151,7 +2565,7 @@ export declare class CoreCrypto {
1151
2565
  */
1152
2566
  getExternalSender(conversationId: ConversationId): Promise<Uint8Array>;
1153
2567
  /**
1154
- * Returns all clients from group's members
2568
+ * See {@link CoreCryptoContext.getClientIds}.
1155
2569
  *
1156
2570
  * @param conversationId - The group's ID
1157
2571
  *
@@ -1159,8 +2573,7 @@ export declare class CoreCrypto {
1159
2573
  */
1160
2574
  getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
1161
2575
  /**
1162
- * Allows {@link CoreCrypto} to act as a CSPRNG provider
1163
- * @note The underlying CSPRNG algorithm is ChaCha20 and takes in account the external seed provider either at init time or provided with {@link CoreCrypto.reseedRng}
2576
+ * See {@link CoreCryptoContext.randomBytes}.
1164
2577
  *
1165
2578
  * @param length - The number of bytes to be returned in the `Uint8Array`
1166
2579
  *
@@ -1182,6 +2595,9 @@ export declare class CoreCrypto {
1182
2595
  *
1183
2596
  * @param sessionId - ID of the Proteus session
1184
2597
  * @param prekey - CBOR-encoded Proteus prekey of the other client
2598
+ *
2599
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2600
+ * and use {@link CoreCryptoContext.proteusSessionFromPrekey} instead.
1185
2601
  */
1186
2602
  proteusSessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<void>;
1187
2603
  /**
@@ -1191,6 +2607,9 @@ export declare class CoreCrypto {
1191
2607
  * @param envelope - CBOR-encoded Proteus message
1192
2608
  *
1193
2609
  * @returns A `Uint8Array` containing the message that was sent along with the session handshake
2610
+ *
2611
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2612
+ * and use {@link CoreCryptoContext.proteusSessionFromMessage} instead.
1194
2613
  */
1195
2614
  proteusSessionFromMessage(sessionId: string, envelope: Uint8Array): Promise<Uint8Array>;
1196
2615
  /**
@@ -1199,6 +2618,9 @@ export declare class CoreCrypto {
1199
2618
  * **Note**: This isn't usually needed as persisting sessions happens automatically when decrypting/encrypting messages and initializing Sessions
1200
2619
  *
1201
2620
  * @param sessionId - ID of the Proteus session
2621
+ *
2622
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2623
+ * and use {@link CoreCryptoContext.proteusSessionSave} instead.
1202
2624
  */
1203
2625
  proteusSessionSave(sessionId: string): Promise<void>;
1204
2626
  /**
@@ -1206,6 +2628,9 @@ export declare class CoreCrypto {
1206
2628
  * Note: this also deletes the persisted data within the keystore
1207
2629
  *
1208
2630
  * @param sessionId - ID of the Proteus session
2631
+ *
2632
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2633
+ * and use {@link CoreCryptoContext.proteusSessionDelete} instead.
1209
2634
  */
1210
2635
  proteusSessionDelete(sessionId: string): Promise<void>;
1211
2636
  /**
@@ -1222,6 +2647,9 @@ export declare class CoreCrypto {
1222
2647
  * @param sessionId - ID of the Proteus session
1223
2648
  * @param ciphertext - CBOR encoded, encrypted proteus message
1224
2649
  * @returns The decrypted payload contained within the message
2650
+ *
2651
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2652
+ * and use {@link CoreCryptoContext.proteusDecrypt} instead.
1225
2653
  */
1226
2654
  proteusDecrypt(sessionId: string, ciphertext: Uint8Array): Promise<Uint8Array>;
1227
2655
  /**
@@ -1230,6 +2658,9 @@ export declare class CoreCrypto {
1230
2658
  * @param sessionId - ID of the Proteus session
1231
2659
  * @param plaintext - payload to encrypt
1232
2660
  * @returns The CBOR-serialized encrypted message
2661
+ *
2662
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2663
+ * and use {@link CoreCryptoContext.proteusEncrypt} instead.
1233
2664
  */
1234
2665
  proteusEncrypt(sessionId: string, plaintext: Uint8Array): Promise<Uint8Array>;
1235
2666
  /**
@@ -1239,6 +2670,8 @@ export declare class CoreCrypto {
1239
2670
  * @param sessions - List of Proteus session IDs to encrypt the message for
1240
2671
  * @param plaintext - payload to encrypt
1241
2672
  * @returns A map indexed by each session ID and the corresponding CBOR-serialized encrypted message for this session
2673
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2674
+ * and use {@link CoreCryptoContext.proteusEncryptBatched} instead.
1242
2675
  */
1243
2676
  proteusEncryptBatched(sessions: string[], plaintext: Uint8Array): Promise<Map<string, Uint8Array>>;
1244
2677
  /**
@@ -1246,18 +2679,27 @@ export declare class CoreCrypto {
1246
2679
  *
1247
2680
  * @param prekeyId - ID of the PreKey to generate. This cannot be bigger than a u16
1248
2681
  * @returns: A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey
2682
+ *
2683
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2684
+ * and use {@link CoreCryptoContext.proteusNewPrekey} instead.
1249
2685
  */
1250
2686
  proteusNewPrekey(prekeyId: number): Promise<Uint8Array>;
1251
2687
  /**
1252
2688
  * Creates a new prekey with an automatically generated ID..
1253
2689
  *
1254
2690
  * @returns A CBOR-serialized version of the PreKeyBundle corresponding to the newly generated and stored PreKey accompanied by its ID
2691
+ *
2692
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2693
+ * and use {@link CoreCryptoContext.proteusNewPrekeyAuto} instead.
1255
2694
  */
1256
2695
  proteusNewPrekeyAuto(): Promise<ProteusAutoPrekeyBundle>;
1257
2696
  /**
1258
2697
  * Proteus last resort prekey stuff
1259
2698
  *
1260
2699
  * @returns A CBOR-serialize version of the PreKeyBundle associated with the last resort PreKey (holding the last resort prekey id)
2700
+ *
2701
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2702
+ * and use {@link CoreCryptoContext.proteusLastResortPrekey} instead.
1261
2703
  */
1262
2704
  proteusLastResortPrekey(): Promise<Uint8Array>;
1263
2705
  /**
@@ -1296,6 +2738,9 @@ export declare class CoreCrypto {
1296
2738
  * Imports all the data stored by Cryptobox into the CoreCrypto keystore
1297
2739
  *
1298
2740
  * @param storeName - The name of the IndexedDB store where the data is stored
2741
+ *
2742
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2743
+ * and use {@link CoreCryptoContext.proteusCryptoboxMigrate} instead.
1299
2744
  */
1300
2745
  proteusCryptoboxMigrate(storeName: string): Promise<void>;
1301
2746
  /**
@@ -1304,163 +2749,124 @@ export declare class CoreCrypto {
1304
2749
  */
1305
2750
  proteusLastErrorCode(): Promise<number>;
1306
2751
  /**
1307
- * Creates an enrollment instance with private key material you can use in order to fetch
1308
- * a new x509 certificate from the acme server.
2752
+ * See {@link CoreCryptoContext.e2eiNewEnrollment}.
1309
2753
  *
1310
- * @param clientId - client identifier e.g. `b7ac11a4-8f01-4527-af88-1c30885a7931:6add501bacd1d90e@example.com`
1311
- * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1312
- * @param handle - user handle e.g. `alice.smith.qa@example.com`
1313
- * @param expirySec - generated x509 certificate expiry
1314
- * @param ciphersuite - for generating signing key material
1315
- * @param team - name of the Wire team a user belongs to
1316
- * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiMlsInitOnly}
2754
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2755
+ * and use {@link CoreCryptoContext.e2eiNewEnrollment} instead.
1317
2756
  */
1318
- e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
2757
+ e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
1319
2758
  /**
1320
- * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1321
- * Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
2759
+ * See {@link CoreCryptoContext.e2eiNewActivationEnrollment}.
1322
2760
  *
1323
- * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1324
- * @param handle - user handle e.g. `alice.smith.qa@example.com`
1325
- * @param expirySec - generated x509 certificate expiry
1326
- * @param ciphersuite - for generating signing key material
1327
- * @param team - name of the Wire team a user belongs to
1328
- * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
2761
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2762
+ * and use {@link CoreCryptoContext.e2eiNewActivationEnrollment} instead.
1329
2763
  */
1330
- e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
2764
+ e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite$1, team?: string): Promise<E2eiEnrollment>;
1331
2765
  /**
1332
- * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1333
- * having to change/rotate their credential, either because the former one is expired or it
1334
- * has been revoked. It lets you change the DisplayName or the handle
1335
- * if you need to. Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
2766
+ * See {@link CoreCryptoContext.e2eiNewRotateEnrollment}.
1336
2767
  *
1337
- * @param expirySec - generated x509 certificate expiry
1338
- * @param ciphersuite - for generating signing key material
1339
- * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1340
- * @param handle - user handle e.g. `alice.smith.qa@example.com`
1341
- * @param team - name of the Wire team a user belongs to
1342
- * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
2768
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2769
+ * and use {@link CoreCryptoContext.e2eiNewRotateEnrollment} instead.
1343
2770
  */
1344
- e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
2771
+ e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite$1, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
1345
2772
  /**
1346
- * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
1347
- * that means he cannot initialize with a Basic credential
2773
+ * See {@link CoreCryptoContext.e2eiMlsInitOnly}.
1348
2774
  *
1349
- * @param enrollment - the enrollment instance used to fetch the certificates
1350
- * @param certificateChain - the raw response from ACME server
1351
- * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
1352
- * @returns a MlsClient initialized with only a x509 credential
2775
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2776
+ * and use {@link CoreCryptoContext.e2eiMlsInitOnly} instead.
1353
2777
  */
1354
2778
  e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<string[] | undefined>;
1355
2779
  /**
1356
- * Dumps the PKI environment as PEM
2780
+ * See {@link CoreCryptoContext.e2eiDumpPKIEnv}.
1357
2781
  *
1358
2782
  * @returns a struct with different fields representing the PKI environment as PEM strings
1359
2783
  */
1360
2784
  e2eiDumpPKIEnv(): Promise<E2eiDumpedPkiEnv | undefined>;
1361
2785
  /**
2786
+ * See {@link CoreCryptoContext.e2eiIsPKIEnvSetup}.
1362
2787
  * @returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
1363
2788
  */
1364
2789
  e2eiIsPKIEnvSetup(): Promise<boolean>;
1365
2790
  /**
1366
- * Registers a Root Trust Anchor CA for the use in E2EI processing.
1367
- *
1368
- * Please note that without a Root Trust Anchor, all validations *will* fail;
1369
- * So this is the first step to perform after initializing your E2EI client
2791
+ * See {@link CoreCryptoContext.e2eiRegisterAcmeCA}.
1370
2792
  *
1371
- * @param trustAnchorPEM - PEM certificate to anchor as a Trust Root
2793
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2794
+ * and use {@link CoreCryptoContext.e2eiRegisterAcmeCA} instead.
1372
2795
  */
1373
2796
  e2eiRegisterAcmeCA(trustAnchorPEM: string): Promise<void>;
1374
2797
  /**
1375
- * Registers an Intermediate CA for the use in E2EI processing.
1376
- *
1377
- * Please note that a Root Trust Anchor CA is needed to validate Intermediate CAs;
1378
- * You **need** to have a Root CA registered before calling this
2798
+ * See {@link CoreCryptoContext.e2eiRegisterIntermediateCA}.
1379
2799
  *
1380
- * @param certPEM - PEM certificate to register as an Intermediate CA
2800
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2801
+ * and use {@link CoreCryptoContext.e2eiRegisterIntermediateCA} instead.
1381
2802
  */
1382
2803
  e2eiRegisterIntermediateCA(certPEM: string): Promise<string[] | undefined>;
1383
2804
  /**
1384
- * Registers a CRL for the use in E2EI processing.
2805
+ * See {@link CoreCryptoContext.e2eiRegisterCRL}.
1385
2806
  *
1386
- * Please note that a Root Trust Anchor CA is needed to validate CRLs;
1387
- * You **need** to have a Root CA registered before calling this
1388
- *
1389
- * @param crlDP - CRL Distribution Point; Basically the URL you fetched it from
1390
- * @param crlDER - DER representation of the CRL
1391
- *
1392
- * @returns a {@link CRLRegistration} with the dirty state of the new CRL (see struct) and its expiration timestamp
2807
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2808
+ * and use {@link CoreCryptoContext.e2eiRegisterCRL} instead.
1393
2809
  */
1394
2810
  e2eiRegisterCRL(crlDP: string, crlDER: Uint8Array): Promise<CRLRegistration>;
1395
2811
  /**
1396
- * Creates a commit in all local conversations for changing the credential. Requires first
1397
- * having enrolled a new X509 certificate with either {@link CoreCrypto.e2eiNewActivationEnrollment}
1398
- * or {@link CoreCrypto.e2eiNewRotateEnrollment}
2812
+ * See {@link CoreCryptoContext.e2eiRotateAll}.
1399
2813
  *
1400
- * @param enrollment - the enrollment instance used to fetch the certificates
1401
- * @param certificateChain - the raw response from ACME server
1402
- * @param newKeyPackageCount - number of KeyPackages with new identity to generate
1403
- * @returns a {@link RotateBundle} with commits to fan-out to other group members, KeyPackages to upload and old ones to delete
2814
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2815
+ * and use {@link CoreCryptoContext.e2eiRotateAll} instead.
1404
2816
  */
1405
2817
  e2eiRotateAll(enrollment: E2eiEnrollment, certificateChain: string, newKeyPackageCount: number): Promise<RotateBundle>;
1406
2818
  /**
1407
- * Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
1408
- * it later with {@link e2eiEnrollmentStashPop}
2819
+ * See {@link CoreCryptoContext.e2eiEnrollmentStash}.
1409
2820
  *
1410
- * @param enrollment the enrollment instance to persist
1411
- * @returns a handle to fetch the enrollment later with {@link e2eiEnrollmentStashPop}
2821
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2822
+ * and use {@link CoreCryptoContext.e2eiEnrollmentStash} instead.
1412
2823
  */
1413
2824
  e2eiEnrollmentStash(enrollment: E2eiEnrollment): Promise<Uint8Array>;
1414
2825
  /**
1415
- * Fetches the persisted enrollment and deletes it from the keystore
2826
+ * See {@link CoreCryptoContext.e2eiEnrollmentStashPop}.
1416
2827
  *
1417
- * @param handle returned by {@link e2eiEnrollmentStash}
1418
- * @returns the persisted enrollment instance
2828
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2829
+ * and use {@link CoreCryptoContext.e2eiEnrollmentStashPop} instead.
1419
2830
  */
1420
2831
  e2eiEnrollmentStashPop(handle: Uint8Array): Promise<E2eiEnrollment>;
1421
2832
  /**
1422
- * Indicates when to mark a conversation as not verified i.e. when not all its members have a X509.
1423
- * Credential generated by Wire's end-to-end identity enrollment
2833
+ * See {@link CoreCryptoContext.e2eiConversationState}.
1424
2834
  *
1425
- * @param conversationId The group's ID
1426
- * @returns the conversation state given current members
2835
+ * @deprecated Create a transaction with {@link CoreCrypto.transaction}
2836
+ * and use {@link CoreCryptoContext.e2eiConversationState} instead.
1427
2837
  */
1428
2838
  e2eiConversationState(conversationId: ConversationId): Promise<E2eiConversationState>;
1429
2839
  /**
1430
- * Returns true when end-to-end-identity is enabled for the given Ciphersuite
2840
+ * See {@link CoreCryptoContext.e2eiIsEnabled}.
1431
2841
  *
1432
2842
  * @param ciphersuite of the credential to check
1433
2843
  * @returns true if end-to-end identity is enabled for the given ciphersuite
1434
2844
  */
1435
- e2eiIsEnabled(ciphersuite: Ciphersuite): Promise<boolean>;
2845
+ e2eiIsEnabled(ciphersuite: Ciphersuite$1): Promise<boolean>;
1436
2846
  /**
1437
- * From a given conversation, get the identity of the members supplied. Identity is only present for members with a
1438
- * Certificate Credential (after turning on end-to-end identity).
2847
+ * See {@link CoreCryptoContext.getDeviceIdentities}.
1439
2848
  *
1440
2849
  * @param conversationId - identifier of the conversation
1441
2850
  * @param deviceIds - identifiers of the devices
1442
2851
  * @returns identities or if no member has a x509 certificate, it will return an empty List
1443
2852
  */
1444
- getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity[]>;
2853
+ getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity$1[]>;
1445
2854
  /**
1446
- * From a given conversation, get the identity of the users (device holders) supplied.
1447
- * Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity).
1448
- * If no member has a x509 certificate, it will return an empty Vec.
2855
+ * See {@link CoreCryptoContext.getUserIdentities}.
1449
2856
  *
1450
2857
  * @param conversationId - identifier of the conversation
1451
2858
  * @param userIds - user identifiers hyphenated UUIDv4 e.g. 'bd4c7053-1c5a-4020-9559-cd7bf7961954'
1452
2859
  * @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.
1453
2860
  */
1454
- getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
2861
+ getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity$1[]>>;
1455
2862
  /**
1456
- * Gets the e2ei conversation state from a `GroupInfo`. Useful to check if the group has e2ei
1457
- * turned on or not before joining it.
2863
+ * See {@link CoreCryptoContext.getCredentialInUse}.
1458
2864
  *
1459
2865
  * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1460
2866
  * @param credentialType - kind of Credential to check usage of. Defaults to X509 for now as no other value will give any result.
1461
2867
  * @returns see {@link E2eiConversationState}
1462
2868
  */
1463
- getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType): Promise<E2eiConversationState>;
2869
+ getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType$1): Promise<E2eiConversationState>;
1464
2870
  /**
1465
2871
  * Returns the current version of {@link CoreCrypto}
1466
2872
  *
@@ -1633,4 +3039,18 @@ export declare enum E2eiConversationState {
1633
3039
  NotEnabled = 3
1634
3040
  }
1635
3041
 
3042
+ export {
3043
+ Ciphersuite$1 as Ciphersuite,
3044
+ ConversationConfiguration as ConversationConfigurationFfi,
3045
+ ConversationConfiguration$1 as ConversationConfiguration,
3046
+ CoreCryptoContext as CoreCryptoContextFfi,
3047
+ CoreCryptoContext$1 as CoreCryptoContext,
3048
+ CredentialType$1 as CredentialType,
3049
+ CustomConfiguration as CustomConfigurationFfi,
3050
+ CustomConfiguration$1 as CustomConfiguration,
3051
+ WireIdentity$1 as WireIdentity,
3052
+ WirePolicy$1 as WirePolicy,
3053
+ X509Identity$1 as X509Identity,
3054
+ };
3055
+
1636
3056
  export {};