@wireapp/core 30.4.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 +27 -0
- package/package.json +3 -3
- package/src/main/Account.d.ts +0 -220
- package/src/main/Account.js +0 -435
- 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 -164
- package/src/main/conversation/ConversationService/ConversationService.js +0 -951
- 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 -16
- package/src/main/cryptography/CryptographyDatabaseRepository.js +0 -42
- 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/notification/NotificationBackendRepository.d.ts +0 -11
- package/src/main/notification/NotificationBackendRepository.js +0 -34
- package/src/main/notification/NotificationDatabaseRepository.d.ts +0 -45
- package/src/main/notification/NotificationDatabaseRepository.js +0 -107
- package/src/main/notification/NotificationService.d.ts +0 -107
- package/src/main/notification/NotificationService.js +0 -411
- 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 -17
- 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/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/team/index.js
DELETED
|
@@ -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("./TeamService"), exports);
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { keys } from '@wireapp/proteus';
|
|
2
|
-
import type { CryptographyService } from '../cryptography';
|
|
3
|
-
export declare function createEncodedCipherText(receiver: keys.IdentityKeyPair, preKey: keys.PreKey, text: string): Promise<string>;
|
|
4
|
-
export declare function getPlainText(cryptographyService: CryptographyService, encodedPreKeyMessage: string, sessionId?: string): Promise<string | void>;
|
|
@@ -1,65 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.getPlainText = exports.createEncodedCipherText = void 0;
|
|
41
|
-
const cryptobox_1 = require("@wireapp/cryptobox");
|
|
42
|
-
const proteus_1 = require("@wireapp/proteus");
|
|
43
|
-
const bazinga64 = __importStar(require("bazinga64"));
|
|
44
|
-
const StoreHelper = require('./StoreHelper');
|
|
45
|
-
async function createEncodedCipherText(receiver, preKey, text) {
|
|
46
|
-
await (0, proteus_1.init)();
|
|
47
|
-
const senderEngine = await StoreHelper.createMemoryEngine();
|
|
48
|
-
const sender = new cryptobox_1.Cryptobox(senderEngine, 1);
|
|
49
|
-
await sender.create();
|
|
50
|
-
const sessionId = `from-${sender['identity'].public_key.fingerprint()}-to-${preKey.key_pair.public_key.fingerprint()}`;
|
|
51
|
-
const alicePublicKey = receiver.public_key;
|
|
52
|
-
const publicPreKeyBundle = new proteus_1.keys.PreKeyBundle(alicePublicKey, preKey);
|
|
53
|
-
const encryptedPreKeyMessage = await sender.encrypt(sessionId, text, publicPreKeyBundle.serialise());
|
|
54
|
-
return bazinga64.Encoder.toBase64(encryptedPreKeyMessage).asString;
|
|
55
|
-
}
|
|
56
|
-
exports.createEncodedCipherText = createEncodedCipherText;
|
|
57
|
-
async function getPlainText(cryptographyService, encodedPreKeyMessage, sessionId = `temp-${Date.now()}`) {
|
|
58
|
-
try {
|
|
59
|
-
const decryptedMessage = await cryptographyService.decrypt(sessionId, encodedPreKeyMessage);
|
|
60
|
-
return Buffer.from(decryptedMessage).toString('utf8');
|
|
61
|
-
}
|
|
62
|
-
catch (error) { }
|
|
63
|
-
}
|
|
64
|
-
exports.getPlainText = getPlainText;
|
|
65
|
-
//# sourceMappingURL=CryptographyHelper.js.map
|
|
@@ -1,66 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.mockUserPayload = exports.getUrlParameter = exports.getUUID = void 0;
|
|
25
|
-
const faker = require("faker");
|
|
26
|
-
const uuidjs_1 = __importDefault(require("uuidjs"));
|
|
27
|
-
function getUUID() {
|
|
28
|
-
return uuidjs_1.default.genV4().toString();
|
|
29
|
-
}
|
|
30
|
-
exports.getUUID = getUUID;
|
|
31
|
-
function getUrlParameter(url, parameter) {
|
|
32
|
-
if (typeof window === 'undefined') {
|
|
33
|
-
return require('url').parse(url, true).query[parameter];
|
|
34
|
-
}
|
|
35
|
-
return new URL(url).searchParams.get(parameter);
|
|
36
|
-
}
|
|
37
|
-
exports.getUrlParameter = getUrlParameter;
|
|
38
|
-
function mockUserPayload(userId) {
|
|
39
|
-
return {
|
|
40
|
-
accent_id: 3,
|
|
41
|
-
assets: [],
|
|
42
|
-
id: userId,
|
|
43
|
-
locale: 'en',
|
|
44
|
-
name: faker.name.findName(),
|
|
45
|
-
picture: [
|
|
46
|
-
{
|
|
47
|
-
content_length: 263345,
|
|
48
|
-
content_type: 'image/jpeg',
|
|
49
|
-
data: null,
|
|
50
|
-
id: getUUID(),
|
|
51
|
-
info: {
|
|
52
|
-
correlation_id: getUUID(),
|
|
53
|
-
height: 960,
|
|
54
|
-
nonce: getUUID(),
|
|
55
|
-
original_height: 960,
|
|
56
|
-
original_width: 1280,
|
|
57
|
-
public: true,
|
|
58
|
-
tag: 'medium',
|
|
59
|
-
width: 1280,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
exports.mockUserPayload = mockUserPayload;
|
|
66
|
-
//# sourceMappingURL=PayloadHelper.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { UserEvent } from '@wireapp/api-client/src/event';
|
|
2
|
-
import { PayloadBundle, PayloadBundleSource } from '../conversation';
|
|
3
|
-
export declare class UserMapper {
|
|
4
|
-
static mapUserEvent(event: UserEvent, selfUserId: string, source: PayloadBundleSource): PayloadBundle | undefined;
|
|
5
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2019 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.UserMapper = void 0;
|
|
22
|
-
const event_1 = require("@wireapp/api-client/src/event");
|
|
23
|
-
const conversation_1 = require("../conversation");
|
|
24
|
-
const MessageBuilder_1 = require("../conversation/message/MessageBuilder");
|
|
25
|
-
class UserMapper {
|
|
26
|
-
static mapUserEvent(event, selfUserId, source) {
|
|
27
|
-
switch (event.type) {
|
|
28
|
-
case event_1.USER_EVENT.CONNECTION: {
|
|
29
|
-
const { connection, user } = event;
|
|
30
|
-
return {
|
|
31
|
-
content: { connection, user },
|
|
32
|
-
conversation: connection.conversation,
|
|
33
|
-
from: connection.from,
|
|
34
|
-
id: MessageBuilder_1.MessageBuilder.createId(),
|
|
35
|
-
messageTimer: 0,
|
|
36
|
-
source,
|
|
37
|
-
state: conversation_1.PayloadBundleState.INCOMING,
|
|
38
|
-
timestamp: new Date(connection.last_update).getTime(),
|
|
39
|
-
type: conversation_1.PayloadBundleType.CONNECTION_REQUEST,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
case event_1.USER_EVENT.CLIENT_ADD: {
|
|
43
|
-
const { client } = event;
|
|
44
|
-
return {
|
|
45
|
-
content: { client },
|
|
46
|
-
conversation: selfUserId,
|
|
47
|
-
from: selfUserId,
|
|
48
|
-
id: MessageBuilder_1.MessageBuilder.createId(),
|
|
49
|
-
messageTimer: 0,
|
|
50
|
-
source,
|
|
51
|
-
state: conversation_1.PayloadBundleState.INCOMING,
|
|
52
|
-
timestamp: new Date().getTime(),
|
|
53
|
-
type: conversation_1.PayloadBundleType.CLIENT_ADD,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
case event_1.USER_EVENT.UPDATE: {
|
|
57
|
-
const { user } = event;
|
|
58
|
-
return {
|
|
59
|
-
content: { user },
|
|
60
|
-
conversation: selfUserId,
|
|
61
|
-
from: selfUserId,
|
|
62
|
-
id: MessageBuilder_1.MessageBuilder.createId(),
|
|
63
|
-
source,
|
|
64
|
-
state: conversation_1.PayloadBundleState.INCOMING,
|
|
65
|
-
timestamp: new Date().getTime(),
|
|
66
|
-
type: conversation_1.PayloadBundleType.USER_UPDATE,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
case event_1.USER_EVENT.CLIENT_REMOVE: {
|
|
70
|
-
const { client } = event;
|
|
71
|
-
return {
|
|
72
|
-
content: { client },
|
|
73
|
-
conversation: selfUserId,
|
|
74
|
-
from: selfUserId,
|
|
75
|
-
id: MessageBuilder_1.MessageBuilder.createId(),
|
|
76
|
-
messageTimer: 0,
|
|
77
|
-
source,
|
|
78
|
-
state: conversation_1.PayloadBundleState.INCOMING,
|
|
79
|
-
timestamp: new Date().getTime(),
|
|
80
|
-
type: conversation_1.PayloadBundleType.CLIENT_REMOVE,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.UserMapper = UserMapper;
|
|
88
|
-
//# sourceMappingURL=UserMapper.js.map
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { APIClient } from '@wireapp/api-client';
|
|
2
|
-
import type { QualifiedId, User } from '@wireapp/api-client/src/user/';
|
|
3
|
-
import type { AvailabilityType, BroadcastService } from '../broadcast/';
|
|
4
|
-
import { ConnectionService } from '../connection';
|
|
5
|
-
import { ConversationService } from '../conversation';
|
|
6
|
-
export declare class UserService {
|
|
7
|
-
private readonly apiClient;
|
|
8
|
-
private readonly broadcastService;
|
|
9
|
-
private readonly connectionService;
|
|
10
|
-
private readonly conversationService;
|
|
11
|
-
constructor(apiClient: APIClient, broadcastService: BroadcastService, conversationService: ConversationService, connectionService: ConnectionService);
|
|
12
|
-
getUser(userId: string | QualifiedId): Promise<User>;
|
|
13
|
-
getUsers(userIds: string[] | QualifiedId[]): Promise<User[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Sends a availability update to members of the same team
|
|
16
|
-
* @param teamId
|
|
17
|
-
* @param type
|
|
18
|
-
* @param options.sendAll=false will broadcast the message to all the members of the team (instead of just direct connections). Should be avoided in a big team
|
|
19
|
-
* @param options.sendAsProtobuf=false
|
|
20
|
-
*/
|
|
21
|
-
setAvailability(teamId: string, type: AvailabilityType, { sendAll, sendAsProtobuf }?: {
|
|
22
|
-
sendAll?: boolean | undefined;
|
|
23
|
-
sendAsProtobuf?: boolean | undefined;
|
|
24
|
-
}): Promise<void>;
|
|
25
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.UserService = void 0;
|
|
25
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
26
|
-
const uuidjs_1 = __importDefault(require("uuidjs"));
|
|
27
|
-
const TypePredicateUtil_1 = require("../util/TypePredicateUtil");
|
|
28
|
-
const connection_1 = require("@wireapp/api-client/src/connection");
|
|
29
|
-
class UserService {
|
|
30
|
-
constructor(apiClient, broadcastService, conversationService, connectionService) {
|
|
31
|
-
this.apiClient = apiClient;
|
|
32
|
-
this.broadcastService = broadcastService;
|
|
33
|
-
this.connectionService = connectionService;
|
|
34
|
-
this.conversationService = conversationService;
|
|
35
|
-
}
|
|
36
|
-
getUser(userId) {
|
|
37
|
-
return this.apiClient.api.user.getUser(userId);
|
|
38
|
-
}
|
|
39
|
-
async getUsers(userIds) {
|
|
40
|
-
if (!userIds.length) {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
return (0, TypePredicateUtil_1.isQualifiedIdArray)(userIds)
|
|
44
|
-
? this.apiClient.api.user.postListUsers({ qualified_ids: userIds })
|
|
45
|
-
: this.apiClient.api.user.getUsers({ ids: userIds });
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Sends a availability update to members of the same team
|
|
49
|
-
* @param teamId
|
|
50
|
-
* @param type
|
|
51
|
-
* @param options.sendAll=false will broadcast the message to all the members of the team (instead of just direct connections). Should be avoided in a big team
|
|
52
|
-
* @param options.sendAsProtobuf=false
|
|
53
|
-
*/
|
|
54
|
-
async setAvailability(teamId, type, { sendAll = false, sendAsProtobuf = false } = {}) {
|
|
55
|
-
// Get pre-key bundles for members of your own team
|
|
56
|
-
const preKeyBundlesFromTeam = await this.broadcastService.getPreKeyBundlesFromTeam(teamId, false, !sendAll);
|
|
57
|
-
// Get pre-key bundles for all of your other 1:1 connections
|
|
58
|
-
const connections = await this.connectionService.getConnections();
|
|
59
|
-
const acceptedConnections = connections.filter(connection => connection.status === connection_1.ConnectionStatus.ACCEPTED);
|
|
60
|
-
const preKeyBundlePromises = acceptedConnections.map(connection => {
|
|
61
|
-
const mappedConnection = {
|
|
62
|
-
userId: connection.to,
|
|
63
|
-
conversationId: connection.conversation,
|
|
64
|
-
};
|
|
65
|
-
return this.conversationService.getPreKeyBundleMap(mappedConnection.conversationId, [mappedConnection.userId]);
|
|
66
|
-
});
|
|
67
|
-
const preKeyBundlesFromConnections = await Promise.all(preKeyBundlePromises);
|
|
68
|
-
// Merge pre-key bundles
|
|
69
|
-
const allPreKeyBundles = preKeyBundlesFromConnections.reduce((accumulator, preKeyBundleMap) => {
|
|
70
|
-
return Object.assign(Object.assign({}, accumulator), preKeyBundleMap);
|
|
71
|
-
}, preKeyBundlesFromTeam);
|
|
72
|
-
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
73
|
-
availability: new protocol_messaging_1.Availability({ type }),
|
|
74
|
-
messageId: uuidjs_1.default.genV4().toString(),
|
|
75
|
-
});
|
|
76
|
-
// Broadcast availability status to your team members & external 1:1 connections
|
|
77
|
-
await this.broadcastService.broadcastGenericMessage(genericMessage, allPreKeyBundles, sendAsProtobuf);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.UserService = UserService;
|
|
81
|
-
//# sourceMappingURL=UserService.js.map
|
package/src/main/user/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './UserService';
|
package/src/main/user/index.js
DELETED
|
@@ -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("./UserService"), exports);
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare type ScheduleTaskParams = {
|
|
2
|
-
task: () => Promise<void>;
|
|
3
|
-
firingDate: number;
|
|
4
|
-
key: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const TaskScheduler: {
|
|
7
|
-
addTask: ({ task, firingDate, key }: ScheduleTaskParams) => void;
|
|
8
|
-
cancelTask: (key: string) => void;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
@@ -1,70 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.TaskScheduler = void 0;
|
|
25
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
26
|
-
const logger = (0, logdown_1.default)('@wireapp/core/util/TaskScheduler/TaskScheduler', {
|
|
27
|
-
logger: console,
|
|
28
|
-
markdown: false,
|
|
29
|
-
});
|
|
30
|
-
const activeTimeouts = {};
|
|
31
|
-
/**
|
|
32
|
-
* Execute a task at a given time.
|
|
33
|
-
*
|
|
34
|
-
* @param task function to be executed
|
|
35
|
-
* @param firingDate execution date
|
|
36
|
-
* @param key unique key for the task
|
|
37
|
-
*/
|
|
38
|
-
const addTask = ({ task, firingDate, key }) => {
|
|
39
|
-
const now = new Date();
|
|
40
|
-
const execute = new Date(firingDate);
|
|
41
|
-
const delay = execute.getTime() - now.getTime();
|
|
42
|
-
if (activeTimeouts[key]) {
|
|
43
|
-
cancelTask(key);
|
|
44
|
-
}
|
|
45
|
-
const timeout = setTimeout(async () => {
|
|
46
|
-
await task();
|
|
47
|
-
delete activeTimeouts[key];
|
|
48
|
-
}, delay > 0 ? delay : 0);
|
|
49
|
-
// add the task to the list of active tasks
|
|
50
|
-
activeTimeouts[key] = timeout;
|
|
51
|
-
logger.info(`New scheduled task to be executed at "${execute}" with key "${key}"`);
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Cancel a scheduled task early
|
|
55
|
-
*
|
|
56
|
-
* @param key unique key for the task
|
|
57
|
-
*/
|
|
58
|
-
const cancelTask = (key) => {
|
|
59
|
-
const timeout = activeTimeouts[key];
|
|
60
|
-
if (timeout) {
|
|
61
|
-
clearTimeout(timeout);
|
|
62
|
-
delete activeTimeouts[key];
|
|
63
|
-
logger.info(`Scheduled task with key "${key}" prematurely cleared`);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
exports.TaskScheduler = {
|
|
67
|
-
addTask,
|
|
68
|
-
cancelTask,
|
|
69
|
-
};
|
|
70
|
-
//# sourceMappingURL=TaskScheduler.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { QualifiedUserClients, UserClients } from '@wireapp/api-client/src/conversation/';
|
|
2
|
-
import type { QualifiedId } from '@wireapp/api-client/src/user/';
|
|
3
|
-
export declare function isStringArray(obj: any): obj is string[];
|
|
4
|
-
export declare function isQualifiedId(obj: any): obj is QualifiedId;
|
|
5
|
-
export declare function isQualifiedIdArray(obj: any): obj is QualifiedId[];
|
|
6
|
-
export declare function isQualifiedUserClients(obj: any): obj is QualifiedUserClients;
|
|
7
|
-
export declare function isUserClients(obj: any): obj is UserClients;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2021 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.isUserClients = exports.isQualifiedUserClients = exports.isQualifiedIdArray = exports.isQualifiedId = exports.isStringArray = void 0;
|
|
22
|
-
function isStringArray(obj) {
|
|
23
|
-
return Array.isArray(obj) && (obj.length === 0 || typeof obj[0] === 'string');
|
|
24
|
-
}
|
|
25
|
-
exports.isStringArray = isStringArray;
|
|
26
|
-
function isQualifiedId(obj) {
|
|
27
|
-
return typeof obj === 'object' && typeof obj['domain'] === 'string';
|
|
28
|
-
}
|
|
29
|
-
exports.isQualifiedId = isQualifiedId;
|
|
30
|
-
function isQualifiedIdArray(obj) {
|
|
31
|
-
return Array.isArray(obj) && isQualifiedId(obj[0]);
|
|
32
|
-
}
|
|
33
|
-
exports.isQualifiedIdArray = isQualifiedIdArray;
|
|
34
|
-
function isQualifiedUserClients(obj) {
|
|
35
|
-
var _a;
|
|
36
|
-
if (typeof obj === 'object') {
|
|
37
|
-
const firstUserClientObject = (_a = Object.values(obj)) === null || _a === void 0 ? void 0 : _a[0];
|
|
38
|
-
if (typeof firstUserClientObject === 'object') {
|
|
39
|
-
const firstClientIdArray = Object.values(firstUserClientObject)[0];
|
|
40
|
-
return isStringArray(firstClientIdArray);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
exports.isQualifiedUserClients = isQualifiedUserClients;
|
|
46
|
-
function isUserClients(obj) {
|
|
47
|
-
var _a;
|
|
48
|
-
if (typeof obj === 'object') {
|
|
49
|
-
const firstUserClientArray = (_a = Object.values(obj)) === null || _a === void 0 ? void 0 : _a[0];
|
|
50
|
-
return isStringArray(firstUserClientArray);
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
exports.isUserClients = isUserClients;
|
|
55
|
-
//# sourceMappingURL=TypePredicateUtil.js.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { DBSchema, IDBPDatabase } from 'idb';
|
|
2
|
-
interface DefaultEncryptedPayload {
|
|
3
|
-
iv: Uint8Array;
|
|
4
|
-
value: Uint8Array;
|
|
5
|
-
}
|
|
6
|
-
interface EncryptedDB<EncryptedPayload> extends DBSchema {
|
|
7
|
-
key: {
|
|
8
|
-
key: string;
|
|
9
|
-
value: CryptoKey;
|
|
10
|
-
};
|
|
11
|
-
secrets: {
|
|
12
|
-
key: string;
|
|
13
|
-
value: EncryptedPayload;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
declare type DecryptFn<EncryptedPayload> = (payload: EncryptedPayload) => Promise<Uint8Array>;
|
|
17
|
-
declare type EncryptFn<EncryptedPayload> = (value: Uint8Array) => Promise<EncryptedPayload>;
|
|
18
|
-
declare type EncryptedStoreConfig<EncryptedPayload> = {
|
|
19
|
-
encrypt: EncryptFn<EncryptedPayload>;
|
|
20
|
-
decrypt: DecryptFn<EncryptedPayload>;
|
|
21
|
-
};
|
|
22
|
-
declare class EncryptedStore<EncryptedPayload> {
|
|
23
|
-
#private;
|
|
24
|
-
private readonly db;
|
|
25
|
-
constructor(db: IDBPDatabase<EncryptedDB<EncryptedPayload>>, { encrypt, decrypt }: EncryptedStoreConfig<EncryptedPayload>);
|
|
26
|
-
saveSecretValue(primaryKey: string, value: Uint8Array): Promise<void>;
|
|
27
|
-
getsecretValue(primaryKey: string): Promise<Uint8Array | undefined>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Will create a database that uses the built in encryption/decryption functions.
|
|
31
|
-
* The master key will be created and stored inside the database
|
|
32
|
-
*
|
|
33
|
-
* @param dbName the name of the database to create
|
|
34
|
-
*/
|
|
35
|
-
export declare function createEncryptedStore(dbName: string): Promise<EncryptedStore<DefaultEncryptedPayload>>;
|
|
36
|
-
/**
|
|
37
|
-
* Will create a database that uses a custom encryption method. It needs the encrypt and decrypt function to be able to process the values stored.
|
|
38
|
-
* It's the responsability of the consumer to store the encryption key
|
|
39
|
-
*
|
|
40
|
-
* @param dbName the name of the database to create
|
|
41
|
-
* @param config contains the encrypt and decrypt methods
|
|
42
|
-
*/
|
|
43
|
-
export declare function createCustomEncryptedStore<EncryptedPayload>(dbName: string, config: EncryptedStoreConfig<EncryptedPayload>): Promise<EncryptedStore<EncryptedPayload>>;
|
|
44
|
-
export declare function deleteEncryptedStore(dbName: string): Promise<void>;
|
|
45
|
-
export {};
|