@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
package/src/main/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Account } from './Account';
|
|
2
|
-
import * as auth from './auth/';
|
|
3
|
-
import * as conversation from './conversation/';
|
|
4
|
-
import { CoreError } from './CoreError';
|
|
5
|
-
import * as cryptography from './cryptography/';
|
|
6
|
-
import * as util from './util';
|
|
7
|
-
import { MessageBuilder } from './conversation/message/MessageBuilder';
|
|
8
|
-
declare const _default: {
|
|
9
|
-
Account: typeof Account;
|
|
10
|
-
MessageBuilder: typeof MessageBuilder;
|
|
11
|
-
CoreError: typeof CoreError;
|
|
12
|
-
auth: typeof auth;
|
|
13
|
-
conversation: typeof conversation;
|
|
14
|
-
cryptography: typeof cryptography;
|
|
15
|
-
util: typeof util;
|
|
16
|
-
};
|
|
17
|
-
export = _default;
|
package/src/main/index.js
DELETED
|
@@ -1,55 +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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
-
}) : function(o, v) {
|
|
30
|
-
o["default"] = v;
|
|
31
|
-
});
|
|
32
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
const Account_1 = require("./Account");
|
|
40
|
-
const auth = __importStar(require("./auth/"));
|
|
41
|
-
const conversation = __importStar(require("./conversation/"));
|
|
42
|
-
const CoreError_1 = require("./CoreError");
|
|
43
|
-
const cryptography = __importStar(require("./cryptography/"));
|
|
44
|
-
const util = __importStar(require("./util"));
|
|
45
|
-
const MessageBuilder_1 = require("./conversation/message/MessageBuilder");
|
|
46
|
-
module.exports = {
|
|
47
|
-
Account: Account_1.Account,
|
|
48
|
-
MessageBuilder: MessageBuilder_1.MessageBuilder,
|
|
49
|
-
CoreError: CoreError_1.CoreError,
|
|
50
|
-
auth,
|
|
51
|
-
conversation,
|
|
52
|
-
cryptography,
|
|
53
|
-
util,
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AssetService } from '../conversation';
|
|
2
|
-
import { LinkPreviewContent, LinkPreviewUploadedContent } from '../conversation/content';
|
|
3
|
-
export declare class LinkPreviewService {
|
|
4
|
-
private readonly assetService;
|
|
5
|
-
constructor(assetService: AssetService);
|
|
6
|
-
uploadLinkPreviewImage(linkPreview: LinkPreviewContent, domain?: string): Promise<LinkPreviewUploadedContent>;
|
|
7
|
-
}
|
|
@@ -1,52 +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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
21
|
-
var t = {};
|
|
22
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
-
t[p] = s[p];
|
|
24
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
-
t[p[i]] = s[p[i]];
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.LinkPreviewService = void 0;
|
|
33
|
-
class LinkPreviewService {
|
|
34
|
-
constructor(assetService) {
|
|
35
|
-
this.assetService = assetService;
|
|
36
|
-
}
|
|
37
|
-
async uploadLinkPreviewImage(linkPreview, domain) {
|
|
38
|
-
const { image } = linkPreview, preview = __rest(linkPreview, ["image"]);
|
|
39
|
-
if (!image) {
|
|
40
|
-
return preview;
|
|
41
|
-
}
|
|
42
|
-
const uploadedLinkPreview = preview;
|
|
43
|
-
const asset = await (await this.assetService.uploadAsset(linkPreview.image.data, { domain })).response;
|
|
44
|
-
uploadedLinkPreview.imageUploaded = {
|
|
45
|
-
asset,
|
|
46
|
-
image,
|
|
47
|
-
};
|
|
48
|
-
return uploadedLinkPreview;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.LinkPreviewService = LinkPreviewService;
|
|
52
|
-
//# sourceMappingURL=LinkPreviewService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './LinkPreviewService';
|
|
@@ -1,32 +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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
__exportStar(require("./LinkPreviewService"), exports);
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AddProposalArgs, CommitBundle, ConversationConfiguration, ConversationId, CoreCrypto, DecryptedMessage, ExternalProposalArgs, ExternalProposalType, ExternalRemoveProposalArgs, Invitee, ProposalArgs, ProposalType, RemoveProposalArgs } from '@otak/core-crypto/platforms/web/corecrypto';
|
|
2
|
-
import { APIClient } from '@wireapp/api-client';
|
|
3
|
-
import { QualifiedUsers } from '../../conversation';
|
|
4
|
-
import type { MLSConfig } from '../types';
|
|
5
|
-
import { PostMlsMessageResponse } from '@wireapp/api-client/src/conversation';
|
|
6
|
-
export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
|
|
7
|
-
export declare class MLSService {
|
|
8
|
-
readonly config: MLSConfig | undefined;
|
|
9
|
-
private readonly apiClient;
|
|
10
|
-
private readonly coreCryptoClientProvider;
|
|
11
|
-
constructor(config: MLSConfig | undefined, apiClient: APIClient, coreCryptoClientProvider: () => CoreCrypto | undefined);
|
|
12
|
-
private getCoreCryptoClient;
|
|
13
|
-
private uploadCommitBundle;
|
|
14
|
-
addUsersToExistingConversation(groupIdDecodedFromBase64: Uint8Array, invitee: Invitee[]): Promise<PostMlsMessageResponse | null>;
|
|
15
|
-
getKeyPackagesPayload(qualifiedUsers: QualifiedUsers[]): Promise<Invitee[]>;
|
|
16
|
-
newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<Uint8Array>;
|
|
17
|
-
newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalProposalArgs | ExternalRemoveProposalArgs): Promise<Uint8Array>;
|
|
18
|
-
processWelcomeMessage(welcomeMessage: Uint8Array): Promise<ConversationId>;
|
|
19
|
-
decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
|
|
20
|
-
encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
|
|
21
|
-
updateKeyingMaterial(conversationId: ConversationId): Promise<PostMlsMessageResponse | null>;
|
|
22
|
-
createConversation(conversationId: ConversationId, configuration?: ConversationConfiguration): Promise<any>;
|
|
23
|
-
removeClientsFromConversation(conversationId: ConversationId, clientIds: Uint8Array[]): Promise<PostMlsMessageResponse | null>;
|
|
24
|
-
commitPendingProposals(conversationId: ConversationId): Promise<CommitBundle>;
|
|
25
|
-
conversationExists(conversationId: ConversationId): Promise<boolean>;
|
|
26
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.MLSService = exports.optionalToUint8Array = void 0;
|
|
22
|
-
const bazinga64_1 = require("bazinga64");
|
|
23
|
-
//@todo: this function is temporary, we wait for the update from core-crypto side
|
|
24
|
-
//they are returning regular array instead of Uint8Array for commit and welcome messages
|
|
25
|
-
const optionalToUint8Array = (array) => {
|
|
26
|
-
return Array.isArray(array) ? Uint8Array.from(array) : array;
|
|
27
|
-
};
|
|
28
|
-
exports.optionalToUint8Array = optionalToUint8Array;
|
|
29
|
-
class MLSService {
|
|
30
|
-
constructor(config, apiClient, coreCryptoClientProvider) {
|
|
31
|
-
this.config = config;
|
|
32
|
-
this.apiClient = apiClient;
|
|
33
|
-
this.coreCryptoClientProvider = coreCryptoClientProvider;
|
|
34
|
-
}
|
|
35
|
-
getCoreCryptoClient() {
|
|
36
|
-
const client = this.coreCryptoClientProvider();
|
|
37
|
-
if (!client) {
|
|
38
|
-
throw new Error('Could not get coreCryptoClient');
|
|
39
|
-
}
|
|
40
|
-
return client;
|
|
41
|
-
}
|
|
42
|
-
async uploadCommitBundle(groupIdDecodedFromBase64, commitBundle) {
|
|
43
|
-
const coreCryptoClient = this.getCoreCryptoClient();
|
|
44
|
-
if (commitBundle.welcome) {
|
|
45
|
-
//@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
|
|
46
|
-
await this.apiClient.api.conversation.postMlsWelcomeMessage((0, exports.optionalToUint8Array)(commitBundle.welcome));
|
|
47
|
-
}
|
|
48
|
-
if (commitBundle.commit) {
|
|
49
|
-
const messageResponse = await this.apiClient.api.conversation.postMlsMessage(
|
|
50
|
-
//@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
|
|
51
|
-
(0, exports.optionalToUint8Array)(commitBundle.commit));
|
|
52
|
-
await coreCryptoClient.commitAccepted(groupIdDecodedFromBase64);
|
|
53
|
-
return messageResponse;
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
async addUsersToExistingConversation(groupIdDecodedFromBase64, invitee) {
|
|
58
|
-
const coreCryptoClient = this.getCoreCryptoClient();
|
|
59
|
-
const memberAddedMessages = await coreCryptoClient.addClientsToConversation(groupIdDecodedFromBase64, invitee);
|
|
60
|
-
if (memberAddedMessages === null || memberAddedMessages === void 0 ? void 0 : memberAddedMessages.welcome) {
|
|
61
|
-
//@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
|
|
62
|
-
await this.apiClient.api.conversation.postMlsWelcomeMessage((0, exports.optionalToUint8Array)(memberAddedMessages.welcome));
|
|
63
|
-
}
|
|
64
|
-
if (memberAddedMessages === null || memberAddedMessages === void 0 ? void 0 : memberAddedMessages.commit) {
|
|
65
|
-
const messageResponse = await this.apiClient.api.conversation.postMlsMessage(
|
|
66
|
-
//@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
|
|
67
|
-
(0, exports.optionalToUint8Array)(memberAddedMessages.commit));
|
|
68
|
-
await coreCryptoClient.commitAccepted(groupIdDecodedFromBase64);
|
|
69
|
-
return messageResponse;
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
async getKeyPackagesPayload(qualifiedUsers) {
|
|
74
|
-
/**
|
|
75
|
-
* @note We need to fetch key packages for all the users
|
|
76
|
-
* we want to add to the new MLS conversations,
|
|
77
|
-
* includes self user too.
|
|
78
|
-
*/
|
|
79
|
-
const keyPackages = await Promise.all([
|
|
80
|
-
...qualifiedUsers.map(({ id, domain, skipOwn }) => this.apiClient.api.client.claimMLSKeyPackages(id, domain, skipOwn)),
|
|
81
|
-
]);
|
|
82
|
-
const coreCryptoKeyPackagesPayload = keyPackages.reduce((previousValue, currentValue) => {
|
|
83
|
-
// skip users that have not uploaded their MLS key packages
|
|
84
|
-
if (currentValue.key_packages.length > 0) {
|
|
85
|
-
return [
|
|
86
|
-
...previousValue,
|
|
87
|
-
...currentValue.key_packages.map(keyPackage => ({
|
|
88
|
-
id: bazinga64_1.Encoder.toBase64(keyPackage.client).asBytes,
|
|
89
|
-
kp: bazinga64_1.Decoder.fromBase64(keyPackage.key_package).asBytes,
|
|
90
|
-
})),
|
|
91
|
-
];
|
|
92
|
-
}
|
|
93
|
-
return previousValue;
|
|
94
|
-
}, []);
|
|
95
|
-
return coreCryptoKeyPackagesPayload;
|
|
96
|
-
}
|
|
97
|
-
async newProposal(proposalType, args) {
|
|
98
|
-
return this.getCoreCryptoClient().newProposal(proposalType, args);
|
|
99
|
-
}
|
|
100
|
-
async newExternalProposal(externalProposalType, args) {
|
|
101
|
-
return this.getCoreCryptoClient().newExternalProposal(externalProposalType, args);
|
|
102
|
-
}
|
|
103
|
-
async processWelcomeMessage(welcomeMessage) {
|
|
104
|
-
return this.getCoreCryptoClient().processWelcomeMessage(welcomeMessage);
|
|
105
|
-
}
|
|
106
|
-
async decryptMessage(conversationId, payload) {
|
|
107
|
-
return this.getCoreCryptoClient().decryptMessage(conversationId, payload);
|
|
108
|
-
}
|
|
109
|
-
async encryptMessage(conversationId, message) {
|
|
110
|
-
return this.getCoreCryptoClient().encryptMessage(conversationId, message);
|
|
111
|
-
}
|
|
112
|
-
async updateKeyingMaterial(conversationId) {
|
|
113
|
-
const commitBundle = await this.getCoreCryptoClient().updateKeyingMaterial(conversationId);
|
|
114
|
-
return this.uploadCommitBundle(conversationId, commitBundle);
|
|
115
|
-
}
|
|
116
|
-
async createConversation(conversationId, configuration) {
|
|
117
|
-
return this.getCoreCryptoClient().createConversation(conversationId, configuration);
|
|
118
|
-
}
|
|
119
|
-
async removeClientsFromConversation(conversationId, clientIds) {
|
|
120
|
-
const commitBundle = await this.getCoreCryptoClient().removeClientsFromConversation(conversationId, clientIds);
|
|
121
|
-
return this.uploadCommitBundle(conversationId, commitBundle);
|
|
122
|
-
}
|
|
123
|
-
async commitPendingProposals(conversationId) {
|
|
124
|
-
return this.getCoreCryptoClient().commitPendingProposals(conversationId);
|
|
125
|
-
}
|
|
126
|
-
async conversationExists(conversationId) {
|
|
127
|
-
return this.getCoreCryptoClient().conversationExists(conversationId);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
exports.MLSService = MLSService;
|
|
131
|
-
//# sourceMappingURL=MLSService.js.map
|
package/src/main/mls/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MLSService/MLSService';
|
package/src/main/mls/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
__exportStar(require("./MLSService/MLSService"), exports);
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
package/src/main/mls/types.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare type SecretCrypto<T> = {
|
|
2
|
-
encrypt: (value: Uint8Array) => Promise<T>;
|
|
3
|
-
decrypt: (payload: T) => Promise<Uint8Array>;
|
|
4
|
-
};
|
|
5
|
-
export interface MLSConfig<T = any> {
|
|
6
|
-
/**
|
|
7
|
-
* encrypt/decrypt function pair that will be called before storing/fetching secrets in the secrets database.
|
|
8
|
-
* If not provided will use the built in encryption mechanism
|
|
9
|
-
*/
|
|
10
|
-
secretsCrypto?: SecretCrypto<T>;
|
|
11
|
-
/**
|
|
12
|
-
* path on the public server to the core crypto wasm file.
|
|
13
|
-
* This file will be downloaded lazily when corecrypto is needed.
|
|
14
|
-
* It, thus, needs to know where, on the server, the file can be found
|
|
15
|
-
*/
|
|
16
|
-
coreCrypoWasmFilePath: string;
|
|
17
|
-
/**
|
|
18
|
-
* (milliseconds) period of time between automatic updates of the keying material (30 days by default)
|
|
19
|
-
*/
|
|
20
|
-
keyingMaterialUpdateThreshold?: number;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
package/src/main/mls/types.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { APIClient } from '@wireapp/api-client';
|
|
2
|
-
import type { Notification } from '@wireapp/api-client/src/notification/';
|
|
3
|
-
export declare class NotificationBackendRepository {
|
|
4
|
-
private readonly apiClient;
|
|
5
|
-
constructor(apiClient: APIClient);
|
|
6
|
-
getAllNotifications(clientId?: string, lastNotificationId?: string): Promise<{
|
|
7
|
-
notifications: Notification[];
|
|
8
|
-
missedNotification?: string | undefined;
|
|
9
|
-
}>;
|
|
10
|
-
getLastNotification(clientId?: string): Promise<Notification>;
|
|
11
|
-
}
|
|
@@ -1,34 +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.NotificationBackendRepository = void 0;
|
|
22
|
-
class NotificationBackendRepository {
|
|
23
|
-
constructor(apiClient) {
|
|
24
|
-
this.apiClient = apiClient;
|
|
25
|
-
}
|
|
26
|
-
async getAllNotifications(clientId, lastNotificationId) {
|
|
27
|
-
return this.apiClient.api.notification.getAllNotifications(clientId, lastNotificationId);
|
|
28
|
-
}
|
|
29
|
-
getLastNotification(clientId) {
|
|
30
|
-
return this.apiClient.api.notification.getLastNotification(clientId);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.NotificationBackendRepository = NotificationBackendRepository;
|
|
34
|
-
//# sourceMappingURL=NotificationBackendRepository.js.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { BackendEvent } from '@wireapp/api-client/src/event';
|
|
2
|
-
import type { Notification } from '@wireapp/api-client/src/notification/';
|
|
3
|
-
import type { CRUDEngine } from '@wireapp/store-engine';
|
|
4
|
-
import { CommonMLS, CompoundGroupIdParams, LastKeyMaterialUpdateParams, StorePendingProposalsParams } from './types';
|
|
5
|
-
export declare enum DatabaseStores {
|
|
6
|
-
EVENTS = "events"
|
|
7
|
-
}
|
|
8
|
-
export declare enum DatabaseKeys {
|
|
9
|
-
PRIMARY_KEY_LAST_EVENT = "z.storage.StorageKey.EVENT.LAST_DATE",
|
|
10
|
-
PRIMARY_KEY_LAST_NOTIFICATION = "z.storage.StorageKey.NOTIFICATION.LAST_ID"
|
|
11
|
-
}
|
|
12
|
-
export declare class NotificationDatabaseRepository {
|
|
13
|
-
private readonly storeEngine;
|
|
14
|
-
constructor(storeEngine: CRUDEngine);
|
|
15
|
-
getNotificationEventList(): Promise<BackendEvent[]>;
|
|
16
|
-
getLastEventDate(): Promise<Date>;
|
|
17
|
-
updateLastEventDate(eventDate: Date): Promise<Date>;
|
|
18
|
-
createLastEventDate(eventDate: Date): Promise<Date>;
|
|
19
|
-
getLastNotificationId(): Promise<string>;
|
|
20
|
-
updateLastNotificationId(lastNotification: Notification): Promise<string>;
|
|
21
|
-
private generateCompoundGroupIdPrimaryKey;
|
|
22
|
-
addCompoundGroupId(params: CompoundGroupIdParams): Promise<CompoundGroupIdParams>;
|
|
23
|
-
getCompoundGroupId(params: Omit<CompoundGroupIdParams, 'groupId'>): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* ## MLS only ##
|
|
26
|
-
* Store groupIds with pending proposals and a delay in the DB until the proposals get committed.
|
|
27
|
-
*
|
|
28
|
-
* @param groupId groupId of the mls conversation
|
|
29
|
-
* @param firingDate date when the pending proposals should be committed
|
|
30
|
-
*/
|
|
31
|
-
storePendingProposal(params: StorePendingProposalsParams): Promise<boolean>;
|
|
32
|
-
/**
|
|
33
|
-
* ## MLS only ##
|
|
34
|
-
* Delete stored entries for pending proposals that have been committed.
|
|
35
|
-
*
|
|
36
|
-
* @param groupId groupId of the mls conversation
|
|
37
|
-
*/
|
|
38
|
-
deletePendingProposal({ groupId }: CommonMLS): Promise<boolean>;
|
|
39
|
-
/**
|
|
40
|
-
* ## MLS only ##
|
|
41
|
-
* Get all stored entries for pending proposals.
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
getStoredPendingProposals(): Promise<StorePendingProposalsParams[]>;
|
|
45
|
-
/**
|
|
46
|
-
* ## MLS only ##
|
|
47
|
-
* Store groupIds with last key material update dates.
|
|
48
|
-
*
|
|
49
|
-
* @param {groupId} params.groupId - groupId of the mls conversation
|
|
50
|
-
* @param {previousUpdateDate} params.previousUpdateDate - date of the previous key material update
|
|
51
|
-
*/
|
|
52
|
-
storeLastKeyMaterialUpdateDate(params: LastKeyMaterialUpdateParams): Promise<boolean>;
|
|
53
|
-
/**
|
|
54
|
-
* ## MLS only ##
|
|
55
|
-
* Delete stored entries for last key materials update dates.
|
|
56
|
-
*
|
|
57
|
-
* @param {groupId} groupId - of the mls conversation
|
|
58
|
-
*/
|
|
59
|
-
deleteLastKeyMaterialUpdateDate({ groupId }: CommonMLS): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* ## MLS only ##
|
|
62
|
-
* Get all stored entries for last key materials update dates.
|
|
63
|
-
*
|
|
64
|
-
*/
|
|
65
|
-
getStoredLastKeyMaterialUpdateDates(): Promise<LastKeyMaterialUpdateParams[]>;
|
|
66
|
-
}
|
|
@@ -1,136 +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.NotificationDatabaseRepository = exports.DatabaseKeys = exports.DatabaseStores = void 0;
|
|
22
|
-
const CryptographyDatabaseRepository_1 = require("../cryptography/CryptographyDatabaseRepository");
|
|
23
|
-
var DatabaseStores;
|
|
24
|
-
(function (DatabaseStores) {
|
|
25
|
-
DatabaseStores["EVENTS"] = "events";
|
|
26
|
-
})(DatabaseStores = exports.DatabaseStores || (exports.DatabaseStores = {}));
|
|
27
|
-
var DatabaseKeys;
|
|
28
|
-
(function (DatabaseKeys) {
|
|
29
|
-
DatabaseKeys["PRIMARY_KEY_LAST_EVENT"] = "z.storage.StorageKey.EVENT.LAST_DATE";
|
|
30
|
-
DatabaseKeys["PRIMARY_KEY_LAST_NOTIFICATION"] = "z.storage.StorageKey.NOTIFICATION.LAST_ID";
|
|
31
|
-
})(DatabaseKeys = exports.DatabaseKeys || (exports.DatabaseKeys = {}));
|
|
32
|
-
const STORES = Object.assign({}, CryptographyDatabaseRepository_1.CryptographyDatabaseRepository.STORES);
|
|
33
|
-
class NotificationDatabaseRepository {
|
|
34
|
-
constructor(storeEngine) {
|
|
35
|
-
this.storeEngine = storeEngine;
|
|
36
|
-
}
|
|
37
|
-
getNotificationEventList() {
|
|
38
|
-
return this.storeEngine.readAll(DatabaseStores.EVENTS);
|
|
39
|
-
}
|
|
40
|
-
async getLastEventDate() {
|
|
41
|
-
const { value } = await this.storeEngine.read(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_EVENT);
|
|
42
|
-
return new Date(value);
|
|
43
|
-
}
|
|
44
|
-
async updateLastEventDate(eventDate) {
|
|
45
|
-
await this.storeEngine.update(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_EVENT, {
|
|
46
|
-
value: eventDate.toISOString(),
|
|
47
|
-
});
|
|
48
|
-
return eventDate;
|
|
49
|
-
}
|
|
50
|
-
async createLastEventDate(eventDate) {
|
|
51
|
-
await this.storeEngine.create(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_EVENT, {
|
|
52
|
-
value: eventDate.toISOString(),
|
|
53
|
-
});
|
|
54
|
-
return eventDate;
|
|
55
|
-
}
|
|
56
|
-
async getLastNotificationId() {
|
|
57
|
-
const { value } = await this.storeEngine.read(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_NOTIFICATION);
|
|
58
|
-
return value;
|
|
59
|
-
}
|
|
60
|
-
async updateLastNotificationId(lastNotification) {
|
|
61
|
-
await this.storeEngine.updateOrCreate(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_NOTIFICATION, {
|
|
62
|
-
value: lastNotification.id,
|
|
63
|
-
});
|
|
64
|
-
return lastNotification.id;
|
|
65
|
-
}
|
|
66
|
-
generateCompoundGroupIdPrimaryKey({ conversationId, conversationDomain, }) {
|
|
67
|
-
return `${conversationId}@${conversationDomain}`;
|
|
68
|
-
}
|
|
69
|
-
async addCompoundGroupId(params) {
|
|
70
|
-
await this.storeEngine.updateOrCreate(STORES.GROUP_IDS, this.generateCompoundGroupIdPrimaryKey(params), params.groupId);
|
|
71
|
-
return params;
|
|
72
|
-
}
|
|
73
|
-
async getCompoundGroupId(params) {
|
|
74
|
-
return this.storeEngine.read(STORES.GROUP_IDS, this.generateCompoundGroupIdPrimaryKey(params));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* ## MLS only ##
|
|
78
|
-
* Store groupIds with pending proposals and a delay in the DB until the proposals get committed.
|
|
79
|
-
*
|
|
80
|
-
* @param groupId groupId of the mls conversation
|
|
81
|
-
* @param firingDate date when the pending proposals should be committed
|
|
82
|
-
*/
|
|
83
|
-
async storePendingProposal(params) {
|
|
84
|
-
await this.storeEngine.updateOrCreate(STORES.PENDING_PROPOSALS, `${params.groupId}`, params);
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* ## MLS only ##
|
|
89
|
-
* Delete stored entries for pending proposals that have been committed.
|
|
90
|
-
*
|
|
91
|
-
* @param groupId groupId of the mls conversation
|
|
92
|
-
*/
|
|
93
|
-
async deletePendingProposal({ groupId }) {
|
|
94
|
-
await this.storeEngine.delete(STORES.PENDING_PROPOSALS, `${groupId}`);
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* ## MLS only ##
|
|
99
|
-
* Get all stored entries for pending proposals.
|
|
100
|
-
*
|
|
101
|
-
*/
|
|
102
|
-
async getStoredPendingProposals() {
|
|
103
|
-
return this.storeEngine.readAll(STORES.PENDING_PROPOSALS);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* ## MLS only ##
|
|
107
|
-
* Store groupIds with last key material update dates.
|
|
108
|
-
*
|
|
109
|
-
* @param {groupId} params.groupId - groupId of the mls conversation
|
|
110
|
-
* @param {previousUpdateDate} params.previousUpdateDate - date of the previous key material update
|
|
111
|
-
*/
|
|
112
|
-
async storeLastKeyMaterialUpdateDate(params) {
|
|
113
|
-
await this.storeEngine.updateOrCreate(STORES.LAST_KEY_MATERIAL_UPDATE_DATES, `${params.groupId}`, params);
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* ## MLS only ##
|
|
118
|
-
* Delete stored entries for last key materials update dates.
|
|
119
|
-
*
|
|
120
|
-
* @param {groupId} groupId - of the mls conversation
|
|
121
|
-
*/
|
|
122
|
-
async deleteLastKeyMaterialUpdateDate({ groupId }) {
|
|
123
|
-
await this.storeEngine.delete(STORES.LAST_KEY_MATERIAL_UPDATE_DATES, `${groupId}`);
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* ## MLS only ##
|
|
128
|
-
* Get all stored entries for last key materials update dates.
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
async getStoredLastKeyMaterialUpdateDates() {
|
|
132
|
-
return this.storeEngine.readAll(STORES.LAST_KEY_MATERIAL_UPDATE_DATES);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
exports.NotificationDatabaseRepository = NotificationDatabaseRepository;
|
|
136
|
-
//# sourceMappingURL=NotificationDatabaseRepository.js.map
|