@wireapp/core 17.31.1 → 17.31.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 +11 -0
- package/package.json +7 -7
- package/src/main/Account.js.map +0 -1
- package/src/main/Account.test.browser.js +0 -114
- package/src/main/Account.test.node.d.ts +0 -1
- package/src/main/Account.test.node.js +0 -214
- package/src/main/Account.test.node.js.map +0 -1
- package/src/main/Account.test.node.ts +0 -236
- package/src/main/Account.ts +0 -401
- package/src/main/CoreError.js.map +0 -1
- package/src/main/CoreError.ts +0 -30
- package/src/main/auth/LoginSanitizer.js.map +0 -1
- package/src/main/auth/LoginSanitizer.test.node.d.ts +0 -1
- package/src/main/auth/LoginSanitizer.test.node.js +0 -56
- package/src/main/auth/LoginSanitizer.test.node.js.map +0 -1
- package/src/main/auth/LoginSanitizer.test.node.ts +0 -68
- package/src/main/auth/LoginSanitizer.ts +0 -44
- package/src/main/auth/index.js.map +0 -1
- package/src/main/auth/index.ts +0 -20
- package/src/main/broadcast/AvailabilityType.js.map +0 -1
- package/src/main/broadcast/AvailabilityType.ts +0 -22
- package/src/main/broadcast/BroadcastService.js.map +0 -1
- package/src/main/broadcast/BroadcastService.ts +0 -66
- package/src/main/broadcast/index.js.map +0 -1
- package/src/main/broadcast/index.ts +0 -21
- package/src/main/client/ClientBackendRepository.js.map +0 -1
- package/src/main/client/ClientBackendRepository.ts +0 -33
- package/src/main/client/ClientDatabaseRepository.js.map +0 -1
- package/src/main/client/ClientDatabaseRepository.ts +0 -130
- package/src/main/client/ClientInfo.js.map +0 -1
- package/src/main/client/ClientInfo.ts +0 -28
- package/src/main/client/ClientService.js.map +0 -1
- package/src/main/client/ClientService.ts +0 -116
- package/src/main/client/index.js.map +0 -1
- package/src/main/client/index.ts +0 -23
- package/src/main/connection/ConnectionService.js.map +0 -1
- package/src/main/connection/ConnectionService.ts +0 -49
- package/src/main/connection/index.js.map +0 -1
- package/src/main/connection/index.ts +0 -20
- package/src/main/conversation/AbortReason.js.map +0 -1
- package/src/main/conversation/AbortReason.ts +0 -22
- package/src/main/conversation/AssetService.js.map +0 -1
- package/src/main/conversation/AssetService.test.node.d.ts +0 -1
- package/src/main/conversation/AssetService.test.node.js +0 -61
- package/src/main/conversation/AssetService.test.node.js.map +0 -1
- package/src/main/conversation/AssetService.test.node.ts +0 -65
- package/src/main/conversation/AssetService.ts +0 -60
- package/src/main/conversation/AssetTransferState.js.map +0 -1
- package/src/main/conversation/AssetTransferState.ts +0 -23
- package/src/main/conversation/ClientActionType.js.map +0 -1
- package/src/main/conversation/ClientActionType.ts +0 -20
- package/src/main/conversation/ConversationMapper.js.map +0 -1
- package/src/main/conversation/ConversationMapper.test.node.d.ts +0 -1
- package/src/main/conversation/ConversationMapper.test.node.js +0 -111
- package/src/main/conversation/ConversationMapper.test.node.js.map +0 -1
- package/src/main/conversation/ConversationMapper.test.node.ts +0 -154
- package/src/main/conversation/ConversationMapper.ts +0 -56
- package/src/main/conversation/ConversationService.js.map +0 -1
- package/src/main/conversation/ConversationService.test.node.d.ts +0 -1
- package/src/main/conversation/ConversationService.test.node.js +0 -344
- package/src/main/conversation/ConversationService.test.node.js.map +0 -1
- package/src/main/conversation/ConversationService.test.node.ts +0 -416
- package/src/main/conversation/ConversationService.ts +0 -1024
- package/src/main/conversation/GenericMessageType.js.map +0 -1
- package/src/main/conversation/GenericMessageType.ts +0 -44
- package/src/main/conversation/MessageTimer.js.map +0 -1
- package/src/main/conversation/MessageTimer.test.node.d.ts +0 -1
- package/src/main/conversation/MessageTimer.test.node.js +0 -88
- package/src/main/conversation/MessageTimer.test.node.js.map +0 -1
- package/src/main/conversation/MessageTimer.test.node.ts +0 -103
- package/src/main/conversation/MessageTimer.ts +0 -56
- package/src/main/conversation/ReactionType.js.map +0 -1
- package/src/main/conversation/ReactionType.ts +0 -23
- package/src/main/conversation/content/AssetContent.js.map +0 -1
- package/src/main/conversation/content/AssetContent.ts +0 -71
- package/src/main/conversation/content/ButtonActionConfirmationContent.js.map +0 -1
- package/src/main/conversation/content/ButtonActionConfirmationContent.ts +0 -21
- package/src/main/conversation/content/ButtonActionContent.js.map +0 -1
- package/src/main/conversation/content/ButtonActionContent.ts +0 -21
- package/src/main/conversation/content/CallingContent.js.map +0 -1
- package/src/main/conversation/content/CallingContent.ts +0 -20
- package/src/main/conversation/content/ClearedContent.js.map +0 -1
- package/src/main/conversation/content/ClearedContent.ts +0 -21
- package/src/main/conversation/content/ClientActionContent.js.map +0 -1
- package/src/main/conversation/content/ClientActionContent.ts +0 -22
- package/src/main/conversation/content/ClientAddContent.js.map +0 -1
- package/src/main/conversation/content/ClientAddContent.ts +0 -24
- package/src/main/conversation/content/ClientRemoveContent.js.map +0 -1
- package/src/main/conversation/content/ClientRemoveContent.ts +0 -25
- package/src/main/conversation/content/CompositeContent.js.map +0 -1
- package/src/main/conversation/content/CompositeContent.ts +0 -21
- package/src/main/conversation/content/ConfirmationContent.js.map +0 -1
- package/src/main/conversation/content/ConfirmationContent.ts +0 -21
- package/src/main/conversation/content/ContentType.js.map +0 -1
- package/src/main/conversation/content/ContentType.ts +0 -112
- package/src/main/conversation/content/ConversationContent.js.map +0 -1
- package/src/main/conversation/content/ConversationContent.ts +0 -71
- package/src/main/conversation/content/DeletedContent.js.map +0 -1
- package/src/main/conversation/content/DeletedContent.ts +0 -21
- package/src/main/conversation/content/EditedTextContent.js.map +0 -1
- package/src/main/conversation/content/EditedTextContent.ts +0 -31
- package/src/main/conversation/content/FileContent.js.map +0 -1
- package/src/main/conversation/content/FileContent.ts +0 -32
- package/src/main/conversation/content/HiddenContent.js.map +0 -1
- package/src/main/conversation/content/HiddenContent.ts +0 -21
- package/src/main/conversation/content/ImageContent.js.map +0 -1
- package/src/main/conversation/content/ImageContent.ts +0 -25
- package/src/main/conversation/content/KnockContent.js.map +0 -1
- package/src/main/conversation/content/KnockContent.ts +0 -21
- package/src/main/conversation/content/LinkPreviewContent.js.map +0 -1
- package/src/main/conversation/content/LinkPreviewContent.ts +0 -32
- package/src/main/conversation/content/LocationContent.js.map +0 -1
- package/src/main/conversation/content/LocationContent.ts +0 -29
- package/src/main/conversation/content/MentionContent.js.map +0 -1
- package/src/main/conversation/content/MentionContent.ts +0 -21
- package/src/main/conversation/content/QuoteContent.js.map +0 -1
- package/src/main/conversation/content/QuoteContent.ts +0 -29
- package/src/main/conversation/content/ReactionContent.js.map +0 -1
- package/src/main/conversation/content/ReactionContent.ts +0 -27
- package/src/main/conversation/content/TextContent.js.map +0 -1
- package/src/main/conversation/content/TextContent.ts +0 -29
- package/src/main/conversation/content/TweetContent.js.map +0 -1
- package/src/main/conversation/content/TweetContent.ts +0 -21
- package/src/main/conversation/content/index.js.map +0 -1
- package/src/main/conversation/content/index.ts +0 -49
- package/src/main/conversation/index.js.map +0 -1
- package/src/main/conversation/index.ts +0 -28
- package/src/main/conversation/message/CompositeContentBuilder.js.map +0 -1
- package/src/main/conversation/message/CompositeContentBuilder.ts +0 -60
- package/src/main/conversation/message/Message.js.map +0 -1
- package/src/main/conversation/message/Message.ts +0 -24
- package/src/main/conversation/message/MessageBuilder.js.map +0 -1
- package/src/main/conversation/message/MessageBuilder.test.browser.js +0 -27
- package/src/main/conversation/message/MessageBuilder.ts +0 -488
- package/src/main/conversation/message/MessageService.js.map +0 -1
- package/src/main/conversation/message/MessageService.test.node.d.ts +0 -1
- package/src/main/conversation/message/MessageService.test.node.js +0 -308
- package/src/main/conversation/message/MessageService.test.node.js.map +0 -1
- package/src/main/conversation/message/MessageService.test.node.ts +0 -398
- package/src/main/conversation/message/MessageService.ts +0 -383
- package/src/main/conversation/message/MessageToProtoMapper.js.map +0 -1
- package/src/main/conversation/message/MessageToProtoMapper.ts +0 -114
- package/src/main/conversation/message/OtrMessage.js.map +0 -1
- package/src/main/conversation/message/OtrMessage.ts +0 -160
- package/src/main/conversation/message/PayloadBundle.js.map +0 -1
- package/src/main/conversation/message/PayloadBundle.ts +0 -101
- package/src/main/conversation/message/TeamMessage.js.map +0 -1
- package/src/main/conversation/message/TeamMessage.ts +0 -72
- package/src/main/conversation/message/TextContentBuilder.js.map +0 -1
- package/src/main/conversation/message/TextContentBuilder.ts +0 -88
- package/src/main/conversation/message/UserClientsUtil.js.map +0 -1
- package/src/main/conversation/message/UserClientsUtil.ts +0 -44
- package/src/main/conversation/message/UserClientsUtils.test.node.d.ts +0 -1
- package/src/main/conversation/message/UserClientsUtils.test.node.js +0 -42
- package/src/main/conversation/message/UserClientsUtils.test.node.js.map +0 -1
- package/src/main/conversation/message/UserClientsUtils.test.node.ts +0 -44
- package/src/main/conversation/message/UserMessage.js.map +0 -1
- package/src/main/conversation/message/UserMessage.ts +0 -95
- package/src/main/cryptography/AssetCryptography.browser.js.map +0 -1
- package/src/main/cryptography/AssetCryptography.browser.ts +0 -76
- package/src/main/cryptography/AssetCryptography.node.js.map +0 -1
- package/src/main/cryptography/AssetCryptography.node.ts +0 -85
- package/src/main/cryptography/CryptographyDatabaseRepository.js.map +0 -1
- package/src/main/cryptography/CryptographyDatabaseRepository.ts +0 -44
- package/src/main/cryptography/CryptographyService.js.map +0 -1
- package/src/main/cryptography/CryptographyService.test.browser.js +0 -195
- package/src/main/cryptography/CryptographyService.test.node.d.ts +0 -1
- package/src/main/cryptography/CryptographyService.test.node.js +0 -228
- package/src/main/cryptography/CryptographyService.test.node.js.map +0 -1
- package/src/main/cryptography/CryptographyService.test.node.ts +0 -246
- package/src/main/cryptography/CryptographyService.ts +0 -246
- package/src/main/cryptography/EncryptedAsset.js.map +0 -1
- package/src/main/cryptography/EncryptedAsset.ts +0 -30
- package/src/main/cryptography/GenericMessageMapper.js.map +0 -1
- package/src/main/cryptography/GenericMessageMapper.ts +0 -274
- package/src/main/cryptography/MessageHashService.js.map +0 -1
- package/src/main/cryptography/MessageHashService.test.browser.js +0 -176
- package/src/main/cryptography/MessageHashService.test.node.d.ts +0 -1
- package/src/main/cryptography/MessageHashService.test.node.js +0 -138
- package/src/main/cryptography/MessageHashService.test.node.js.map +0 -1
- package/src/main/cryptography/MessageHashService.test.node.ts +0 -176
- package/src/main/cryptography/MessageHashService.ts +0 -109
- package/src/main/cryptography/SessionPayloadBundle.js.map +0 -1
- package/src/main/cryptography/SessionPayloadBundle.ts +0 -23
- package/src/main/cryptography/index.js.map +0 -1
- package/src/main/cryptography/index.ts +0 -23
- package/src/main/giphy/GiphyService.js.map +0 -1
- package/src/main/giphy/GiphyService.ts +0 -37
- package/src/main/giphy/index.js.map +0 -1
- package/src/main/giphy/index.ts +0 -20
- package/src/main/index.js.map +0 -1
- package/src/main/index.test.browser.js +0 -22
- package/src/main/index.ts +0 -34
- package/src/main/notification/NotificationBackendRepository.js.map +0 -1
- package/src/main/notification/NotificationBackendRepository.ts +0 -33
- package/src/main/notification/NotificationDatabaseRepository.js.map +0 -1
- package/src/main/notification/NotificationDatabaseRepository.ts +0 -74
- package/src/main/notification/NotificationService.js.map +0 -1
- package/src/main/notification/NotificationService.test.browser.js +0 -179
- package/src/main/notification/NotificationService.test.node.d.ts +0 -1
- package/src/main/notification/NotificationService.test.node.js +0 -99
- package/src/main/notification/NotificationService.test.node.js.map +0 -1
- package/src/main/notification/NotificationService.test.node.ts +0 -124
- package/src/main/notification/NotificationService.ts +0 -260
- package/src/main/notification/index.js.map +0 -1
- package/src/main/notification/index.ts +0 -20
- package/src/main/self/SelfService.js.map +0 -1
- package/src/main/self/SelfService.ts +0 -59
- package/src/main/self/index.js.map +0 -1
- package/src/main/self/index.ts +0 -20
- package/src/main/team/TeamService.js.map +0 -1
- package/src/main/team/TeamService.ts +0 -68
- package/src/main/team/index.js.map +0 -1
- package/src/main/team/index.ts +0 -20
- package/src/main/test/CryptographyHelper.js.map +0 -1
- package/src/main/test/CryptographyHelper.ts +0 -57
- package/src/main/test/PayloadHelper.js.map +0 -1
- package/src/main/test/PayloadHelper.ts +0 -60
- package/src/main/user/UserMapper.js.map +0 -1
- package/src/main/user/UserMapper.test.node.d.ts +0 -1
- package/src/main/user/UserMapper.test.node.js +0 -55
- package/src/main/user/UserMapper.test.node.js.map +0 -1
- package/src/main/user/UserMapper.test.node.ts +0 -63
- package/src/main/user/UserMapper.ts +0 -92
- package/src/main/user/UserService.js.map +0 -1
- package/src/main/user/UserService.test.node.js +0 -141
- package/src/main/user/UserService.ts +0 -98
- package/src/main/user/index.js.map +0 -1
- package/src/main/user/index.ts +0 -20
- package/src/main/util/TypePredicateUtil.js.map +0 -1
- package/src/main/util/TypePredicateUtil.test.node.d.ts +0 -1
- package/src/main/util/TypePredicateUtil.test.node.js +0 -42
- package/src/main/util/TypePredicateUtil.test.node.js.map +0 -1
- package/src/main/util/TypePredicateUtil.test.node.ts +0 -44
- package/src/main/util/TypePredicateUtil.ts +0 -52
- package/src/main/util/index.js.map +0 -1
- package/src/main/util/index.ts +0 -20
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import type {ConversationEventData, TeamEventData, UserEventData} from '@wireapp/api-client/src/event/';
|
|
21
|
-
import {QualifiedId} from '@wireapp/api-client/src/user';
|
|
22
|
-
|
|
23
|
-
import type {ConversationContent} from '../content';
|
|
24
|
-
import type {Message} from './Message';
|
|
25
|
-
|
|
26
|
-
export type PayloadBundleContent = ConversationContent | ConversationEventData | TeamEventData | UserEventData;
|
|
27
|
-
|
|
28
|
-
export enum PayloadBundleSource {
|
|
29
|
-
LOCAL = 'PayloadBundleSource.LOCAL',
|
|
30
|
-
NOTIFICATION_STREAM = 'PayloadBundleSource.NOTIFICATION_STREAM',
|
|
31
|
-
WEBSOCKET = 'PayloadBundleSource.WEBSOCKET',
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export enum PayloadBundleState {
|
|
35
|
-
INCOMING = 'PayloadBundleState.INCOMING',
|
|
36
|
-
OUTGOING_SENT = 'PayloadBundleState.OUTGOING_SENT',
|
|
37
|
-
OUTGOING_UNSENT = 'PayloadBundleState.OUTGOING_UNSENT',
|
|
38
|
-
CANCELLED = 'PayloadBundleState.CANCELLED',
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface BasePayloadBundle {
|
|
42
|
-
content: PayloadBundleContent;
|
|
43
|
-
conversation: string;
|
|
44
|
-
qualifiedConversation?: QualifiedId;
|
|
45
|
-
from: string;
|
|
46
|
-
qualifiedFrom?: QualifiedId;
|
|
47
|
-
fromClientId?: string;
|
|
48
|
-
id: string;
|
|
49
|
-
messageTimer?: number;
|
|
50
|
-
source: PayloadBundleSource;
|
|
51
|
-
state: PayloadBundleState;
|
|
52
|
-
timestamp: number;
|
|
53
|
-
type: PayloadBundleType;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type PayloadBundle = Message | BasePayloadBundle;
|
|
57
|
-
|
|
58
|
-
export enum PayloadBundleType {
|
|
59
|
-
ASSET = 'PayloadBundleType.ASSET',
|
|
60
|
-
ASSET_ABORT = 'PayloadBundleType.ASSET_ABORT',
|
|
61
|
-
ASSET_IMAGE = 'PayloadBundleType.ASSET_IMAGE',
|
|
62
|
-
ASSET_META = 'PayloadBundleType.ASSET_META',
|
|
63
|
-
BUTTON_ACTION = 'PayloadBundleType.BUTTON_ACTION',
|
|
64
|
-
BUTTON_ACTION_CONFIRMATION = 'PayloadBundleType.BUTTON_ACTION_CONFIRMATION',
|
|
65
|
-
CALL = 'PayloadBundleType.CALL',
|
|
66
|
-
CLIENT_ACTION = 'PayloadBundleType.CLIENT_ACTION',
|
|
67
|
-
CLIENT_ADD = 'PayloadBundleType.CLIENT_ADD',
|
|
68
|
-
CLIENT_REMOVE = 'PayloadBundleType.CLIENT_REMOVE',
|
|
69
|
-
COMPOSITE = 'PayloadBundleType.COMPOSITE',
|
|
70
|
-
CONFIRMATION = 'PayloadBundleType.CONFIRMATION',
|
|
71
|
-
CONNECTION_REQUEST = 'PayloadBundleType.CONNECTION_REQUEST',
|
|
72
|
-
CONVERSATION_CLEAR = 'PayloadBundleType.CONVERSATION_CLEAR',
|
|
73
|
-
CONVERSATION_RENAME = 'PayloadBundleType.CONVERSATION_RENAME',
|
|
74
|
-
LOCATION = 'PayloadBundleType.LOCATION',
|
|
75
|
-
MEMBER_JOIN = 'PayloadBundleType.MEMBER_JOIN',
|
|
76
|
-
MESSAGE_DELETE = 'PayloadBundleType.MESSAGE_DELETE',
|
|
77
|
-
MESSAGE_EDIT = 'PayloadBundleType.MESSAGE_EDIT',
|
|
78
|
-
MESSAGE_HIDE = 'PayloadBundleType.MESSAGE_HIDE',
|
|
79
|
-
PING = 'PayloadBundleType.PING',
|
|
80
|
-
REACTION = 'PayloadBundleType.REACTION',
|
|
81
|
-
TEAM_CONVERSATION_CREATE = 'PayloadBundleType.TEAM_CONVERSATION_CREATE',
|
|
82
|
-
TEAM_CONVERSATION_DELETE = 'PayloadBundleType.TEAM_CONVERSATION_DELETE',
|
|
83
|
-
TEAM_DELETE = 'PayloadBundleType.TEAM_DELETE',
|
|
84
|
-
TEAM_MEMBER_JOIN = 'PayloadBundleType.TEAM_MEMBER_JOIN',
|
|
85
|
-
TEAM_MEMBER_LEAVE = 'PayloadBundleType.TEAM_MEMBER_LEAVE',
|
|
86
|
-
TEAM_UPDATE = 'PayloadBundleType.TEAM_UPDATE',
|
|
87
|
-
TEXT = 'PayloadBundleType.TEXT',
|
|
88
|
-
TIMER_UPDATE = 'PayloadBundleType.TIMER_UPDATE',
|
|
89
|
-
TYPING = 'PayloadBundleType.TYPING',
|
|
90
|
-
UNKNOWN = 'PayloadBundleType.UNKNOWN',
|
|
91
|
-
USER_ACTIVATE = 'PayloadBundleType.USER_ACTIVATE',
|
|
92
|
-
USER_CLIENT_ADD = 'PayloadBundleType.USER_CLIENT_ADD',
|
|
93
|
-
USER_CLIENT_REMOVE = 'PayloadBundleType.USER_CLIENT_REMOVE',
|
|
94
|
-
USER_CONNECTION = 'PayloadBundleType.USER_CONNECTION',
|
|
95
|
-
USER_DELETE = 'PayloadBundleType.USER_DELETE',
|
|
96
|
-
USER_LEGAL_HOLD_DISABLE = 'PayloadBundleType.USER_LEGAL_HOLD_DISABLE',
|
|
97
|
-
USER_LEGAL_HOLD_ENABLE = 'PayloadBundleType.USER_LEGAL_HOLD_ENABLE',
|
|
98
|
-
USER_LEGAL_HOLD_REQUEST = 'PayloadBundleType.USER_LEGAL_HOLD_REQUEST',
|
|
99
|
-
USER_PROPERTIES_SET = 'PayloadBundleType.USER_PROPERTIES_SET',
|
|
100
|
-
USER_UPDATE = 'PayloadBundleType.USER_UPDATE',
|
|
101
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TeamMessage.js","sourceRoot":"","sources":["TeamMessage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2019 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import type {
|
|
21
|
-
TeamConversationCreateData,
|
|
22
|
-
TeamConversationDeleteData,
|
|
23
|
-
TeamMemberJoinData,
|
|
24
|
-
TeamMemberLeaveData,
|
|
25
|
-
TeamUpdateData,
|
|
26
|
-
} from '@wireapp/api-client/src/team/data';
|
|
27
|
-
|
|
28
|
-
import type {BasePayloadBundle, PayloadBundleType} from './PayloadBundle';
|
|
29
|
-
|
|
30
|
-
export interface TeamConversationCreateMessage extends BasePayloadBundle {
|
|
31
|
-
content: TeamConversationCreateData;
|
|
32
|
-
type: PayloadBundleType.TEAM_CONVERSATION_CREATE;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface TeamMemberLeaveMessage extends BasePayloadBundle {
|
|
36
|
-
content: TeamMemberLeaveData;
|
|
37
|
-
type: PayloadBundleType.TEAM_MEMBER_LEAVE;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface TeamConversationDeleteMessage extends BasePayloadBundle {
|
|
41
|
-
content: TeamConversationDeleteData;
|
|
42
|
-
type: PayloadBundleType.TEAM_CONVERSATION_DELETE;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface TeamDeleteMessage extends BasePayloadBundle {
|
|
46
|
-
content: null;
|
|
47
|
-
type: PayloadBundleType.TEAM_DELETE;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface TeamMemberJoinMessage extends BasePayloadBundle {
|
|
51
|
-
content: TeamMemberJoinData;
|
|
52
|
-
type: PayloadBundleType.TEAM_MEMBER_JOIN;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface TeamMemberLeaveMesssage extends BasePayloadBundle {
|
|
56
|
-
content: TeamMemberLeaveData;
|
|
57
|
-
type: PayloadBundleType.TEAM_MEMBER_LEAVE;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface TeamUpdateMessage extends BasePayloadBundle {
|
|
61
|
-
content: TeamUpdateData;
|
|
62
|
-
type: PayloadBundleType.TEAM_UPDATE;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export type TeamMessage =
|
|
66
|
-
| TeamConversationCreateMessage
|
|
67
|
-
| TeamMemberLeaveMessage
|
|
68
|
-
| TeamConversationDeleteMessage
|
|
69
|
-
| TeamDeleteMessage
|
|
70
|
-
| TeamMemberJoinMessage
|
|
71
|
-
| TeamMemberLeaveMesssage
|
|
72
|
-
| TeamUpdateMessage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextContentBuilder.js","sourceRoot":"","sources":["TextContentBuilder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,qDAAsD;AACtD,wCAAkH;AAGlH,MAAa,kBAAkB;IAI7B,YAAY,aAA8C;QACxD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAsB,CAAC;IAC3D,CAAC;IAED,KAAK;QACH,IAAI,CAAC,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC1C,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,gBAAgB,CAAC,YAA2C;QAC1D,IAAI,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,QAA2B;QACtC,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,EAAE;YACpB,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAClC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,KAAsC;QAC9C,IAAI,KAAK,EAAE;YACT,IAAK,KAAsB,CAAC,eAAe,EAAE;gBAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAqB,CAAC;aAC5C;iBAAM;gBACL,MAAM,kBAAkB,GAAG,IAAI,iCAAkB,CAC9C,KAAyB,CAAC,OAAO,EACjC,KAAyB,CAAC,SAAS,CACrC,CAAC;gBACF,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,OAAO,EAAE,CAAC;gBAEvD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG;oBACnB,eAAe,EAAG,KAAyB,CAAC,EAAE;oBAC9C,mBAAmB,EAAE,IAAI,UAAU,CAAC,iBAAiB,CAAC;iBACvD,CAAC;aACH;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB,CAAC,uBAAuB,GAAG,KAAK;QAClD,IAAI,OAAO,uBAAuB,KAAK,WAAW,EAAE;YAClD,IAAI,CAAC,OAAO,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;SAChE;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mBAAmB,CAAC,eAAe,GAAG,yBAAe,CAAC,OAAO;QAC3D,IAAI,OAAO,eAAe,KAAK,WAAW,EAAE;YAC1C,IAAI,CAAC,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC;SAChD;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhED,gDAgEC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import {MessageHashService} from '../../cryptography';
|
|
21
|
-
import {LegalHoldStatus, LinkPreviewUploadedContent, MentionContent, QuoteContent, TextContent} from '../content';
|
|
22
|
-
import type {EditedTextMessage, TextMessage, QuotableMessage} from './OtrMessage';
|
|
23
|
-
|
|
24
|
-
export class TextContentBuilder {
|
|
25
|
-
private readonly content: TextContent;
|
|
26
|
-
private readonly payloadBundle: TextMessage | EditedTextMessage;
|
|
27
|
-
|
|
28
|
-
constructor(payloadBundle: TextMessage | EditedTextMessage) {
|
|
29
|
-
this.payloadBundle = payloadBundle;
|
|
30
|
-
this.content = this.payloadBundle.content as TextContent;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
build(): TextMessage | EditedTextMessage {
|
|
34
|
-
this.payloadBundle.content = this.content;
|
|
35
|
-
return this.payloadBundle;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
withLinkPreviews(linkPreviews?: LinkPreviewUploadedContent[]): TextContentBuilder {
|
|
39
|
-
if (linkPreviews?.length) {
|
|
40
|
-
this.content.linkPreviews = linkPreviews;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
withMentions(mentions?: MentionContent[]): TextContentBuilder {
|
|
47
|
-
if (mentions?.length) {
|
|
48
|
-
this.content.mentions = mentions;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
withQuote(quote?: QuotableMessage | QuoteContent): TextContentBuilder {
|
|
55
|
-
if (quote) {
|
|
56
|
-
if ((quote as QuoteContent).quotedMessageId) {
|
|
57
|
-
this.content.quote = quote as QuoteContent;
|
|
58
|
-
} else {
|
|
59
|
-
const messageHashService = new MessageHashService(
|
|
60
|
-
(quote as QuotableMessage).content,
|
|
61
|
-
(quote as QuotableMessage).timestamp,
|
|
62
|
-
);
|
|
63
|
-
const messageHashBuffer = messageHashService.getHash();
|
|
64
|
-
|
|
65
|
-
this.content.quote = {
|
|
66
|
-
quotedMessageId: (quote as QuotableMessage).id,
|
|
67
|
-
quotedMessageSha256: new Uint8Array(messageHashBuffer),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return this;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
withReadConfirmation(expectsReadConfirmation = false): TextContentBuilder {
|
|
76
|
-
if (typeof expectsReadConfirmation !== 'undefined') {
|
|
77
|
-
this.content.expectsReadConfirmation = expectsReadConfirmation;
|
|
78
|
-
}
|
|
79
|
-
return this;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
withLegalHoldStatus(legalHoldStatus = LegalHoldStatus.UNKNOWN): TextContentBuilder {
|
|
83
|
-
if (typeof legalHoldStatus !== 'undefined') {
|
|
84
|
-
this.content.legalHoldStatus = legalHoldStatus;
|
|
85
|
-
}
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserClientsUtil.js","sourceRoot":"","sources":["UserClientsUtil.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAOH,SAAgB,kBAAkB,CAChC,WAAoC,EACpC,SAAiB,EAAE;IAEnB,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,EAAC,CAAC,CAAC,CAAC;AACzF,CAAC;AALD,gDAKC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CACzC,WAA6C;IAE7C,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE;QACvE,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,kBAAkB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9D,CAAC,EAAE,EAAsC,CAAC,CAAC;AAC7C,CAAC;AAND,kEAMC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2021 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import {QualifiedId} from '@wireapp/api-client/src/user';
|
|
21
|
-
|
|
22
|
-
type UserClientsContainer<T> = {[userId: string]: T};
|
|
23
|
-
type QualifiedUserClientsContainer<T> = {[domain: string]: UserClientsContainer<T>};
|
|
24
|
-
|
|
25
|
-
export function flattenUserClients<T>(
|
|
26
|
-
userClients: UserClientsContainer<T>,
|
|
27
|
-
domain: string = '',
|
|
28
|
-
): {data: T; userId: QualifiedId}[] {
|
|
29
|
-
return Object.entries(userClients).map(([id, data]) => ({data, userId: {domain, id}}));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Will flatten a container of users=>clients infos to an array
|
|
34
|
-
*
|
|
35
|
-
* @param userClients The UserClients (qualified or not) to flatten
|
|
36
|
-
* @return An array containing the qualified user Ids and the clients info
|
|
37
|
-
*/
|
|
38
|
-
export function flattenQualifiedUserClients<T = unknown>(
|
|
39
|
-
userClients: QualifiedUserClientsContainer<T>,
|
|
40
|
-
): {data: T; userId: QualifiedId}[] {
|
|
41
|
-
return Object.entries(userClients).reduce((ids, [domain, userClients]) => {
|
|
42
|
-
return [...ids, ...flattenUserClients(userClients, domain)];
|
|
43
|
-
}, [] as {data: T; userId: QualifiedId}[]);
|
|
44
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2021 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
|
-
const UserClientsUtil_1 = require("./UserClientsUtil");
|
|
22
|
-
describe('userClientsUtils', () => {
|
|
23
|
-
it('extracts user and data info from qualified payload', () => {
|
|
24
|
-
const payload = { domain1: { user1: ['client1'], user2: ['client11'] }, domain2: { user3: ['client1', 'client2'] } };
|
|
25
|
-
const expected = [
|
|
26
|
-
{ data: ['client1'], userId: { domain: 'domain1', id: 'user1' } },
|
|
27
|
-
{ data: ['client11'], userId: { domain: 'domain1', id: 'user2' } },
|
|
28
|
-
{ data: ['client1', 'client2'], userId: { domain: 'domain2', id: 'user3' } },
|
|
29
|
-
];
|
|
30
|
-
expect((0, UserClientsUtil_1.flattenQualifiedUserClients)(payload)).toEqual(expected);
|
|
31
|
-
});
|
|
32
|
-
it('extracts user and data info from non-qualified payload', () => {
|
|
33
|
-
const payload = { user1: ['client1'], user2: ['client11'], user3: ['client1', 'client2'] };
|
|
34
|
-
const expected = [
|
|
35
|
-
{ data: ['client1'], userId: { domain: '', id: 'user1' } },
|
|
36
|
-
{ data: ['client11'], userId: { domain: '', id: 'user2' } },
|
|
37
|
-
{ data: ['client1', 'client2'], userId: { domain: '', id: 'user3' } },
|
|
38
|
-
];
|
|
39
|
-
expect((0, UserClientsUtil_1.flattenUserClients)(payload)).toEqual(expected);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=UserClientsUtils.test.node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserClientsUtils.test.node.js","sourceRoot":"","sources":["UserClientsUtils.test.node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAEH,uDAAkF;AAElF,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,OAAO,GAAG,EAAC,OAAO,EAAE,EAAC,KAAK,EAA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,EAAE,EAAE,EAAE,EAAE,OAAO,EAAC,EAAC;SAClE,CAAC;QAEF,MAAM,CAAC,IAAA,oCAAkB,EAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2021 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import {flattenQualifiedUserClients, flattenUserClients} from './UserClientsUtil';
|
|
21
|
-
|
|
22
|
-
describe('userClientsUtils', () => {
|
|
23
|
-
it('extracts user and data info from qualified payload', () => {
|
|
24
|
-
const payload = {domain1: {user1: ['client1'], user2: ['client11']}, domain2: {user3: ['client1', 'client2']}};
|
|
25
|
-
const expected = [
|
|
26
|
-
{data: ['client1'], userId: {domain: 'domain1', id: 'user1'}},
|
|
27
|
-
{data: ['client11'], userId: {domain: 'domain1', id: 'user2'}},
|
|
28
|
-
{data: ['client1', 'client2'], userId: {domain: 'domain2', id: 'user3'}},
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
expect(flattenQualifiedUserClients(payload)).toEqual(expected);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('extracts user and data info from non-qualified payload', () => {
|
|
35
|
-
const payload = {user1: ['client1'], user2: ['client11'], user3: ['client1', 'client2']};
|
|
36
|
-
const expected = [
|
|
37
|
-
{data: ['client1'], userId: {domain: '', id: 'user1'}},
|
|
38
|
-
{data: ['client11'], userId: {domain: '', id: 'user2'}},
|
|
39
|
-
{data: ['client1', 'client2'], userId: {domain: '', id: 'user3'}},
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
expect(flattenUserClients(payload)).toEqual(expected);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserMessage.js","sourceRoot":"","sources":["UserMessage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2019 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import type {
|
|
21
|
-
UserActivateData,
|
|
22
|
-
UserClientAddData,
|
|
23
|
-
UserClientRemoveData,
|
|
24
|
-
UserConnectionData,
|
|
25
|
-
UserDeleteData,
|
|
26
|
-
UserLegalHoldDisableData,
|
|
27
|
-
UserLegalHoldEnableData,
|
|
28
|
-
UserLegalHoldRequestData,
|
|
29
|
-
UserPropertiesSetData,
|
|
30
|
-
UserUpdateData,
|
|
31
|
-
} from '@wireapp/api-client/src/user/data';
|
|
32
|
-
|
|
33
|
-
import type {BasePayloadBundle, PayloadBundleType} from './PayloadBundle';
|
|
34
|
-
|
|
35
|
-
export interface UserActivateMessage extends BasePayloadBundle {
|
|
36
|
-
content: UserActivateData;
|
|
37
|
-
type: PayloadBundleType.USER_ACTIVATE;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface UserClientAddMessage extends BasePayloadBundle {
|
|
41
|
-
content: UserClientAddData;
|
|
42
|
-
type: PayloadBundleType.USER_CLIENT_ADD;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface UserLegalHoldRequestMessage extends BasePayloadBundle {
|
|
46
|
-
content: UserLegalHoldRequestData;
|
|
47
|
-
type: PayloadBundleType.USER_LEGAL_HOLD_REQUEST;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface UserLegalHoldEnableMessage extends BasePayloadBundle {
|
|
51
|
-
content: UserLegalHoldEnableData;
|
|
52
|
-
type: PayloadBundleType.USER_LEGAL_HOLD_ENABLE;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface UserLegalHoldDisableMessage extends BasePayloadBundle {
|
|
56
|
-
content: UserLegalHoldDisableData;
|
|
57
|
-
type: PayloadBundleType.USER_LEGAL_HOLD_DISABLE;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface UserClientRemoveMessage extends BasePayloadBundle {
|
|
61
|
-
content: UserClientRemoveData;
|
|
62
|
-
type: PayloadBundleType.USER_CLIENT_REMOVE;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface UserConnectionMessage extends BasePayloadBundle {
|
|
66
|
-
content: UserConnectionData;
|
|
67
|
-
type: PayloadBundleType.USER_CONNECTION;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface UserDeleteMessage extends BasePayloadBundle {
|
|
71
|
-
content: UserDeleteData;
|
|
72
|
-
type: PayloadBundleType.USER_DELETE;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface UserPropertiesSetEvent extends BasePayloadBundle {
|
|
76
|
-
content: UserPropertiesSetData;
|
|
77
|
-
type: PayloadBundleType.USER_PROPERTIES_SET;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface UserUpdateMessage extends BasePayloadBundle {
|
|
81
|
-
content: UserUpdateData;
|
|
82
|
-
type: PayloadBundleType.USER_UPDATE;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type UserMessage =
|
|
86
|
-
| UserActivateMessage
|
|
87
|
-
| UserClientAddMessage
|
|
88
|
-
| UserLegalHoldRequestMessage
|
|
89
|
-
| UserLegalHoldEnableMessage
|
|
90
|
-
| UserLegalHoldDisableMessage
|
|
91
|
-
| UserClientRemoveMessage
|
|
92
|
-
| UserConnectionMessage
|
|
93
|
-
| UserDeleteMessage
|
|
94
|
-
| UserPropertiesSetEvent
|
|
95
|
-
| UserUpdateMessage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AssetCryptography.browser.js","sourceRoot":"","sources":["AssetCryptography.browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAGH,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,CAAC;AAExB,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,CAAS,EAAW,EAAE;IAChD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;IAElC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC;IACtD,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAA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-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import type {EncryptedAsset} from '../cryptography/';
|
|
21
|
-
const {crypto} = window;
|
|
22
|
-
|
|
23
|
-
const isEqual = (a: Buffer, b: Buffer): boolean => {
|
|
24
|
-
const arrayA = new Uint32Array(a);
|
|
25
|
-
const arrayB = new Uint32Array(b);
|
|
26
|
-
|
|
27
|
-
const hasSameLength = arrayA.length === arrayB.length;
|
|
28
|
-
const hasSameValues = arrayA.every((value, index) => value === arrayB[index]);
|
|
29
|
-
|
|
30
|
-
return hasSameLength && hasSameValues;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const decryptAsset = async ({
|
|
34
|
-
cipherText,
|
|
35
|
-
keyBytes,
|
|
36
|
-
sha256: referenceSha256,
|
|
37
|
-
}: EncryptedAsset): Promise<Buffer> => {
|
|
38
|
-
const computedSha256 = await crypto.subtle.digest('SHA-256', cipherText);
|
|
39
|
-
|
|
40
|
-
if (!isEqual(Buffer.from(computedSha256), referenceSha256)) {
|
|
41
|
-
throw new Error('Encrypted asset does not match its SHA-256 hash');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const key = await crypto.subtle.importKey('raw', keyBytes, 'AES-CBC', false, ['decrypt']);
|
|
45
|
-
|
|
46
|
-
const initializationVector = cipherText.slice(0, 16);
|
|
47
|
-
const assetCipherText = cipherText.slice(16);
|
|
48
|
-
const decipher = await crypto.subtle.decrypt({iv: initializationVector, name: 'AES-CBC'}, key, assetCipherText);
|
|
49
|
-
|
|
50
|
-
return Buffer.from(decipher);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const encryptAsset = async (options: {plaintext: ArrayBuffer}): Promise<EncryptedAsset> => {
|
|
54
|
-
const initializationVector = crypto.getRandomValues(new Uint8Array(16));
|
|
55
|
-
const rawKeyBytes = crypto.getRandomValues(new Uint8Array(32));
|
|
56
|
-
|
|
57
|
-
const key = await crypto.subtle.importKey('raw', rawKeyBytes.buffer, 'AES-CBC', true, ['encrypt']);
|
|
58
|
-
const cipherText = await crypto.subtle.encrypt(
|
|
59
|
-
{iv: initializationVector.buffer, name: 'AES-CBC'},
|
|
60
|
-
key,
|
|
61
|
-
options.plaintext,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const ivCipherText = new Uint8Array(cipherText.byteLength + initializationVector.byteLength);
|
|
65
|
-
ivCipherText.set(initializationVector, 0);
|
|
66
|
-
ivCipherText.set(new Uint8Array(cipherText), initializationVector.byteLength);
|
|
67
|
-
|
|
68
|
-
const computedSha256 = await crypto.subtle.digest('SHA-256', ivCipherText);
|
|
69
|
-
const keyBytes = await crypto.subtle.exportKey('raw', key);
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
cipherText: Buffer.from(ivCipherText.buffer),
|
|
73
|
-
keyBytes: Buffer.from(keyBytes),
|
|
74
|
-
sha256: Buffer.from(computedSha256),
|
|
75
|
-
};
|
|
76
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AssetCryptography.node.js","sourceRoot":"","sources":["AssetCryptography.node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;AAGH,+CAAiC;AAQjC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,CAAS,EAAW,EAAE;IAChD,MAAM,MAAM,GAAG,IAAI,WAAW,CAA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