@wireapp/core 30.13.0 → 31.1.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/package.json +28 -22
- package/src/main/Account.d.ts +3 -3
- package/src/main/CoreError.d.ts +1 -1
- package/src/main/account/AccountService.d.ts +2 -2
- package/src/main/account/AccountService.ts +2 -2
- package/src/main/auth/LoginSanitizer.d.ts +1 -1
- package/src/main/broadcast/AvailabilityType.d.ts +1 -1
- package/src/main/broadcast/BroadcastService.d.ts +3 -3
- package/src/main/client/ClientBackendRepository.d.ts +2 -2
- package/src/main/client/ClientDatabaseRepository.d.ts +3 -3
- package/src/main/client/ClientInfo.d.ts +1 -1
- package/src/main/client/ClientService.d.ts +4 -4
- package/src/main/connection/ConnectionService.d.ts +1 -1
- package/src/main/conversation/AbortReason.d.ts +1 -1
- package/src/main/conversation/AssetService/AssetService.d.ts +4 -4
- package/src/main/conversation/ConversationService/ConversationService.d.ts +9 -29
- package/src/main/conversation/ConversationService/ConversationService.js +2 -336
- package/src/main/conversation/ConversationService/ConversationService.types.d.ts +2 -0
- package/src/main/conversation/ConversationService/messageGenerator.d.ts +9 -0
- package/src/main/conversation/ConversationService/messageGenerator.js +313 -0
- package/src/main/conversation/message/CompositeContentBuilder.d.ts +1 -1
- package/src/main/conversation/message/Message.d.ts +3 -3
- package/src/main/conversation/message/MessageBuilder.d.ts +11 -2
- package/src/main/conversation/message/MessageBuilder.js +6 -0
- package/src/main/conversation/message/MessageToProtoMapper.d.ts +2 -2
- package/src/main/conversation/message/OtrMessage.d.ts +2 -2
- package/src/main/conversation/message/PayloadBundle.d.ts +3 -3
- package/src/main/conversation/message/TeamMessage.d.ts +2 -2
- package/src/main/conversation/message/TextContentBuilder.d.ts +1 -1
- package/src/main/conversation/message/UserMessage.d.ts +2 -2
- package/src/main/cryptography/AssetCryptography/index.d.ts +1 -1
- package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +1 -1
- package/src/main/cryptography/CryptographyService.d.ts +7 -7
- package/src/main/cryptography/GenericMessageMapper.d.ts +1 -1
- package/src/main/giphy/GiphyService.d.ts +2 -2
- package/src/main/mls/MLSService/MLSService.d.ts +1 -1
- package/src/main/notification/NotificationBackendRepository.d.ts +2 -2
- package/src/main/notification/NotificationDatabaseRepository.d.ts +3 -3
- package/src/main/notification/NotificationService.d.ts +4 -4
- package/src/main/self/SelfService.d.ts +2 -2
- package/src/main/team/TeamService.d.ts +2 -2
- package/src/main/test/CryptographyHelper.d.ts +1 -1
- package/src/main/user/UserService.d.ts +3 -3
- package/src/main/util/TypePredicateUtil.d.ts +2 -2
- package/CHANGELOG.md +0 -12419
|
@@ -0,0 +1,313 @@
|
|
|
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.generateGenericMessage = void 0;
|
|
22
|
+
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
23
|
+
const PayloadBundle_1 = require("../message/PayloadBundle");
|
|
24
|
+
const MessageToProtoMapper_1 = require("../message/MessageToProtoMapper");
|
|
25
|
+
const GenericMessageType_1 = require("../GenericMessageType");
|
|
26
|
+
const AssetTransferState_1 = require("../AssetTransferState");
|
|
27
|
+
function generateGenericMessage(payload, messageTimer) {
|
|
28
|
+
const content = payload.content;
|
|
29
|
+
switch (payload.type) {
|
|
30
|
+
case PayloadBundle_1.PayloadBundleType.ASSET:
|
|
31
|
+
return { genericMessage: generateFileDataGenericMessage(payload, messageTimer), content };
|
|
32
|
+
case PayloadBundle_1.PayloadBundleType.ASSET_ABORT:
|
|
33
|
+
return { genericMessage: generateFileAbortGenericMessage(payload, messageTimer), content };
|
|
34
|
+
case PayloadBundle_1.PayloadBundleType.ASSET_META:
|
|
35
|
+
return { genericMessage: generateFileMetaDataGenericMessage(payload, messageTimer), content };
|
|
36
|
+
case PayloadBundle_1.PayloadBundleType.ASSET_IMAGE:
|
|
37
|
+
return generateImageGenericMessage(payload, messageTimer);
|
|
38
|
+
case PayloadBundle_1.PayloadBundleType.BUTTON_ACTION:
|
|
39
|
+
return { genericMessage: generateButtonActionGenericMessage(payload), content };
|
|
40
|
+
case PayloadBundle_1.PayloadBundleType.BUTTON_ACTION_CONFIRMATION:
|
|
41
|
+
return { genericMessage: generateButtonActionConfirmationGenericMessage(payload), content };
|
|
42
|
+
case PayloadBundle_1.PayloadBundleType.CALL:
|
|
43
|
+
return { genericMessage: generateCallGenericMessage(payload), content };
|
|
44
|
+
case PayloadBundle_1.PayloadBundleType.CLIENT_ACTION:
|
|
45
|
+
return { genericMessage: generateSessionResetGenericMessage(payload), content };
|
|
46
|
+
case PayloadBundle_1.PayloadBundleType.COMPOSITE:
|
|
47
|
+
return { genericMessage: generateCompositeGenericMessage(payload), content };
|
|
48
|
+
case PayloadBundle_1.PayloadBundleType.CONFIRMATION:
|
|
49
|
+
return { genericMessage: generateConfirmationGenericMessage(payload), content };
|
|
50
|
+
case PayloadBundle_1.PayloadBundleType.LOCATION:
|
|
51
|
+
return { genericMessage: generateLocationGenericMessage(payload, messageTimer), content };
|
|
52
|
+
case PayloadBundle_1.PayloadBundleType.MESSAGE_EDIT:
|
|
53
|
+
return { genericMessage: generateEditedTextGenericMessage(payload), content };
|
|
54
|
+
case PayloadBundle_1.PayloadBundleType.PING:
|
|
55
|
+
return { genericMessage: generatePingGenericMessage(payload, messageTimer), content };
|
|
56
|
+
case PayloadBundle_1.PayloadBundleType.REACTION:
|
|
57
|
+
return { genericMessage: generateReactionGenericMessage(payload), content };
|
|
58
|
+
case PayloadBundle_1.PayloadBundleType.TEXT:
|
|
59
|
+
return { genericMessage: generateTextGenericMessage(payload, messageTimer), content };
|
|
60
|
+
case PayloadBundle_1.PayloadBundleType.MESSAGE_DELETE:
|
|
61
|
+
return { genericMessage: generateDeleteMessage(payload), content };
|
|
62
|
+
case PayloadBundle_1.PayloadBundleType.MESSAGE_HIDE:
|
|
63
|
+
return { genericMessage: generateHideMessage(payload), content };
|
|
64
|
+
/**
|
|
65
|
+
* ToDo: Create Generic implementation for everything else
|
|
66
|
+
*/
|
|
67
|
+
default:
|
|
68
|
+
throw new Error(`No send method implemented for "${payload['type']}".`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.generateGenericMessage = generateGenericMessage;
|
|
72
|
+
function generateButtonActionGenericMessage(payloadBundle) {
|
|
73
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
74
|
+
[GenericMessageType_1.GenericMessageType.BUTTON_ACTION]: protocol_messaging_1.ButtonAction.create(payloadBundle.content),
|
|
75
|
+
messageId: payloadBundle.id,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function generateButtonActionConfirmationGenericMessage(payloadBundle) {
|
|
79
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
80
|
+
[GenericMessageType_1.GenericMessageType.BUTTON_ACTION_CONFIRMATION]: protocol_messaging_1.ButtonActionConfirmation.create(payloadBundle.content),
|
|
81
|
+
messageId: payloadBundle.id,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function generateCompositeGenericMessage(payloadBundle) {
|
|
85
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
86
|
+
[GenericMessageType_1.GenericMessageType.COMPOSITE]: protocol_messaging_1.Composite.create(payloadBundle.content),
|
|
87
|
+
messageId: payloadBundle.id,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function generateConfirmationGenericMessage(payloadBundle) {
|
|
91
|
+
const content = protocol_messaging_1.Confirmation.create(payloadBundle.content);
|
|
92
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
93
|
+
[GenericMessageType_1.GenericMessageType.CONFIRMATION]: content,
|
|
94
|
+
messageId: payloadBundle.id,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function generateEditedTextGenericMessage(payloadBundle) {
|
|
98
|
+
const editedMessage = protocol_messaging_1.MessageEdit.create({
|
|
99
|
+
replacingMessageId: payloadBundle.content.originalMessageId,
|
|
100
|
+
text: MessageToProtoMapper_1.MessageToProtoMapper.mapText(payloadBundle),
|
|
101
|
+
});
|
|
102
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
103
|
+
[GenericMessageType_1.GenericMessageType.EDITED]: editedMessage,
|
|
104
|
+
messageId: payloadBundle.id,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function generateFileDataGenericMessage(payloadBundle, messageTimer) {
|
|
108
|
+
if (!payloadBundle.content) {
|
|
109
|
+
throw new Error('No content for sendFileData provided.');
|
|
110
|
+
}
|
|
111
|
+
const { asset, expectsReadConfirmation, legalHoldStatus } = payloadBundle.content;
|
|
112
|
+
const remoteData = protocol_messaging_1.Asset.RemoteData.create({
|
|
113
|
+
assetId: asset.key,
|
|
114
|
+
assetToken: asset.token,
|
|
115
|
+
otrKey: asset.keyBytes,
|
|
116
|
+
sha256: asset.sha256,
|
|
117
|
+
assetDomain: asset.domain,
|
|
118
|
+
});
|
|
119
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
120
|
+
expectsReadConfirmation,
|
|
121
|
+
legalHoldStatus,
|
|
122
|
+
uploaded: remoteData,
|
|
123
|
+
});
|
|
124
|
+
assetMessage.status = AssetTransferState_1.AssetTransferState.UPLOADED;
|
|
125
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
126
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
|
|
127
|
+
messageId: payloadBundle.id,
|
|
128
|
+
});
|
|
129
|
+
const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
|
|
130
|
+
return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
|
|
131
|
+
}
|
|
132
|
+
function generateFileMetaDataGenericMessage(payloadBundle, messageTimer) {
|
|
133
|
+
if (!payloadBundle.content) {
|
|
134
|
+
throw new Error('No content for sendFileMetaData provided.');
|
|
135
|
+
}
|
|
136
|
+
const { expectsReadConfirmation, legalHoldStatus, metaData } = payloadBundle.content;
|
|
137
|
+
const original = protocol_messaging_1.Asset.Original.create({
|
|
138
|
+
audio: metaData.audio,
|
|
139
|
+
mimeType: metaData.type,
|
|
140
|
+
name: metaData.name,
|
|
141
|
+
size: metaData.length,
|
|
142
|
+
video: metaData.video,
|
|
143
|
+
image: metaData.image,
|
|
144
|
+
});
|
|
145
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
146
|
+
expectsReadConfirmation,
|
|
147
|
+
legalHoldStatus,
|
|
148
|
+
original,
|
|
149
|
+
});
|
|
150
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
151
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
|
|
152
|
+
messageId: payloadBundle.id,
|
|
153
|
+
});
|
|
154
|
+
const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
|
|
155
|
+
return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
|
|
156
|
+
}
|
|
157
|
+
function generateFileAbortGenericMessage(payloadBundle, messageTimer) {
|
|
158
|
+
if (!payloadBundle.content) {
|
|
159
|
+
throw new Error('No content for sendFileAbort provided.');
|
|
160
|
+
}
|
|
161
|
+
const { expectsReadConfirmation, legalHoldStatus, reason } = payloadBundle.content;
|
|
162
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
163
|
+
expectsReadConfirmation,
|
|
164
|
+
legalHoldStatus,
|
|
165
|
+
notUploaded: reason,
|
|
166
|
+
});
|
|
167
|
+
assetMessage.status = AssetTransferState_1.AssetTransferState.NOT_UPLOADED;
|
|
168
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
169
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
|
|
170
|
+
messageId: payloadBundle.id,
|
|
171
|
+
});
|
|
172
|
+
const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
|
|
173
|
+
return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
|
|
174
|
+
}
|
|
175
|
+
function generateImageGenericMessage(payloadBundle, messageTimer) {
|
|
176
|
+
const imageAsset = generateAsset(payloadBundle);
|
|
177
|
+
let genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
178
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: imageAsset,
|
|
179
|
+
messageId: payloadBundle.id,
|
|
180
|
+
});
|
|
181
|
+
const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
|
|
182
|
+
if (expireAfterMillis) {
|
|
183
|
+
genericMessage = createEphemeral(genericMessage, expireAfterMillis);
|
|
184
|
+
}
|
|
185
|
+
return { genericMessage, content: imageAsset };
|
|
186
|
+
}
|
|
187
|
+
function generateLocationGenericMessage(payloadBundle, messageTimer) {
|
|
188
|
+
const { expectsReadConfirmation, latitude, legalHoldStatus, longitude, name, zoom } = payloadBundle.content;
|
|
189
|
+
const locationMessage = protocol_messaging_1.Location.create({
|
|
190
|
+
expectsReadConfirmation,
|
|
191
|
+
latitude,
|
|
192
|
+
legalHoldStatus,
|
|
193
|
+
longitude,
|
|
194
|
+
name,
|
|
195
|
+
zoom,
|
|
196
|
+
});
|
|
197
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
198
|
+
[GenericMessageType_1.GenericMessageType.LOCATION]: locationMessage,
|
|
199
|
+
messageId: payloadBundle.id,
|
|
200
|
+
});
|
|
201
|
+
const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
|
|
202
|
+
return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
|
|
203
|
+
}
|
|
204
|
+
function generatePingGenericMessage(payloadBundle, messageTimer) {
|
|
205
|
+
const content = protocol_messaging_1.Knock.create(payloadBundle.content);
|
|
206
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
207
|
+
[GenericMessageType_1.GenericMessageType.KNOCK]: content,
|
|
208
|
+
messageId: payloadBundle.id,
|
|
209
|
+
});
|
|
210
|
+
const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
|
|
211
|
+
return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
|
|
212
|
+
}
|
|
213
|
+
function generateReactionGenericMessage(payloadBundle) {
|
|
214
|
+
const { legalHoldStatus, originalMessageId, type } = payloadBundle.content;
|
|
215
|
+
const reaction = protocol_messaging_1.Reaction.create({
|
|
216
|
+
emoji: type,
|
|
217
|
+
legalHoldStatus,
|
|
218
|
+
messageId: originalMessageId,
|
|
219
|
+
});
|
|
220
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
221
|
+
[GenericMessageType_1.GenericMessageType.REACTION]: reaction,
|
|
222
|
+
messageId: payloadBundle.id,
|
|
223
|
+
});
|
|
224
|
+
return genericMessage;
|
|
225
|
+
}
|
|
226
|
+
function generateSessionResetGenericMessage(payload) {
|
|
227
|
+
if (payload.content.clientAction !== protocol_messaging_1.ClientAction.RESET_SESSION) {
|
|
228
|
+
throw new Error(`No send method implemented for "${payload.type}" and ClientAction "${payload.content}".`);
|
|
229
|
+
}
|
|
230
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
231
|
+
[GenericMessageType_1.GenericMessageType.CLIENT_ACTION]: protocol_messaging_1.ClientAction.RESET_SESSION,
|
|
232
|
+
messageId: payload.id,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function generateCallGenericMessage(payloadBundle) {
|
|
236
|
+
const callMessage = protocol_messaging_1.Calling.create({
|
|
237
|
+
content: payloadBundle.content,
|
|
238
|
+
});
|
|
239
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
240
|
+
[GenericMessageType_1.GenericMessageType.CALLING]: callMessage,
|
|
241
|
+
messageId: payloadBundle.id,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function generateDeleteMessage(payload) {
|
|
245
|
+
const content = protocol_messaging_1.MessageDelete.create({
|
|
246
|
+
messageId: payload.content.messageId,
|
|
247
|
+
});
|
|
248
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
249
|
+
[GenericMessageType_1.GenericMessageType.DELETED]: content,
|
|
250
|
+
messageId: payload.id,
|
|
251
|
+
});
|
|
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
|
+
}
|
|
263
|
+
function generateTextGenericMessage(payloadBundle, messageTimer) {
|
|
264
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
265
|
+
messageId: payloadBundle.id,
|
|
266
|
+
[GenericMessageType_1.GenericMessageType.TEXT]: MessageToProtoMapper_1.MessageToProtoMapper.mapText(payloadBundle),
|
|
267
|
+
});
|
|
268
|
+
const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
|
|
269
|
+
return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
|
|
270
|
+
}
|
|
271
|
+
function generateAsset(payloadBundle) {
|
|
272
|
+
if (!payloadBundle.content) {
|
|
273
|
+
throw new Error('No content for sendImage provided.');
|
|
274
|
+
}
|
|
275
|
+
const { asset, expectsReadConfirmation, image, legalHoldStatus } = payloadBundle.content;
|
|
276
|
+
const imageMetadata = protocol_messaging_1.Asset.ImageMetaData.create({
|
|
277
|
+
height: image.height,
|
|
278
|
+
width: image.width,
|
|
279
|
+
});
|
|
280
|
+
const original = protocol_messaging_1.Asset.Original.create({
|
|
281
|
+
[GenericMessageType_1.GenericMessageType.IMAGE]: imageMetadata,
|
|
282
|
+
mimeType: image.type,
|
|
283
|
+
name: null,
|
|
284
|
+
size: image.data.length,
|
|
285
|
+
});
|
|
286
|
+
const remoteData = protocol_messaging_1.Asset.RemoteData.create({
|
|
287
|
+
assetId: asset.key,
|
|
288
|
+
assetToken: asset.token,
|
|
289
|
+
assetDomain: asset.domain,
|
|
290
|
+
otrKey: asset.keyBytes,
|
|
291
|
+
sha256: asset.sha256,
|
|
292
|
+
});
|
|
293
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
294
|
+
expectsReadConfirmation,
|
|
295
|
+
legalHoldStatus,
|
|
296
|
+
original,
|
|
297
|
+
uploaded: remoteData,
|
|
298
|
+
});
|
|
299
|
+
assetMessage.status = AssetTransferState_1.AssetTransferState.UPLOADED;
|
|
300
|
+
return assetMessage;
|
|
301
|
+
}
|
|
302
|
+
function createEphemeral(originalGenericMessage, expireAfterMillis) {
|
|
303
|
+
const ephemeralMessage = protocol_messaging_1.Ephemeral.create({
|
|
304
|
+
expireAfterMillis,
|
|
305
|
+
[originalGenericMessage.content]: originalGenericMessage[originalGenericMessage.content],
|
|
306
|
+
});
|
|
307
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
308
|
+
[GenericMessageType_1.GenericMessageType.EPHEMERAL]: ephemeralMessage,
|
|
309
|
+
messageId: originalGenericMessage.messageId,
|
|
310
|
+
});
|
|
311
|
+
return genericMessage;
|
|
312
|
+
}
|
|
313
|
+
//# sourceMappingURL=messageGenerator.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Text } from '@wireapp/protocol-messaging';
|
|
2
2
|
import { LegalHoldStatus } from '../content';
|
|
3
|
-
import
|
|
3
|
+
import { CompositeMessage } from './OtrMessage';
|
|
4
4
|
export declare class CompositeContentBuilder {
|
|
5
5
|
private readonly content;
|
|
6
6
|
private readonly payloadBundle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { OtrMessage } from './OtrMessage';
|
|
2
|
+
import { TeamMessage } from './TeamMessage';
|
|
3
|
+
import { UserMessage } from './UserMessage';
|
|
4
4
|
export declare type Message = OtrMessage | TeamMessage | UserMessage;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { Confirmation } from '@wireapp/protocol-messaging';
|
|
2
2
|
import { AbortReason } from '..';
|
|
3
3
|
import { EncryptedAssetUploaded } from '../../cryptography';
|
|
4
|
-
import
|
|
4
|
+
import { ButtonActionConfirmationContent, ButtonActionContent, CallingContent, FileContent, FileMetaDataContent, ImageContent, KnockContent, LegalHoldStatus, LocationContent, ReactionContent } from '../content';
|
|
5
5
|
import { CompositeContentBuilder } from './CompositeContentBuilder';
|
|
6
|
-
import
|
|
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 CreateMessageDeleteOption extends BaseOptions {
|
|
14
|
+
messageIdToDelete: string;
|
|
15
|
+
}
|
|
16
|
+
interface CreateMessageHideOption extends BaseOptions {
|
|
17
|
+
messageIdToDelete: string;
|
|
18
|
+
targetConversation: string;
|
|
19
|
+
}
|
|
13
20
|
interface CreateImageOptions extends BaseOptions {
|
|
14
21
|
expectsReadConfirmation?: boolean;
|
|
15
22
|
asset: EncryptedAssetUploaded;
|
|
@@ -69,6 +76,8 @@ interface CreateActionMessageOptions extends BaseOptions {
|
|
|
69
76
|
export declare class MessageBuilder {
|
|
70
77
|
static createEditedText(payload: CreateEditedTextOptions): TextContentBuilder;
|
|
71
78
|
static createFileData(payload: CreateFileOptions): FileAssetMessage;
|
|
79
|
+
static createMessageDelete(payload: CreateMessageDeleteOption): DeleteMessage;
|
|
80
|
+
static createMessageHide(payload: CreateMessageHideOption): HideMessage;
|
|
72
81
|
static createFileMetadata(payload: CreateFileMetadataOptions): FileAssetMetaDataMessage;
|
|
73
82
|
static createFileAbort(payload: CreateFileAbortOptions): FileAssetAbortMessage;
|
|
74
83
|
static createImage(payload: CreateImageOptions): ImageAssetMessageOutgoing;
|
|
@@ -53,6 +53,12 @@ class MessageBuilder {
|
|
|
53
53
|
legalHoldStatus,
|
|
54
54
|
}, id: originalMessageId, type: __1.PayloadBundleType.ASSET });
|
|
55
55
|
}
|
|
56
|
+
static createMessageDelete(payload) {
|
|
57
|
+
return Object.assign(Object.assign({}, createCommonProperties(payload)), { content: { messageId: payload.messageIdToDelete }, type: __1.PayloadBundleType.MESSAGE_DELETE });
|
|
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
|
+
}
|
|
56
62
|
static createFileMetadata(payload) {
|
|
57
63
|
const { expectsReadConfirmation, legalHoldStatus, metaData } = payload;
|
|
58
64
|
return Object.assign(Object.assign({}, createCommonProperties(payload)), { content: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LinkPreview, Text } from '@wireapp/protocol-messaging';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { LinkPreviewUploadedContent } from '../content';
|
|
3
|
+
import { EditedTextMessage, TextMessage } from './OtrMessage';
|
|
4
4
|
export declare class MessageToProtoMapper {
|
|
5
5
|
static mapLinkPreviews(linkPreviews: LinkPreviewUploadedContent[]): LinkPreview[];
|
|
6
6
|
static mapText(payloadBundle: TextMessage | EditedTextMessage): Text;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { AssetContent, ButtonActionContent, ButtonActionConfirmationContent, CallingContent, ClearedContent, ClientActionContent, CompositeContent, ConfirmationContent, DeletedContent, EditedTextContent, FileAssetAbortContent, FileAssetContent, FileAssetMetaDataContent, HiddenContent, ImageAssetContent, KnockContent, LocationContent, ReactionContent, TextContent } from '../content';
|
|
2
|
+
import { BasePayloadBundle, PayloadBundleType } from './PayloadBundle';
|
|
3
3
|
export interface TextMessage extends BasePayloadBundle {
|
|
4
4
|
content: TextContent;
|
|
5
5
|
type: PayloadBundleType.TEXT;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ConversationEventData, TeamEventData, UserEventData } from '@wireapp/api-client/src/event/';
|
|
2
2
|
import { QualifiedId } from '@wireapp/api-client/src/user';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import { ConversationContent } from '../content';
|
|
4
|
+
import { Message } from './Message';
|
|
5
5
|
export declare type PayloadBundleContent = ConversationContent | ConversationEventData | TeamEventData | UserEventData;
|
|
6
6
|
export declare enum PayloadBundleSource {
|
|
7
7
|
LOCAL = "PayloadBundleSource.LOCAL",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { TeamConversationCreateData, TeamConversationDeleteData, TeamMemberJoinData, TeamMemberLeaveData, TeamUpdateData } from '@wireapp/api-client/src/team/data';
|
|
2
|
+
import { BasePayloadBundle, PayloadBundleType } from './PayloadBundle';
|
|
3
3
|
export interface TeamConversationCreateMessage extends BasePayloadBundle {
|
|
4
4
|
content: TeamConversationCreateData;
|
|
5
5
|
type: PayloadBundleType.TEAM_CONVERSATION_CREATE;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LegalHoldStatus, LinkPreviewUploadedContent, MentionContent, QuoteContent } from '../content';
|
|
2
|
-
import
|
|
2
|
+
import { EditedTextMessage, TextMessage, QuotableMessage } from './OtrMessage';
|
|
3
3
|
export declare class TextContentBuilder {
|
|
4
4
|
private readonly content;
|
|
5
5
|
private readonly payloadBundle;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { UserActivateData, UserClientAddData, UserClientRemoveData, UserConnectionData, UserDeleteData, UserLegalHoldDisableData, UserLegalHoldEnableData, UserLegalHoldRequestData, UserPropertiesSetData, UserUpdateData } from '@wireapp/api-client/src/user/data';
|
|
2
|
+
import { BasePayloadBundle, PayloadBundleType } from './PayloadBundle';
|
|
3
3
|
export interface UserActivateMessage extends BasePayloadBundle {
|
|
4
4
|
content: UserActivateData;
|
|
5
5
|
type: PayloadBundleType.USER_ACTIVATE;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { PreKey as SerializedPreKey } from '@wireapp/api-client/src/auth/';
|
|
3
|
+
import { RegisteredClient } from '@wireapp/api-client/src/client/';
|
|
4
|
+
import { OTRRecipients, QualifiedOTRRecipients, QualifiedUserClients, UserClients } from '@wireapp/api-client/src/conversation/';
|
|
5
|
+
import { ConversationOtrMessageAddEvent } from '@wireapp/api-client/src/event';
|
|
6
|
+
import { QualifiedId, QualifiedUserPreKeyBundleMap, UserPreKeyBundleMap } from '@wireapp/api-client/src/user/';
|
|
7
7
|
import { Cryptobox } from '@wireapp/cryptobox';
|
|
8
8
|
import { GenericMessage } from '@wireapp/protocol-messaging';
|
|
9
|
-
import
|
|
9
|
+
import { CRUDEngine } from '@wireapp/store-engine';
|
|
10
10
|
import { PayloadBundle, PayloadBundleSource } from '../conversation';
|
|
11
11
|
export declare type DecryptionError = {
|
|
12
12
|
code: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ConversationOtrMessageAddEvent } from '@wireapp/api-client/src/event/';
|
|
2
2
|
import { PayloadBundle, PayloadBundleSource } from '../conversation';
|
|
3
3
|
export declare class GenericMessageMapper {
|
|
4
4
|
private static readonly logger;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { GiphySearchOptions, GiphyMultipleResult, GiphyResult, GIPHY_RATING } from '@wireapp/api-client/src/giphy/';
|
|
3
3
|
export declare class GiphyService {
|
|
4
4
|
private readonly apiClient;
|
|
5
5
|
constructor(apiClient: APIClient);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AddProposalArgs, 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
|
-
import
|
|
4
|
+
import { MLSCallbacks, MLSConfig } from '../types';
|
|
5
5
|
import { PostMlsMessageResponse } from '@wireapp/api-client/src/conversation';
|
|
6
6
|
export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
|
|
7
7
|
export declare class MLSService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { Notification } from '@wireapp/api-client/src/notification/';
|
|
3
3
|
export declare class NotificationBackendRepository {
|
|
4
4
|
private readonly apiClient;
|
|
5
5
|
constructor(apiClient: APIClient);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { BackendEvent } from '@wireapp/api-client/src/event';
|
|
2
|
+
import { Notification } from '@wireapp/api-client/src/notification/';
|
|
3
|
+
import { CRUDEngine } from '@wireapp/store-engine';
|
|
4
4
|
import { CommonMLS, StorePendingProposalsParams } from './types';
|
|
5
5
|
export declare enum DatabaseStores {
|
|
6
6
|
EVENTS = "events"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
2
|
+
import { APIClient } from '@wireapp/api-client';
|
|
3
3
|
import * as Events from '@wireapp/api-client/src/event';
|
|
4
|
-
import
|
|
4
|
+
import { Notification } from '@wireapp/api-client/src/notification/';
|
|
5
5
|
import { CRUDEngine } from '@wireapp/store-engine';
|
|
6
6
|
import { EventEmitter } from 'events';
|
|
7
7
|
import { PayloadBundle, PayloadBundleSource } from '../conversation';
|
|
8
8
|
import { NotificationError } from '../CoreError';
|
|
9
|
-
import
|
|
9
|
+
import { CryptographyService } from '../cryptography';
|
|
10
10
|
import { GenericMessage } from '@wireapp/protocol-messaging';
|
|
11
11
|
import { AbortHandler } from '@wireapp/api-client/src/tcp';
|
|
12
12
|
import { CommitPendingProposalsParams, LastKeyMaterialUpdateParams } from './types';
|
|
13
|
-
import
|
|
13
|
+
import { MLSService } from '../mls';
|
|
14
14
|
export declare type HandledEventPayload = {
|
|
15
15
|
event: Events.BackendEvent;
|
|
16
16
|
mappedEvent?: PayloadBundle;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { Self } from '@wireapp/api-client/src/self/';
|
|
3
3
|
export declare class SelfService {
|
|
4
4
|
private readonly apiClient;
|
|
5
5
|
constructor(apiClient: APIClient);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { MemberData, Members, NewTeamData, TeamChunkData, TeamData, UpdateTeamData } from '@wireapp/api-client/src/team/';
|
|
3
3
|
export declare class TeamService {
|
|
4
4
|
private readonly apiClient;
|
|
5
5
|
constructor(apiClient: APIClient);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { keys } from '@wireapp/proteus';
|
|
2
|
-
import
|
|
2
|
+
import { CryptographyService } from '../cryptography';
|
|
3
3
|
export declare function createEncodedCipherText(receiver: keys.IdentityKeyPair, preKey: keys.PreKey, text: string): Promise<string>;
|
|
4
4
|
export declare function getPlainText(cryptographyService: CryptographyService, encodedPreKeyMessage: string, sessionId?: string): Promise<string | void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { QualifiedId, User } from '@wireapp/api-client/src/user/';
|
|
3
|
+
import { AvailabilityType, BroadcastService } from '../broadcast/';
|
|
4
4
|
import { ConnectionService } from '../connection';
|
|
5
5
|
import { ConversationService } from '../conversation';
|
|
6
6
|
export declare class UserService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { QualifiedUserClients, UserClients } from '@wireapp/api-client/src/conversation/';
|
|
2
|
+
import { QualifiedId } from '@wireapp/api-client/src/user/';
|
|
3
3
|
export declare function isStringArray(obj: any): obj is string[];
|
|
4
4
|
export declare function isQualifiedId(obj: any): obj is QualifiedId;
|
|
5
5
|
export declare function isQualifiedIdArray(obj: any): obj is QualifiedId[];
|