@wireapp/core 30.7.2 → 30.8.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [30.8.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.7.2...@wireapp/core@30.8.0) (2022-09-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * Call clearPendingCommits when commit sending failed on backend ([#4395](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4395)) ([b863bf0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/b863bf0b3292bb71db94eb6411e5232e5918646e))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [30.7.2](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.7.1...@wireapp/core@30.7.2) (2022-09-14)
7
18
 
8
19
  **Note:** Version bump only for package @wireapp/core
package/package.json CHANGED
@@ -77,6 +77,6 @@
77
77
  "test:node": "nyc jasmine --config=jasmine.json",
78
78
  "watch": "tsc ---watch"
79
79
  },
80
- "version": "30.7.2",
81
- "gitHead": "5c05f4c0eea63367bf61f725fbba5860dd909d0e"
80
+ "version": "30.8.0",
81
+ "gitHead": "908930586bdf08bdb150a1092084ab36f80fbb64"
82
82
  }
@@ -1,4 +1,4 @@
1
- import { AddProposalArgs, CommitBundle, ConversationConfiguration, ConversationId, CoreCrypto, DecryptedMessage, ExternalProposalArgs, ExternalProposalType, ExternalRemoveProposalArgs, Invitee, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto/platforms/web/corecrypto';
1
+ import { AddProposalArgs, CommitBundle, ConversationConfiguration, ConversationId, CoreCrypto, DecryptedMessage, ExternalProposalArgs, ExternalProposalType, ExternalRemoveProposalArgs, Invitee, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
2
2
  import { APIClient } from '@wireapp/api-client';
3
3
  import { QualifiedUsers } from '../../conversation';
4
4
  import type { MLSConfig } from '../types';
@@ -11,9 +11,9 @@ export declare class MLSService {
11
11
  constructor(config: MLSConfig | undefined, apiClient: APIClient, coreCryptoClientProvider: () => CoreCrypto | undefined);
12
12
  private getCoreCryptoClient;
13
13
  private uploadCommitBundle;
14
- addUsersToExistingConversation(groupIdDecodedFromBase64: Uint8Array, invitee: Invitee[]): Promise<PostMlsMessageResponse | null>;
14
+ addUsersToExistingConversation(groupId: Uint8Array, invitee: Invitee[]): Promise<PostMlsMessageResponse | null>;
15
15
  getKeyPackagesPayload(qualifiedUsers: QualifiedUsers[]): Promise<Invitee[]>;
16
- newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<import("@wireapp/core-crypto/platforms/web/corecrypto").ProposalBundle>;
16
+ newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<import("@wireapp/core-crypto").ProposalBundle>;
17
17
  newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalProposalArgs | ExternalRemoveProposalArgs): Promise<Uint8Array>;
18
18
  processWelcomeMessage(welcomeMessage: Uint8Array): Promise<ConversationId>;
19
19
  decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
@@ -39,36 +39,31 @@ class MLSService {
39
39
  }
40
40
  return client;
41
41
  }
42
- async uploadCommitBundle(groupIdDecodedFromBase64, commitBundle) {
42
+ async uploadCommitBundle(groupId, commitBundle) {
43
43
  const coreCryptoClient = this.getCoreCryptoClient();
44
44
  if (commitBundle.welcome) {
45
45
  //@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
46
46
  await this.apiClient.api.conversation.postMlsWelcomeMessage((0, exports.optionalToUint8Array)(commitBundle.welcome));
47
47
  }
48
48
  if (commitBundle.commit) {
49
- const messageResponse = await this.apiClient.api.conversation.postMlsMessage(
50
- //@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
51
- (0, exports.optionalToUint8Array)(commitBundle.commit));
52
- await coreCryptoClient.commitAccepted(groupIdDecodedFromBase64);
53
- return messageResponse;
49
+ try {
50
+ const messageResponse = await this.apiClient.api.conversation.postMlsMessage(
51
+ //@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
52
+ (0, exports.optionalToUint8Array)(commitBundle.commit));
53
+ await coreCryptoClient.commitAccepted(groupId);
54
+ return messageResponse;
55
+ }
56
+ catch (error) {
57
+ await coreCryptoClient.clear_pending_commit(groupId);
58
+ return null;
59
+ }
54
60
  }
55
61
  return null;
56
62
  }
57
- async addUsersToExistingConversation(groupIdDecodedFromBase64, invitee) {
63
+ async addUsersToExistingConversation(groupId, invitee) {
58
64
  const coreCryptoClient = this.getCoreCryptoClient();
59
- const memberAddedMessages = await coreCryptoClient.addClientsToConversation(groupIdDecodedFromBase64, invitee);
60
- if (memberAddedMessages === null || memberAddedMessages === void 0 ? void 0 : memberAddedMessages.welcome) {
61
- //@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
62
- await this.apiClient.api.conversation.postMlsWelcomeMessage((0, exports.optionalToUint8Array)(memberAddedMessages.welcome));
63
- }
64
- if (memberAddedMessages === null || memberAddedMessages === void 0 ? void 0 : memberAddedMessages.commit) {
65
- const messageResponse = await this.apiClient.api.conversation.postMlsMessage(
66
- //@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
67
- (0, exports.optionalToUint8Array)(memberAddedMessages.commit));
68
- await coreCryptoClient.commitAccepted(groupIdDecodedFromBase64);
69
- return messageResponse;
70
- }
71
- return null;
65
+ const memberAddedMessages = await coreCryptoClient.addClientsToConversation(groupId, invitee);
66
+ return this.uploadCommitBundle(groupId, memberAddedMessages);
72
67
  }
73
68
  async getKeyPackagesPayload(qualifiedUsers) {
74
69
  /**