@wireapp/core 24.0.3 → 24.2.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,41 @@
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
+ # [24.2.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@24.1.1...@wireapp/core@24.2.0) (2022-03-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **core:** Do not use qualified session ids in non-federated env ([#4237](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4237)) ([ad9e6d0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/ad9e6d0e903c42674aa7f60038463e3c1dfeb5e4))
12
+
13
+
14
+ ### Features
15
+
16
+ * **api-client:** Send federated broadcast messages ([#4235](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4235)) ([4e437a5](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/4e437a5c60a0c801d2ce10d802f100d7ac9c6f6b))
17
+
18
+
19
+
20
+
21
+
22
+ ## [24.1.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@24.1.0...@wireapp/core@24.1.1) (2022-03-01)
23
+
24
+ **Note:** Version bump only for package @wireapp/core
25
+
26
+
27
+
28
+
29
+
30
+ # [24.1.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@24.0.3...@wireapp/core@24.1.0) (2022-02-28)
31
+
32
+
33
+ ### Features
34
+
35
+ * **core:** Allow sending broadcast message to federated env ([#4234](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4234)) ([ee66d4d](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/ee66d4d269d0af9fdd72d9a20fdfa4cab884cf8d))
36
+
37
+
38
+
39
+
40
+
6
41
  ## [24.0.3](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@24.0.2...@wireapp/core@24.0.3) (2022-02-25)
7
42
 
8
43
  **Note:** Version bump only for package @wireapp/core
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "dependencies": {
6
6
  "@types/long": "4.0.1",
7
7
  "@types/node": "~14",
8
- "@wireapp/api-client": "18.1.0",
8
+ "@wireapp/api-client": "18.3.0",
9
9
  "@wireapp/cryptobox": "12.7.1",
10
10
  "bazinga64": "5.10.0",
11
11
  "hash.js": "1.1.7",
@@ -20,14 +20,14 @@
20
20
  "@types/jasmine": "3.8.2",
21
21
  "@types/karma": "6.3.1",
22
22
  "@wireapp/commons": "4.2.13",
23
- "@wireapp/store-engine-dexie": "1.6.8",
23
+ "@wireapp/store-engine-dexie": "1.6.9",
24
24
  "commander": "8.0.0",
25
25
  "cross-env": "7.0.3",
26
26
  "dotenv-defaults": "2.0.2",
27
27
  "faker": "5.5.3",
28
28
  "istanbul": "1.1.0-alpha.1",
29
29
  "jasmine": "3.8.0",
30
- "karma": "6.3.14",
30
+ "karma": "6.3.16",
31
31
  "karma-chrome-launcher": "3.1.0",
32
32
  "karma-jasmine": "4.0.1",
33
33
  "karma-jasmine-diff-reporter": "2.0.1",
@@ -69,6 +69,6 @@
69
69
  "test:project": "yarn dist && yarn test",
70
70
  "test:node": "nyc jasmine --config=jasmine.json"
71
71
  },
72
- "version": "24.0.3",
73
- "gitHead": "4dee80062725efdc91bb0102eb768e5f431db04b"
72
+ "version": "24.2.0",
73
+ "gitHead": "e0b2ffc4997ecf5bc50148635b639c055fa863c7"
74
74
  }
@@ -149,15 +149,20 @@ class Account extends events_1.EventEmitter {
149
149
  return context;
150
150
  }
151
151
  async initServices(storeEngine) {
152
- const config = { useQualifiedIds: this.apiClient.backendFeatures.federationEndpoints };
153
152
  const accountService = new account_1.AccountService(this.apiClient);
154
153
  const assetService = new conversation_1.AssetService(this.apiClient);
155
- const cryptographyService = new cryptography_1.CryptographyService(this.apiClient, storeEngine, config);
154
+ const cryptographyService = new cryptography_1.CryptographyService(this.apiClient, storeEngine, {
155
+ // We want to encrypt with fully qualified session ids, only if the backend is federated with other backends
156
+ useQualifiedIds: this.backendFeatures.isFederated,
157
+ });
156
158
  const clientService = new client_2.ClientService(this.apiClient, storeEngine, cryptographyService);
157
159
  const connectionService = new connection_1.ConnectionService(this.apiClient);
158
160
  const giphyService = new giphy_1.GiphyService(this.apiClient);
159
161
  const linkPreviewService = new linkPreview_1.LinkPreviewService(assetService);
160
- const conversationService = new conversation_1.ConversationService(this.apiClient, cryptographyService, config);
162
+ const conversationService = new conversation_1.ConversationService(this.apiClient, cryptographyService, {
163
+ // We can use qualified ids to send messages as long as the backend supports federated endpoints
164
+ useQualifiedIds: this.backendFeatures.federationEndpoints,
165
+ });
161
166
  const notificationService = new notification_1.NotificationService(this.apiClient, cryptographyService, storeEngine);
162
167
  const selfService = new self_1.SelfService(this.apiClient);
163
168
  const teamService = new team_1.TeamService(this.apiClient);
@@ -1,5 +1,5 @@
1
1
  import type { APIClient } from '@wireapp/api-client';
2
- import { ClientMismatch, UserClients } from '@wireapp/api-client/src/conversation';
2
+ import { ClientMismatch, MessageSendingStatus, QualifiedUserClients, UserClients } from '@wireapp/api-client/src/conversation';
3
3
  import type { UserPreKeyBundleMap } from '@wireapp/api-client/src/user/';
4
4
  import { GenericMessage } from '@wireapp/protocol-messaging';
5
5
  import type { CryptographyService } from '../cryptography/';
@@ -16,5 +16,9 @@ export declare class BroadcastService {
16
16
  * @param onlyDirectConnections=false Will generate a bundle only for directly connected users (users the self user has conversation with). Allows avoiding broadcasting messages to too many people
17
17
  */
18
18
  getPreKeyBundlesFromTeam(teamId: string, skipOwnClients?: boolean, onlyDirectConnections?: boolean): Promise<UserPreKeyBundleMap>;
19
- broadcastGenericMessage(genericMessage: GenericMessage, recipients: UserPreKeyBundleMap | UserClients, sendAsProtobuf?: boolean, onClientMismatch?: (mismatch: ClientMismatch) => void | boolean | Promise<boolean>): Promise<ClientMismatch>;
19
+ broadcastGenericMessage(genericMessage: GenericMessage, recipients: UserPreKeyBundleMap | UserClients | QualifiedUserClients, sendAsProtobuf?: boolean, onClientMismatch?: (mismatch: ClientMismatch | MessageSendingStatus) => void | boolean | Promise<boolean>): Promise<(MessageSendingStatus & {
20
+ errored?: boolean | undefined;
21
+ }) | (ClientMismatch & {
22
+ errored?: boolean | undefined;
23
+ })>;
20
24
  }
@@ -21,6 +21,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.BroadcastService = void 0;
22
22
  const protocol_messaging_1 = require("@wireapp/protocol-messaging");
23
23
  const MessageService_1 = require("../conversation/message/MessageService");
24
+ const UserClientsUtil_1 = require("../conversation/message/UserClientsUtil");
25
+ const util_1 = require("../util");
24
26
  class BroadcastService {
25
27
  constructor(apiClient, cryptographyService) {
26
28
  this.apiClient = apiClient;
@@ -56,11 +58,16 @@ class BroadcastService {
56
58
  }
57
59
  async broadcastGenericMessage(genericMessage, recipients, sendAsProtobuf, onClientMismatch) {
58
60
  const plainTextArray = protocol_messaging_1.GenericMessage.encode(genericMessage).finish();
59
- return this.messageService.sendMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
60
- sendAsProtobuf,
61
- reportMissing: Object.keys(recipients),
62
- onClientMismatch,
63
- });
61
+ return (0, util_1.isQualifiedUserClients)(recipients)
62
+ ? this.messageService.sendFederatedMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
63
+ reportMissing: (0, UserClientsUtil_1.flattenQualifiedUserClients)(recipients).map(({ userId }) => userId),
64
+ onClientMismatch,
65
+ })
66
+ : this.messageService.sendMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
67
+ sendAsProtobuf,
68
+ reportMissing: Object.keys(recipients),
69
+ onClientMismatch,
70
+ });
64
71
  }
65
72
  }
66
73
  exports.BroadcastService = BroadcastService;
@@ -162,8 +162,7 @@ class MessageService {
162
162
  protoMessage.ignoreAll = true;
163
163
  }
164
164
  if (!options.conversationId) {
165
- //TODO implement federated broadcast sending
166
- throw new Error('Unimplemented federated broadcast');
165
+ return this.apiClient.api.broadcast.postBroadcastFederatedMessage(sendingClientId, protoMessage);
167
166
  }
168
167
  const { id, domain } = options.conversationId;
169
168
  return this.apiClient.api.conversation.postOTRMessageV2(id, domain, protoMessage);