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