@wireapp/core 30.5.1 → 30.5.2
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 +8 -0
- package/package.json +3 -3
- package/src/main/Account.d.ts +0 -204
- package/src/main/Account.js +0 -439
- package/src/main/CoreError.d.ts +0 -9
- package/src/main/CoreError.js +0 -26
- package/src/main/account/AccountService.d.ts +0 -7
- package/src/main/account/AccountService.js +0 -33
- package/src/main/account/AccountService.js.map +0 -1
- package/src/main/account/index.d.ts +0 -1
- package/src/main/account/index.js +0 -32
- package/src/main/account/index.js.map +0 -1
- package/src/main/auth/LoginSanitizer.d.ts +0 -5
- package/src/main/auth/LoginSanitizer.js +0 -41
- package/src/main/auth/index.d.ts +0 -1
- package/src/main/auth/index.js +0 -32
- package/src/main/broadcast/AvailabilityType.d.ts +0 -2
- package/src/main/broadcast/AvailabilityType.js +0 -21
- package/src/main/broadcast/BroadcastService.d.ts +0 -24
- package/src/main/broadcast/BroadcastService.js +0 -74
- package/src/main/broadcast/index.d.ts +0 -2
- package/src/main/broadcast/index.js +0 -33
- package/src/main/client/ClientBackendRepository.d.ts +0 -11
- package/src/main/client/ClientBackendRepository.js +0 -43
- package/src/main/client/ClientDatabaseRepository.d.ts +0 -27
- package/src/main/client/ClientDatabaseRepository.js +0 -85
- package/src/main/client/ClientInfo.d.ts +0 -8
- package/src/main/client/ClientInfo.js +0 -21
- package/src/main/client/ClientService.d.ts +0 -48
- package/src/main/client/ClientService.js +0 -118
- package/src/main/client/index.d.ts +0 -4
- package/src/main/client/index.js +0 -35
- package/src/main/connection/ConnectionService.d.ts +0 -11
- package/src/main/connection/ConnectionService.js +0 -45
- package/src/main/connection/index.d.ts +0 -1
- package/src/main/connection/index.js +0 -32
- package/src/main/conversation/AbortReason.d.ts +0 -2
- package/src/main/conversation/AbortReason.js +0 -21
- package/src/main/conversation/AssetService/AssetService.d.ts +0 -62
- package/src/main/conversation/AssetService/AssetService.js +0 -88
- package/src/main/conversation/AssetService/index.d.ts +0 -1
- package/src/main/conversation/AssetService/index.js +0 -32
- package/src/main/conversation/AssetTransferState.d.ts +0 -4
- package/src/main/conversation/AssetTransferState.js +0 -27
- package/src/main/conversation/ClientActionType.d.ts +0 -1
- package/src/main/conversation/ClientActionType.js +0 -24
- package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +0 -6
- package/src/main/conversation/ConversationMapper/ConversationMapper.js +0 -57
- package/src/main/conversation/ConversationMapper/index.d.ts +0 -1
- package/src/main/conversation/ConversationMapper/index.js +0 -32
- package/src/main/conversation/ConversationService/ConversationService.d.ts +0 -162
- package/src/main/conversation/ConversationService/ConversationService.js +0 -900
- package/src/main/conversation/ConversationService/ConversationService.types.d.ts +0 -108
- package/src/main/conversation/ConversationService/ConversationService.types.js +0 -28
- package/src/main/conversation/ConversationService/index.d.ts +0 -2
- package/src/main/conversation/ConversationService/index.js +0 -33
- package/src/main/conversation/GenericMessageType.d.ts +0 -25
- package/src/main/conversation/GenericMessageType.js +0 -49
- package/src/main/conversation/MessageTimer/MessageTimer.d.ts +0 -10
- package/src/main/conversation/MessageTimer/MessageTimer.js +0 -54
- package/src/main/conversation/MessageTimer/index.d.ts +0 -1
- package/src/main/conversation/MessageTimer/index.js +0 -32
- package/src/main/conversation/ReactionType.d.ts +0 -4
- package/src/main/conversation/ReactionType.js +0 -27
- package/src/main/conversation/content/AssetContent.d.ts +0 -42
- package/src/main/conversation/content/AssetContent.js +0 -21
- package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +0 -2
- package/src/main/conversation/content/ButtonActionConfirmationContent.js +0 -21
- package/src/main/conversation/content/ButtonActionContent.d.ts +0 -2
- package/src/main/conversation/content/ButtonActionContent.js +0 -21
- package/src/main/conversation/content/CallingContent.d.ts +0 -1
- package/src/main/conversation/content/CallingContent.js +0 -21
- package/src/main/conversation/content/ClearedContent.d.ts +0 -2
- package/src/main/conversation/content/ClearedContent.js +0 -21
- package/src/main/conversation/content/ClientActionContent.d.ts +0 -2
- package/src/main/conversation/content/ClientActionContent.js +0 -21
- package/src/main/conversation/content/ClientAddContent.d.ts +0 -4
- package/src/main/conversation/content/ClientAddContent.js +0 -21
- package/src/main/conversation/content/ClientRemoveContent.d.ts +0 -6
- package/src/main/conversation/content/ClientRemoveContent.js +0 -21
- package/src/main/conversation/content/CompositeContent.d.ts +0 -2
- package/src/main/conversation/content/CompositeContent.js +0 -21
- package/src/main/conversation/content/ConfirmationContent.d.ts +0 -2
- package/src/main/conversation/content/ConfirmationContent.js +0 -21
- package/src/main/conversation/content/ContentType.d.ts +0 -21
- package/src/main/conversation/content/ContentType.js +0 -94
- package/src/main/conversation/content/ConversationContent.d.ts +0 -3
- package/src/main/conversation/content/ConversationContent.js +0 -21
- package/src/main/conversation/content/DeletedContent.d.ts +0 -2
- package/src/main/conversation/content/DeletedContent.js +0 -21
- package/src/main/conversation/content/EditedTextContent.d.ts +0 -11
- package/src/main/conversation/content/EditedTextContent.js +0 -21
- package/src/main/conversation/content/FileContent.d.ts +0 -13
- package/src/main/conversation/content/FileContent.js +0 -21
- package/src/main/conversation/content/HiddenContent.d.ts +0 -2
- package/src/main/conversation/content/HiddenContent.js +0 -21
- package/src/main/conversation/content/ImageContent.d.ts +0 -7
- package/src/main/conversation/content/ImageContent.js +0 -21
- package/src/main/conversation/content/KnockContent.d.ts +0 -2
- package/src/main/conversation/content/KnockContent.js +0 -21
- package/src/main/conversation/content/LinkPreviewContent.d.ts +0 -10
- package/src/main/conversation/content/LinkPreviewContent.js +0 -21
- package/src/main/conversation/content/LocationContent.d.ts +0 -9
- package/src/main/conversation/content/LocationContent.js +0 -21
- package/src/main/conversation/content/MentionContent.d.ts +0 -2
- package/src/main/conversation/content/MentionContent.js +0 -21
- package/src/main/conversation/content/QuoteContent.d.ts +0 -7
- package/src/main/conversation/content/QuoteContent.js +0 -21
- package/src/main/conversation/content/ReactionContent.d.ts +0 -7
- package/src/main/conversation/content/ReactionContent.js +0 -21
- package/src/main/conversation/content/TextContent.d.ts +0 -9
- package/src/main/conversation/content/TextContent.js +0 -21
- package/src/main/conversation/content/TweetContent.d.ts +0 -2
- package/src/main/conversation/content/TweetContent.js +0 -21
- package/src/main/conversation/content/index.d.ts +0 -28
- package/src/main/conversation/content/index.js +0 -72
- package/src/main/conversation/index.d.ts +0 -9
- package/src/main/conversation/index.js +0 -40
- package/src/main/conversation/message/CompositeContentBuilder.d.ts +0 -14
- package/src/main/conversation/message/CompositeContentBuilder.js +0 -54
- package/src/main/conversation/message/Message.d.ts +0 -4
- package/src/main/conversation/message/Message.js +0 -21
- package/src/main/conversation/message/MessageBuilder.d.ts +0 -87
- package/src/main/conversation/message/MessageBuilder.js +0 -119
- package/src/main/conversation/message/MessageService.d.ts +0 -67
- package/src/main/conversation/message/MessageService.js +0 -293
- package/src/main/conversation/message/MessageToProtoMapper.d.ts +0 -7
- package/src/main/conversation/message/MessageToProtoMapper.js +0 -99
- package/src/main/conversation/message/OtrMessage.d.ts +0 -80
- package/src/main/conversation/message/OtrMessage.js +0 -21
- package/src/main/conversation/message/PayloadBundle.d.ts +0 -76
- package/src/main/conversation/message/PayloadBundle.js +0 -81
- package/src/main/conversation/message/TeamMessage.d.ts +0 -31
- package/src/main/conversation/message/TeamMessage.js +0 -21
- package/src/main/conversation/message/TextContentBuilder.d.ts +0 -13
- package/src/main/conversation/message/TextContentBuilder.js +0 -75
- package/src/main/conversation/message/UserClientsUtil.d.ts +0 -22
- package/src/main/conversation/message/UserClientsUtil.js +0 -38
- package/src/main/conversation/message/UserMessage.d.ts +0 -43
- package/src/main/conversation/message/UserMessage.js +0 -21
- package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +0 -11
- package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +0 -21
- package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +0 -2
- package/src/main/cryptography/AssetCryptography/crypto.browser.js +0 -46
- package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +0 -2
- package/src/main/cryptography/AssetCryptography/crypto.node.js +0 -68
- package/src/main/cryptography/AssetCryptography/index.d.ts +0 -8
- package/src/main/cryptography/AssetCryptography/index.js +0 -53
- package/src/main/cryptography/AssetCryptography/interfaces.d.ts +0 -9
- package/src/main/cryptography/AssetCryptography/interfaces.js +0 -21
- package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +0 -17
- package/src/main/cryptography/CryptographyDatabaseRepository.js +0 -45
- package/src/main/cryptography/CryptographyService.d.ts +0 -52
- package/src/main/cryptography/CryptographyService.js +0 -205
- package/src/main/cryptography/GenericMessageMapper.d.ts +0 -6
- package/src/main/cryptography/GenericMessageMapper.js +0 -160
- package/src/main/cryptography/MessageHashService.d.ts +0 -16
- package/src/main/cryptography/MessageHashService.js +0 -114
- package/src/main/cryptography/SessionPayloadBundle.d.ts +0 -4
- package/src/main/cryptography/SessionPayloadBundle.js +0 -21
- package/src/main/cryptography/index.d.ts +0 -4
- package/src/main/cryptography/index.js +0 -35
- package/src/main/giphy/GiphyService.d.ts +0 -9
- package/src/main/giphy/GiphyService.js +0 -37
- package/src/main/giphy/index.d.ts +0 -1
- package/src/main/giphy/index.js +0 -32
- package/src/main/index.d.ts +0 -17
- package/src/main/index.js +0 -55
- package/src/main/linkPreview/LinkPreviewService.d.ts +0 -7
- package/src/main/linkPreview/LinkPreviewService.js +0 -52
- package/src/main/linkPreview/index.d.ts +0 -1
- package/src/main/linkPreview/index.js +0 -32
- package/src/main/mls/MLSService/MLSService.d.ts +0 -26
- package/src/main/mls/MLSService/MLSService.js +0 -131
- package/src/main/mls/index.d.ts +0 -1
- package/src/main/mls/index.js +0 -32
- package/src/main/mls/types.d.ts +0 -22
- package/src/main/mls/types.js +0 -21
- package/src/main/notification/NotificationBackendRepository.d.ts +0 -11
- package/src/main/notification/NotificationBackendRepository.js +0 -34
- package/src/main/notification/NotificationDatabaseRepository.d.ts +0 -66
- package/src/main/notification/NotificationDatabaseRepository.js +0 -136
- package/src/main/notification/NotificationService.d.ts +0 -131
- package/src/main/notification/NotificationService.js +0 -468
- package/src/main/notification/index.d.ts +0 -1
- package/src/main/notification/index.js +0 -32
- package/src/main/notification/types.d.ts +0 -20
- package/src/main/notification/types.js +0 -21
- package/src/main/self/SelfService.d.ts +0 -13
- package/src/main/self/SelfService.js +0 -55
- package/src/main/self/index.d.ts +0 -1
- package/src/main/self/index.js +0 -32
- package/src/main/team/TeamService.d.ts +0 -15
- package/src/main/team/TeamService.js +0 -55
- package/src/main/team/index.d.ts +0 -1
- package/src/main/team/index.js +0 -32
- package/src/main/test/CryptographyHelper.d.ts +0 -4
- package/src/main/test/CryptographyHelper.js +0 -65
- package/src/main/test/PayloadHelper.d.ts +0 -3
- package/src/main/test/PayloadHelper.js +0 -66
- package/src/main/user/UserMapper.d.ts +0 -5
- package/src/main/user/UserMapper.js +0 -88
- package/src/main/user/UserService.d.ts +0 -25
- package/src/main/user/UserService.js +0 -81
- package/src/main/user/index.d.ts +0 -1
- package/src/main/user/index.js +0 -32
- package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts +0 -21
- package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +0 -62
- package/src/main/util/TaskScheduler/TaskScheduler.d.ts +0 -10
- package/src/main/util/TaskScheduler/TaskScheduler.js +0 -70
- package/src/main/util/TypePredicateUtil.d.ts +0 -7
- package/src/main/util/TypePredicateUtil.js +0 -55
- package/src/main/util/encryptedStore.d.ts +0 -45
- package/src/main/util/encryptedStore.js +0 -116
- package/src/main/util/index.d.ts +0 -1
- package/src/main/util/index.js +0 -32
- package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.d.ts +0 -8
- package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.js +0 -32
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2020 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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.MessageService = void 0;
|
|
25
|
-
const http_status_codes_1 = require("http-status-codes");
|
|
26
|
-
const otr_1 = require("@wireapp/protocol-messaging/web/otr");
|
|
27
|
-
const long_1 = __importDefault(require("long"));
|
|
28
|
-
const StringUtil_1 = require("@wireapp/commons/src/main/util/StringUtil");
|
|
29
|
-
const bazinga64_1 = require("bazinga64");
|
|
30
|
-
const AssetCryptography_1 = require("../../cryptography/AssetCryptography");
|
|
31
|
-
const cryptography_1 = require("../../cryptography");
|
|
32
|
-
const MessageBuilder_1 = require("./MessageBuilder");
|
|
33
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
34
|
-
const __1 = require("..");
|
|
35
|
-
const UserClientsUtil_1 = require("./UserClientsUtil");
|
|
36
|
-
const util_1 = require("../../util");
|
|
37
|
-
class MessageService {
|
|
38
|
-
constructor(apiClient, cryptographyService) {
|
|
39
|
-
this.apiClient = apiClient;
|
|
40
|
-
this.cryptographyService = cryptographyService;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Sends a message to a non-federated backend.
|
|
44
|
-
*
|
|
45
|
-
* @param sendingClientId The clientId of the current user
|
|
46
|
-
* @param recipients The list of recipients to send the message to
|
|
47
|
-
* @param plainText The plainText data to send
|
|
48
|
-
* @param options.conversationId? the conversation to send the message to. Will broadcast if not set
|
|
49
|
-
* @param options.reportMissing? trigger a mismatch error when there are missing recipients in the payload
|
|
50
|
-
* @param options.sendAsProtobuf?
|
|
51
|
-
* @param options.onClientMismatch? Called when a mismatch happens on the server
|
|
52
|
-
* @return the ClientMismatch status returned by the backend
|
|
53
|
-
*/
|
|
54
|
-
async sendMessage(sendingClientId, recipients, plainText, options = {}) {
|
|
55
|
-
let plainTextPayload = plainText;
|
|
56
|
-
let cipherText;
|
|
57
|
-
if (this.shouldSendAsExternal(plainText, recipients)) {
|
|
58
|
-
const externalPayload = await this.generateExternalPayload(plainText);
|
|
59
|
-
plainTextPayload = externalPayload.text;
|
|
60
|
-
cipherText = externalPayload.cipherText;
|
|
61
|
-
}
|
|
62
|
-
const { encrypted, missing } = await this.cryptographyService.encrypt(plainTextPayload, recipients);
|
|
63
|
-
const encryptedPayload = Object.keys(missing).length
|
|
64
|
-
? await this.reencryptAfterMismatch({ missing, deleted: {} }, encrypted, plainText)
|
|
65
|
-
: encrypted;
|
|
66
|
-
const send = (payload) => {
|
|
67
|
-
return options.sendAsProtobuf
|
|
68
|
-
? this.sendOTRProtobufMessage(sendingClientId, payload, Object.assign(Object.assign({}, options), { assetData: cipherText }))
|
|
69
|
-
: this.sendOTRMessage(sendingClientId, payload, Object.assign(Object.assign({}, options), { assetData: cipherText }));
|
|
70
|
-
};
|
|
71
|
-
try {
|
|
72
|
-
return await send(encryptedPayload);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
if (!this.isClientMismatchError(error)) {
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
const mismatch = error.response.data;
|
|
79
|
-
const shouldStopSending = options.onClientMismatch && (await options.onClientMismatch(mismatch)) === false;
|
|
80
|
-
if (shouldStopSending) {
|
|
81
|
-
return Object.assign(Object.assign({}, mismatch), { errored: true });
|
|
82
|
-
}
|
|
83
|
-
const reEncryptedMessage = await this.reencryptAfterMismatch(mismatch, encryptedPayload, plainText);
|
|
84
|
-
return send(reEncryptedMessage);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Sends a message to a federated backend.
|
|
89
|
-
*
|
|
90
|
-
* @param sendingClientId The clientId of the current user
|
|
91
|
-
* @param recipients The list of recipients to send the message to
|
|
92
|
-
* @param plainText The plainText data to send
|
|
93
|
-
* @param options.conversationId? the conversation to send the message to. Will broadcast if not set
|
|
94
|
-
* @param options.reportMissing? trigger a mismatch error when there are missing recipients in the payload
|
|
95
|
-
* @param options.sendAsProtobuf?
|
|
96
|
-
* @param options.onClientMismatch? Called when a mismatch happens on the server
|
|
97
|
-
* @return the MessageSendingStatus returned by the backend
|
|
98
|
-
*/
|
|
99
|
-
async sendFederatedMessage(sendingClientId, recipients, plainText, options) {
|
|
100
|
-
const send = (payload) => {
|
|
101
|
-
return this.sendFederatedOtrMessage(sendingClientId, payload, options);
|
|
102
|
-
};
|
|
103
|
-
const { encrypted, missing } = await this.cryptographyService.encryptQualified(plainText, recipients);
|
|
104
|
-
const encryptedPayload = Object.keys(missing).length
|
|
105
|
-
? await this.reencryptAfterFederatedMismatch({ missing, deleted: {} }, encrypted, plainText)
|
|
106
|
-
: encrypted;
|
|
107
|
-
try {
|
|
108
|
-
return await send(encryptedPayload);
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
if (!this.isClientMismatchError(error)) {
|
|
112
|
-
throw error;
|
|
113
|
-
}
|
|
114
|
-
const mismatch = error.response.data;
|
|
115
|
-
const shouldStopSending = options.onClientMismatch && (await options.onClientMismatch(mismatch)) === false;
|
|
116
|
-
if (shouldStopSending) {
|
|
117
|
-
return Object.assign(Object.assign({}, mismatch), { errored: true });
|
|
118
|
-
}
|
|
119
|
-
const reEncryptedPayload = await this.reencryptAfterFederatedMismatch(mismatch, encryptedPayload, plainText);
|
|
120
|
-
return send(reEncryptedPayload);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
async sendFederatedOtrMessage(sendingClientId, recipients, options) {
|
|
124
|
-
const qualifiedUserEntries = Object.entries(recipients).map(([domain, otrRecipients]) => {
|
|
125
|
-
const userEntries = Object.entries(otrRecipients).map(([userId, otrClientMap]) => {
|
|
126
|
-
const clientEntries = Object.entries(otrClientMap).map(([clientId, payload]) => {
|
|
127
|
-
return {
|
|
128
|
-
client: {
|
|
129
|
-
client: long_1.default.fromString(clientId, 16),
|
|
130
|
-
},
|
|
131
|
-
text: payload,
|
|
132
|
-
};
|
|
133
|
-
});
|
|
134
|
-
return {
|
|
135
|
-
user: {
|
|
136
|
-
uuid: (0, StringUtil_1.uuidToBytes)(userId),
|
|
137
|
-
},
|
|
138
|
-
clients: clientEntries,
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
return { domain, entries: userEntries };
|
|
142
|
-
});
|
|
143
|
-
const protoMessage = otr_1.proteus.QualifiedNewOtrMessage.create({
|
|
144
|
-
recipients: qualifiedUserEntries,
|
|
145
|
-
sender: {
|
|
146
|
-
client: long_1.default.fromString(sendingClientId, 16),
|
|
147
|
-
},
|
|
148
|
-
nativePush: options.nativePush,
|
|
149
|
-
});
|
|
150
|
-
if (options.assetData) {
|
|
151
|
-
protoMessage.blob = options.assetData;
|
|
152
|
-
}
|
|
153
|
-
if (options.reportMissing) {
|
|
154
|
-
if ((0, util_1.isQualifiedIdArray)(options.reportMissing)) {
|
|
155
|
-
protoMessage.reportOnly = { userIds: options.reportMissing };
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
protoMessage.reportAll = true;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
protoMessage.ignoreAll = true;
|
|
163
|
-
}
|
|
164
|
-
if (!options.conversationId) {
|
|
165
|
-
return this.apiClient.api.broadcast.postBroadcastFederatedMessage(sendingClientId, protoMessage);
|
|
166
|
-
}
|
|
167
|
-
const { id, domain } = options.conversationId;
|
|
168
|
-
return this.apiClient.api.conversation.postOTRMessageV2(id, domain, protoMessage);
|
|
169
|
-
}
|
|
170
|
-
async sendOTRMessage(sendingClientId, recipients, options) {
|
|
171
|
-
const message = {
|
|
172
|
-
data: options.assetData ? bazinga64_1.Encoder.toBase64(options.assetData).asString : undefined,
|
|
173
|
-
recipients: cryptography_1.CryptographyService.convertArrayRecipientsToBase64(recipients),
|
|
174
|
-
sender: sendingClientId,
|
|
175
|
-
native_push: options.nativePush,
|
|
176
|
-
};
|
|
177
|
-
let ignoreMissing;
|
|
178
|
-
if ((0, util_1.isStringArray)(options.reportMissing)) {
|
|
179
|
-
message.report_missing = options.reportMissing;
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
// By default we want ignore missing to be false (and have mismatch errors in case some clients are missing)
|
|
183
|
-
ignoreMissing = typeof options.reportMissing === 'boolean' ? !options.reportMissing : false;
|
|
184
|
-
}
|
|
185
|
-
return !options.conversationId
|
|
186
|
-
? this.apiClient.api.broadcast.postBroadcastMessage(sendingClientId, message, ignoreMissing)
|
|
187
|
-
: this.apiClient.api.conversation.postOTRMessage(sendingClientId, options.conversationId, message, ignoreMissing);
|
|
188
|
-
}
|
|
189
|
-
async generateExternalPayload(plainText) {
|
|
190
|
-
const asset = await (0, AssetCryptography_1.encryptAsset)({ plainText });
|
|
191
|
-
const { cipherText, keyBytes, sha256 } = asset;
|
|
192
|
-
const messageId = MessageBuilder_1.MessageBuilder.createId();
|
|
193
|
-
const externalMessage = {
|
|
194
|
-
otrKey: new Uint8Array(keyBytes),
|
|
195
|
-
sha256: new Uint8Array(sha256),
|
|
196
|
-
};
|
|
197
|
-
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
198
|
-
[__1.GenericMessageType.EXTERNAL]: externalMessage,
|
|
199
|
-
messageId,
|
|
200
|
-
});
|
|
201
|
-
return { text: protocol_messaging_1.GenericMessage.encode(genericMessage).finish(), cipherText };
|
|
202
|
-
}
|
|
203
|
-
shouldSendAsExternal(plainText, preKeyBundles) {
|
|
204
|
-
const EXTERNAL_MESSAGE_THRESHOLD_BYTES = 200 * 1024;
|
|
205
|
-
let clientCount = 0;
|
|
206
|
-
for (const user in preKeyBundles) {
|
|
207
|
-
clientCount += Object.keys(preKeyBundles[user]).length;
|
|
208
|
-
}
|
|
209
|
-
const messageInBytes = new Uint8Array(plainText).length;
|
|
210
|
-
const estimatedPayloadInBytes = clientCount * messageInBytes;
|
|
211
|
-
return estimatedPayloadInBytes > EXTERNAL_MESSAGE_THRESHOLD_BYTES;
|
|
212
|
-
}
|
|
213
|
-
isClientMismatchError(error) {
|
|
214
|
-
var _a;
|
|
215
|
-
return ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === http_status_codes_1.StatusCodes.PRECONDITION_FAILED;
|
|
216
|
-
}
|
|
217
|
-
async reencryptAfterMismatch(mismatch, recipients, plainText) {
|
|
218
|
-
const deleted = (0, UserClientsUtil_1.flattenUserClients)(mismatch.deleted);
|
|
219
|
-
const missing = (0, UserClientsUtil_1.flattenUserClients)(mismatch.missing);
|
|
220
|
-
// remove deleted clients to the recipients
|
|
221
|
-
deleted.forEach(({ userId, data }) => data.forEach(clientId => delete recipients[userId.id][clientId]));
|
|
222
|
-
if (missing.length) {
|
|
223
|
-
const missingPreKeyBundles = await this.apiClient.api.user.postMultiPreKeyBundles(mismatch.missing);
|
|
224
|
-
const { encrypted } = await this.cryptographyService.encrypt(plainText, missingPreKeyBundles);
|
|
225
|
-
const reEncryptedPayloads = (0, UserClientsUtil_1.flattenUserClients)(encrypted);
|
|
226
|
-
// add missing clients to the recipients
|
|
227
|
-
reEncryptedPayloads.forEach(({ data, userId }) => (recipients[userId.id] = Object.assign(Object.assign({}, recipients[userId.id]), data)));
|
|
228
|
-
}
|
|
229
|
-
return recipients;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Will re-encrypt a message when there were some missing clients in the initial send (typically when the server replies with a client mismatch error)
|
|
233
|
-
*
|
|
234
|
-
* @param {ProtobufOTR.QualifiedNewOtrMessage} messageData The initial message that was sent
|
|
235
|
-
* @param {MessageSendingStatus} messageSendingStatus Info about the missing/deleted clients
|
|
236
|
-
* @param {Uint8Array} plainText The text that should be encrypted for the missing clients
|
|
237
|
-
* @return resolves with a new message payload that can be sent
|
|
238
|
-
*/
|
|
239
|
-
async reencryptAfterFederatedMismatch(mismatch, recipients, plainText) {
|
|
240
|
-
const deleted = (0, UserClientsUtil_1.flattenQualifiedUserClients)(mismatch.deleted);
|
|
241
|
-
const missing = (0, UserClientsUtil_1.flattenQualifiedUserClients)(mismatch.missing);
|
|
242
|
-
// remove deleted clients to the recipients
|
|
243
|
-
deleted.forEach(({ userId, data }) => data.forEach(clientId => delete recipients[userId.domain][userId.id][clientId]));
|
|
244
|
-
if (Object.keys(missing).length) {
|
|
245
|
-
const missingPreKeyBundles = await this.apiClient.api.user.postQualifiedMultiPreKeyBundles(mismatch.missing);
|
|
246
|
-
const { encrypted } = await this.cryptographyService.encryptQualified(plainText, missingPreKeyBundles);
|
|
247
|
-
const reEncryptedPayloads = (0, UserClientsUtil_1.flattenQualifiedUserClients)(encrypted);
|
|
248
|
-
reEncryptedPayloads.forEach(({ data, userId }) => (recipients[userId.domain][userId.id] = Object.assign(Object.assign({}, recipients[userId.domain][userId.id]), data)));
|
|
249
|
-
}
|
|
250
|
-
return recipients;
|
|
251
|
-
}
|
|
252
|
-
async sendOTRProtobufMessage(sendingClientId, recipients, options) {
|
|
253
|
-
const userEntries = Object.entries(recipients).map(([userId, otrClientMap]) => {
|
|
254
|
-
const clients = Object.entries(otrClientMap).map(([clientId, payload]) => {
|
|
255
|
-
return {
|
|
256
|
-
client: {
|
|
257
|
-
client: long_1.default.fromString(clientId, 16),
|
|
258
|
-
},
|
|
259
|
-
text: payload,
|
|
260
|
-
};
|
|
261
|
-
});
|
|
262
|
-
return {
|
|
263
|
-
clients,
|
|
264
|
-
user: {
|
|
265
|
-
uuid: (0, StringUtil_1.uuidToBytes)(userId),
|
|
266
|
-
},
|
|
267
|
-
};
|
|
268
|
-
});
|
|
269
|
-
const protoMessage = otr_1.proteus.NewOtrMessage.create({
|
|
270
|
-
recipients: userEntries,
|
|
271
|
-
sender: {
|
|
272
|
-
client: long_1.default.fromString(sendingClientId, 16),
|
|
273
|
-
},
|
|
274
|
-
});
|
|
275
|
-
let ignoreMissing;
|
|
276
|
-
if ((0, util_1.isStringArray)(options.reportMissing)) {
|
|
277
|
-
const encoder = new TextEncoder();
|
|
278
|
-
protoMessage.reportMissing = options.reportMissing.map(userId => ({ uuid: encoder.encode(userId) }));
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
// By default we want ignore missing to be false (and have mismatch errors in case some clients are missing)
|
|
282
|
-
ignoreMissing = typeof options.reportMissing === 'boolean' ? !options.reportMissing : false;
|
|
283
|
-
}
|
|
284
|
-
if (options.assetData) {
|
|
285
|
-
protoMessage.blob = options.assetData;
|
|
286
|
-
}
|
|
287
|
-
return !options.conversationId
|
|
288
|
-
? this.apiClient.api.broadcast.postBroadcastProtobufMessage(sendingClientId, protoMessage, ignoreMissing)
|
|
289
|
-
: this.apiClient.api.conversation.postOTRProtobufMessage(sendingClientId, options.conversationId, protoMessage, ignoreMissing);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
exports.MessageService = MessageService;
|
|
293
|
-
//# sourceMappingURL=MessageService.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { LinkPreview, Text } from '@wireapp/protocol-messaging';
|
|
2
|
-
import type { LinkPreviewUploadedContent } from '../content';
|
|
3
|
-
import type { EditedTextMessage, TextMessage } from './OtrMessage';
|
|
4
|
-
export declare class MessageToProtoMapper {
|
|
5
|
-
static mapLinkPreviews(linkPreviews: LinkPreviewUploadedContent[]): LinkPreview[];
|
|
6
|
-
static mapText(payloadBundle: TextMessage | EditedTextMessage): Text;
|
|
7
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2020 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.MessageToProtoMapper = void 0;
|
|
22
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
23
|
-
const GenericMessageType_1 = require("../GenericMessageType");
|
|
24
|
-
class MessageToProtoMapper {
|
|
25
|
-
static mapLinkPreviews(linkPreviews) {
|
|
26
|
-
const builtLinkPreviews = [];
|
|
27
|
-
for (const linkPreview of linkPreviews) {
|
|
28
|
-
const linkPreviewMessage = protocol_messaging_1.LinkPreview.create({
|
|
29
|
-
permanentUrl: linkPreview.permanentUrl,
|
|
30
|
-
summary: linkPreview.summary,
|
|
31
|
-
title: linkPreview.title,
|
|
32
|
-
url: linkPreview.url,
|
|
33
|
-
urlOffset: linkPreview.urlOffset,
|
|
34
|
-
});
|
|
35
|
-
if (linkPreview.tweet) {
|
|
36
|
-
linkPreviewMessage.tweet = protocol_messaging_1.Tweet.create({
|
|
37
|
-
author: linkPreview.tweet.author,
|
|
38
|
-
username: linkPreview.tweet.username,
|
|
39
|
-
});
|
|
40
|
-
linkPreviewMessage.metaData = 'tweet';
|
|
41
|
-
}
|
|
42
|
-
if (linkPreview.imageUploaded) {
|
|
43
|
-
const { asset, image } = linkPreview.imageUploaded;
|
|
44
|
-
const imageMetadata = protocol_messaging_1.Asset.ImageMetaData.create({
|
|
45
|
-
height: image.height,
|
|
46
|
-
width: image.width,
|
|
47
|
-
});
|
|
48
|
-
const original = protocol_messaging_1.Asset.Original.create({
|
|
49
|
-
[GenericMessageType_1.GenericMessageType.IMAGE]: imageMetadata,
|
|
50
|
-
mimeType: image.type,
|
|
51
|
-
size: image.data.length,
|
|
52
|
-
});
|
|
53
|
-
const remoteData = protocol_messaging_1.Asset.RemoteData.create({
|
|
54
|
-
assetId: asset.key,
|
|
55
|
-
assetToken: asset.token,
|
|
56
|
-
assetDomain: asset.domain,
|
|
57
|
-
otrKey: asset.keyBytes,
|
|
58
|
-
sha256: asset.sha256,
|
|
59
|
-
});
|
|
60
|
-
const assetMessage = protocol_messaging_1.Asset.create({
|
|
61
|
-
original,
|
|
62
|
-
uploaded: remoteData,
|
|
63
|
-
});
|
|
64
|
-
linkPreviewMessage.image = assetMessage;
|
|
65
|
-
}
|
|
66
|
-
linkPreviewMessage.article = protocol_messaging_1.Article.create({
|
|
67
|
-
image: linkPreviewMessage.image,
|
|
68
|
-
permanentUrl: linkPreviewMessage.permanentUrl,
|
|
69
|
-
summary: linkPreviewMessage.summary,
|
|
70
|
-
title: linkPreviewMessage.title,
|
|
71
|
-
});
|
|
72
|
-
builtLinkPreviews.push(linkPreviewMessage);
|
|
73
|
-
}
|
|
74
|
-
return builtLinkPreviews;
|
|
75
|
-
}
|
|
76
|
-
static mapText(payloadBundle) {
|
|
77
|
-
const { expectsReadConfirmation, legalHoldStatus, linkPreviews, mentions, quote, text } = payloadBundle.content;
|
|
78
|
-
const textMessage = protocol_messaging_1.Text.create({
|
|
79
|
-
content: text,
|
|
80
|
-
expectsReadConfirmation,
|
|
81
|
-
legalHoldStatus,
|
|
82
|
-
});
|
|
83
|
-
if (linkPreviews === null || linkPreviews === void 0 ? void 0 : linkPreviews.length) {
|
|
84
|
-
textMessage.linkPreview = MessageToProtoMapper.mapLinkPreviews(linkPreviews);
|
|
85
|
-
}
|
|
86
|
-
if (mentions === null || mentions === void 0 ? void 0 : mentions.length) {
|
|
87
|
-
textMessage.mentions = mentions.map(mention => protocol_messaging_1.Mention.create(mention));
|
|
88
|
-
}
|
|
89
|
-
if (quote) {
|
|
90
|
-
textMessage.quote = protocol_messaging_1.Quote.create({
|
|
91
|
-
quotedMessageId: quote.quotedMessageId,
|
|
92
|
-
quotedMessageSha256: quote.quotedMessageSha256,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
return textMessage;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.MessageToProtoMapper = MessageToProtoMapper;
|
|
99
|
-
//# sourceMappingURL=MessageToProtoMapper.js.map
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { AssetContent, ButtonActionContent, ButtonActionConfirmationContent, CallingContent, ClearedContent, ClientActionContent, CompositeContent, ConfirmationContent, DeletedContent, EditedTextContent, FileAssetAbortContent, FileAssetContent, FileAssetMetaDataContent, HiddenContent, ImageAssetContent, KnockContent, LocationContent, ReactionContent, TextContent } from '../content';
|
|
2
|
-
import type { BasePayloadBundle, PayloadBundleType } from './PayloadBundle';
|
|
3
|
-
export interface TextMessage extends BasePayloadBundle {
|
|
4
|
-
content: TextContent;
|
|
5
|
-
type: PayloadBundleType.TEXT;
|
|
6
|
-
}
|
|
7
|
-
export interface ButtonActionMessage extends BasePayloadBundle {
|
|
8
|
-
content: ButtonActionContent;
|
|
9
|
-
type: PayloadBundleType.BUTTON_ACTION;
|
|
10
|
-
}
|
|
11
|
-
export interface ButtonActionConfirmationMessage extends BasePayloadBundle {
|
|
12
|
-
content: ButtonActionConfirmationContent;
|
|
13
|
-
type: PayloadBundleType.BUTTON_ACTION_CONFIRMATION;
|
|
14
|
-
}
|
|
15
|
-
export interface CallMessage extends BasePayloadBundle {
|
|
16
|
-
content: CallingContent;
|
|
17
|
-
type: PayloadBundleType.CALL;
|
|
18
|
-
}
|
|
19
|
-
export interface CompositeMessage extends BasePayloadBundle {
|
|
20
|
-
content: CompositeContent;
|
|
21
|
-
type: PayloadBundleType.COMPOSITE;
|
|
22
|
-
}
|
|
23
|
-
export interface EditedTextMessage extends BasePayloadBundle {
|
|
24
|
-
content: EditedTextContent;
|
|
25
|
-
type: PayloadBundleType.MESSAGE_EDIT;
|
|
26
|
-
}
|
|
27
|
-
export interface FileAssetMessage extends BasePayloadBundle {
|
|
28
|
-
content: FileAssetContent;
|
|
29
|
-
type: PayloadBundleType.ASSET;
|
|
30
|
-
}
|
|
31
|
-
export interface FileAssetMetaDataMessage extends BasePayloadBundle {
|
|
32
|
-
content: FileAssetMetaDataContent;
|
|
33
|
-
type: PayloadBundleType.ASSET_META;
|
|
34
|
-
}
|
|
35
|
-
export interface FileAssetAbortMessage extends BasePayloadBundle {
|
|
36
|
-
content: FileAssetAbortContent;
|
|
37
|
-
type: PayloadBundleType.ASSET_ABORT;
|
|
38
|
-
}
|
|
39
|
-
export interface ImageAssetMessageOutgoing extends BasePayloadBundle {
|
|
40
|
-
content: ImageAssetContent;
|
|
41
|
-
type: PayloadBundleType.ASSET_IMAGE;
|
|
42
|
-
}
|
|
43
|
-
export interface ImageAssetMessage extends BasePayloadBundle {
|
|
44
|
-
content: AssetContent;
|
|
45
|
-
type: PayloadBundleType.ASSET_IMAGE;
|
|
46
|
-
}
|
|
47
|
-
export interface LocationMessage extends BasePayloadBundle {
|
|
48
|
-
content: LocationContent;
|
|
49
|
-
type: PayloadBundleType.LOCATION;
|
|
50
|
-
}
|
|
51
|
-
export interface ReactionMessage extends BasePayloadBundle {
|
|
52
|
-
content: ReactionContent;
|
|
53
|
-
type: PayloadBundleType.REACTION;
|
|
54
|
-
}
|
|
55
|
-
export interface ConfirmationMessage extends BasePayloadBundle {
|
|
56
|
-
content: ConfirmationContent;
|
|
57
|
-
type: PayloadBundleType.CONFIRMATION;
|
|
58
|
-
}
|
|
59
|
-
export interface PingMessage extends BasePayloadBundle {
|
|
60
|
-
content: KnockContent;
|
|
61
|
-
type: PayloadBundleType.PING;
|
|
62
|
-
}
|
|
63
|
-
export interface ResetSessionMessage extends BasePayloadBundle {
|
|
64
|
-
content: ClientActionContent;
|
|
65
|
-
type: PayloadBundleType.CLIENT_ACTION;
|
|
66
|
-
}
|
|
67
|
-
export interface ClearConversationMessage extends BasePayloadBundle {
|
|
68
|
-
content: ClearedContent;
|
|
69
|
-
type: PayloadBundleType.CONVERSATION_CLEAR;
|
|
70
|
-
}
|
|
71
|
-
export interface HideMessage extends BasePayloadBundle {
|
|
72
|
-
content: HiddenContent;
|
|
73
|
-
type: PayloadBundleType.MESSAGE_HIDE;
|
|
74
|
-
}
|
|
75
|
-
export interface DeleteMessage extends BasePayloadBundle {
|
|
76
|
-
content: DeletedContent;
|
|
77
|
-
type: PayloadBundleType.MESSAGE_DELETE;
|
|
78
|
-
}
|
|
79
|
-
export declare type OtrMessage = ButtonActionMessage | ButtonActionConfirmationMessage | CallMessage | ClearConversationMessage | CompositeMessage | ConfirmationMessage | DeleteMessage | EditedTextMessage | FileAssetAbortMessage | FileAssetMessage | FileAssetMetaDataMessage | HideMessage | ImageAssetMessage | ImageAssetMessageOutgoing | LocationMessage | PingMessage | ReactionMessage | ResetSessionMessage | TextMessage;
|
|
80
|
-
export declare type QuotableMessage = EditedTextMessage | ImageAssetMessage | LocationMessage | TextMessage;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2018 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
|
-
//# sourceMappingURL=OtrMessage.js.map
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { ConversationEventData, TeamEventData, UserEventData } from '@wireapp/api-client/src/event/';
|
|
2
|
-
import { QualifiedId } from '@wireapp/api-client/src/user';
|
|
3
|
-
import type { ConversationContent } from '../content';
|
|
4
|
-
import type { Message } from './Message';
|
|
5
|
-
export declare type PayloadBundleContent = ConversationContent | ConversationEventData | TeamEventData | UserEventData;
|
|
6
|
-
export declare enum PayloadBundleSource {
|
|
7
|
-
LOCAL = "PayloadBundleSource.LOCAL",
|
|
8
|
-
NOTIFICATION_STREAM = "PayloadBundleSource.NOTIFICATION_STREAM",
|
|
9
|
-
WEBSOCKET = "PayloadBundleSource.WEBSOCKET"
|
|
10
|
-
}
|
|
11
|
-
export declare enum PayloadBundleState {
|
|
12
|
-
INCOMING = "PayloadBundleState.INCOMING",
|
|
13
|
-
OUTGOING_SENT = "PayloadBundleState.OUTGOING_SENT",
|
|
14
|
-
OUTGOING_UNSENT = "PayloadBundleState.OUTGOING_UNSENT",
|
|
15
|
-
CANCELLED = "PayloadBundleState.CANCELLED"
|
|
16
|
-
}
|
|
17
|
-
export interface BasePayloadBundle {
|
|
18
|
-
content: PayloadBundleContent;
|
|
19
|
-
conversation: string;
|
|
20
|
-
qualifiedConversation?: QualifiedId;
|
|
21
|
-
from: string;
|
|
22
|
-
qualifiedFrom?: QualifiedId;
|
|
23
|
-
fromClientId?: string;
|
|
24
|
-
id: string;
|
|
25
|
-
messageTimer?: number;
|
|
26
|
-
source: PayloadBundleSource;
|
|
27
|
-
state: PayloadBundleState;
|
|
28
|
-
timestamp: number;
|
|
29
|
-
type: PayloadBundleType;
|
|
30
|
-
}
|
|
31
|
-
export declare type PayloadBundle = Message | BasePayloadBundle;
|
|
32
|
-
export declare enum PayloadBundleType {
|
|
33
|
-
ASSET = "PayloadBundleType.ASSET",
|
|
34
|
-
ASSET_ABORT = "PayloadBundleType.ASSET_ABORT",
|
|
35
|
-
ASSET_IMAGE = "PayloadBundleType.ASSET_IMAGE",
|
|
36
|
-
ASSET_META = "PayloadBundleType.ASSET_META",
|
|
37
|
-
BUTTON_ACTION = "PayloadBundleType.BUTTON_ACTION",
|
|
38
|
-
BUTTON_ACTION_CONFIRMATION = "PayloadBundleType.BUTTON_ACTION_CONFIRMATION",
|
|
39
|
-
CALL = "PayloadBundleType.CALL",
|
|
40
|
-
CLIENT_ACTION = "PayloadBundleType.CLIENT_ACTION",
|
|
41
|
-
CLIENT_ADD = "PayloadBundleType.CLIENT_ADD",
|
|
42
|
-
CLIENT_REMOVE = "PayloadBundleType.CLIENT_REMOVE",
|
|
43
|
-
COMPOSITE = "PayloadBundleType.COMPOSITE",
|
|
44
|
-
CONFIRMATION = "PayloadBundleType.CONFIRMATION",
|
|
45
|
-
CONNECTION_REQUEST = "PayloadBundleType.CONNECTION_REQUEST",
|
|
46
|
-
CONVERSATION_CLEAR = "PayloadBundleType.CONVERSATION_CLEAR",
|
|
47
|
-
CONVERSATION_RENAME = "PayloadBundleType.CONVERSATION_RENAME",
|
|
48
|
-
LOCATION = "PayloadBundleType.LOCATION",
|
|
49
|
-
MEMBER_JOIN = "PayloadBundleType.MEMBER_JOIN",
|
|
50
|
-
MESSAGE_DELETE = "PayloadBundleType.MESSAGE_DELETE",
|
|
51
|
-
MESSAGE_EDIT = "PayloadBundleType.MESSAGE_EDIT",
|
|
52
|
-
MESSAGE_HIDE = "PayloadBundleType.MESSAGE_HIDE",
|
|
53
|
-
MLS_WELCOME_MESSAGE = "PayloadBundleType.MLS_WELCOME",
|
|
54
|
-
PING = "PayloadBundleType.PING",
|
|
55
|
-
REACTION = "PayloadBundleType.REACTION",
|
|
56
|
-
TEAM_CONVERSATION_CREATE = "PayloadBundleType.TEAM_CONVERSATION_CREATE",
|
|
57
|
-
TEAM_CONVERSATION_DELETE = "PayloadBundleType.TEAM_CONVERSATION_DELETE",
|
|
58
|
-
TEAM_DELETE = "PayloadBundleType.TEAM_DELETE",
|
|
59
|
-
TEAM_MEMBER_JOIN = "PayloadBundleType.TEAM_MEMBER_JOIN",
|
|
60
|
-
TEAM_MEMBER_LEAVE = "PayloadBundleType.TEAM_MEMBER_LEAVE",
|
|
61
|
-
TEAM_UPDATE = "PayloadBundleType.TEAM_UPDATE",
|
|
62
|
-
TEXT = "PayloadBundleType.TEXT",
|
|
63
|
-
TIMER_UPDATE = "PayloadBundleType.TIMER_UPDATE",
|
|
64
|
-
TYPING = "PayloadBundleType.TYPING",
|
|
65
|
-
UNKNOWN = "PayloadBundleType.UNKNOWN",
|
|
66
|
-
USER_ACTIVATE = "PayloadBundleType.USER_ACTIVATE",
|
|
67
|
-
USER_CLIENT_ADD = "PayloadBundleType.USER_CLIENT_ADD",
|
|
68
|
-
USER_CLIENT_REMOVE = "PayloadBundleType.USER_CLIENT_REMOVE",
|
|
69
|
-
USER_CONNECTION = "PayloadBundleType.USER_CONNECTION",
|
|
70
|
-
USER_DELETE = "PayloadBundleType.USER_DELETE",
|
|
71
|
-
USER_LEGAL_HOLD_DISABLE = "PayloadBundleType.USER_LEGAL_HOLD_DISABLE",
|
|
72
|
-
USER_LEGAL_HOLD_ENABLE = "PayloadBundleType.USER_LEGAL_HOLD_ENABLE",
|
|
73
|
-
USER_LEGAL_HOLD_REQUEST = "PayloadBundleType.USER_LEGAL_HOLD_REQUEST",
|
|
74
|
-
USER_PROPERTIES_SET = "PayloadBundleType.USER_PROPERTIES_SET",
|
|
75
|
-
USER_UPDATE = "PayloadBundleType.USER_UPDATE"
|
|
76
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2018 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.PayloadBundleType = exports.PayloadBundleState = exports.PayloadBundleSource = void 0;
|
|
22
|
-
var PayloadBundleSource;
|
|
23
|
-
(function (PayloadBundleSource) {
|
|
24
|
-
PayloadBundleSource["LOCAL"] = "PayloadBundleSource.LOCAL";
|
|
25
|
-
PayloadBundleSource["NOTIFICATION_STREAM"] = "PayloadBundleSource.NOTIFICATION_STREAM";
|
|
26
|
-
PayloadBundleSource["WEBSOCKET"] = "PayloadBundleSource.WEBSOCKET";
|
|
27
|
-
})(PayloadBundleSource = exports.PayloadBundleSource || (exports.PayloadBundleSource = {}));
|
|
28
|
-
var PayloadBundleState;
|
|
29
|
-
(function (PayloadBundleState) {
|
|
30
|
-
PayloadBundleState["INCOMING"] = "PayloadBundleState.INCOMING";
|
|
31
|
-
PayloadBundleState["OUTGOING_SENT"] = "PayloadBundleState.OUTGOING_SENT";
|
|
32
|
-
PayloadBundleState["OUTGOING_UNSENT"] = "PayloadBundleState.OUTGOING_UNSENT";
|
|
33
|
-
PayloadBundleState["CANCELLED"] = "PayloadBundleState.CANCELLED";
|
|
34
|
-
})(PayloadBundleState = exports.PayloadBundleState || (exports.PayloadBundleState = {}));
|
|
35
|
-
var PayloadBundleType;
|
|
36
|
-
(function (PayloadBundleType) {
|
|
37
|
-
PayloadBundleType["ASSET"] = "PayloadBundleType.ASSET";
|
|
38
|
-
PayloadBundleType["ASSET_ABORT"] = "PayloadBundleType.ASSET_ABORT";
|
|
39
|
-
PayloadBundleType["ASSET_IMAGE"] = "PayloadBundleType.ASSET_IMAGE";
|
|
40
|
-
PayloadBundleType["ASSET_META"] = "PayloadBundleType.ASSET_META";
|
|
41
|
-
PayloadBundleType["BUTTON_ACTION"] = "PayloadBundleType.BUTTON_ACTION";
|
|
42
|
-
PayloadBundleType["BUTTON_ACTION_CONFIRMATION"] = "PayloadBundleType.BUTTON_ACTION_CONFIRMATION";
|
|
43
|
-
PayloadBundleType["CALL"] = "PayloadBundleType.CALL";
|
|
44
|
-
PayloadBundleType["CLIENT_ACTION"] = "PayloadBundleType.CLIENT_ACTION";
|
|
45
|
-
PayloadBundleType["CLIENT_ADD"] = "PayloadBundleType.CLIENT_ADD";
|
|
46
|
-
PayloadBundleType["CLIENT_REMOVE"] = "PayloadBundleType.CLIENT_REMOVE";
|
|
47
|
-
PayloadBundleType["COMPOSITE"] = "PayloadBundleType.COMPOSITE";
|
|
48
|
-
PayloadBundleType["CONFIRMATION"] = "PayloadBundleType.CONFIRMATION";
|
|
49
|
-
PayloadBundleType["CONNECTION_REQUEST"] = "PayloadBundleType.CONNECTION_REQUEST";
|
|
50
|
-
PayloadBundleType["CONVERSATION_CLEAR"] = "PayloadBundleType.CONVERSATION_CLEAR";
|
|
51
|
-
PayloadBundleType["CONVERSATION_RENAME"] = "PayloadBundleType.CONVERSATION_RENAME";
|
|
52
|
-
PayloadBundleType["LOCATION"] = "PayloadBundleType.LOCATION";
|
|
53
|
-
PayloadBundleType["MEMBER_JOIN"] = "PayloadBundleType.MEMBER_JOIN";
|
|
54
|
-
PayloadBundleType["MESSAGE_DELETE"] = "PayloadBundleType.MESSAGE_DELETE";
|
|
55
|
-
PayloadBundleType["MESSAGE_EDIT"] = "PayloadBundleType.MESSAGE_EDIT";
|
|
56
|
-
PayloadBundleType["MESSAGE_HIDE"] = "PayloadBundleType.MESSAGE_HIDE";
|
|
57
|
-
PayloadBundleType["MLS_WELCOME_MESSAGE"] = "PayloadBundleType.MLS_WELCOME";
|
|
58
|
-
PayloadBundleType["PING"] = "PayloadBundleType.PING";
|
|
59
|
-
PayloadBundleType["REACTION"] = "PayloadBundleType.REACTION";
|
|
60
|
-
PayloadBundleType["TEAM_CONVERSATION_CREATE"] = "PayloadBundleType.TEAM_CONVERSATION_CREATE";
|
|
61
|
-
PayloadBundleType["TEAM_CONVERSATION_DELETE"] = "PayloadBundleType.TEAM_CONVERSATION_DELETE";
|
|
62
|
-
PayloadBundleType["TEAM_DELETE"] = "PayloadBundleType.TEAM_DELETE";
|
|
63
|
-
PayloadBundleType["TEAM_MEMBER_JOIN"] = "PayloadBundleType.TEAM_MEMBER_JOIN";
|
|
64
|
-
PayloadBundleType["TEAM_MEMBER_LEAVE"] = "PayloadBundleType.TEAM_MEMBER_LEAVE";
|
|
65
|
-
PayloadBundleType["TEAM_UPDATE"] = "PayloadBundleType.TEAM_UPDATE";
|
|
66
|
-
PayloadBundleType["TEXT"] = "PayloadBundleType.TEXT";
|
|
67
|
-
PayloadBundleType["TIMER_UPDATE"] = "PayloadBundleType.TIMER_UPDATE";
|
|
68
|
-
PayloadBundleType["TYPING"] = "PayloadBundleType.TYPING";
|
|
69
|
-
PayloadBundleType["UNKNOWN"] = "PayloadBundleType.UNKNOWN";
|
|
70
|
-
PayloadBundleType["USER_ACTIVATE"] = "PayloadBundleType.USER_ACTIVATE";
|
|
71
|
-
PayloadBundleType["USER_CLIENT_ADD"] = "PayloadBundleType.USER_CLIENT_ADD";
|
|
72
|
-
PayloadBundleType["USER_CLIENT_REMOVE"] = "PayloadBundleType.USER_CLIENT_REMOVE";
|
|
73
|
-
PayloadBundleType["USER_CONNECTION"] = "PayloadBundleType.USER_CONNECTION";
|
|
74
|
-
PayloadBundleType["USER_DELETE"] = "PayloadBundleType.USER_DELETE";
|
|
75
|
-
PayloadBundleType["USER_LEGAL_HOLD_DISABLE"] = "PayloadBundleType.USER_LEGAL_HOLD_DISABLE";
|
|
76
|
-
PayloadBundleType["USER_LEGAL_HOLD_ENABLE"] = "PayloadBundleType.USER_LEGAL_HOLD_ENABLE";
|
|
77
|
-
PayloadBundleType["USER_LEGAL_HOLD_REQUEST"] = "PayloadBundleType.USER_LEGAL_HOLD_REQUEST";
|
|
78
|
-
PayloadBundleType["USER_PROPERTIES_SET"] = "PayloadBundleType.USER_PROPERTIES_SET";
|
|
79
|
-
PayloadBundleType["USER_UPDATE"] = "PayloadBundleType.USER_UPDATE";
|
|
80
|
-
})(PayloadBundleType = exports.PayloadBundleType || (exports.PayloadBundleType = {}));
|
|
81
|
-
//# sourceMappingURL=PayloadBundle.js.map
|