@wireapp/core-crypto 1.0.0-pre.5 → 1.0.0-pre.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "1.0.0-pre.5",
3
+ "version": "1.0.0-pre.6",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -47,7 +47,11 @@ export declare enum Ciphersuite {
47
47
  /**
48
48
  * DH KEM P384 | AES-GCM 256 | SHA2-384 | EcDSA P384
49
49
  */
50
- MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
50
+ MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7,
51
+ /**
52
+ * x25519Kyber768Draft00 Hybrid KEM | AES-GCM 128 | SHA2-256 | Ed25519
53
+ */
54
+ MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519 = 61489
51
55
  }
52
56
  export declare enum CredentialType {
53
57
  /**
@@ -231,6 +235,29 @@ export declare enum RatchetTreeType {
231
235
  */
232
236
  ByRef = 3
233
237
  }
238
+ /**
239
+ * Result returned after rotating the Credential of the current client in all the local conversations
240
+ */
241
+ export interface RotateBundle {
242
+ /**
243
+ * An Update commit for each conversation
244
+ *
245
+ * @readonly
246
+ */
247
+ commits: CommitBundle[];
248
+ /**
249
+ * Fresh KeyPackages with the new Credential
250
+ *
251
+ * @readonly
252
+ */
253
+ newKeyPackages: Uint8Array[];
254
+ /**
255
+ * All the now deprecated KeyPackages. Once deleted remotely, delete them locally with {@link CoreCrypto.deleteKeyPackages}
256
+ *
257
+ * @readonly
258
+ */
259
+ keyPackageRefsToRemove: Uint8Array[];
260
+ }
234
261
  /**
235
262
  * Params for CoreCrypto deferred initialization
236
263
  * Please note that the `entropySeed` parameter MUST be exactly 32 bytes
@@ -607,12 +634,12 @@ export declare class CoreCrypto {
607
634
  */
608
635
  conversationExists(conversationId: ConversationId): Promise<boolean>;
609
636
  /**
610
- * Marks a conversation as child of another one
611
- * This will mostly affect the behavior of the callbacks (the parentConversationClients parameter will be filled)
612
- *
613
- * @param childId - conversation identifier of the child conversation
614
- * @param parentId - conversation identifier of the parent conversation
615
- */
637
+ * Marks a conversation as child of another one
638
+ * This will mostly affect the behavior of the callbacks (the parentConversationClients parameter will be filled)
639
+ *
640
+ * @param childId - conversation identifier of the child conversation
641
+ * @param parentId - conversation identifier of the parent conversation
642
+ */
616
643
  markConversationAsChildOf(childId: ConversationId, parentId: ConversationId): Promise<void>;
617
644
  /**
618
645
  * Returns the current epoch of a conversation
@@ -678,17 +705,26 @@ export declare class CoreCrypto {
678
705
  /**
679
706
  *
680
707
  * @param ciphersuite - of the KeyPackages to count
708
+ * @param credentialType - of the KeyPackages to count
681
709
  * @returns The amount of valid, non-expired KeyPackages that are persisted in the backing storage
682
710
  */
683
- clientValidKeypackagesCount(ciphersuite: Ciphersuite): Promise<number>;
711
+ clientValidKeypackagesCount(ciphersuite: Ciphersuite, credentialType: CredentialType): Promise<number>;
684
712
  /**
685
713
  * Fetches a requested amount of keypackages
686
714
  *
687
715
  * @param ciphersuite - of the KeyPackages to generate
716
+ * @param credentialType - of the KeyPackages to generate
688
717
  * @param amountRequested - The amount of keypackages requested
689
718
  * @returns An array of length `amountRequested` containing TLS-serialized KeyPackages
690
719
  */
691
- clientKeypackages(ciphersuite: Ciphersuite, amountRequested: number): Promise<Array<Uint8Array>>;
720
+ clientKeypackages(ciphersuite: Ciphersuite, credentialType: CredentialType, amountRequested: number): Promise<Array<Uint8Array>>;
721
+ /**
722
+ * Prunes local KeyPackages after making sure they also have been deleted on the backend side
723
+ * You should only use this after {@link CoreCrypto.e2eiRotateAll}
724
+ *
725
+ * @param refs - KeyPackage references to delete obtained from a {RotateBundle}
726
+ */
727
+ deleteKeypackages(refs: Uint8Array[]): Promise<void>;
692
728
  /**
693
729
  * Adds new clients to a conversation, assuming the current client has the right to add new clients to the conversation.
694
730
  *
@@ -750,13 +786,6 @@ export declare class CoreCrypto {
750
786
  */
751
787
  newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<ProposalBundle>;
752
788
  newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
753
- /**
754
- * Exports GroupInfo for use in external commits
755
- *
756
- * @param conversationId - MLS Conversation ID
757
- * @returns TLS-serialized MLS GroupInfo
758
- */
759
- exportGroupInfo(conversationId: ConversationId): Promise<Uint8Array>;
760
789
  /**
761
790
  * Allows to create an external commit to "apply" to join a group through its GroupInfo.
762
791
  *
@@ -996,12 +1025,48 @@ export declare class CoreCrypto {
996
1025
  */
997
1026
  e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite): Promise<WireE2eIdentity>;
998
1027
  /**
999
- * Parses the ACME server response from the endpoint fetching x509 certificates and uses it to initialize the MLS client with a certificate
1028
+ * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1029
+ * As a consequence, this method does not support changing the ClientId which should remain the same as the Basic one.
1030
+ * Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1031
+ *
1032
+ * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
1033
+ * @param handle user handle e.g. `alice.smith.qa@example.com`
1034
+ * @param expiryDays generated x509 certificate expiry
1035
+ * @param ciphersuite - for generating signing key material
1036
+ * @returns The new {@link WireE2eIdentity} object
1037
+ */
1038
+ e2eiNewActivationEnrollment(displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite): Promise<WireE2eIdentity>;
1039
+ /**
1040
+ * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1041
+ * having to change/rotate their credential, either because the former one is expired or it
1042
+ * has been revoked. As a consequence, this method does not support changing neither ClientId which
1043
+ * should remain the same as the previous one. It lets you change the DisplayName or the handle
1044
+ * if you need to. Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1045
+ *
1046
+ * @param expiryDays generated x509 certificate expiry
1047
+ * @param ciphersuite - for generating signing key material
1048
+ * @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
1049
+ * @param handle user handle e.g. `alice.smith.qa@example.com`
1050
+ * @returns The new {@link WireE2eIdentity} object
1051
+ */
1052
+ e2eiNewRotateEnrollment(expiryDays: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string): Promise<WireE2eIdentity>;
1053
+ /**
1054
+ * 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
1055
+ *
1056
+ * @param enrollment - the enrollment instance used to fetch the certificates
1057
+ * @param certificateChain - the raw response from ACME server
1058
+ */
1059
+ e2eiMlsInitOnly(enrollment: WireE2eIdentity, certificateChain: string): Promise<void>;
1060
+ /**
1061
+ * Creates a commit in all local conversations for changing the credential. Requires first
1062
+ * having enrolled a new X509 certificate with either {@link CoreCrypto.e2eiNewActivationEnrollment}
1063
+ * or {@link CoreCrypto.e2eiNewRotateEnrollment}
1000
1064
  *
1001
1065
  * @param enrollment - the enrollment instance used to fetch the certificates
1002
1066
  * @param certificateChain - the raw response from ACME server
1067
+ * @param newKeyPackageCount - number of KeyPackages with new identity to generate
1003
1068
  */
1004
- e2eiMlsInit(enrollment: WireE2eIdentity, certificateChain: string): Promise<void>;
1069
+ e2eiRotateAll(enrollment: WireE2eIdentity, certificateChain: string, newKeyPackageCount: number): Promise<RotateBundle>;
1005
1070
  /**
1006
1071
  * Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
1007
1072
  * it later with {@link e2eiEnrollmentStashPop}