@wireapp/core-crypto 7.0.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/CoreCrypto.ts +116 -0
- package/src/corecrypto.d.ts +251 -232
- package/src/corecrypto.js +640 -520
- package/src/core-crypto-ffi_bg.wasm +0 -0
- package/src/core-crypto-ffi_bg.wasm.d.ts +0 -269
package/src/corecrypto.d.ts
CHANGED
@@ -1,9 +1,22 @@
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
2
2
|
|
3
|
+
/* tslint:disable */
|
4
|
+
/* eslint-disable */
|
5
|
+
export function ciphersuiteFromU16(discriminant: number): Ciphersuite;
|
6
|
+
export function ciphersuiteDefault(): Ciphersuite;
|
3
7
|
/**
|
4
|
-
*
|
8
|
+
* Updates the key of the CoreCrypto database.
|
9
|
+
* To be used only once, when moving from CoreCrypto <= 5.x to CoreCrypto 6.x.
|
5
10
|
*/
|
6
|
-
export
|
11
|
+
export function migrateDatabaseKeyTypeToBytes(name: string, old_key: string, new_key: DatabaseKey): Promise<void>;
|
12
|
+
/**
|
13
|
+
* Updates the key of the CoreCrypto database.
|
14
|
+
*/
|
15
|
+
export function updateDatabaseKey(name: string, old_key: DatabaseKey, new_key: DatabaseKey): Promise<void>;
|
16
|
+
/**
|
17
|
+
* MLS ciphersuites.
|
18
|
+
*/
|
19
|
+
export enum Ciphersuite {
|
7
20
|
/**
|
8
21
|
* DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
|
9
22
|
*/
|
@@ -33,13 +46,6 @@ export declare enum Ciphersuite {
|
|
33
46
|
*/
|
34
47
|
MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
|
35
48
|
}
|
36
|
-
/* tslint:disable */
|
37
|
-
/* eslint-disable */
|
38
|
-
/**
|
39
|
-
* Updates the key of the CoreCrypto database.
|
40
|
-
* To be used only once, when moving from CoreCrypto <= 5.x to CoreCrypto 6.x.
|
41
|
-
*/
|
42
|
-
export function migrateDatabaseKeyTypeToBytes(name: string, old_key: string, new_key: DatabaseKey): Promise<void>;
|
43
49
|
export enum CredentialType {
|
44
50
|
/**
|
45
51
|
* Basic credential i.e. a KeyPair
|
@@ -156,11 +162,6 @@ declare class AcmeDirectory {
|
|
156
162
|
*/
|
157
163
|
readonly revokeCert: string;
|
158
164
|
}
|
159
|
-
declare class ArrayOfByteArray {
|
160
|
-
free(): void;
|
161
|
-
constructor(aoba: Uint8Array[]);
|
162
|
-
as_arrays(): Uint8Array[];
|
163
|
-
}
|
164
165
|
declare class BufferedDecryptedMessage {
|
165
166
|
private constructor();
|
166
167
|
free(): void;
|
@@ -184,7 +185,7 @@ declare class BufferedDecryptedMessage {
|
|
184
185
|
/**
|
185
186
|
* New CRL Distribution of members of this group
|
186
187
|
*/
|
187
|
-
readonly crlNewDistributionPoints:
|
188
|
+
readonly crlNewDistributionPoints: string[] | undefined;
|
188
189
|
}
|
189
190
|
/**
|
190
191
|
* Metadata describing the conditions of the build of this software.
|
@@ -237,29 +238,36 @@ export class BuildMetadata {
|
|
237
238
|
*/
|
238
239
|
readonly gitDirty: string;
|
239
240
|
}
|
240
|
-
|
241
|
-
free(): void;
|
242
|
-
as_u16(): number;
|
243
|
-
constructor(discriminant: number);
|
244
|
-
}
|
245
|
-
declare class Ciphersuites {
|
246
|
-
free(): void;
|
247
|
-
constructor(ids: Uint16Array);
|
248
|
-
}
|
249
|
-
declare class ClientId {
|
241
|
+
export class ClientId {
|
250
242
|
free(): void;
|
251
243
|
constructor(bytes: Uint8Array);
|
252
|
-
|
244
|
+
copyBytes(): Uint8Array;
|
253
245
|
}
|
254
246
|
declare class ConversationConfiguration {
|
255
247
|
free(): void;
|
256
|
-
constructor(ciphersuite?: Ciphersuite
|
257
|
-
readonly ciphersuite: Ciphersuite
|
248
|
+
constructor(ciphersuite?: Ciphersuite | null, external_senders?: ExternalSenderKey[] | null, key_rotation_span?: number | null, wire_policy?: WirePolicy | null);
|
249
|
+
readonly ciphersuite: Ciphersuite | undefined;
|
250
|
+
readonly externalSenders: ExternalSenderKey[];
|
258
251
|
readonly custom: CustomConfiguration;
|
252
|
+
}
|
253
|
+
/**
|
254
|
+
* r" A unique identifier for a single conversation.
|
255
|
+
* r"
|
256
|
+
* r" The backend provides an opaque string identifying a new conversation.
|
257
|
+
* r" Construct an instance of this newtype to pass that identifier to Rust.
|
258
|
+
*/
|
259
|
+
export class ConversationId {
|
260
|
+
free(): void;
|
259
261
|
/**
|
260
|
-
*
|
262
|
+
* Construct a new instance, transferring data from the client layer to Rust.
|
263
|
+
*/
|
264
|
+
constructor(bytes: Uint8Array);
|
265
|
+
/**
|
266
|
+
* Get the raw bytes from this type, transferring data from Rust to the client layer.
|
267
|
+
*
|
268
|
+
* This does not consume the newtype, instead copying the internal data across the FFI boundary.
|
261
269
|
*/
|
262
|
-
|
270
|
+
copyBytes(): Uint8Array;
|
263
271
|
}
|
264
272
|
declare class CoreCryptoContext {
|
265
273
|
private constructor();
|
@@ -267,15 +275,15 @@ declare class CoreCryptoContext {
|
|
267
275
|
/**
|
268
276
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_new_enrollment]
|
269
277
|
*/
|
270
|
-
e2ei_new_enrollment(client_id: string, display_name: string, handle: string, team: string | null | undefined, expiry_sec: number, ciphersuite: Ciphersuite
|
278
|
+
e2ei_new_enrollment(client_id: string, display_name: string, handle: string, team: string | null | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<FfiWireE2EIdentity>;
|
271
279
|
/**
|
272
280
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_new_activation_enrollment]
|
273
281
|
*/
|
274
|
-
e2ei_new_activation_enrollment(display_name: string, handle: string, team: string | null | undefined, expiry_sec: number, ciphersuite: Ciphersuite
|
282
|
+
e2ei_new_activation_enrollment(display_name: string, handle: string, team: string | null | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<FfiWireE2EIdentity>;
|
275
283
|
/**
|
276
284
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_new_rotate_enrollment]
|
277
285
|
*/
|
278
|
-
e2ei_new_rotate_enrollment(display_name: string | null | undefined, handle: string | null | undefined, team: string | null | undefined, expiry_sec: number, ciphersuite: Ciphersuite
|
286
|
+
e2ei_new_rotate_enrollment(display_name: string | null | undefined, handle: string | null | undefined, team: string | null | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<FfiWireE2EIdentity>;
|
279
287
|
/**
|
280
288
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_register_acme_ca]
|
281
289
|
*/
|
@@ -283,7 +291,7 @@ declare class CoreCryptoContext {
|
|
283
291
|
/**
|
284
292
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_register_intermediate_ca_pem]
|
285
293
|
*/
|
286
|
-
e2ei_register_intermediate_ca(cert_pem: string): Promise<
|
294
|
+
e2ei_register_intermediate_ca(cert_pem: string): Promise<string[] | undefined>;
|
287
295
|
/**
|
288
296
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_register_crl]
|
289
297
|
*/
|
@@ -291,19 +299,19 @@ declare class CoreCryptoContext {
|
|
291
299
|
/**
|
292
300
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_mls_init_only]
|
293
301
|
*/
|
294
|
-
e2ei_mls_init_only(enrollment: FfiWireE2EIdentity, certificate_chain: string, nb_key_package?: number | null): Promise<
|
302
|
+
e2ei_mls_init_only(enrollment: FfiWireE2EIdentity, certificate_chain: string, nb_key_package?: number | null): Promise<string[] | undefined>;
|
295
303
|
/**
|
296
304
|
* See [core_crypto::mls::conversation::ConversationGuard::e2ei_rotate]
|
297
305
|
*/
|
298
|
-
e2ei_rotate(conversation_id:
|
306
|
+
e2ei_rotate(conversation_id: ConversationId): Promise<void>;
|
299
307
|
/**
|
300
308
|
* See [core_crypto::transaction_context::TransactionContext::save_x509_credential]
|
301
309
|
*/
|
302
|
-
save_x509_credential(enrollment: FfiWireE2EIdentity, certificate_chain: string): Promise<
|
310
|
+
save_x509_credential(enrollment: FfiWireE2EIdentity, certificate_chain: string): Promise<string[] | undefined>;
|
303
311
|
/**
|
304
312
|
* See [core_crypto::transaction_context::TransactionContext::delete_stale_key_packages]
|
305
313
|
*/
|
306
|
-
delete_stale_key_packages(ciphersuite: Ciphersuite
|
314
|
+
delete_stale_key_packages(ciphersuite: Ciphersuite): Promise<void>;
|
307
315
|
/**
|
308
316
|
* See [core_crypto::transaction_context::TransactionContext::e2ei_enrollment_stash]
|
309
317
|
*
|
@@ -317,27 +325,19 @@ declare class CoreCryptoContext {
|
|
317
325
|
/**
|
318
326
|
* See [core_crypto::mls::conversation::Conversation::e2ei_conversation_state]
|
319
327
|
*/
|
320
|
-
e2ei_conversation_state(conversation_id:
|
328
|
+
e2ei_conversation_state(conversation_id: ConversationId): Promise<E2eiConversationState>;
|
321
329
|
/**
|
322
330
|
* See [core_crypto::prelude::Session::e2ei_is_enabled]
|
323
331
|
*/
|
324
|
-
e2ei_is_enabled(ciphersuite: Ciphersuite
|
332
|
+
e2ei_is_enabled(ciphersuite: Ciphersuite): Promise<boolean>;
|
325
333
|
/**
|
326
334
|
* See [core_crypto::mls::conversation::Conversation::get_device_identities]
|
327
335
|
*/
|
328
|
-
get_device_identities(conversation_id:
|
336
|
+
get_device_identities(conversation_id: ConversationId, device_ids: ClientId[]): Promise<WireIdentity[]>;
|
329
337
|
/**
|
330
338
|
* See [core_crypto::mls::conversation::Conversation::get_user_identities]
|
331
339
|
*/
|
332
|
-
get_user_identities(conversation_id:
|
333
|
-
/**
|
334
|
-
* See [core_crypto::prelude::Session::get_credential_in_use]
|
335
|
-
*/
|
336
|
-
get_credential_in_use(group_info: Uint8Array, credential_type: CredentialType): Promise<E2eiConversationState>;
|
337
|
-
/**
|
338
|
-
* See [core_crypto::prelude::Session::e2ei_dump_pki_env]
|
339
|
-
*/
|
340
|
-
e2ei_dump_pki_env(): Promise<E2eiDumpedPkiEnv | undefined>;
|
340
|
+
get_user_identities(conversation_id: ConversationId, user_ids: string[]): Promise<Map<string, WireIdentity[]>>;
|
341
341
|
/**
|
342
342
|
* See [core_crypto::prelude::Session::e2ei_is_pki_env_setup]
|
343
343
|
*/
|
@@ -345,99 +345,95 @@ declare class CoreCryptoContext {
|
|
345
345
|
/**
|
346
346
|
* See [core_crypto::transaction_context::TransactionContext::mls_init]
|
347
347
|
*/
|
348
|
-
mls_init(client_id: ClientId, ciphersuites:
|
349
|
-
/**
|
350
|
-
* See [core_crypto::transaction_context::TransactionContext::mls_generate_keypairs]
|
351
|
-
*/
|
352
|
-
mls_generate_keypairs(ciphersuites: Ciphersuites): Promise<ClientId[]>;
|
353
|
-
/**
|
354
|
-
* See [core_crypto::transaction_context::TransactionContext::mls_init_with_client_id]
|
355
|
-
*/
|
356
|
-
mls_init_with_client_id(client_id: ClientId, tmp_client_ids: ClientId[], ciphersuites: Ciphersuites): Promise<void>;
|
348
|
+
mls_init(client_id: ClientId, ciphersuites: any[], nb_key_package?: number | null): Promise<void>;
|
357
349
|
/**
|
358
350
|
* See [core_crypto::transaction_context::TransactionContext::client_public_key]
|
359
351
|
*/
|
360
|
-
client_public_key(ciphersuite: Ciphersuite
|
352
|
+
client_public_key(ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<Uint8Array>;
|
361
353
|
/**
|
362
354
|
* See [core_crypto::mls::conversation::Conversation::epoch]
|
363
355
|
*/
|
364
|
-
conversation_epoch(conversation_id:
|
356
|
+
conversation_epoch(conversation_id: ConversationId): Promise<bigint>;
|
365
357
|
/**
|
366
358
|
* See [core_crypto::mls::conversation::Conversation::ciphersuite]
|
367
359
|
*/
|
368
|
-
conversation_ciphersuite(conversation_id:
|
360
|
+
conversation_ciphersuite(conversation_id: ConversationId): Promise<Ciphersuite>;
|
369
361
|
/**
|
370
362
|
* See [core_crypto::prelude::Session::conversation_exists]
|
371
363
|
*/
|
372
|
-
conversation_exists(conversation_id:
|
364
|
+
conversation_exists(conversation_id: ConversationId): Promise<boolean>;
|
373
365
|
/**
|
374
366
|
* See [core_crypto::mls::conversation::Conversation::get_client_ids]
|
375
367
|
*/
|
376
|
-
get_client_ids(conversation_id:
|
368
|
+
get_client_ids(conversation_id: ConversationId): Promise<ClientId[]>;
|
377
369
|
/**
|
378
370
|
* See [core_crypto::mls::conversation::Conversation::export_secret_key]
|
379
371
|
*/
|
380
|
-
export_secret_key(conversation_id:
|
372
|
+
export_secret_key(conversation_id: ConversationId, key_length: number): Promise<SecretKey>;
|
381
373
|
/**
|
382
374
|
* See [core_crypto::mls::conversation::Conversation::get_external_sender]
|
383
375
|
*/
|
384
|
-
get_external_sender(conversation_id:
|
376
|
+
get_external_sender(conversation_id: ConversationId): Promise<ExternalSenderKey>;
|
385
377
|
/**
|
386
378
|
* See [core_crypto::transaction_context::TransactionContext::get_or_create_client_keypackages]
|
387
379
|
*/
|
388
|
-
client_keypackages(ciphersuite: Ciphersuite
|
380
|
+
client_keypackages(ciphersuite: Ciphersuite, credential_type: CredentialType, amount_requested: number): Promise<KeyPackage[]>;
|
389
381
|
/**
|
390
382
|
* See [core_crypto::transaction_context::TransactionContext::client_valid_key_packages_count]
|
391
383
|
*/
|
392
|
-
client_valid_keypackages_count(ciphersuite: Ciphersuite
|
393
|
-
/**
|
394
|
-
* See [core_crypto::transaction_context::TransactionContext::delete_keypackages]
|
395
|
-
*/
|
396
|
-
delete_keypackages(refs: ArrayOfByteArray): Promise<void>;
|
384
|
+
client_valid_keypackages_count(ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<bigint>;
|
397
385
|
/**
|
398
386
|
* See [core_crypto::transaction_context::TransactionContext::new_conversation]
|
399
387
|
*/
|
400
|
-
create_conversation(conversation_id:
|
388
|
+
create_conversation(conversation_id: ConversationId, creator_credential_type: CredentialType, config: ConversationConfiguration): Promise<void>;
|
401
389
|
/**
|
402
390
|
* See [core_crypto::transaction_context::TransactionContext::process_raw_welcome_message]
|
403
391
|
*/
|
404
|
-
process_welcome_message(welcome_message:
|
392
|
+
process_welcome_message(welcome_message: Welcome, custom_configuration: CustomConfiguration): Promise<WelcomeBundle>;
|
405
393
|
/**
|
406
394
|
* See [core_crypto::mls::conversation::ConversationGuard::add_members]
|
407
395
|
*/
|
408
|
-
add_clients_to_conversation(conversation_id:
|
396
|
+
add_clients_to_conversation(conversation_id: ConversationId, key_packages: KeyPackage[]): Promise<string[] | undefined>;
|
409
397
|
/**
|
410
398
|
* See [core_crypto::mls::conversation::ConversationGuard::remove_members]
|
411
399
|
*/
|
412
|
-
remove_clients_from_conversation(conversation_id:
|
400
|
+
remove_clients_from_conversation(conversation_id: ConversationId, clients: ClientId[]): Promise<void>;
|
413
401
|
/**
|
414
402
|
* See [core_crypto::mls::conversation::ConversationGuard::mark_as_child_of]
|
415
403
|
*/
|
416
|
-
mark_conversation_as_child_of(child_id:
|
404
|
+
mark_conversation_as_child_of(child_id: ConversationId, parent_id: ConversationId): Promise<void>;
|
417
405
|
/**
|
418
406
|
* See [core_crypto::mls::conversation::ConversationGuard::update_key_material]
|
419
407
|
*/
|
420
|
-
update_keying_material(conversation_id:
|
408
|
+
update_keying_material(conversation_id: ConversationId): Promise<void>;
|
421
409
|
/**
|
422
410
|
* See [core_crypto::mls::conversation::ConversationGuard::commit_pending_proposals]
|
423
411
|
*/
|
424
|
-
commit_pending_proposals(conversation_id:
|
412
|
+
commit_pending_proposals(conversation_id: ConversationId): Promise<void>;
|
425
413
|
/**
|
426
414
|
* See [core_crypto::mls::conversation::ConversationGuard::wipe]
|
427
415
|
*/
|
428
|
-
wipe_conversation(conversation_id:
|
416
|
+
wipe_conversation(conversation_id: ConversationId): Promise<void>;
|
429
417
|
/**
|
430
418
|
* See [core_crypto::mls::conversation::ConversationGuard::decrypt_message]
|
431
419
|
*/
|
432
|
-
decrypt_message(conversation_id:
|
420
|
+
decrypt_message(conversation_id: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
|
433
421
|
/**
|
434
422
|
* See [core_crypto::mls::conversation::ConversationGuard::encrypt_message]
|
435
423
|
*/
|
436
|
-
encrypt_message(conversation_id:
|
424
|
+
encrypt_message(conversation_id: ConversationId, message: Uint8Array): Promise<Uint8Array>;
|
437
425
|
/**
|
438
426
|
* See [core_crypto::transaction_context::TransactionContext::join_by_external_commit]
|
439
427
|
*/
|
440
|
-
join_by_external_commit(group_info:
|
428
|
+
join_by_external_commit(group_info: GroupInfo, custom_configuration: CustomConfiguration, credential_type: CredentialType): Promise<WelcomeBundle>;
|
429
|
+
/**
|
430
|
+
* See [core_crypto::mls::conversation::ConversationGuard::enable_history_sharing]
|
431
|
+
*/
|
432
|
+
enable_history_sharing(conversation_id: ConversationId): Promise<void>;
|
433
|
+
/**
|
434
|
+
* See [core_crypto::mls::conversation::ConversationGuard::disable_history_sharing]
|
435
|
+
*/
|
436
|
+
disable_history_sharing(conversation_id: ConversationId): Promise<void>;
|
441
437
|
/**
|
442
438
|
* See [core_crypto::proteus::ProteusCentral::try_new]
|
443
439
|
*/
|
@@ -601,26 +597,25 @@ declare class DecryptedMessage {
|
|
601
597
|
/**
|
602
598
|
* New CRL Distribution of members of this group
|
603
599
|
*/
|
604
|
-
readonly crlNewDistributionPoints:
|
600
|
+
readonly crlNewDistributionPoints: string[] | undefined;
|
605
601
|
}
|
606
602
|
/**
|
607
|
-
*
|
603
|
+
* r" The raw public key of an external sender.
|
604
|
+
* r"
|
605
|
+
* r" This can be used to initialize a subconversation.
|
608
606
|
*/
|
609
|
-
export class
|
610
|
-
private constructor();
|
607
|
+
export class ExternalSenderKey {
|
611
608
|
free(): void;
|
612
609
|
/**
|
613
|
-
*
|
614
|
-
*/
|
615
|
-
readonly root_ca: string;
|
616
|
-
/**
|
617
|
-
* Intermediate CAs that are loaded
|
610
|
+
* Construct a new instance, transferring data from the client layer to Rust.
|
618
611
|
*/
|
619
|
-
|
612
|
+
constructor(bytes: Uint8Array);
|
620
613
|
/**
|
621
|
-
*
|
614
|
+
* Get the raw bytes from this type, transferring data from Rust to the client layer.
|
615
|
+
*
|
616
|
+
* This does not consume the newtype, instead copying the internal data across the FFI boundary.
|
622
617
|
*/
|
623
|
-
|
618
|
+
copyBytes(): Uint8Array;
|
624
619
|
}
|
625
620
|
declare class FfiWireE2EIdentity {
|
626
621
|
private constructor();
|
@@ -694,6 +689,43 @@ declare class FfiWireE2EIdentity {
|
|
694
689
|
*/
|
695
690
|
new_oidc_challenge_response(challenge: Uint8Array): Promise<void>;
|
696
691
|
}
|
692
|
+
/**
|
693
|
+
* r" MLS Group Information
|
694
|
+
* r"
|
695
|
+
* r" This is used when joining by external commit.
|
696
|
+
* r" It can be found within the `GroupInfoBundle` within a `CommitBundle`.
|
697
|
+
*/
|
698
|
+
export class GroupInfo {
|
699
|
+
free(): void;
|
700
|
+
/**
|
701
|
+
* Construct a new instance, transferring data from the client layer to Rust.
|
702
|
+
*/
|
703
|
+
constructor(bytes: Uint8Array);
|
704
|
+
/**
|
705
|
+
* Get the raw bytes from this type, transferring data from Rust to the client layer.
|
706
|
+
*
|
707
|
+
* This does not consume the newtype, instead copying the internal data across the FFI boundary.
|
708
|
+
*/
|
709
|
+
copyBytes(): Uint8Array;
|
710
|
+
}
|
711
|
+
declare class KeyPackage {
|
712
|
+
free(): void;
|
713
|
+
/**
|
714
|
+
* Construct a new instance, transferring data from the client layer to Rust.
|
715
|
+
*/
|
716
|
+
constructor(bytes: Uint8Array);
|
717
|
+
/**
|
718
|
+
* Get the raw bytes from this type, transferring data from Rust to the client layer.
|
719
|
+
*
|
720
|
+
* This does not consume the newtype, instead copying the internal data across the FFI boundary.
|
721
|
+
*/
|
722
|
+
copyBytes(): Uint8Array;
|
723
|
+
}
|
724
|
+
export class MlsTransportData {
|
725
|
+
free(): void;
|
726
|
+
constructor(buf: Uint8Array);
|
727
|
+
readonly data: Uint8Array;
|
728
|
+
}
|
697
729
|
/**
|
698
730
|
* Result of an authorization creation.
|
699
731
|
*
|
@@ -728,17 +760,49 @@ export class NewAcmeOrder {
|
|
728
760
|
readonly delegate: Uint8Array;
|
729
761
|
readonly authorizations: string[];
|
730
762
|
}
|
731
|
-
declare class NewCrlDistributionPoints {
|
732
|
-
private constructor();
|
733
|
-
free(): void;
|
734
|
-
as_strings(): string[] | undefined;
|
735
|
-
}
|
736
763
|
declare class ProteusAutoPrekeyBundle {
|
737
764
|
private constructor();
|
738
765
|
free(): void;
|
739
766
|
readonly id: number;
|
740
767
|
readonly pkb: Uint8Array;
|
741
768
|
}
|
769
|
+
/**
|
770
|
+
* r" A secret key derived from the group secret.
|
771
|
+
* r"
|
772
|
+
* r" This is intended to be used for AVS.
|
773
|
+
*/
|
774
|
+
export class SecretKey {
|
775
|
+
free(): void;
|
776
|
+
/**
|
777
|
+
* Construct a new instance, transferring data from the client layer to Rust.
|
778
|
+
*/
|
779
|
+
constructor(bytes: Uint8Array);
|
780
|
+
/**
|
781
|
+
* Get the raw bytes from this type, transferring data from Rust to the client layer.
|
782
|
+
*
|
783
|
+
* This does not consume the newtype, instead copying the internal data across the FFI boundary.
|
784
|
+
*/
|
785
|
+
copyBytes(): Uint8Array;
|
786
|
+
}
|
787
|
+
/**
|
788
|
+
* r" A TLS-serialized Welcome message.
|
789
|
+
* r"
|
790
|
+
* r" This structure is defined in RFC 9420:
|
791
|
+
* r" <https://www.rfc-editor.org/rfc/rfc9420.html#joining-via-welcome-message>.
|
792
|
+
*/
|
793
|
+
export class Welcome {
|
794
|
+
free(): void;
|
795
|
+
/**
|
796
|
+
* Construct a new instance, transferring data from the client layer to Rust.
|
797
|
+
*/
|
798
|
+
constructor(bytes: Uint8Array);
|
799
|
+
/**
|
800
|
+
* Get the raw bytes from this type, transferring data from Rust to the client layer.
|
801
|
+
*
|
802
|
+
* This does not consume the newtype, instead copying the internal data across the FFI boundary.
|
803
|
+
*/
|
804
|
+
copyBytes(): Uint8Array;
|
805
|
+
}
|
742
806
|
/**
|
743
807
|
* see [core_crypto::prelude::WelcomeBundle]
|
744
808
|
*/
|
@@ -748,7 +812,7 @@ export class WelcomeBundle {
|
|
748
812
|
/**
|
749
813
|
* Identifier of the joined conversation
|
750
814
|
*/
|
751
|
-
readonly id:
|
815
|
+
readonly id: ConversationId;
|
752
816
|
/**
|
753
817
|
* New CRL Distribution of members of this group
|
754
818
|
*/
|
@@ -781,13 +845,13 @@ export class WireIdentity {
|
|
781
845
|
export class X509Identity {
|
782
846
|
private constructor();
|
783
847
|
free(): void;
|
784
|
-
handle: string;
|
785
|
-
|
786
|
-
domain: string;
|
787
|
-
certificate: string;
|
788
|
-
|
789
|
-
|
790
|
-
|
848
|
+
readonly handle: string;
|
849
|
+
readonly displayName: string;
|
850
|
+
readonly domain: string;
|
851
|
+
readonly certificate: string;
|
852
|
+
readonly serialNumber: string;
|
853
|
+
readonly notBefore: bigint;
|
854
|
+
readonly notAfter: bigint;
|
791
855
|
}
|
792
856
|
interface ConversationConfiguration$1 {
|
793
857
|
/**
|
@@ -797,7 +861,7 @@ interface ConversationConfiguration$1 {
|
|
797
861
|
/**
|
798
862
|
* List of client IDs that are allowed to be external senders
|
799
863
|
*/
|
800
|
-
externalSenders?:
|
864
|
+
externalSenders?: ExternalSenderKey[];
|
801
865
|
/**
|
802
866
|
* Duration in seconds after which we will automatically force a self-update commit
|
803
867
|
* Note: This isn't currently implemented
|
@@ -829,24 +893,22 @@ export declare class CoreCryptoError extends Error {
|
|
829
893
|
proteusErrorCode: number | null;
|
830
894
|
private constructor();
|
831
895
|
private static fallback;
|
832
|
-
static build(msg: string, ...params: unknown[]): CoreCryptoError
|
833
|
-
static fromStdError(e: Error): CoreCryptoError
|
896
|
+
static build(msg: string, ...params: unknown[]): CoreCryptoError;
|
897
|
+
static fromStdError(e: Error): CoreCryptoError;
|
834
898
|
static asyncMapErr<T>(p: Promise<T>): Promise<T>;
|
835
899
|
}
|
836
|
-
/**
|
837
|
-
* Alias for conversation IDs.
|
838
|
-
* This is a freeform, uninspected buffer.
|
839
|
-
*/
|
840
|
-
export type ConversationId = Uint8Array;
|
841
|
-
/**
|
842
|
-
* Alias for client identifier.
|
843
|
-
* This is a freeform, uninspected buffer.
|
844
|
-
*/
|
845
|
-
type ClientId$1 = Uint8Array;
|
846
900
|
/**
|
847
901
|
* Alias for proposal reference. It is a byte array of size 16.
|
848
902
|
*/
|
849
903
|
export type ProposalRef = Uint8Array;
|
904
|
+
/**
|
905
|
+
* A `HistorySecret` encodes sufficient client state that it can be used to instantiate an
|
906
|
+
* ephemeral client.
|
907
|
+
*/
|
908
|
+
export interface HistorySecret {
|
909
|
+
clientId: ClientId;
|
910
|
+
data: Uint8Array;
|
911
|
+
}
|
850
912
|
/**
|
851
913
|
* Data shape for a MLS generic commit + optional bundle (aka stapled commit & welcome)
|
852
914
|
*/
|
@@ -862,13 +924,18 @@ export interface CommitBundle {
|
|
862
924
|
*
|
863
925
|
* @readonly
|
864
926
|
*/
|
865
|
-
welcome?:
|
927
|
+
welcome?: Welcome;
|
866
928
|
/**
|
867
929
|
* MLS GroupInfo which is required for joining a group by external commit
|
868
930
|
*
|
869
931
|
* @readonly
|
870
932
|
*/
|
871
933
|
groupInfo: GroupInfoBundle;
|
934
|
+
/**
|
935
|
+
* An encrypted message to fan out to all other conversation members in the new epoch
|
936
|
+
* @readonly
|
937
|
+
*/
|
938
|
+
encryptedMessage?: Uint8Array;
|
872
939
|
}
|
873
940
|
/**
|
874
941
|
* Wraps a GroupInfo in order to efficiently upload it to the Delivery Service.
|
@@ -886,7 +953,7 @@ export interface GroupInfoBundle {
|
|
886
953
|
/**
|
887
954
|
* TLS-serialized GroupInfo
|
888
955
|
*/
|
889
|
-
payload:
|
956
|
+
payload: GroupInfo;
|
890
957
|
}
|
891
958
|
/**
|
892
959
|
* This is a wrapper for all the possible outcomes you can get after decrypting a message
|
@@ -907,7 +974,7 @@ interface DecryptedMessage$1 {
|
|
907
974
|
/**
|
908
975
|
* Client identifier of the sender of the message being decrypted. Only present for application messages.
|
909
976
|
*/
|
910
|
-
senderClientId?: ClientId
|
977
|
+
senderClientId?: ClientId;
|
911
978
|
/**
|
912
979
|
* true when the decrypted message resulted in an epoch change i.e. it was a commit
|
913
980
|
*/
|
@@ -948,7 +1015,7 @@ interface BufferedDecryptedMessage$1 {
|
|
948
1015
|
/**
|
949
1016
|
* see {@link DecryptedMessage.senderClientId}
|
950
1017
|
*/
|
951
|
-
senderClientId?: ClientId
|
1018
|
+
senderClientId?: ClientId;
|
952
1019
|
/**
|
953
1020
|
* see {@link DecryptedMessage.hasEpochChanged}
|
954
1021
|
*/
|
@@ -991,6 +1058,12 @@ export interface MlsTransport {
|
|
991
1058
|
* @returns a promise resolving to a {@link MlsTransportResponse}
|
992
1059
|
*/
|
993
1060
|
sendMessage: (message: Uint8Array) => Promise<MlsTransportResponse>;
|
1061
|
+
/**
|
1062
|
+
* This callback is called by CoreCrypto to prepare a history secret to be sent to the delivery service.
|
1063
|
+
* @param secret
|
1064
|
+
* @returns a promise resolving to a {@link MlsTransportData}
|
1065
|
+
*/
|
1066
|
+
prepareForTransport: (secret: HistorySecret) => Promise<MlsTransportData>;
|
994
1067
|
}
|
995
1068
|
/**
|
996
1069
|
* Supporting struct for CRL registration result
|
@@ -1030,7 +1103,7 @@ interface AcmeDirectory$1 {
|
|
1030
1103
|
/**
|
1031
1104
|
* Returned by APIs whose code paths potentially discover new certificate revocation list distribution URLs.
|
1032
1105
|
*/
|
1033
|
-
type NewCrlDistributionPoints
|
1106
|
+
export type NewCrlDistributionPoints = string[] | undefined;
|
1034
1107
|
export type JsonRawData = Uint8Array;
|
1035
1108
|
export declare class E2eiEnrollment {
|
1036
1109
|
#private;
|
@@ -1235,25 +1308,7 @@ declare class CoreCryptoContext$1 {
|
|
1235
1308
|
* @param ciphersuites - All the ciphersuites supported by this MLS client
|
1236
1309
|
* @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
|
1237
1310
|
*/
|
1238
|
-
mlsInit(clientId: ClientId
|
1239
|
-
/**
|
1240
|
-
* Generates a MLS KeyPair/CredentialBundle with a temporary, random client ID.
|
1241
|
-
* This method is designed to be used in conjunction with {@link CoreCryptoContext.mlsInitWithClientId} and represents the first step in this process
|
1242
|
-
*
|
1243
|
-
* @param ciphersuites - All the ciphersuites supported by this MLS client
|
1244
|
-
* @returns This returns the TLS-serialized identity key (i.e. the signature keypair's public key)
|
1245
|
-
*/
|
1246
|
-
mlsGenerateKeypair(ciphersuites: Ciphersuite[]): Promise<Uint8Array[]>;
|
1247
|
-
/**
|
1248
|
-
* Updates the current temporary Client ID with the newly provided one. This is the second step in the externally-generated clients process
|
1249
|
-
*
|
1250
|
-
* Important: This is designed to be called after {@link CoreCryptoContext.mlsGenerateKeypair}
|
1251
|
-
*
|
1252
|
-
* @param clientId - The newly-allocated client ID by the MLS Authentication Service
|
1253
|
-
* @param signaturePublicKeys - The public key you were given at the first step; This is for authentication purposes
|
1254
|
-
* @param ciphersuites - All the ciphersuites supported by this MLS client
|
1255
|
-
*/
|
1256
|
-
mlsInitWithClientId(clientId: ClientId$1, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite[]): Promise<void>;
|
1311
|
+
mlsInit(clientId: ClientId, ciphersuites: Ciphersuite[], nbKeyPackage?: number): Promise<void>;
|
1257
1312
|
/**
|
1258
1313
|
* Checks if the Client is member of a given conversation and if the MLS Group is loaded up
|
1259
1314
|
*
|
@@ -1349,7 +1404,7 @@ declare class CoreCryptoContext$1 {
|
|
1349
1404
|
* @param configuration - configuration of the MLS group
|
1350
1405
|
* @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
|
1351
1406
|
*/
|
1352
|
-
processWelcomeMessage(welcomeMessage:
|
1407
|
+
processWelcomeMessage(welcomeMessage: Welcome, configuration?: Partial<CustomConfiguration>): Promise<WelcomeBundle>;
|
1353
1408
|
/**
|
1354
1409
|
* Get the client's public signature key. To upload to the DS for further backend side validation
|
1355
1410
|
*
|
@@ -1374,13 +1429,6 @@ declare class CoreCryptoContext$1 {
|
|
1374
1429
|
* @returns An array of length `amountRequested` containing TLS-serialized KeyPackages
|
1375
1430
|
*/
|
1376
1431
|
clientKeypackages(ciphersuite: Ciphersuite, credentialType: CredentialType, amountRequested: number): Promise<Array<Uint8Array>>;
|
1377
|
-
/**
|
1378
|
-
* Prunes local KeyPackages after making sure they also have been deleted on the backend side
|
1379
|
-
* You should only use this after calling {@link CoreCryptoContext.e2eiRotate} on all conversations.
|
1380
|
-
*
|
1381
|
-
* @param refs - KeyPackage references to delete obtained from a {RotateBundle}
|
1382
|
-
*/
|
1383
|
-
deleteKeypackages(refs: Uint8Array[]): Promise<void>;
|
1384
1432
|
/**
|
1385
1433
|
* Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
|
1386
1434
|
*
|
@@ -1391,7 +1439,7 @@ declare class CoreCryptoContext$1 {
|
|
1391
1439
|
*
|
1392
1440
|
* @returns Potentially a list of newly discovered crl distribution points
|
1393
1441
|
*/
|
1394
|
-
addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<NewCrlDistributionPoints
|
1442
|
+
addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<NewCrlDistributionPoints>;
|
1395
1443
|
/**
|
1396
1444
|
* Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
|
1397
1445
|
* to do so, otherwise this operation does nothing.
|
@@ -1399,7 +1447,7 @@ declare class CoreCryptoContext$1 {
|
|
1399
1447
|
* @param conversationId - The ID of the conversation
|
1400
1448
|
* @param clientIds - Array of Client IDs to remove.
|
1401
1449
|
*/
|
1402
|
-
removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId
|
1450
|
+
removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId[]): Promise<void>;
|
1403
1451
|
/**
|
1404
1452
|
* Update the keying material of the conversation.
|
1405
1453
|
*
|
@@ -1429,7 +1477,15 @@ declare class CoreCryptoContext$1 {
|
|
1429
1477
|
*
|
1430
1478
|
* @return see {@link WelcomeBundle}
|
1431
1479
|
*/
|
1432
|
-
joinByExternalCommit(groupInfo:
|
1480
|
+
joinByExternalCommit(groupInfo: GroupInfo, credentialType: CredentialType, configuration?: Partial<CustomConfiguration>): Promise<WelcomeBundle>;
|
1481
|
+
/**
|
1482
|
+
* Enable history sharing by generating a history client and adding it to the conversation.
|
1483
|
+
*/
|
1484
|
+
enableHistorySharing(conversationId: ConversationId): Promise<void>;
|
1485
|
+
/**
|
1486
|
+
* Disable history sharing by removing histroy clients from the conversation.
|
1487
|
+
*/
|
1488
|
+
disableHistorySharing(conversationId: ConversationId): Promise<void>;
|
1433
1489
|
/**
|
1434
1490
|
* Derives a new key from the group
|
1435
1491
|
*
|
@@ -1439,7 +1495,7 @@ declare class CoreCryptoContext$1 {
|
|
1439
1495
|
*
|
1440
1496
|
* @returns A `Uint8Array` representing the derived key
|
1441
1497
|
*/
|
1442
|
-
exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<
|
1498
|
+
exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<SecretKey>;
|
1443
1499
|
/**
|
1444
1500
|
* Returns the raw public key of the single external sender present in this group.
|
1445
1501
|
* This should be used to initialize a subconversation
|
@@ -1448,7 +1504,7 @@ declare class CoreCryptoContext$1 {
|
|
1448
1504
|
*
|
1449
1505
|
* @returns A `Uint8Array` representing the external sender raw public key
|
1450
1506
|
*/
|
1451
|
-
getExternalSender(conversationId: ConversationId): Promise<
|
1507
|
+
getExternalSender(conversationId: ConversationId): Promise<ExternalSenderKey>;
|
1452
1508
|
/**
|
1453
1509
|
* Returns all clients from group's members
|
1454
1510
|
*
|
@@ -1456,7 +1512,7 @@ declare class CoreCryptoContext$1 {
|
|
1456
1512
|
*
|
1457
1513
|
* @returns A list of clients from the members of the group
|
1458
1514
|
*/
|
1459
|
-
getClientIds(conversationId: ConversationId): Promise<ClientId
|
1515
|
+
getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
|
1460
1516
|
/**
|
1461
1517
|
* Allows {@link CoreCryptoContext} to act as a CSPRNG provider
|
1462
1518
|
*
|
@@ -1641,13 +1697,7 @@ declare class CoreCryptoContext$1 {
|
|
1641
1697
|
* @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
|
1642
1698
|
* @returns a MlsClient initialized with only a x509 credential
|
1643
1699
|
*/
|
1644
|
-
e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<NewCrlDistributionPoints
|
1645
|
-
/**
|
1646
|
-
* Dumps the PKI environment as PEM
|
1647
|
-
*
|
1648
|
-
* @returns a struct with different fields representing the PKI environment as PEM strings
|
1649
|
-
*/
|
1650
|
-
e2eiDumpPKIEnv(): Promise<E2eiDumpedPkiEnv | undefined>;
|
1700
|
+
e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<NewCrlDistributionPoints>;
|
1651
1701
|
/**
|
1652
1702
|
* @returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
|
1653
1703
|
*/
|
@@ -1669,7 +1719,7 @@ declare class CoreCryptoContext$1 {
|
|
1669
1719
|
*
|
1670
1720
|
* @param certPEM - PEM certificate to register as an Intermediate CA
|
1671
1721
|
*/
|
1672
|
-
e2eiRegisterIntermediateCA(certPEM: string): Promise<NewCrlDistributionPoints
|
1722
|
+
e2eiRegisterIntermediateCA(certPEM: string): Promise<NewCrlDistributionPoints>;
|
1673
1723
|
/**
|
1674
1724
|
* Registers a CRL for the use in E2EI processing.
|
1675
1725
|
*
|
@@ -1711,13 +1761,13 @@ declare class CoreCryptoContext$1 {
|
|
1711
1761
|
* @param certificateChain - the raw response from ACME server
|
1712
1762
|
* @returns Potentially a list of new crl distribution points discovered in the certificate chain
|
1713
1763
|
*/
|
1714
|
-
saveX509Credential(enrollment: E2eiEnrollment, certificateChain: string): Promise<NewCrlDistributionPoints
|
1764
|
+
saveX509Credential(enrollment: E2eiEnrollment, certificateChain: string): Promise<NewCrlDistributionPoints>;
|
1715
1765
|
/**
|
1716
1766
|
* Deletes all key packages whose credential does not match the most recently
|
1717
1767
|
* saved x509 credential and the provided signature scheme.
|
1718
|
-
* @param
|
1768
|
+
* @param ciphersuite
|
1719
1769
|
*/
|
1720
|
-
deleteStaleKeyPackages(
|
1770
|
+
deleteStaleKeyPackages(ciphersuite: Ciphersuite): Promise<void>;
|
1721
1771
|
/**
|
1722
1772
|
* Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
|
1723
1773
|
* it later with {@link e2eiEnrollmentStashPop}
|
@@ -1756,7 +1806,7 @@ declare class CoreCryptoContext$1 {
|
|
1756
1806
|
* @param deviceIds - identifiers of the devices
|
1757
1807
|
* @returns identities or if no member has a x509 certificate, it will return an empty List
|
1758
1808
|
*/
|
1759
|
-
getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId
|
1809
|
+
getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity[]>;
|
1760
1810
|
/**
|
1761
1811
|
* From a given conversation, get the identity of the users (device holders) supplied.
|
1762
1812
|
* Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity).
|
@@ -1767,15 +1817,6 @@ declare class CoreCryptoContext$1 {
|
|
1767
1817
|
* @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.
|
1768
1818
|
*/
|
1769
1819
|
getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
|
1770
|
-
/**
|
1771
|
-
* Gets the e2ei conversation state from a `GroupInfo`. Useful to check if the group has e2ei
|
1772
|
-
* turned on or not before joining it.
|
1773
|
-
*
|
1774
|
-
* @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
|
1775
|
-
* @param credentialType - kind of Credential to check usage of. Defaults to X509 for now as no other value will give any result.
|
1776
|
-
* @returns see {@link E2eiConversationState}
|
1777
|
-
*/
|
1778
|
-
getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType): Promise<E2eiConversationState$1>;
|
1779
1820
|
}
|
1780
1821
|
/**
|
1781
1822
|
* Params for CoreCrypto deferred initialization
|
@@ -1796,10 +1837,6 @@ export interface CoreCryptoDeferredParams {
|
|
1796
1837
|
* This **must** be exactly 32 bytes
|
1797
1838
|
*/
|
1798
1839
|
entropySeed?: Uint8Array;
|
1799
|
-
/**
|
1800
|
-
* .wasm file path, this will be useful in case your bundling system likes to relocate files (i.e. what webpack does)
|
1801
|
-
*/
|
1802
|
-
wasmFilePath?: string;
|
1803
1840
|
}
|
1804
1841
|
/**
|
1805
1842
|
* Params for CoreCrypto initialization
|
@@ -1810,7 +1847,7 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
|
|
1810
1847
|
* MLS Client ID.
|
1811
1848
|
* This should stay consistent as it will be verified against the stored signature & identity to validate the persisted credential
|
1812
1849
|
*/
|
1813
|
-
clientId: ClientId
|
1850
|
+
clientId: ClientId;
|
1814
1851
|
/**
|
1815
1852
|
* All the ciphersuites this MLS client can support
|
1816
1853
|
*/
|
@@ -1823,6 +1860,9 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
|
|
1823
1860
|
export interface EpochObserver {
|
1824
1861
|
epochChanged(conversationId: ConversationId, epoch: number): Promise<void>;
|
1825
1862
|
}
|
1863
|
+
export interface HistoryObserver {
|
1864
|
+
historyClientCreated(conversationId: ConversationId, secret: HistorySecret): Promise<void>;
|
1865
|
+
}
|
1826
1866
|
/**
|
1827
1867
|
* Initializes the global logger for Core Crypto and registers the callback.
|
1828
1868
|
*
|
@@ -1895,7 +1935,7 @@ export declare class CoreCrypto {
|
|
1895
1935
|
* // Do the rest with `cc`
|
1896
1936
|
* ```
|
1897
1937
|
*
|
1898
|
-
* ## Custom Entropy seed init
|
1938
|
+
* ## Custom Entropy seed init
|
1899
1939
|
* ```ts
|
1900
1940
|
* // FYI, this is the IETF test vector #1
|
1901
1941
|
* const entropySeed = Uint32Array.from([
|
@@ -1905,19 +1945,15 @@ export declare class CoreCrypto {
|
|
1905
1945
|
* 0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2,
|
1906
1946
|
* ]);
|
1907
1947
|
*
|
1908
|
-
* const wasmFilePath = "/long/complicated/path/on/webserver/whatever.wasm";
|
1909
|
-
*
|
1910
1948
|
* const cc = await CoreCrypto.init({
|
1911
1949
|
* databaseName: "test",
|
1912
1950
|
* key: "test",
|
1913
1951
|
* clientId: "test",
|
1914
1952
|
* entropySeed,
|
1915
|
-
* wasmFilePath,
|
1916
1953
|
* });
|
1917
1954
|
* ````
|
1918
1955
|
*/
|
1919
|
-
static init({ databaseName, key, clientId,
|
1920
|
-
ciphersuites, entropySeed, nbKeyPackage, }: CoreCryptoParams): Promise<CoreCrypto>;
|
1956
|
+
static init({ databaseName, key, clientId, ciphersuites, entropySeed, nbKeyPackage, }: CoreCryptoParams): Promise<CoreCrypto>;
|
1921
1957
|
/**
|
1922
1958
|
* Almost identical to {@link CoreCrypto.init} but allows a 2 phase initialization of MLS.
|
1923
1959
|
* First, calling this will set up the keystore and will allow generating proteus prekeys.
|
@@ -1925,14 +1961,14 @@ export declare class CoreCrypto {
|
|
1925
1961
|
* Use this clientId to initialize MLS with {@link CoreCryptoContext.mlsInit}.
|
1926
1962
|
* @param params - {@link CoreCryptoDeferredParams}
|
1927
1963
|
*/
|
1928
|
-
static deferredInit({ databaseName, key, entropySeed,
|
1964
|
+
static deferredInit({ databaseName, key, entropySeed, }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
|
1929
1965
|
/**
|
1930
1966
|
* Instantiate a history client.
|
1931
1967
|
*
|
1932
1968
|
* This client exposes the full interface of `CoreCrypto`, but it should only be used to decrypt messages.
|
1933
1969
|
* Other use is a logic error.
|
1934
1970
|
*/
|
1935
|
-
static historyClient(historySecret:
|
1971
|
+
static historyClient(historySecret: HistorySecret): Promise<CoreCrypto>;
|
1936
1972
|
/**
|
1937
1973
|
* Starts a new transaction in Core Crypto. If the callback succeeds, it will be committed,
|
1938
1974
|
* otherwise, every operation performed with the context will be discarded.
|
@@ -1945,28 +1981,11 @@ export declare class CoreCrypto {
|
|
1945
1981
|
/** @hidden */
|
1946
1982
|
private constructor();
|
1947
1983
|
/**
|
1948
|
-
*
|
1949
|
-
*
|
1950
|
-
*
|
1951
|
-
* As always with this kind of thing, beware TOCTOU.
|
1952
|
-
*
|
1953
|
-
* @returns whether the CoreCrypto instance can currently close.
|
1954
|
-
*/
|
1955
|
-
canClose(): Promise<boolean>;
|
1956
|
-
/**
|
1957
|
-
* If this returns `true` you **cannot** call {@link CoreCrypto.close} as it will produce an error because of the
|
1958
|
-
* outstanding references that were detected.
|
1984
|
+
* Waits for any transaction that is currently in progress, then closes this {@link CoreCrypto}
|
1985
|
+
* instance and deallocates all loaded resources
|
1959
1986
|
*
|
1960
|
-
* This
|
1961
|
-
*
|
1962
|
-
* @returns false
|
1963
|
-
* @deprecated prefer {@link CoreCrypto.canClose}
|
1964
|
-
*/
|
1965
|
-
isLocked(): boolean;
|
1966
|
-
/**
|
1967
|
-
* Closes this {@link CoreCrypto} instance and deallocates all loaded resources
|
1968
|
-
*
|
1969
|
-
* **CAUTION**: This {@link CoreCrypto} instance won't be usable after a call to this method, but there's no way to express this requirement in TypeScript, so you'll get errors instead!
|
1987
|
+
* **CAUTION**: This {@link CoreCrypto} instance won't be usable after a call to this method,
|
1988
|
+
* but there's no way to express this requirement in TypeScript, so you'll get errors instead!
|
1970
1989
|
*/
|
1971
1990
|
close(): Promise<void>;
|
1972
1991
|
/**
|
@@ -2018,6 +2037,15 @@ export declare class CoreCrypto {
|
|
2018
2037
|
* @returns A `Uint8Array` representing the derived key
|
2019
2038
|
*/
|
2020
2039
|
exportSecretKey(conversationId: ConversationId, keyLength: number): Promise<Uint8Array>;
|
2040
|
+
/**
|
2041
|
+
* Check if history sharing is enabled, i.e., if any of the conversation members have a {@link ClientId} starting
|
2042
|
+
* with the history client id prefix.
|
2043
|
+
*
|
2044
|
+
* @param conversationId - The group's ID
|
2045
|
+
*
|
2046
|
+
* @returns Whether history sharing is enabled
|
2047
|
+
*/
|
2048
|
+
isHistorySharingEnabled(conversationId: ConversationId): Promise<boolean>;
|
2021
2049
|
/**
|
2022
2050
|
* See {@link CoreCryptoContext.getExternalSender}.
|
2023
2051
|
*
|
@@ -2033,7 +2061,7 @@ export declare class CoreCrypto {
|
|
2033
2061
|
*
|
2034
2062
|
* @returns A list of clients from the members of the group
|
2035
2063
|
*/
|
2036
|
-
getClientIds(conversationId: ConversationId): Promise<ClientId
|
2064
|
+
getClientIds(conversationId: ConversationId): Promise<ClientId[]>;
|
2037
2065
|
/**
|
2038
2066
|
* See {@link CoreCryptoContext.randomBytes}.
|
2039
2067
|
*
|
@@ -2088,12 +2116,6 @@ export declare class CoreCrypto {
|
|
2088
2116
|
* @returns Hex-encoded public key string
|
2089
2117
|
**/
|
2090
2118
|
static proteusFingerprintPrekeybundle(prekey: Uint8Array): string;
|
2091
|
-
/**
|
2092
|
-
* See {@link CoreCryptoContext.e2eiDumpPKIEnv}.
|
2093
|
-
*
|
2094
|
-
* @returns a struct with different fields representing the PKI environment as PEM strings
|
2095
|
-
*/
|
2096
|
-
e2eiDumpPKIEnv(): Promise<E2eiDumpedPkiEnv | undefined>;
|
2097
2119
|
/**
|
2098
2120
|
* See {@link CoreCryptoContext.e2eiIsPKIEnvSetup}.
|
2099
2121
|
* @returns whether the E2EI PKI environment is setup (i.e. Root CA, Intermediates, CRLs)
|
@@ -2113,7 +2135,7 @@ export declare class CoreCrypto {
|
|
2113
2135
|
* @param deviceIds - identifiers of the devices
|
2114
2136
|
* @returns identities or if no member has a x509 certificate, it will return an empty List
|
2115
2137
|
*/
|
2116
|
-
getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId
|
2138
|
+
getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity[]>;
|
2117
2139
|
/**
|
2118
2140
|
* See {@link CoreCryptoContext.getUserIdentities}.
|
2119
2141
|
*
|
@@ -2122,14 +2144,6 @@ export declare class CoreCrypto {
|
|
2122
2144
|
* @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.
|
2123
2145
|
*/
|
2124
2146
|
getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
|
2125
|
-
/**
|
2126
|
-
* See {@link CoreCryptoContext.getCredentialInUse}.
|
2127
|
-
*
|
2128
|
-
* @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
|
2129
|
-
* @param credentialType - kind of Credential to check usage of. Defaults to X509 for now as no other value will give any result.
|
2130
|
-
* @returns see {@link E2eiConversationState}
|
2131
|
-
*/
|
2132
|
-
getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType): Promise<E2eiConversationState$1>;
|
2133
2147
|
/**
|
2134
2148
|
* Registers an epoch observer, which will then be notified every time a conversation's epoch changes.
|
2135
2149
|
*
|
@@ -2137,6 +2151,13 @@ export declare class CoreCrypto {
|
|
2137
2151
|
* @returns nothing
|
2138
2152
|
*/
|
2139
2153
|
registerEpochObserver(observer: EpochObserver): Promise<void>;
|
2154
|
+
/**
|
2155
|
+
* Registers a history observer, which will then be notified every time a history client is created.
|
2156
|
+
*
|
2157
|
+
* @param observer must conform to the {@link HistoryObserver} interface
|
2158
|
+
* @returns nothing
|
2159
|
+
*/
|
2160
|
+
registerHistoryObserver(observer: HistoryObserver): Promise<void>;
|
2140
2161
|
}
|
2141
2162
|
/**
|
2142
2163
|
* Initialises the wasm module necessary for running core crypto.
|
@@ -2148,14 +2169,12 @@ export declare function initWasmModule(location?: string | undefined): Promise<v
|
|
2148
2169
|
export {
|
2149
2170
|
AcmeDirectory$1 as AcmeDirectory,
|
2150
2171
|
BufferedDecryptedMessage$1 as BufferedDecryptedMessage,
|
2151
|
-
ClientId$1 as ClientId,
|
2152
2172
|
ConversationConfiguration$1 as ConversationConfiguration,
|
2153
2173
|
CoreCryptoContext$1 as CoreCryptoContext,
|
2154
2174
|
DecryptedMessage$1 as DecryptedMessage,
|
2155
2175
|
E2eiConversationState$1 as E2eiConversationState,
|
2156
2176
|
MlsGroupInfoEncryptionType as GroupInfoEncryptionType,
|
2157
2177
|
MlsRatchetTreeType as RatchetTreeType,
|
2158
|
-
NewCrlDistributionPoints$1 as NewCrlDistributionPoints,
|
2159
2178
|
ProteusAutoPrekeyBundle$1 as ProteusAutoPrekeyBundle,
|
2160
2179
|
};
|
2161
2180
|
|