@wireapp/core-crypto 1.0.0-rc.2 → 1.0.0-rc.20

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.
@@ -1,3 +1,133 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * see [core_crypto::prelude::DeviceStatus]
5
+ */
6
+ export enum DeviceStatus {
7
+ /**
8
+ * All is fine
9
+ */
10
+ Valid = 0,
11
+ /**
12
+ * The Credential's certificate is expired
13
+ */
14
+ Expired = 1,
15
+ /**
16
+ * The Credential's certificate is revoked (not implemented yet)
17
+ */
18
+ Revoked = 2
19
+ }
20
+ /**
21
+ * For creating a challenge.
22
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
23
+ */
24
+ export class AcmeChallenge {
25
+ free(): void;
26
+ /**
27
+ * Contains raw JSON data of this challenge. This is parsed by the underlying Rust library hence should not be accessed
28
+ */
29
+ readonly delegate: Uint8Array;
30
+ /**
31
+ * Non-standard, Wire specific claim. Indicates the consumer from where it should get the challenge proof.
32
+ * Either from wire-server "/access-token" endpoint in case of a DPoP challenge, or from an OAuth token endpoint for an OIDC challenge
33
+ */
34
+ readonly target: string;
35
+ /**
36
+ * URL of this challenge
37
+ */
38
+ readonly url: string;
39
+ }
40
+ /**
41
+ * Holds URLs of all the standard ACME endpoint supported on an ACME server.
42
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.1.1
43
+ */
44
+ export class AcmeDirectory {
45
+ free(): void;
46
+ /**
47
+ * URL for creating a new account.
48
+ */
49
+ readonly newAccount: string;
50
+ /**
51
+ * URL for fetching a new nonce. Use this only for creating a new account.
52
+ */
53
+ readonly newNonce: string;
54
+ /**
55
+ * URL for creating a new order.
56
+ */
57
+ readonly newOrder: string;
58
+ /**
59
+ * Revocation URL
60
+ */
61
+ readonly revokeCert: string;
62
+ }
63
+ /**
64
+ * Result of an authorization creation.
65
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
66
+ */
67
+ export class NewAcmeAuthz {
68
+ free(): void;
69
+ /**
70
+ * DNS entry associated with those challenge
71
+ */
72
+ readonly identifier: string;
73
+ /**
74
+ * Challenge for the deviceId owned by wire-server
75
+ */
76
+ readonly wireDpopChallenge: AcmeChallenge | undefined;
77
+ /**
78
+ * Challenge for the userId and displayName owned by the identity provider
79
+ */
80
+ readonly wireOidcChallenge: AcmeChallenge | undefined;
81
+ }
82
+ /**
83
+ * Result of an order creation.
84
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
85
+ */
86
+ export class NewAcmeOrder {
87
+ free(): void;
88
+ /**
89
+ */
90
+ readonly authorizations: (Uint8Array)[];
91
+ /**
92
+ * Contains raw JSON data of this order. This is parsed by the underlying Rust library hence should not be accessed
93
+ */
94
+ readonly delegate: Uint8Array;
95
+ }
96
+ /**
97
+ * Represents the identity claims identifying a client
98
+ * Those claims are verifiable by any member in the group
99
+ */
100
+ export class WireIdentity {
101
+ free(): void;
102
+ /**
103
+ * X509 certificate identifying this client in the MLS group ; PEM encoded
104
+ */
105
+ readonly certificate: string;
106
+ /**
107
+ * Unique client identifier e.g. `T4Coy4vdRzianwfOgXpn6A:6add501bacd1d90e@whitehouse.gov`
108
+ */
109
+ readonly clientId: string;
110
+ /**
111
+ * Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
112
+ */
113
+ readonly displayName: string;
114
+ /**
115
+ * DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
116
+ */
117
+ readonly domain: string;
118
+ /**
119
+ * user handle e.g. `john_wire`
120
+ */
121
+ readonly handle: string;
122
+ /**
123
+ * Status of the Credential at the moment T when this object is created
124
+ */
125
+ readonly status: DeviceStatus;
126
+ /**
127
+ * MLS thumbprint
128
+ */
129
+ readonly thumbprint: string;
130
+ }
1
131
  /**
2
132
  * Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
3
133
  *
@@ -262,7 +392,7 @@ export interface RotateBundle {
262
392
  *
263
393
  * @readonly
264
394
  */
265
- commits: CommitBundle[];
395
+ commits: Map<string, CommitBundle>;
266
396
  /**
267
397
  * Fresh KeyPackages with the new Credential
268
398
  *
@@ -303,6 +433,10 @@ export interface CoreCryptoDeferredParams {
303
433
  * .wasm file path, this will be useful in case your bundling system likes to relocate files (i.e. what webpack does)
304
434
  */
305
435
  wasmFilePath?: string;
436
+ /**
437
+ * Number of initial KeyPackage to create when initializing the client
438
+ */
439
+ nbKeyPackage?: number;
306
440
  }
307
441
  /**
308
442
  * Params for CoreCrypto initialization
@@ -315,19 +449,6 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
315
449
  */
316
450
  clientId: ClientId;
317
451
  }
318
- /**
319
- * Data shape for adding clients to a conversation
320
- */
321
- export interface Invitee {
322
- /**
323
- * Client ID as a byte array
324
- */
325
- id: ClientId;
326
- /**
327
- * MLS KeyPackage belonging to the aforementioned client
328
- */
329
- kp: Uint8Array;
330
- }
331
452
  export interface ConversationInitBundle {
332
453
  /**
333
454
  * Conversation ID of the conversation created
@@ -386,27 +507,45 @@ export interface DecryptedMessage {
386
507
  * Present for all messages
387
508
  */
388
509
  identity?: WireIdentity;
510
+ /**
511
+ * Only set when the decrypted message is a commit.
512
+ * Contains buffered messages for next epoch which were received before the commit creating the epoch
513
+ * because the DS did not fan them out in order.
514
+ */
515
+ bufferedMessages?: BufferedDecryptedMessage[];
389
516
  }
390
517
  /**
391
- * Represents the identity claims identifying a client. Those claims are verifiable by any member in the group
518
+ * Almost same as {@link DecryptedMessage} but avoids recursion
392
519
  */
393
- export interface WireIdentity {
520
+ export interface BufferedDecryptedMessage {
521
+ /**
522
+ * see {@link DecryptedMessage.message}
523
+ */
524
+ message?: Uint8Array;
525
+ /**
526
+ * see {@link DecryptedMessage.proposals}
527
+ */
528
+ proposals: ProposalBundle[];
394
529
  /**
395
- * Represents the identity claims identifying a client. Those claims are verifiable by any member in the group
530
+ * see {@link DecryptedMessage.isActive}
396
531
  */
397
- clientId: string;
532
+ isActive: boolean;
533
+ /**
534
+ * see {@link DecryptedMessage.commitDelay}
535
+ */
536
+ commitDelay?: number;
398
537
  /**
399
- * user handle e.g. `john_wire`
538
+ * see {@link DecryptedMessage.senderClientId}
400
539
  */
401
- handle: string;
540
+ senderClientId?: ClientId;
402
541
  /**
403
- * Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
542
+ * see {@link DecryptedMessage.hasEpochChanged}
404
543
  */
405
- displayName: string;
544
+ hasEpochChanged: boolean;
406
545
  /**
407
- * DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
546
+ * see {@link DecryptedMessage.identity}
408
547
  */
409
- domain: string;
548
+ identity?: WireIdentity;
410
549
  }
411
550
  /**
412
551
  * Returned by all methods creating proposals. Contains a proposal message and an identifier to roll back the proposal
@@ -573,7 +712,7 @@ export declare class CoreCrypto {
573
712
  * });
574
713
  * ````
575
714
  */
576
- static init({ databaseName, key, clientId, wasmFilePath, ciphersuites, entropySeed }: CoreCryptoParams): Promise<CoreCrypto>;
715
+ static init({ databaseName, key, clientId, wasmFilePath, ciphersuites, entropySeed, nbKeyPackage, }: CoreCryptoParams): Promise<CoreCrypto>;
577
716
  /**
578
717
  * Almost identical to {@link CoreCrypto.init} but allows a 2 phase initialization of MLS.
579
718
  * First, calling this will set up the keystore and will allow generating proteus prekeys.
@@ -581,14 +720,15 @@ export declare class CoreCrypto {
581
720
  * Use this clientId to initialize MLS with {@link CoreCrypto.mlsInit}.
582
721
  * @param params - {@link CoreCryptoDeferredParams}
583
722
  */
584
- static deferredInit({ databaseName, key, ciphersuites, entropySeed, wasmFilePath }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
723
+ static deferredInit({ databaseName, key, ciphersuites, entropySeed, wasmFilePath, nbKeyPackage, }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
585
724
  /**
586
725
  * Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
587
726
  *
588
727
  * @param clientId - {@link CoreCryptoParams#clientId} but required
589
728
  * @param ciphersuites - All the ciphersuites supported by this MLS client
729
+ * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
590
730
  */
591
- mlsInit(clientId: ClientId, ciphersuites: Ciphersuite[]): Promise<void>;
731
+ mlsInit(clientId: ClientId, ciphersuites: Ciphersuite[], nbKeyPackage?: number): Promise<void>;
592
732
  /**
593
733
  * Generates a MLS KeyPair/CredentialBundle with a temporary, random client ID.
594
734
  * This method is designed to be used in conjunction with {@link CoreCrypto.mlsInitWithClientId} and represents the first step in this process
@@ -625,7 +765,7 @@ export declare class CoreCrypto {
625
765
  /**
626
766
  * Closes this {@link CoreCrypto} instance and deallocates all loaded resources
627
767
  *
628
- * **CAUTION**: This {@link CoreCrypto} instance won't be useable after a call to this method, but there's no way to express this requirement in TypeScript so you'll get errors instead!
768
+ * **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!
629
769
  */
630
770
  close(): Promise<void>;
631
771
  /**
@@ -691,7 +831,12 @@ export declare class CoreCrypto {
691
831
  */
692
832
  createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType, configuration?: ConversationConfiguration): Promise<any>;
693
833
  /**
694
- * Decrypts a message for a given conversation
834
+ * Decrypts a message for a given conversation.
835
+ *
836
+ * Note: you should catch & ignore the following error reasons:
837
+ * * "We already decrypted this message once"
838
+ * * "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"
839
+ * * "Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives"
695
840
  *
696
841
  * @param conversationId - The ID of the conversation
697
842
  * @param payload - The encrypted message buffer
@@ -723,17 +868,24 @@ export declare class CoreCrypto {
723
868
  *
724
869
  * @returns A {@link CommitBundle}
725
870
  */
726
- update_trust_anchors_from_conversation(conversationId: ConversationId, removeDomainNames: string[], addTrustAnchors: PerDomainTrustAnchor[]): Promise<CommitBundle>;
871
+ updateTrustAnchorsFromConversation(conversationId: ConversationId, removeDomainNames: string[], addTrustAnchors: PerDomainTrustAnchor[]): Promise<CommitBundle>;
727
872
  /**
728
873
  * Ingest a TLS-serialized MLS welcome message to join an existing MLS group
729
874
  *
875
+ * Important: you have to catch the error with this reason "Although this Welcome seems valid, the local KeyPackage
876
+ * it references has already been deleted locally. Join this group with an external commit", ignore it and then try
877
+ * to join this group with an external commit.
878
+ *
730
879
  * @param welcomeMessage - TLS-serialized MLS Welcome message
731
880
  * @param configuration - configuration of the MLS group
732
881
  * @returns The conversation ID of the newly joined group. You can use the same ID to decrypt/encrypt messages
733
882
  */
734
883
  processWelcomeMessage(welcomeMessage: Uint8Array, configuration?: CustomConfiguration): Promise<ConversationId>;
735
884
  /**
736
- * @returns The client's public key
885
+ * Get the client's public signature key. To upload to the DS for further backend side validation
886
+ *
887
+ * @param ciphersuite - of the signature key to get
888
+ * @returns the client's public signature key
737
889
  */
738
890
  clientPublicKey(ciphersuite: Ciphersuite): Promise<Uint8Array>;
739
891
  /**
@@ -762,21 +914,21 @@ export declare class CoreCrypto {
762
914
  /**
763
915
  * Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
764
916
  *
765
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
917
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
766
918
  * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
767
919
  * epoch, use new encryption secrets etc...
768
920
  *
769
921
  * @param conversationId - The ID of the conversation
770
- * @param clients - Array of {@link Invitee} (which are Client ID / KeyPackage pairs)
922
+ * @param keyPackages - KeyPackages of the new clients to add
771
923
  *
772
924
  * @returns A {@link CommitBundle}
773
925
  */
774
- addClientsToConversation(conversationId: ConversationId, clients: Invitee[]): Promise<MemberAddedMessages>;
926
+ addClientsToConversation(conversationId: ConversationId, keyPackages: Uint8Array[]): Promise<MemberAddedMessages>;
775
927
  /**
776
928
  * Removes the provided clients from a conversation; Assuming those clients exist and the current client is allowed
777
929
  * to do so, otherwise this operation does nothing.
778
930
  *
779
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
931
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
780
932
  * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
781
933
  * epoch, use new encryption secrets etc...
782
934
  *
@@ -787,9 +939,9 @@ export declare class CoreCrypto {
787
939
  */
788
940
  removeClientsFromConversation(conversationId: ConversationId, clientIds: ClientId[]): Promise<CommitBundle>;
789
941
  /**
790
- * Creates an update commit which forces every client to update their keypackages in the conversation
942
+ * Creates an update commit which forces every client to update their LeafNode in the conversation
791
943
  *
792
- * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterwards **ONLY IF** the Delivery Service responds
944
+ * **CAUTION**: {@link CoreCrypto.commitAccepted} **HAS TO** be called afterward **ONLY IF** the Delivery Service responds
793
945
  * '200 OK' to the {@link CommitBundle} upload. It will "merge" the commit locally i.e. increment the local group
794
946
  * epoch, use new encryption secrets etc...
795
947
  *
@@ -819,6 +971,9 @@ export declare class CoreCrypto {
819
971
  * @returns A {@link ProposalBundle} containing the Proposal and its reference in order to roll it back if necessary
820
972
  */
821
973
  newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<ProposalBundle>;
974
+ /**
975
+ * Creates a new external Add proposal for self client to join a conversation.
976
+ */
822
977
  newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
823
978
  /**
824
979
  * Allows to create an external commit to "apply" to join a group through its GroupInfo.
@@ -843,8 +998,9 @@ export declare class CoreCrypto {
843
998
  * and deletes the temporary one. This step makes the group operational and ready to encrypt/decrypt message
844
999
  *
845
1000
  * @param conversationId - The ID of the conversation
1001
+ * @returns eventually decrypted buffered messages if any
846
1002
  */
847
- mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<DecryptedMessage[] | undefined>;
1003
+ mergePendingGroupFromExternalCommit(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
848
1004
  /**
849
1005
  * In case the external commit generated by {@link CoreCrypto.joinByExternalCommit} is rejected by the Delivery Service, and we
850
1006
  * want to abort this external commit once for all, we can wipe out the pending group from the keystore in order
@@ -854,26 +1010,24 @@ export declare class CoreCrypto {
854
1010
  */
855
1011
  clearPendingGroupFromExternalCommit(conversationId: ConversationId): Promise<void>;
856
1012
  /**
857
- * Allows to mark the latest commit produced as "accepted" and be able to safely merge it
858
- * into the local group state
1013
+ * Allows to mark the latest commit produced as "accepted" and be able to safely merge it into the local group state
859
1014
  *
860
1015
  * @param conversationId - The group's ID
1016
+ * @returns the messages from current epoch which had been buffered, if any
861
1017
  */
862
- commitAccepted(conversationId: ConversationId): Promise<void>;
1018
+ commitAccepted(conversationId: ConversationId): Promise<BufferedDecryptedMessage[] | undefined>;
863
1019
  /**
864
- * Allows to remove a pending proposal (rollback). Use this when backend rejects the proposal you just sent e.g. if permissions
865
- * have changed meanwhile.
1020
+ * Allows to remove a pending proposal (rollback). Use this when backend rejects the proposal you just sent e.g. if permissions have changed meanwhile.
866
1021
  *
867
1022
  * **CAUTION**: only use this when you had an explicit response from the Delivery Service
868
- * e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc..
1023
+ * e.g. 403 or 409. Do not use otherwise e.g. 5xx responses, timeout etc
869
1024
  *
870
1025
  * @param conversationId - The group's ID
871
1026
  * @param proposalRef - A reference to the proposal to delete. You get one when using {@link CoreCrypto.newProposal}
872
1027
  */
873
1028
  clearPendingProposal(conversationId: ConversationId, proposalRef: ProposalRef): Promise<void>;
874
1029
  /**
875
- * Allows to remove a pending commit (rollback). Use this when backend rejects the commit you just sent e.g. if permissions
876
- * have changed meanwhile.
1030
+ * Allows to remove a pending commit (rollback). Use this when backend rejects the commit you just sent e.g. if permissions have changed meanwhile.
877
1031
  *
878
1032
  * **CAUTION**: only use this when you had an explicit response from the Delivery Service
879
1033
  * e.g. 403. Do not use otherwise e.g. 5xx responses, timeout etc..
@@ -917,7 +1071,7 @@ export declare class CoreCrypto {
917
1071
  */
918
1072
  reseedRng(seed: Uint8Array): Promise<void>;
919
1073
  /**
920
- * Initiailizes the proteus client
1074
+ * Initializes the proteus client
921
1075
  */
922
1076
  proteusInit(): Promise<void>;
923
1077
  /**
@@ -1050,47 +1204,53 @@ export declare class CoreCrypto {
1050
1204
  * Creates an enrollment instance with private key material you can use in order to fetch
1051
1205
  * a new x509 certificate from the acme server.
1052
1206
  *
1053
- * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
1054
- * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
1055
- * @param handle user handle e.g. `alice.smith.qa@example.com`
1056
- * @param expiryDays generated x509 certificate expiry
1207
+ * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `t6wRpI8BRSeviBwwiFp5MQ:6add501bacd1d90e@example.com`
1208
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1209
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1210
+ * @param expiryDays - generated x509 certificate expiry
1057
1211
  * @param ciphersuite - for generating signing key material
1058
- * @returns The new {@link WireE2eIdentity} object
1212
+ * @param team - name of the Wire team a user belongs to
1213
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiMlsInitOnly}
1059
1214
  */
1060
- e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite): Promise<WireE2eIdentity>;
1215
+ e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
1061
1216
  /**
1062
1217
  * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1063
1218
  * Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1064
1219
  *
1065
- * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
1066
- * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
1067
- * @param handle user handle e.g. `alice.smith.qa@example.com`
1068
- * @param expiryDays generated x509 certificate expiry
1220
+ * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `t6wRpI8BRSeviBwwiFp5MQ:6add501bacd1d90e@example.com`
1221
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1222
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1223
+ * @param expiryDays - generated x509 certificate expiry
1069
1224
  * @param ciphersuite - for generating signing key material
1070
- * @returns The new {@link WireE2eIdentity} object
1225
+ * @param team - name of the Wire team a user belongs to
1226
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
1071
1227
  */
1072
- e2eiNewActivationEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite): Promise<WireE2eIdentity>;
1228
+ e2eiNewActivationEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
1073
1229
  /**
1074
1230
  * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1075
1231
  * having to change/rotate their credential, either because the former one is expired or it
1076
1232
  * has been revoked. It lets you change the DisplayName or the handle
1077
1233
  * if you need to. Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1078
1234
  *
1079
- * @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
1080
- * @param expiryDays generated x509 certificate expiry
1235
+ * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `t6wRpI8BRSeviBwwiFp5MQ:6add501bacd1d90e@example.com`
1236
+ * @param expiryDays - generated x509 certificate expiry
1081
1237
  * @param ciphersuite - for generating signing key material
1082
- * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
1083
- * @param handle user handle e.g. `alice.smith.qa@example.com`
1084
- * @returns The new {@link WireE2eIdentity} object
1238
+ * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1239
+ * @param handle - user handle e.g. `alice.smith.qa@example.com`
1240
+ * @param team - name of the Wire team a user belongs to
1241
+ * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
1085
1242
  */
1086
- e2eiNewRotateEnrollment(clientId: string, expiryDays: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string): Promise<WireE2eIdentity>;
1243
+ e2eiNewRotateEnrollment(clientId: string, expiryDays: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
1087
1244
  /**
1088
- * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ; that means he cannot initialize with a Basic credential
1245
+ * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
1246
+ * that means he cannot initialize with a Basic credential
1089
1247
  *
1090
1248
  * @param enrollment - the enrollment instance used to fetch the certificates
1091
1249
  * @param certificateChain - the raw response from ACME server
1250
+ * @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
1251
+ * @returns a MlsClient initialized with only a x509 credential
1092
1252
  */
1093
- e2eiMlsInitOnly(enrollment: WireE2eIdentity, certificateChain: string): Promise<void>;
1253
+ e2eiMlsInitOnly(enrollment: E2eiEnrollment, certificateChain: string, nbKeyPackage?: number): Promise<void>;
1094
1254
  /**
1095
1255
  * Creates a commit in all local conversations for changing the credential. Requires first
1096
1256
  * having enrolled a new X509 certificate with either {@link CoreCrypto.e2eiNewActivationEnrollment}
@@ -1099,8 +1259,9 @@ export declare class CoreCrypto {
1099
1259
  * @param enrollment - the enrollment instance used to fetch the certificates
1100
1260
  * @param certificateChain - the raw response from ACME server
1101
1261
  * @param newKeyPackageCount - number of KeyPackages with new identity to generate
1262
+ * @returns a {@link RotateBundle} with commits to fan-out to other group members, KeyPackages to upload and old ones to delete
1102
1263
  */
1103
- e2eiRotateAll(enrollment: WireE2eIdentity, certificateChain: string, newKeyPackageCount: number): Promise<RotateBundle>;
1264
+ e2eiRotateAll(enrollment: E2eiEnrollment, certificateChain: string, newKeyPackageCount: number): Promise<RotateBundle>;
1104
1265
  /**
1105
1266
  * Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
1106
1267
  * it later with {@link e2eiEnrollmentStashPop}
@@ -1108,22 +1269,48 @@ export declare class CoreCrypto {
1108
1269
  * @param enrollment the enrollment instance to persist
1109
1270
  * @returns a handle to fetch the enrollment later with {@link e2eiEnrollmentStashPop}
1110
1271
  */
1111
- e2eiEnrollmentStash(enrollment: WireE2eIdentity): Promise<Uint8Array>;
1272
+ e2eiEnrollmentStash(enrollment: E2eiEnrollment): Promise<Uint8Array>;
1112
1273
  /**
1113
1274
  * Fetches the persisted enrollment and deletes it from the keystore
1114
1275
  *
1115
1276
  * @param handle returned by {@link e2eiEnrollmentStash}
1116
1277
  * @returns the persisted enrollment instance
1117
1278
  */
1118
- e2eiEnrollmentStashPop(handle: Uint8Array): Promise<WireE2eIdentity>;
1279
+ e2eiEnrollmentStashPop(handle: Uint8Array): Promise<E2eiEnrollment>;
1119
1280
  /**
1120
1281
  * Indicates when to mark a conversation as degraded i.e. when not all its members have a X509.
1121
1282
  * Credential generated by Wire's end-to-end identity enrollment
1122
1283
  *
1123
1284
  * @param conversationId The group's ID
1124
- * @returns true if all the members have valid X509 credentials
1285
+ * @returns the conversation state given current members
1286
+ */
1287
+ e2eiConversationState(conversationId: ConversationId): Promise<E2eiConversationState>;
1288
+ /**
1289
+ * Returns true when end-to-end-identity is enabled for the given Ciphersuite
1290
+ *
1291
+ * @param ciphersuite of the credential to check
1292
+ * @returns true if end-to-end identity is enabled for the given ciphersuite
1293
+ */
1294
+ e2eiIsEnabled(ciphersuite: Ciphersuite): Promise<boolean>;
1295
+ /**
1296
+ * From a given conversation, get the identity of the members supplied. Identity is only present for members with a
1297
+ * Certificate Credential (after turning on end-to-end identity).
1298
+ *
1299
+ * @param conversationId - identifier of the conversation
1300
+ * @param deviceIds - identifiers of the devices
1301
+ * @returns identities or if no member has a x509 certificate, it will return an empty List
1302
+ */
1303
+ getDeviceIdentities(conversationId: ConversationId, deviceIds: ClientId[]): Promise<WireIdentity[]>;
1304
+ /**
1305
+ * From a given conversation, get the identity of the users (device holders) supplied.
1306
+ * Identity is only present for devices with a Certificate Credential (after turning on end-to-end identity).
1307
+ * If no member has a x509 certificate, it will return an empty Vec.
1308
+ *
1309
+ * @param conversationId - identifier of the conversation
1310
+ * @param userIds - user identifiers e.g. t6wRpI8BRSeviBwwiFp5MQ which is a base64UrlUnpadded UUIDv4
1311
+ * @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.
1125
1312
  */
1126
- e2eiIsDegraded(conversationId: ConversationId): Promise<boolean>;
1313
+ getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
1127
1314
  /**
1128
1315
  * Returns the current version of {@link CoreCrypto}
1129
1316
  *
@@ -1132,7 +1319,7 @@ export declare class CoreCrypto {
1132
1319
  static version(): string;
1133
1320
  }
1134
1321
  type JsonRawData = Uint8Array;
1135
- export declare class WireE2eIdentity {
1322
+ export declare class E2eiEnrollment {
1136
1323
  #private;
1137
1324
  /** @hidden */
1138
1325
  constructor(e2ei: unknown);
@@ -1241,7 +1428,7 @@ export declare class WireE2eIdentity {
1241
1428
  * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}`.
1242
1429
  *
1243
1430
  * @param order HTTP response body
1244
- * @return the finalize url to use with {@link finalizeRequest}
1431
+ * @return finalize url to use with {@link finalizeRequest}
1245
1432
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1246
1433
  */
1247
1434
  checkOrderResponse(order: JsonRawData): string;
@@ -1269,95 +1456,23 @@ export declare class WireE2eIdentity {
1269
1456
  certificateRequest(previousNonce: string): JsonRawData;
1270
1457
  }
1271
1458
  /**
1272
- * Holds URLs of all the standard ACME endpoint supported on an ACME server.
1273
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.1.1
1274
- */
1275
- export interface AcmeDirectory {
1276
- /**
1277
- * URL for fetching a new nonce. Use this only for creating a new account.
1278
- *
1279
- * @readonly
1280
- */
1281
- newNonce: string;
1282
- /**
1283
- * URL for creating a new account.
1284
- *
1285
- * @readonly
1286
- */
1287
- newAccount: string;
1288
- /**
1289
- * URL for creating a new order.
1290
- *
1291
- * @readonly
1292
- */
1293
- newOrder: string;
1294
- }
1295
- /**
1296
- * Result of an order creation
1297
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1459
+ * Indicates the state of a Conversation regarding end-to-end identity.
1460
+ * Note: this does not check pending state (pending commit, pending proposals) so it does not
1461
+ * consider members about to be added/removed
1298
1462
  */
1299
- export interface NewAcmeOrder {
1463
+ export declare enum E2eiConversationState {
1300
1464
  /**
1301
- * Contains raw JSON data of this order. This is parsed by the underlying Rust library hence should not be accessed
1302
- *
1303
- * @readonly
1304
- */
1305
- delegate: Uint8Array;
1306
- /**
1307
- * An authorization for each domain to create
1308
- *
1309
- * @readonly
1310
- */
1311
- authorizations: Uint8Array[];
1312
- }
1313
- /**
1314
- * Result of an authorization creation.
1315
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
1316
- */
1317
- export interface NewAcmeAuthz {
1318
- /**
1319
- * DNS entry associated with those challenge
1320
- *
1321
- * @readonly
1322
- */
1323
- identifier: string;
1324
- /**
1325
- * Challenge for the clientId
1326
- *
1327
- * @readonly
1328
- */
1329
- wireDpopChallenge?: AcmeChallenge;
1330
- /**
1331
- * Challenge for the userId and displayName
1332
- *
1333
- * @readonly
1334
- */
1335
- wireOidcChallenge?: AcmeChallenge;
1336
- }
1337
- /**
1338
- * For creating a challenge
1339
- * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1340
- */
1341
- export interface AcmeChallenge {
1342
- /**
1343
- * Contains raw JSON data of this challenge. This is parsed by the underlying Rust library hence should not be accessed
1344
- *
1345
- * @readonly
1465
+ * All clients have a valid E2EI certificate
1346
1466
  */
1347
- delegate: Uint8Array;
1467
+ Verified = 1,
1348
1468
  /**
1349
- * URL of this challenge
1350
- *
1351
- * @readonly
1469
+ * Some clients are either still Basic or their certificate is expired
1352
1470
  */
1353
- url: string;
1471
+ Degraded = 2,
1354
1472
  /**
1355
- * Non-standard, Wire specific claim. Indicates the consumer from where it should get the challenge proof.
1356
- * Either from wire-server "/access-token" endpoint in case of a DPoP challenge, or from an OAuth token endpoint for an OIDC challenge
1357
- *
1358
- * @readonly
1473
+ * All clients are still Basic. If all client have expired certificates, Degraded is returned.
1359
1474
  */
1360
- target: string;
1475
+ NotEnabled = 3
1361
1476
  }
1362
1477
 
1363
1478
  export {};