@wireapp/core 31.1.3 → 31.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -8
- package/src/main/Account.d.ts +214 -0
- package/src/main/Account.js +463 -0
- package/src/main/CoreError.d.ts +9 -0
- package/src/main/CoreError.js +26 -0
- package/src/main/account/AccountService.d.ts +7 -0
- package/src/main/account/AccountService.js +33 -0
- package/src/main/account/AccountService.js.map +1 -0
- package/src/main/account/index.d.ts +1 -0
- package/src/main/account/index.js +36 -0
- package/src/main/account/index.js.map +1 -0
- package/src/main/auth/LoginSanitizer.d.ts +5 -0
- package/src/main/auth/LoginSanitizer.js +41 -0
- package/src/main/auth/index.d.ts +1 -0
- package/src/main/auth/index.js +36 -0
- package/src/main/broadcast/AvailabilityType.d.ts +2 -0
- package/src/main/broadcast/AvailabilityType.js +21 -0
- package/src/main/broadcast/BroadcastService.d.ts +24 -0
- package/src/main/broadcast/BroadcastService.js +74 -0
- package/src/main/broadcast/index.d.ts +2 -0
- package/src/main/broadcast/index.js +37 -0
- package/src/main/client/ClientBackendRepository.d.ts +11 -0
- package/src/main/client/ClientBackendRepository.js +43 -0
- package/src/main/client/ClientDatabaseRepository.d.ts +27 -0
- package/src/main/client/ClientDatabaseRepository.js +85 -0
- package/src/main/client/ClientInfo.d.ts +8 -0
- package/src/main/client/ClientInfo.js +21 -0
- package/src/main/client/ClientService.d.ts +40 -0
- package/src/main/client/ClientService.js +103 -0
- package/src/main/client/index.d.ts +4 -0
- package/src/main/client/index.js +39 -0
- package/src/main/connection/ConnectionService.d.ts +11 -0
- package/src/main/connection/ConnectionService.js +45 -0
- package/src/main/connection/index.d.ts +1 -0
- package/src/main/connection/index.js +36 -0
- package/src/main/conversation/AbortReason.d.ts +2 -0
- package/src/main/conversation/AbortReason.js +21 -0
- package/src/main/conversation/AssetService/AssetService.d.ts +62 -0
- package/src/main/conversation/AssetService/AssetService.js +88 -0
- package/src/main/conversation/AssetService/index.d.ts +1 -0
- package/src/main/conversation/AssetService/index.js +36 -0
- package/src/main/conversation/AssetTransferState.d.ts +4 -0
- package/src/main/conversation/AssetTransferState.js +27 -0
- package/src/main/conversation/ClientActionType.d.ts +1 -0
- package/src/main/conversation/ClientActionType.js +24 -0
- package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +6 -0
- package/src/main/conversation/ConversationMapper/ConversationMapper.js +57 -0
- package/src/main/conversation/ConversationMapper/index.d.ts +1 -0
- package/src/main/conversation/ConversationMapper/index.js +36 -0
- package/src/main/conversation/ConversationService/ConversationService.d.ts +149 -0
- package/src/main/conversation/ConversationService/ConversationService.js +584 -0
- package/src/main/conversation/ConversationService/ConversationService.types.d.ts +110 -0
- package/src/main/conversation/ConversationService/ConversationService.types.js +28 -0
- package/src/main/conversation/ConversationService/index.d.ts +2 -0
- package/src/main/conversation/ConversationService/index.js +37 -0
- package/src/main/conversation/ConversationService/messageGenerator.d.ts +9 -0
- package/src/main/conversation/ConversationService/messageGenerator.js +313 -0
- package/src/main/conversation/GenericMessageType.d.ts +25 -0
- package/src/main/conversation/GenericMessageType.js +49 -0
- package/src/main/conversation/MessageTimer/MessageTimer.d.ts +10 -0
- package/src/main/conversation/MessageTimer/MessageTimer.js +54 -0
- package/src/main/conversation/MessageTimer/index.d.ts +1 -0
- package/src/main/conversation/MessageTimer/index.js +36 -0
- package/src/main/conversation/ReactionType.d.ts +4 -0
- package/src/main/conversation/ReactionType.js +27 -0
- package/src/main/conversation/content/AssetContent.d.ts +42 -0
- package/src/main/conversation/content/AssetContent.js +21 -0
- package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +2 -0
- package/src/main/conversation/content/ButtonActionConfirmationContent.js +21 -0
- package/src/main/conversation/content/ButtonActionContent.d.ts +2 -0
- package/src/main/conversation/content/ButtonActionContent.js +21 -0
- package/src/main/conversation/content/CallingContent.d.ts +1 -0
- package/src/main/conversation/content/CallingContent.js +21 -0
- package/src/main/conversation/content/ClearedContent.d.ts +2 -0
- package/src/main/conversation/content/ClearedContent.js +21 -0
- package/src/main/conversation/content/ClientActionContent.d.ts +2 -0
- package/src/main/conversation/content/ClientActionContent.js +21 -0
- package/src/main/conversation/content/ClientAddContent.d.ts +4 -0
- package/src/main/conversation/content/ClientAddContent.js +21 -0
- package/src/main/conversation/content/ClientRemoveContent.d.ts +6 -0
- package/src/main/conversation/content/ClientRemoveContent.js +21 -0
- package/src/main/conversation/content/CompositeContent.d.ts +2 -0
- package/src/main/conversation/content/CompositeContent.js +21 -0
- package/src/main/conversation/content/ConfirmationContent.d.ts +2 -0
- package/src/main/conversation/content/ConfirmationContent.js +21 -0
- package/src/main/conversation/content/ContentType.d.ts +21 -0
- package/src/main/conversation/content/ContentType.js +94 -0
- package/src/main/conversation/content/ConversationContent.d.ts +3 -0
- package/src/main/conversation/content/ConversationContent.js +21 -0
- package/src/main/conversation/content/DeletedContent.d.ts +2 -0
- package/src/main/conversation/content/DeletedContent.js +21 -0
- package/src/main/conversation/content/EditedTextContent.d.ts +11 -0
- package/src/main/conversation/content/EditedTextContent.js +21 -0
- package/src/main/conversation/content/FileContent.d.ts +13 -0
- package/src/main/conversation/content/FileContent.js +21 -0
- package/src/main/conversation/content/HiddenContent.d.ts +2 -0
- package/src/main/conversation/content/HiddenContent.js +21 -0
- package/src/main/conversation/content/ImageContent.d.ts +7 -0
- package/src/main/conversation/content/ImageContent.js +21 -0
- package/src/main/conversation/content/KnockContent.d.ts +2 -0
- package/src/main/conversation/content/KnockContent.js +21 -0
- package/src/main/conversation/content/LinkPreviewContent.d.ts +10 -0
- package/src/main/conversation/content/LinkPreviewContent.js +21 -0
- package/src/main/conversation/content/LocationContent.d.ts +9 -0
- package/src/main/conversation/content/LocationContent.js +21 -0
- package/src/main/conversation/content/MentionContent.d.ts +2 -0
- package/src/main/conversation/content/MentionContent.js +21 -0
- package/src/main/conversation/content/QuoteContent.d.ts +7 -0
- package/src/main/conversation/content/QuoteContent.js +21 -0
- package/src/main/conversation/content/ReactionContent.d.ts +7 -0
- package/src/main/conversation/content/ReactionContent.js +21 -0
- package/src/main/conversation/content/TextContent.d.ts +9 -0
- package/src/main/conversation/content/TextContent.js +21 -0
- package/src/main/conversation/content/TweetContent.d.ts +2 -0
- package/src/main/conversation/content/TweetContent.js +21 -0
- package/src/main/conversation/content/index.d.ts +28 -0
- package/src/main/conversation/content/index.js +76 -0
- package/src/main/conversation/index.d.ts +9 -0
- package/src/main/conversation/index.js +44 -0
- package/src/main/conversation/message/CompositeContentBuilder.d.ts +14 -0
- package/src/main/conversation/message/CompositeContentBuilder.js +54 -0
- package/src/main/conversation/message/Message.d.ts +4 -0
- package/src/main/conversation/message/Message.js +21 -0
- package/src/main/conversation/message/MessageBuilder.d.ts +96 -0
- package/src/main/conversation/message/MessageBuilder.js +125 -0
- package/src/main/conversation/message/MessageService.d.ts +67 -0
- package/src/main/conversation/message/MessageService.js +293 -0
- package/src/main/conversation/message/MessageToProtoMapper.d.ts +7 -0
- package/src/main/conversation/message/MessageToProtoMapper.js +99 -0
- package/src/main/conversation/message/OtrMessage.d.ts +80 -0
- package/src/main/conversation/message/OtrMessage.js +21 -0
- package/src/main/conversation/message/PayloadBundle.d.ts +76 -0
- package/src/main/conversation/message/PayloadBundle.js +81 -0
- package/src/main/conversation/message/TeamMessage.d.ts +31 -0
- package/src/main/conversation/message/TeamMessage.js +21 -0
- package/src/main/conversation/message/TextContentBuilder.d.ts +13 -0
- package/src/main/conversation/message/TextContentBuilder.js +75 -0
- package/src/main/conversation/message/UserClientsUtil.d.ts +22 -0
- package/src/main/conversation/message/UserClientsUtil.js +38 -0
- package/src/main/conversation/message/UserMessage.d.ts +43 -0
- package/src/main/conversation/message/UserMessage.js +21 -0
- package/src/main/conversation/message/messageSender.d.ts +4 -0
- package/src/main/conversation/message/messageSender.js +36 -0
- package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +11 -0
- package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +21 -0
- package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +2 -0
- package/src/main/cryptography/AssetCryptography/crypto.browser.js +46 -0
- package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +2 -0
- package/src/main/cryptography/AssetCryptography/crypto.node.js +72 -0
- package/src/main/cryptography/AssetCryptography/index.d.ts +8 -0
- package/src/main/cryptography/AssetCryptography/index.js +53 -0
- package/src/main/cryptography/AssetCryptography/interfaces.d.ts +9 -0
- package/src/main/cryptography/AssetCryptography/interfaces.js +21 -0
- package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +16 -0
- package/src/main/cryptography/CryptographyDatabaseRepository.js +44 -0
- package/src/main/cryptography/CryptographyService.d.ts +52 -0
- package/src/main/cryptography/CryptographyService.js +205 -0
- package/src/main/cryptography/GenericMessageMapper.d.ts +6 -0
- package/src/main/cryptography/GenericMessageMapper.js +160 -0
- package/src/main/cryptography/MessageHashService.d.ts +16 -0
- package/src/main/cryptography/MessageHashService.js +118 -0
- package/src/main/cryptography/SessionPayloadBundle.d.ts +4 -0
- package/src/main/cryptography/SessionPayloadBundle.js +21 -0
- package/src/main/cryptography/index.d.ts +4 -0
- package/src/main/cryptography/index.js +39 -0
- package/src/main/giphy/GiphyService.d.ts +9 -0
- package/src/main/giphy/GiphyService.js +37 -0
- package/src/main/giphy/index.d.ts +1 -0
- package/src/main/giphy/index.js +36 -0
- package/src/main/index.d.ts +17 -0
- package/src/main/index.js +59 -0
- package/src/main/linkPreview/LinkPreviewService.d.ts +7 -0
- package/src/main/linkPreview/LinkPreviewService.js +52 -0
- package/src/main/linkPreview/index.d.ts +1 -0
- package/src/main/linkPreview/index.js +36 -0
- package/src/main/mls/MLSService/MLSService.d.ts +39 -0
- package/src/main/mls/MLSService/MLSService.js +181 -0
- package/src/main/mls/index.d.ts +1 -0
- package/src/main/mls/index.js +36 -0
- package/src/main/mls/keyMaterialUpdatesStore/index.d.ts +1 -0
- package/src/main/mls/keyMaterialUpdatesStore/index.js +36 -0
- package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +9 -0
- package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +51 -0
- package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.d.ts +7 -0
- package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.js +42 -0
- package/src/main/mls/types.d.ts +33 -0
- package/src/main/mls/types.js +21 -0
- package/src/main/notification/NotificationBackendRepository.d.ts +11 -0
- package/src/main/notification/NotificationBackendRepository.js +34 -0
- package/src/main/notification/NotificationDatabaseRepository.d.ts +42 -0
- package/src/main/notification/NotificationDatabaseRepository.js +97 -0
- package/src/main/notification/NotificationService.d.ts +129 -0
- package/src/main/notification/NotificationService.js +501 -0
- package/src/main/notification/index.d.ts +1 -0
- package/src/main/notification/index.js +36 -0
- package/src/main/notification/types.d.ts +16 -0
- package/src/main/notification/types.js +21 -0
- package/src/main/self/SelfService.d.ts +13 -0
- package/src/main/self/SelfService.js +55 -0
- package/src/main/self/index.d.ts +1 -0
- package/src/main/self/index.js +36 -0
- package/src/main/team/TeamService.d.ts +15 -0
- package/src/main/team/TeamService.js +55 -0
- package/src/main/team/index.d.ts +1 -0
- package/src/main/team/index.js +36 -0
- package/src/main/test/CryptographyHelper.d.ts +4 -0
- package/src/main/test/CryptographyHelper.js +69 -0
- package/src/main/test/PayloadHelper.d.ts +3 -0
- package/src/main/test/PayloadHelper.js +66 -0
- package/src/main/user/UserMapper.d.ts +5 -0
- package/src/main/user/UserMapper.js +88 -0
- package/src/main/user/UserService.d.ts +25 -0
- package/src/main/user/UserService.js +81 -0
- package/src/main/user/index.d.ts +1 -0
- package/src/main/user/index.js +36 -0
- package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts +21 -0
- package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +62 -0
- package/src/main/util/TaskScheduler/TaskScheduler.d.ts +10 -0
- package/src/main/util/TaskScheduler/TaskScheduler.js +70 -0
- package/src/main/util/TypePredicateUtil.d.ts +7 -0
- package/src/main/util/TypePredicateUtil.js +55 -0
- package/src/main/util/encryptedStore.d.ts +45 -0
- package/src/main/util/encryptedStore.js +116 -0
- package/src/main/util/fullyQualifiedClientIdUtils.d.ts +13 -0
- package/src/main/util/fullyQualifiedClientIdUtils.js +42 -0
- package/src/main/util/index.d.ts +1 -0
- package/src/main/util/index.js +36 -0
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./LoginSanitizer"), exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
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=AvailabilityType.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { ClientMismatch, MessageSendingStatus, QualifiedUserClients, UserClients } from '@wireapp/api-client/src/conversation';
|
|
3
|
+
import { UserPreKeyBundleMap } from '@wireapp/api-client/src/user/';
|
|
4
|
+
import { GenericMessage } from '@wireapp/protocol-messaging';
|
|
5
|
+
import { CryptographyService } from '../cryptography/';
|
|
6
|
+
export declare class BroadcastService {
|
|
7
|
+
private readonly apiClient;
|
|
8
|
+
private readonly cryptographyService;
|
|
9
|
+
private readonly messageService;
|
|
10
|
+
constructor(apiClient: APIClient, cryptographyService: CryptographyService);
|
|
11
|
+
/**
|
|
12
|
+
* Will create a key bundle for all the users of the team
|
|
13
|
+
*
|
|
14
|
+
* @param teamId
|
|
15
|
+
* @param skipOwnClients=false
|
|
16
|
+
* @param onlyDirectConnections=false Will generate a bundle only for directly connected users (users the self user has conversation with). Allows avoiding broadcasting messages to too many people
|
|
17
|
+
*/
|
|
18
|
+
getPreKeyBundlesFromTeam(teamId: string, skipOwnClients?: boolean, onlyDirectConnections?: boolean): Promise<UserPreKeyBundleMap>;
|
|
19
|
+
broadcastGenericMessage(genericMessage: GenericMessage, recipients: UserPreKeyBundleMap | UserClients | QualifiedUserClients, sendAsProtobuf?: boolean, onClientMismatch?: (mismatch: ClientMismatch | MessageSendingStatus) => void | boolean | Promise<boolean>): Promise<(MessageSendingStatus & {
|
|
20
|
+
errored?: boolean | undefined;
|
|
21
|
+
}) | (ClientMismatch & {
|
|
22
|
+
errored?: boolean | undefined;
|
|
23
|
+
})>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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.BroadcastService = void 0;
|
|
22
|
+
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
23
|
+
const MessageService_1 = require("../conversation/message/MessageService");
|
|
24
|
+
const UserClientsUtil_1 = require("../conversation/message/UserClientsUtil");
|
|
25
|
+
const util_1 = require("../util");
|
|
26
|
+
class BroadcastService {
|
|
27
|
+
constructor(apiClient, cryptographyService) {
|
|
28
|
+
this.apiClient = apiClient;
|
|
29
|
+
this.cryptographyService = cryptographyService;
|
|
30
|
+
this.messageService = new MessageService_1.MessageService(this.apiClient, this.cryptographyService);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Will create a key bundle for all the users of the team
|
|
34
|
+
*
|
|
35
|
+
* @param teamId
|
|
36
|
+
* @param skipOwnClients=false
|
|
37
|
+
* @param onlyDirectConnections=false Will generate a bundle only for directly connected users (users the self user has conversation with). Allows avoiding broadcasting messages to too many people
|
|
38
|
+
*/
|
|
39
|
+
async getPreKeyBundlesFromTeam(teamId, skipOwnClients = false, onlyDirectConnections = false) {
|
|
40
|
+
const teamMembers = onlyDirectConnections
|
|
41
|
+
? (await this.apiClient.api.conversation.getConversations()).conversations
|
|
42
|
+
.map(({ members }) => members.others.map(user => user.id).concat(members.self.id))
|
|
43
|
+
.flat()
|
|
44
|
+
: (await this.apiClient.api.teams.member.getAllMembers(teamId)).members.map(({ user }) => user);
|
|
45
|
+
let members = Array.from(new Set(teamMembers)).map(member => ({ id: member }));
|
|
46
|
+
if (skipOwnClients) {
|
|
47
|
+
const selfUser = await this.apiClient.api.self.getSelf();
|
|
48
|
+
members = members.filter(member => member.id !== selfUser.id);
|
|
49
|
+
}
|
|
50
|
+
const preKeys = await Promise.all(members.map(member => this.apiClient.api.user.getUserPreKeys(member.id)));
|
|
51
|
+
return preKeys.reduce((bundleMap, bundle) => {
|
|
52
|
+
bundleMap[bundle.user] = {};
|
|
53
|
+
for (const client of bundle.clients) {
|
|
54
|
+
bundleMap[bundle.user][client.client] = client.prekey;
|
|
55
|
+
}
|
|
56
|
+
return bundleMap;
|
|
57
|
+
}, {});
|
|
58
|
+
}
|
|
59
|
+
async broadcastGenericMessage(genericMessage, recipients, sendAsProtobuf, onClientMismatch) {
|
|
60
|
+
const plainTextArray = protocol_messaging_1.GenericMessage.encode(genericMessage).finish();
|
|
61
|
+
return (0, util_1.isQualifiedUserClients)(recipients)
|
|
62
|
+
? this.messageService.sendFederatedMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
|
|
63
|
+
reportMissing: (0, UserClientsUtil_1.flattenQualifiedUserClients)(recipients).map(({ userId }) => userId),
|
|
64
|
+
onClientMismatch,
|
|
65
|
+
})
|
|
66
|
+
: this.messageService.sendMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
|
|
67
|
+
sendAsProtobuf,
|
|
68
|
+
reportMissing: Object.keys(recipients),
|
|
69
|
+
onClientMismatch,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.BroadcastService = BroadcastService;
|
|
74
|
+
//# sourceMappingURL=BroadcastService.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./AvailabilityType"), exports);
|
|
36
|
+
__exportStar(require("./BroadcastService"), exports);
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { CreateClientPayload, RegisteredClient, UpdateClientPayload } from '@wireapp/api-client/src/client/';
|
|
3
|
+
export declare class ClientBackendRepository {
|
|
4
|
+
private readonly apiClient;
|
|
5
|
+
constructor(apiClient: APIClient);
|
|
6
|
+
getClients(): Promise<RegisteredClient[]>;
|
|
7
|
+
postClient(client: CreateClientPayload): Promise<RegisteredClient>;
|
|
8
|
+
putClient(clientId: string, updates: UpdateClientPayload): Promise<void>;
|
|
9
|
+
deleteClient(clientId: string, password?: string): Promise<void>;
|
|
10
|
+
uploadMLSKeyPackages(clientId: string, keyPackages: string[]): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.ClientBackendRepository = void 0;
|
|
22
|
+
class ClientBackendRepository {
|
|
23
|
+
constructor(apiClient) {
|
|
24
|
+
this.apiClient = apiClient;
|
|
25
|
+
}
|
|
26
|
+
getClients() {
|
|
27
|
+
return this.apiClient.api.client.getClients();
|
|
28
|
+
}
|
|
29
|
+
postClient(client) {
|
|
30
|
+
return this.apiClient.api.client.postClient(client);
|
|
31
|
+
}
|
|
32
|
+
putClient(clientId, updates) {
|
|
33
|
+
return this.apiClient.api.client.putClient(clientId, updates);
|
|
34
|
+
}
|
|
35
|
+
deleteClient(clientId, password) {
|
|
36
|
+
return this.apiClient.api.client.deleteClient(clientId, password);
|
|
37
|
+
}
|
|
38
|
+
uploadMLSKeyPackages(clientId, keyPackages) {
|
|
39
|
+
return this.apiClient.api.client.uploadMLSKeyPackages(clientId, keyPackages);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.ClientBackendRepository = ClientBackendRepository;
|
|
43
|
+
//# sourceMappingURL=ClientBackendRepository.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RegisteredClient } from '@wireapp/api-client/src/client/';
|
|
2
|
+
import { CRUDEngine } from '@wireapp/store-engine';
|
|
3
|
+
import { CryptographyService } from '../cryptography/';
|
|
4
|
+
import { MetaClient } from './ClientService';
|
|
5
|
+
export declare enum DatabaseStores {
|
|
6
|
+
CLIENTS = "clients"
|
|
7
|
+
}
|
|
8
|
+
export declare class ClientDatabaseRepository {
|
|
9
|
+
private readonly storeEngine;
|
|
10
|
+
private readonly cryptographyService;
|
|
11
|
+
static readonly STORES: typeof DatabaseStores;
|
|
12
|
+
static KEYS: {
|
|
13
|
+
LOCAL_IDENTITY: string;
|
|
14
|
+
};
|
|
15
|
+
constructor(storeEngine: CRUDEngine, cryptographyService: CryptographyService);
|
|
16
|
+
getLocalClient(): Promise<MetaClient>;
|
|
17
|
+
getClient(sessionId: string): Promise<MetaClient>;
|
|
18
|
+
deleteLocalClient(): Promise<string>;
|
|
19
|
+
deleteClient(sessionId: string): Promise<string>;
|
|
20
|
+
createClientList(userId: string, clientList: RegisteredClient[], domain?: string): Promise<MetaClient[]>;
|
|
21
|
+
createLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
|
|
22
|
+
updateLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
|
|
23
|
+
updateClient(userId: string, client: RegisteredClient, domain?: string): Promise<MetaClient>;
|
|
24
|
+
createClient(userId: string, client: RegisteredClient, domain?: string): Promise<MetaClient>;
|
|
25
|
+
private transformClient;
|
|
26
|
+
private transformLocalClient;
|
|
27
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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.ClientDatabaseRepository = exports.DatabaseStores = void 0;
|
|
22
|
+
var DatabaseStores;
|
|
23
|
+
(function (DatabaseStores) {
|
|
24
|
+
DatabaseStores["CLIENTS"] = "clients";
|
|
25
|
+
})(DatabaseStores = exports.DatabaseStores || (exports.DatabaseStores = {}));
|
|
26
|
+
class ClientDatabaseRepository {
|
|
27
|
+
constructor(storeEngine, cryptographyService) {
|
|
28
|
+
this.storeEngine = storeEngine;
|
|
29
|
+
this.cryptographyService = cryptographyService;
|
|
30
|
+
}
|
|
31
|
+
getLocalClient() {
|
|
32
|
+
return this.getClient(ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
|
|
33
|
+
}
|
|
34
|
+
getClient(sessionId) {
|
|
35
|
+
return this.storeEngine.read(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
|
|
36
|
+
}
|
|
37
|
+
deleteLocalClient() {
|
|
38
|
+
return this.deleteClient(ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
|
|
39
|
+
}
|
|
40
|
+
deleteClient(sessionId) {
|
|
41
|
+
return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
|
|
42
|
+
}
|
|
43
|
+
createClientList(userId, clientList, domain) {
|
|
44
|
+
const createClientTasks = [];
|
|
45
|
+
for (const client of clientList) {
|
|
46
|
+
createClientTasks.push(this.createClient(userId, client, domain));
|
|
47
|
+
}
|
|
48
|
+
return Promise.all(createClientTasks);
|
|
49
|
+
}
|
|
50
|
+
async createLocalClient(client, domain) {
|
|
51
|
+
const transformedClient = this.transformLocalClient(client, domain);
|
|
52
|
+
await this.storeEngine.create(ClientDatabaseRepository.STORES.CLIENTS, ClientDatabaseRepository.KEYS.LOCAL_IDENTITY, transformedClient);
|
|
53
|
+
return transformedClient;
|
|
54
|
+
}
|
|
55
|
+
async updateLocalClient(client, domain) {
|
|
56
|
+
const transformedClient = this.transformLocalClient(client, domain);
|
|
57
|
+
await this.storeEngine.update(ClientDatabaseRepository.STORES.CLIENTS, ClientDatabaseRepository.KEYS.LOCAL_IDENTITY, transformedClient);
|
|
58
|
+
return transformedClient;
|
|
59
|
+
}
|
|
60
|
+
async updateClient(userId, client, domain) {
|
|
61
|
+
const transformedClient = this.transformClient(userId, client, false, domain);
|
|
62
|
+
await this.storeEngine.update(ClientDatabaseRepository.STORES.CLIENTS, this.cryptographyService.constructSessionId(userId, client.id, domain), transformedClient);
|
|
63
|
+
return transformedClient;
|
|
64
|
+
}
|
|
65
|
+
async createClient(userId, client, domain) {
|
|
66
|
+
const transformedClient = this.transformClient(userId, client, false, domain);
|
|
67
|
+
await this.storeEngine.create(ClientDatabaseRepository.STORES.CLIENTS, this.cryptographyService.constructSessionId(userId, client.id, domain), transformedClient);
|
|
68
|
+
return transformedClient;
|
|
69
|
+
}
|
|
70
|
+
transformClient(userId, client, verified, domain) {
|
|
71
|
+
return Object.assign(Object.assign({}, client), { domain, meta: {
|
|
72
|
+
is_verified: verified,
|
|
73
|
+
primary_key: this.cryptographyService.constructSessionId(userId, client.id, domain),
|
|
74
|
+
} });
|
|
75
|
+
}
|
|
76
|
+
transformLocalClient(client, domain) {
|
|
77
|
+
return Object.assign(Object.assign({}, client), { domain, meta: { is_verified: true, primary_key: ClientDatabaseRepository.KEYS.LOCAL_IDENTITY } });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.ClientDatabaseRepository = ClientDatabaseRepository;
|
|
81
|
+
ClientDatabaseRepository.STORES = DatabaseStores;
|
|
82
|
+
ClientDatabaseRepository.KEYS = {
|
|
83
|
+
LOCAL_IDENTITY: 'local_identity',
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=ClientDatabaseRepository.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClientClassification, Location } from '@wireapp/api-client/src/client/';
|
|
2
|
+
export interface ClientInfo {
|
|
3
|
+
classification: ClientClassification.DESKTOP | ClientClassification.PHONE | ClientClassification.TABLET;
|
|
4
|
+
cookieLabel: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
location?: Location;
|
|
7
|
+
model: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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=ClientInfo.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { LoginData } from '@wireapp/api-client/src/auth/';
|
|
3
|
+
import { RegisteredClient } from '@wireapp/api-client/src/client/';
|
|
4
|
+
import { CRUDEngine } from '@wireapp/store-engine';
|
|
5
|
+
import { CryptographyService } from '../cryptography/';
|
|
6
|
+
import { ClientInfo } from './';
|
|
7
|
+
export interface MetaClient extends RegisteredClient {
|
|
8
|
+
domain?: string;
|
|
9
|
+
meta: {
|
|
10
|
+
is_verified?: boolean;
|
|
11
|
+
primary_key: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare class ClientService {
|
|
15
|
+
private readonly apiClient;
|
|
16
|
+
private readonly storeEngine;
|
|
17
|
+
private readonly cryptographyService;
|
|
18
|
+
private readonly database;
|
|
19
|
+
private readonly backend;
|
|
20
|
+
constructor(apiClient: APIClient, storeEngine: CRUDEngine, cryptographyService: CryptographyService);
|
|
21
|
+
getClients(): Promise<RegisteredClient[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Will delete the given client from backend and will also delete it from the local database
|
|
24
|
+
*
|
|
25
|
+
* note: use deleteLocalClient if you wish to delete the client currently used by the user
|
|
26
|
+
*
|
|
27
|
+
* @param clientId The id of the client to delete
|
|
28
|
+
* @param password? Password of the owning user. Can be omitted for temporary devices
|
|
29
|
+
*/
|
|
30
|
+
deleteClient(clientId: string, password?: string): Promise<unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Will delete the local client (client currently in use by the user) from backend and will also delete it from the local database
|
|
33
|
+
* @param password? Password of the owning user. Can be omitted for temporary devices
|
|
34
|
+
*/
|
|
35
|
+
deleteLocalClient(password?: string): Promise<string>;
|
|
36
|
+
getLocalClient(): Promise<MetaClient>;
|
|
37
|
+
createLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
|
|
38
|
+
synchronizeClients(): Promise<MetaClient[]>;
|
|
39
|
+
register(loginData: LoginData, clientInfo: ClientInfo, entropyData?: Uint8Array): Promise<RegisteredClient>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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.ClientService = void 0;
|
|
22
|
+
const client_1 = require("@wireapp/api-client/src/client/");
|
|
23
|
+
const _1 = require("./");
|
|
24
|
+
class ClientService {
|
|
25
|
+
constructor(apiClient, storeEngine, cryptographyService) {
|
|
26
|
+
this.apiClient = apiClient;
|
|
27
|
+
this.storeEngine = storeEngine;
|
|
28
|
+
this.cryptographyService = cryptographyService;
|
|
29
|
+
this.database = new _1.ClientDatabaseRepository(this.storeEngine, this.cryptographyService);
|
|
30
|
+
this.backend = new _1.ClientBackendRepository(this.apiClient);
|
|
31
|
+
}
|
|
32
|
+
getClients() {
|
|
33
|
+
return this.backend.getClients();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Will delete the given client from backend and will also delete it from the local database
|
|
37
|
+
*
|
|
38
|
+
* note: use deleteLocalClient if you wish to delete the client currently used by the user
|
|
39
|
+
*
|
|
40
|
+
* @param clientId The id of the client to delete
|
|
41
|
+
* @param password? Password of the owning user. Can be omitted for temporary devices
|
|
42
|
+
*/
|
|
43
|
+
async deleteClient(clientId, password) {
|
|
44
|
+
const userId = { id: this.apiClient.userId, domain: this.apiClient.domain || '' };
|
|
45
|
+
await this.backend.deleteClient(clientId, password);
|
|
46
|
+
return this.database.deleteClient(this.cryptographyService.constructSessionId(userId, clientId));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Will delete the local client (client currently in use by the user) from backend and will also delete it from the local database
|
|
50
|
+
* @param password? Password of the owning user. Can be omitted for temporary devices
|
|
51
|
+
*/
|
|
52
|
+
async deleteLocalClient(password) {
|
|
53
|
+
var _a;
|
|
54
|
+
const localClientId = (_a = this.apiClient.context) === null || _a === void 0 ? void 0 : _a.clientId;
|
|
55
|
+
if (!localClientId) {
|
|
56
|
+
throw new Error('Trying to delete local client, but local client has not been set');
|
|
57
|
+
}
|
|
58
|
+
await this.backend.deleteClient(localClientId, password);
|
|
59
|
+
return this.database.deleteLocalClient();
|
|
60
|
+
}
|
|
61
|
+
getLocalClient() {
|
|
62
|
+
return this.database.getLocalClient();
|
|
63
|
+
}
|
|
64
|
+
createLocalClient(client, domain) {
|
|
65
|
+
return this.database.createLocalClient(client, domain);
|
|
66
|
+
}
|
|
67
|
+
async synchronizeClients() {
|
|
68
|
+
var _a;
|
|
69
|
+
const registeredClients = await this.backend.getClients();
|
|
70
|
+
const filteredClients = registeredClients.filter(client => client.id !== this.apiClient.context.clientId);
|
|
71
|
+
return this.database.createClientList(this.apiClient.context.userId, filteredClients, (_a = this.apiClient.context) === null || _a === void 0 ? void 0 : _a.domain);
|
|
72
|
+
}
|
|
73
|
+
// TODO: Split functionality into "create" and "register" client
|
|
74
|
+
async register(loginData, clientInfo, entropyData) {
|
|
75
|
+
if (!this.apiClient.context) {
|
|
76
|
+
throw new Error('Context is not set.');
|
|
77
|
+
}
|
|
78
|
+
if (loginData.clientType === client_1.ClientType.NONE) {
|
|
79
|
+
throw new Error(`Can't register client of type "${client_1.ClientType.NONE}"`);
|
|
80
|
+
}
|
|
81
|
+
const serializedPreKeys = await this.cryptographyService.createCryptobox(entropyData);
|
|
82
|
+
if (!this.cryptographyService.cryptobox.lastResortPreKey) {
|
|
83
|
+
throw new Error('Cryptobox got initialized without a last resort PreKey.');
|
|
84
|
+
}
|
|
85
|
+
const newClient = {
|
|
86
|
+
class: clientInfo.classification,
|
|
87
|
+
cookie: clientInfo.cookieLabel,
|
|
88
|
+
label: clientInfo.label,
|
|
89
|
+
lastkey: this.cryptographyService.cryptobox.serialize_prekey(this.cryptographyService.cryptobox.lastResortPreKey),
|
|
90
|
+
location: clientInfo.location,
|
|
91
|
+
model: clientInfo.model,
|
|
92
|
+
password: loginData.password ? String(loginData.password) : undefined,
|
|
93
|
+
verification_code: loginData.verificationCode,
|
|
94
|
+
prekeys: serializedPreKeys,
|
|
95
|
+
type: loginData.clientType,
|
|
96
|
+
};
|
|
97
|
+
const client = await this.backend.postClient(newClient);
|
|
98
|
+
await this.createLocalClient(client, this.apiClient.context.domain);
|
|
99
|
+
return client;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.ClientService = ClientService;
|
|
103
|
+
//# sourceMappingURL=ClientService.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./ClientInfo"), exports);
|
|
36
|
+
__exportStar(require("./ClientService"), exports);
|
|
37
|
+
__exportStar(require("./ClientBackendRepository"), exports);
|
|
38
|
+
__exportStar(require("./ClientDatabaseRepository"), exports);
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { APIClient } from '@wireapp/api-client';
|
|
2
|
+
import { Connection } from '@wireapp/api-client/src/connection/';
|
|
3
|
+
import { QualifiedId } from '@wireapp/api-client/src/user';
|
|
4
|
+
export declare class ConnectionService {
|
|
5
|
+
private readonly apiClient;
|
|
6
|
+
constructor(apiClient: APIClient);
|
|
7
|
+
getConnections(): Promise<Connection[]>;
|
|
8
|
+
acceptConnection(userId: string): Promise<Connection>;
|
|
9
|
+
ignoreConnection(userId: string): Promise<Connection>;
|
|
10
|
+
createConnection(userId: QualifiedId): Promise<Connection>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.ConnectionService = void 0;
|
|
22
|
+
const connection_1 = require("@wireapp/api-client/src/connection/");
|
|
23
|
+
class ConnectionService {
|
|
24
|
+
constructor(apiClient) {
|
|
25
|
+
this.apiClient = apiClient;
|
|
26
|
+
}
|
|
27
|
+
getConnections() {
|
|
28
|
+
return this.apiClient.api.connection.getAllConnections();
|
|
29
|
+
}
|
|
30
|
+
acceptConnection(userId) {
|
|
31
|
+
return this.apiClient.api.connection.putConnection(userId, {
|
|
32
|
+
status: connection_1.ConnectionStatus.ACCEPTED,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
ignoreConnection(userId) {
|
|
36
|
+
return this.apiClient.api.connection.putConnection(userId, {
|
|
37
|
+
status: connection_1.ConnectionStatus.IGNORED,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
createConnection(userId) {
|
|
41
|
+
return this.apiClient.api.connection.postConnection(userId, '');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ConnectionService = ConnectionService;
|
|
45
|
+
//# sourceMappingURL=ConnectionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConnectionService';
|