@wireapp/core 31.0.0 → 31.1.1

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
@@ -3,12 +3,12 @@
3
3
  "./src/main/cryptography/AssetCryptography/crypto.node": "./src/main/cryptography/AssetCryptography/crypto.browser.js"
4
4
  },
5
5
  "dependencies": {
6
- "@wireapp/api-client": "workspace:^",
7
- "@wireapp/commons": "workspace:^",
6
+ "@wireapp/api-client": "^20.5.0",
7
+ "@wireapp/commons": "^4.4.0",
8
8
  "@wireapp/core-crypto": "0.5.0",
9
9
  "@wireapp/cryptobox": "12.8.0",
10
- "@wireapp/promise-queue": "workspace:^",
11
- "@wireapp/store-engine-dexie": "workspace:^",
10
+ "@wireapp/promise-queue": "^1.2.0",
11
+ "@wireapp/store-engine-dexie": "^1.7.0",
12
12
  "axios": "^0.27.2",
13
13
  "bazinga64": "5.11.0",
14
14
  "hash.js": "1.1.7",
@@ -81,6 +81,6 @@
81
81
  "test": "jest",
82
82
  "watch": "tsc ---watch"
83
83
  },
84
- "version": "31.0.0",
85
- "gitHead": "a23001a062060cec72d2e3687e381c8ae6ca31a7"
84
+ "version": "31.1.1",
85
+ "gitHead": "b95b3e1af8e527cceaa3f770c9c2b06c019d0cb9"
86
86
  }
@@ -7,7 +7,7 @@ import { RemoteData } from '../content';
7
7
  import { CryptographyService } from '../../cryptography/';
8
8
  import { MLSService } from '../../mls';
9
9
  import { NotificationService } from '../../notification';
10
- import { ClearConversationMessage, HideMessage, OtrMessage } from '../message/OtrMessage';
10
+ import { ClearConversationMessage, OtrMessage } from '../message/OtrMessage';
11
11
  import { XOR } from '@wireapp/commons/src/main/util/TypeUtil';
12
12
  import { AddUsersParams, MessageSendingOptions, MLSReturnType, SendMlsMessageParams, SendProteusMessageParams } from './ConversationService.types';
13
13
  export declare class ConversationService {
@@ -91,7 +91,6 @@ export declare class ConversationService {
91
91
  * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
92
92
  */
93
93
  fetchAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
94
- deleteMessageLocal(conversationId: string, messageIdToHide: string, sendAsProtobuf?: boolean, conversationDomain?: string): Promise<HideMessage>;
95
94
  /**
96
95
  * Create a group conversation.
97
96
  * @param {string} name
@@ -342,33 +342,6 @@ class ConversationService {
342
342
  }));
343
343
  return qualifiedUserClients;
344
344
  }
345
- async deleteMessageLocal(conversationId, messageIdToHide, sendAsProtobuf, conversationDomain) {
346
- const messageId = MessageBuilder_1.MessageBuilder.createId();
347
- const content = protocol_messaging_1.MessageHide.create({
348
- conversationId,
349
- messageId: messageIdToHide,
350
- });
351
- const genericMessage = protocol_messaging_1.GenericMessage.create({
352
- [conversation_2.GenericMessageType.HIDDEN]: content,
353
- messageId,
354
- });
355
- const { id: selfConversationId } = await this.getSelfConversationId();
356
- await this.sendGenericMessage(this.apiClient.validatedClientId, selfConversationId, genericMessage, {
357
- sendAsProtobuf,
358
- conversationDomain,
359
- });
360
- return {
361
- content,
362
- conversation: conversationId,
363
- from: this.apiClient.context.userId,
364
- id: messageId,
365
- messageTimer: this.messageTimer.getMessageTimer(conversationId),
366
- source: conversation_2.PayloadBundleSource.LOCAL,
367
- state: conversation_2.PayloadBundleState.OUTGOING_SENT,
368
- timestamp: Date.now(),
369
- type: conversation_2.PayloadBundleType.MESSAGE_HIDE,
370
- };
371
- }
372
345
  createProteusConversation(conversationData, otherUserIds) {
373
346
  let payload;
374
347
  if (typeof conversationData === 'string') {
@@ -59,6 +59,8 @@ function generateGenericMessage(payload, messageTimer) {
59
59
  return { genericMessage: generateTextGenericMessage(payload, messageTimer), content };
60
60
  case PayloadBundle_1.PayloadBundleType.MESSAGE_DELETE:
61
61
  return { genericMessage: generateDeleteMessage(payload), content };
62
+ case PayloadBundle_1.PayloadBundleType.MESSAGE_HIDE:
63
+ return { genericMessage: generateHideMessage(payload), content };
62
64
  /**
63
65
  * ToDo: Create Generic implementation for everything else
64
66
  */
@@ -248,6 +250,16 @@ function generateDeleteMessage(payload) {
248
250
  messageId: payload.id,
249
251
  });
250
252
  }
253
+ function generateHideMessage(payload) {
254
+ const content = protocol_messaging_1.MessageHide.create({
255
+ messageId: payload.content.messageId,
256
+ conversationId: payload.content.conversationId,
257
+ });
258
+ return protocol_messaging_1.GenericMessage.create({
259
+ [GenericMessageType_1.GenericMessageType.HIDDEN]: content,
260
+ messageId: payload.id,
261
+ });
262
+ }
251
263
  function generateTextGenericMessage(payloadBundle, messageTimer) {
252
264
  const genericMessage = protocol_messaging_1.GenericMessage.create({
253
265
  messageId: payloadBundle.id,
@@ -3,16 +3,20 @@ import { AbortReason } from '..';
3
3
  import { EncryptedAssetUploaded } from '../../cryptography';
4
4
  import { ButtonActionConfirmationContent, ButtonActionContent, CallingContent, FileContent, FileMetaDataContent, ImageContent, KnockContent, LegalHoldStatus, LocationContent, ReactionContent } from '../content';
5
5
  import { CompositeContentBuilder } from './CompositeContentBuilder';
6
- import { ButtonActionConfirmationMessage, ButtonActionMessage, CallMessage, ConfirmationMessage, DeleteMessage, FileAssetAbortMessage, FileAssetMessage, FileAssetMetaDataMessage, ImageAssetMessageOutgoing, LocationMessage, PingMessage, ReactionMessage, ResetSessionMessage } from './OtrMessage';
6
+ import { ButtonActionConfirmationMessage, ButtonActionMessage, CallMessage, ConfirmationMessage, DeleteMessage, FileAssetAbortMessage, FileAssetMessage, FileAssetMetaDataMessage, HideMessage, ImageAssetMessageOutgoing, LocationMessage, PingMessage, ReactionMessage, ResetSessionMessage } from './OtrMessage';
7
7
  import { TextContentBuilder } from './TextContentBuilder';
8
8
  interface BaseOptions {
9
9
  conversationId: string;
10
10
  from: string;
11
11
  messageId?: string;
12
12
  }
13
- interface CreateDeleteOption extends BaseOptions {
13
+ interface CreateMessageDeleteOption extends BaseOptions {
14
14
  messageIdToDelete: string;
15
15
  }
16
+ interface CreateMessageHideOption extends BaseOptions {
17
+ messageIdToDelete: string;
18
+ targetConversation: string;
19
+ }
16
20
  interface CreateImageOptions extends BaseOptions {
17
21
  expectsReadConfirmation?: boolean;
18
22
  asset: EncryptedAssetUploaded;
@@ -72,7 +76,8 @@ interface CreateActionMessageOptions extends BaseOptions {
72
76
  export declare class MessageBuilder {
73
77
  static createEditedText(payload: CreateEditedTextOptions): TextContentBuilder;
74
78
  static createFileData(payload: CreateFileOptions): FileAssetMessage;
75
- static createDelete(payload: CreateDeleteOption): DeleteMessage;
79
+ static createMessageDelete(payload: CreateMessageDeleteOption): DeleteMessage;
80
+ static createMessageHide(payload: CreateMessageHideOption): HideMessage;
76
81
  static createFileMetadata(payload: CreateFileMetadataOptions): FileAssetMetaDataMessage;
77
82
  static createFileAbort(payload: CreateFileAbortOptions): FileAssetAbortMessage;
78
83
  static createImage(payload: CreateImageOptions): ImageAssetMessageOutgoing;
@@ -53,9 +53,12 @@ class MessageBuilder {
53
53
  legalHoldStatus,
54
54
  }, id: originalMessageId, type: __1.PayloadBundleType.ASSET });
55
55
  }
56
- static createDelete(payload) {
56
+ static createMessageDelete(payload) {
57
57
  return Object.assign(Object.assign({}, createCommonProperties(payload)), { content: { messageId: payload.messageIdToDelete }, type: __1.PayloadBundleType.MESSAGE_DELETE });
58
58
  }
59
+ static createMessageHide(payload) {
60
+ return Object.assign(Object.assign({}, createCommonProperties(payload)), { content: { messageId: payload.messageIdToDelete, conversationId: payload.targetConversation }, type: __1.PayloadBundleType.MESSAGE_HIDE });
61
+ }
59
62
  static createFileMetadata(payload) {
60
63
  const { expectsReadConfirmation, legalHoldStatus, metaData } = payload;
61
64
  return Object.assign(Object.assign({}, createCommonProperties(payload)), { content: {
@@ -0,0 +1,8 @@
1
+ import { QualifiedUserClientMap } from '@wireapp/api-client/src/client';
2
+ declare type UserId = string;
3
+ declare type ClientId = string;
4
+ declare type Domain = string;
5
+ export declare type ClientIdStringType = `${UserId}:${ClientId}@${Domain}`;
6
+ export declare const constructFullyQualifiedClientId: (userId: UserId, clientId: ClientId, domain: Domain) => ClientIdStringType;
7
+ export declare const mapQualifiedUserClientIdsToFullyQualifiedClientIds: (qualifiedUserMap: QualifiedUserClientMap) => Uint8Array[];
8
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.mapQualifiedUserClientIdsToFullyQualifiedClientIds = exports.constructFullyQualifiedClientId = void 0;
22
+ const constructFullyQualifiedClientId = (userId, clientId, domain) => `${userId}:${clientId}@${domain}`;
23
+ exports.constructFullyQualifiedClientId = constructFullyQualifiedClientId;
24
+ const mapQualifiedUserClientIdsToFullyQualifiedClientIds = (qualifiedUserMap) => {
25
+ const encoder = new TextEncoder();
26
+ return Object.entries(qualifiedUserMap).flatMap(([domain, users]) => {
27
+ const clients = Object.entries(users);
28
+ return clients.flatMap(([userId, clients]) => clients.map(client => encoder.encode((0, exports.constructFullyQualifiedClientId)(userId, client.id, domain))));
29
+ });
30
+ };
31
+ exports.mapQualifiedUserClientIdsToFullyQualifiedClientIds = mapQualifiedUserClientIdsToFullyQualifiedClientIds;
32
+ //# sourceMappingURL=mapQualifiedUserClientIdsToFullyQualifiedClientIds.js.map