@wireapp/core 46.46.6-beta.10.d7a6c4c53 → 46.46.6-beta.14.f6fd03fe6
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/lib/Account.d.ts +51 -168
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +127 -517
- package/lib/Account.test.js +147 -158
- package/lib/broadcast/AvailabilityType.d.ts +1 -1
- package/lib/broadcast/AvailabilityType.d.ts.map +1 -1
- package/lib/broadcast/BroadcastService.d.ts +1 -1
- package/lib/broadcast/BroadcastService.d.ts.map +1 -1
- package/lib/broadcast/BroadcastService.js +1 -1
- package/lib/client/ClientService.d.ts +3 -4
- package/lib/client/ClientService.d.ts.map +1 -1
- package/lib/client/ClientService.js +5 -19
- package/lib/conversation/AbortReason.d.ts +1 -1
- package/lib/conversation/AbortReason.d.ts.map +1 -1
- package/lib/conversation/AssetService/AssetService.d.ts +30 -12
- package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
- package/lib/conversation/AssetService/AssetService.js +10 -1
- package/lib/conversation/AssetService/AssetService.test.js +3 -8
- package/lib/conversation/ClientActionType.d.ts +1 -1
- package/lib/conversation/ClientActionType.d.ts.map +1 -1
- package/lib/conversation/ClientActionType.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts +14 -98
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +101 -314
- package/lib/conversation/ConversationService/ConversationService.test.js +47 -441
- package/lib/conversation/ConversationService/ConversationService.types.d.ts +4 -5
- package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.js +3 -6
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +11 -158
- package/lib/conversation/SubconversationService/SubconversationService.test.js +2 -8
- package/lib/conversation/content/AssetContent.d.ts +1 -1
- package/lib/conversation/content/AssetContent.d.ts.map +1 -1
- package/lib/conversation/content/ButtonActionConfirmationContent.d.ts +1 -1
- package/lib/conversation/content/ButtonActionConfirmationContent.d.ts.map +1 -1
- package/lib/conversation/content/ButtonActionContent.d.ts +1 -1
- package/lib/conversation/content/ButtonActionContent.d.ts.map +1 -1
- package/lib/conversation/content/ClearedContent.d.ts +1 -1
- package/lib/conversation/content/ClearedContent.d.ts.map +1 -1
- package/lib/conversation/content/ClientActionContent.d.ts +1 -1
- package/lib/conversation/content/ClientActionContent.d.ts.map +1 -1
- package/lib/conversation/content/CompositeContent.d.ts +1 -1
- package/lib/conversation/content/CompositeContent.d.ts.map +1 -1
- package/lib/conversation/content/ConfirmationContent.d.ts +1 -1
- package/lib/conversation/content/ConfirmationContent.d.ts.map +1 -1
- package/lib/conversation/content/DeletedContent.d.ts +1 -1
- package/lib/conversation/content/DeletedContent.d.ts.map +1 -1
- package/lib/conversation/content/HiddenContent.d.ts +1 -1
- package/lib/conversation/content/HiddenContent.d.ts.map +1 -1
- package/lib/conversation/content/KnockContent.d.ts +1 -1
- package/lib/conversation/content/KnockContent.d.ts.map +1 -1
- package/lib/conversation/content/LinkPreviewContent.d.ts +1 -1
- package/lib/conversation/content/LinkPreviewContent.d.ts.map +1 -1
- package/lib/conversation/content/MentionContent.d.ts +1 -1
- package/lib/conversation/content/MentionContent.d.ts.map +1 -1
- package/lib/conversation/content/MultipartContent.d.ts +1 -1
- package/lib/conversation/content/MultipartContent.d.ts.map +1 -1
- package/lib/conversation/content/QuoteContent.d.ts +1 -1
- package/lib/conversation/content/QuoteContent.d.ts.map +1 -1
- package/lib/conversation/content/TweetContent.d.ts +1 -1
- package/lib/conversation/content/TweetContent.d.ts.map +1 -1
- package/lib/conversation/content/index.d.ts +1 -1
- package/lib/conversation/content/index.d.ts.map +1 -1
- package/lib/conversation/content/index.js +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
- package/lib/conversation/message/MessageBuilder.js +1 -1
- package/lib/conversation/message/MessageService.d.ts.map +1 -1
- package/lib/conversation/message/MessageService.js +1 -1
- package/lib/conversation/message/MessageService.test.js +1 -7
- package/lib/conversation/message/MessageToProtoMapper.d.ts +1 -1
- package/lib/conversation/message/MessageToProtoMapper.d.ts.map +1 -1
- package/lib/conversation/message/MessageToProtoMapper.js +1 -1
- package/lib/conversation/message/messageSender.js +2 -2
- package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts +2 -2
- package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts.map +1 -1
- package/lib/messagingProtocols/common.types.d.ts +0 -9
- package/lib/messagingProtocols/common.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +2 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +1 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +11 -13
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +16 -21
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +3 -9
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +12 -31
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +0 -6
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +1 -19
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts +4 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.js +69 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts +2 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.js +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.js +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +14 -23
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +98 -0
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +2 -5
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +3 -13
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts +2 -38
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.js +6 -41
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +34 -38
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +208 -267
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +160 -157
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +3 -3
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +5 -5
- package/lib/messagingProtocols/mls/conversationRejoinQueue.js +2 -2
- package/lib/messagingProtocols/mls/types.d.ts +8 -0
- package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.js +1 -7
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +15 -8
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +62 -97
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +6 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts +6 -1
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +22 -19
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +3 -5
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +24 -11
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +0 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +2 -11
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +9 -13
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +2 -3
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/WithMockedGenerics.test.js +4 -11
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +4 -0
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +5 -0
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts +1 -2
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +2 -8
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +0 -4
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +1 -1
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +1 -1
- package/lib/notification/NotificationService.d.ts +6 -20
- package/lib/notification/NotificationService.d.ts.map +1 -1
- package/lib/notification/NotificationService.js +14 -23
- package/lib/notification/NotificationService.test.js +0 -8
- package/lib/secretStore/secretKeyGenerator.d.ts +0 -1
- package/lib/secretStore/secretKeyGenerator.d.ts.map +1 -1
- package/lib/secretStore/secretKeyGenerator.js +1 -3
- package/lib/self/SelfService.d.ts +2 -2
- package/lib/self/SelfService.d.ts.map +1 -1
- package/lib/self/SelfService.test.js +2 -5
- package/lib/team/TeamService.d.ts +2 -5
- package/lib/team/TeamService.d.ts.map +1 -1
- package/lib/team/TeamService.js +2 -12
- package/lib/user/UserService.d.ts +2 -2
- package/lib/user/UserService.d.ts.map +1 -1
- package/lib/user/UserService.js +3 -3
- package/lib/util/TypePredicateUtil.d.ts.map +1 -1
- package/lib/util/TypePredicateUtil.js +2 -2
- package/package.json +3 -3
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts +0 -7
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.js +0 -48
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/index.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.js +0 -124
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts +0 -78
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.js +0 -173
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.js +0 -117
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts +0 -167
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.js +0 -317
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.js +0 -248
- package/lib/messagingProtocols/mls/recovery/index.d.ts +0 -5
- package/lib/messagingProtocols/mls/recovery/index.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/index.js +0 -28
- package/lib/test/StoreHelper.d.ts +0 -2
- package/lib/test/StoreHelper.d.ts.map +0 -1
- package/lib/test/StoreHelper.js +0 -27
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const mls_1 = require("@
|
|
21
|
+
const mls_1 = require("@pydio/protocol-messaging/web/mls");
|
|
22
22
|
const bazinga64_1 = require("bazinga64");
|
|
23
23
|
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
24
24
|
const commitBundleUtil_1 = require("./commitBundleUtil");
|
|
@@ -26,18 +26,18 @@ describe('toProtobufCommitBundle', () => {
|
|
|
26
26
|
it('encode commit bundles', () => {
|
|
27
27
|
const payload = {
|
|
28
28
|
commit: Uint8Array.from([0]),
|
|
29
|
-
welcome:
|
|
29
|
+
welcome: Uint8Array.from([1]),
|
|
30
30
|
groupInfo: {
|
|
31
31
|
ratchetTreeType: core_crypto_1.RatchetTreeType.Full,
|
|
32
|
-
payload:
|
|
32
|
+
payload: Uint8Array.from([2]),
|
|
33
33
|
encryptionType: core_crypto_1.GroupInfoEncryptionType.Plaintext,
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
const result = (0, commitBundleUtil_1.toProtobufCommitBundle)(payload);
|
|
37
37
|
const { commit, welcome, groupInfoBundle } = mls_1.mls.CommitBundle.decode(result);
|
|
38
38
|
expect(bazinga64_1.Encoder.toBase64(commit)).toEqual(bazinga64_1.Encoder.toBase64(payload.commit));
|
|
39
|
-
expect(bazinga64_1.Encoder.toBase64(welcome)).toEqual(bazinga64_1.Encoder.toBase64(payload.welcome
|
|
40
|
-
expect(bazinga64_1.Encoder.toBase64(groupInfoBundle.groupInfo)).toEqual(bazinga64_1.Encoder.toBase64(payload.groupInfo.payload
|
|
39
|
+
expect(bazinga64_1.Encoder.toBase64(welcome)).toEqual(bazinga64_1.Encoder.toBase64(payload.welcome));
|
|
40
|
+
expect(bazinga64_1.Encoder.toBase64(groupInfoBundle.groupInfo)).toEqual(bazinga64_1.Encoder.toBase64(payload.groupInfo.payload));
|
|
41
41
|
expect(groupInfoBundle.ratchetTreeType).toEqual(mls_1.mls.RatchetTreeType.FULL);
|
|
42
42
|
expect(groupInfoBundle.groupInfoType).toEqual(mls_1.mls.GroupInfoType.PUBLIC_GROUP_STATE);
|
|
43
43
|
});
|
|
@@ -38,8 +38,8 @@ async function queueConversationRejoin(groupId, rejoinFn) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function resumeRejoiningMLSConversations() {
|
|
41
|
-
sendingQueue.
|
|
41
|
+
sendingQueue.pause(false);
|
|
42
42
|
}
|
|
43
43
|
function pauseRejoiningMLSConversations() {
|
|
44
|
-
sendingQueue.pause();
|
|
44
|
+
sendingQueue.pause(true);
|
|
45
45
|
}
|
|
@@ -20,4 +20,12 @@ export type HandlePendingProposalsParams = {
|
|
|
20
20
|
delayInMs: number;
|
|
21
21
|
eventTime: string;
|
|
22
22
|
} & CommonMLS;
|
|
23
|
+
export interface CoreCryptoConfig {
|
|
24
|
+
/**
|
|
25
|
+
* path on the public server to the core crypto wasm file.
|
|
26
|
+
* This file will be downloaded lazily when corecrypto is needed.
|
|
27
|
+
* It, thus, needs to know where, on the server, the file can be found
|
|
28
|
+
*/
|
|
29
|
+
wasmFilePath: string;
|
|
30
|
+
}
|
|
23
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,MAAM,MAAM,QAAQ,GA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CACnB,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otrMessageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"otrMessageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,+BAG7B,yBAAyB,KAAG,OAAO,CAAC,mBAAmB,CA6BzD,CAAC"}
|
|
@@ -19,21 +19,16 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.handleOtrMessageAdd = void 0;
|
|
22
|
+
const protocol_messaging_1 = require("@pydio/protocol-messaging");
|
|
22
23
|
const bazinga64_1 = require("bazinga64");
|
|
23
|
-
const commons_1 = require("@wireapp/commons");
|
|
24
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
25
24
|
const conversation_1 = require("../../../../../conversation");
|
|
26
25
|
const DecryptionError_1 = require("../../../../../errors/DecryptionError");
|
|
27
|
-
const logger = commons_1.LogFactory.getLogger('@wireapp/core/otrMessageAdd');
|
|
28
26
|
const handleOtrMessageAdd = async ({ event, proteusService, }) => {
|
|
29
27
|
try {
|
|
30
28
|
const { from, qualified_from, data: { sender: clientId, text: encodedCiphertext }, } = event;
|
|
31
29
|
const userId = qualified_from || { id: from, domain: '' };
|
|
32
30
|
const messageBytes = bazinga64_1.Decoder.fromBase64(encodedCiphertext).asBytes;
|
|
33
|
-
const now = Date.now();
|
|
34
|
-
logger.info('Decrypting OTR message', { userId, clientId, event });
|
|
35
31
|
const decryptedData = await proteusService.decrypt(messageBytes, userId, clientId);
|
|
36
|
-
logger.info('OTR message decrypted successfully', { userId, clientId, event, duration: Date.now() - now });
|
|
37
32
|
const decodedData = protocol_messaging_1.GenericMessage.decode(decryptedData);
|
|
38
33
|
const isSessionReset = decodedData[conversation_1.GenericMessageType.CLIENT_ACTION] === protocol_messaging_1.ClientAction.RESET_SESSION;
|
|
39
34
|
if (isSessionReset) {
|
|
@@ -46,7 +41,6 @@ const handleOtrMessageAdd = async ({ event, proteusService, }) => {
|
|
|
46
41
|
};
|
|
47
42
|
}
|
|
48
43
|
catch (error) {
|
|
49
|
-
logger.warn('Failed to decrypt OTR message', { event, error });
|
|
50
44
|
if (error instanceof DecryptionError_1.DecryptionError) {
|
|
51
45
|
return { event, decryptionError: error };
|
|
52
46
|
}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { PreKey } from '@wireapp/api-client/lib/auth';
|
|
2
|
-
import { CoreCrypto
|
|
2
|
+
import { CoreCrypto } from '@wireapp/core-crypto';
|
|
3
3
|
import type { CRUDEngine } from '@wireapp/store-engine';
|
|
4
4
|
import { GeneratedKey } from '../../../../../secretStore/secretKeyGenerator';
|
|
5
|
-
import { CoreCryptoConfig } from '../../../../common.types';
|
|
6
5
|
import { CryptoClient } from '../CryptoClient.types';
|
|
7
6
|
type Config = {
|
|
8
|
-
generateSecretKey: (keyId: string
|
|
7
|
+
generateSecretKey: (keyId: string) => Promise<GeneratedKey>;
|
|
9
8
|
nbPrekeys: number;
|
|
10
9
|
onNewPrekeys: (prekeys: PreKey[]) => void;
|
|
10
|
+
wasmFilePath: string;
|
|
11
11
|
};
|
|
12
|
-
type ClientConfig = Omit<Config, 'generateSecretKey'> & {
|
|
12
|
+
type ClientConfig = Omit<Config, 'generateSecretKey' | 'wasmFilePath'> & {
|
|
13
13
|
onWipe: () => Promise<void>;
|
|
14
14
|
};
|
|
15
|
-
export declare
|
|
16
|
-
export declare const wipeCoreCryptoDb: (storeEngine: CRUDEngine) => Promise<void>;
|
|
17
|
-
export declare function buildClient(storeEngine: CRUDEngine, { generateSecretKey, nbPrekeys, onNewPrekeys }: Config, { wasmFilePath }: CoreCryptoConfig): Promise<CoreCryptoWrapper>;
|
|
15
|
+
export declare function buildClient(storeEngine: CRUDEngine, { wasmFilePath, generateSecretKey, nbPrekeys, onNewPrekeys }: Config): Promise<CoreCryptoWrapper>;
|
|
18
16
|
export declare class CoreCryptoWrapper implements CryptoClient {
|
|
19
17
|
private readonly coreCrypto;
|
|
18
|
+
private readonly config;
|
|
20
19
|
private readonly prekeyTracker;
|
|
21
20
|
readonly version: string;
|
|
22
21
|
constructor(coreCrypto: CoreCrypto, config: ClientConfig);
|
|
@@ -31,7 +30,6 @@ export declare class CoreCryptoWrapper implements CryptoClient {
|
|
|
31
30
|
key: string;
|
|
32
31
|
};
|
|
33
32
|
}>;
|
|
34
|
-
setMaxLogLevel(level: CoreCryptoLogLevel): void;
|
|
35
33
|
getFingerprint(): Promise<string>;
|
|
36
34
|
getRemoteFingerprint(sessionId: string): Promise<string>;
|
|
37
35
|
sessionFromMessage(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
|
|
@@ -45,6 +43,15 @@ export declare class CoreCryptoWrapper implements CryptoClient {
|
|
|
45
43
|
key: string;
|
|
46
44
|
}>;
|
|
47
45
|
debugBreakSession(sessionId: string): Promise<void>;
|
|
46
|
+
debugResetIdentity(): Promise<void>;
|
|
47
|
+
migrateFromCryptobox(dbName: string): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Will call the callback once corecrypto is ready.
|
|
50
|
+
* @param callback - Function to be called once corecrypto is ready.
|
|
51
|
+
* @see https://github.com/wireapp/wire-web-packages/pull/4972
|
|
52
|
+
*/
|
|
53
|
+
private onReady;
|
|
54
|
+
wipe(): Promise<void>;
|
|
48
55
|
}
|
|
49
56
|
export {};
|
|
50
57
|
//# sourceMappingURL=CoreCryptoWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAKpD,OAAO,
|
|
1
|
+
{"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAKpD,OAAO,EAAC,UAAU,EAAgD,MAAM,sBAAsB,CAAC;AAC/F,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAItD,OAAO,EAAoB,YAAY,EAAC,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,KAAK,MAAM,GAAG;IACZ,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,cAAc,CAAC,GAAG;IACvE,MAAM,EAAE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
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CoreCryptoWrapper =
|
|
21
|
+
exports.CoreCryptoWrapper = void 0;
|
|
22
22
|
exports.buildClient = buildClient;
|
|
23
23
|
const bazinga64_1 = require("bazinga64");
|
|
24
24
|
const idb_1 = require("idb");
|
|
@@ -40,118 +40,57 @@ const coreCryptoLogger = {
|
|
|
40
40
|
logFunctions[level].call(logger, { message, context });
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
const migrateOnceAndGetKey = async (generateSecretKey, coreCryptoDbName) => {
|
|
47
|
-
const coreCryptoNewKeyId = 'corecrypto-key-v2';
|
|
43
|
+
async function buildClient(storeEngine, { wasmFilePath, generateSecretKey, nbPrekeys, onNewPrekeys }) {
|
|
44
|
+
let key;
|
|
45
|
+
const coreCryptoDbName = `corecrypto-${storeEngine.storeName}`;
|
|
48
46
|
const coreCryptoKeyId = 'corecrypto-key';
|
|
49
|
-
// We retrieve the old key if it exists or generate a new one
|
|
50
|
-
const keyOld = await getKey(generateSecretKey, coreCryptoKeyId, 16);
|
|
51
|
-
// We retrieve the new key if it exists or generate a new one
|
|
52
|
-
const keyNew = await getKey(generateSecretKey, coreCryptoNewKeyId, 32);
|
|
53
|
-
if (!keyNew || !keyOld) {
|
|
54
|
-
// If we dont retreive any key, we throw an error
|
|
55
|
-
// This should not happen since we generate a new key if it does not exist
|
|
56
|
-
throw new Error('Key not found and could not be generated');
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Handles migration and cleanup of encryption keys.
|
|
60
|
-
*
|
|
61
|
-
* - If `keyNew` is freshly generated and `keyOld` is not freshly generated:
|
|
62
|
-
* - Migrate data from `keyOld` to `keyNew`
|
|
63
|
-
*/
|
|
64
|
-
if (keyNew.freshlyGenerated && !keyOld.freshlyGenerated) {
|
|
65
|
-
const databaseKey = new core_crypto_1.DatabaseKey(keyNew.key);
|
|
66
|
-
await (0, core_crypto_1.migrateDatabaseKeyTypeToBytes)(coreCryptoDbName, bazinga64_1.Encoder.toBase64(keyOld.key).asString, databaseKey);
|
|
67
|
-
}
|
|
68
|
-
// Always clean up the old key
|
|
69
|
-
await keyOld.deleteKey();
|
|
70
|
-
return {
|
|
71
|
-
key: new core_crypto_1.DatabaseKey(keyNew.key),
|
|
72
|
-
deleteKey: keyNew.deleteKey,
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
const getCoreCryptoDbName = (storeEngine) => {
|
|
76
|
-
return `corecrypto-${storeEngine.storeName}`;
|
|
77
|
-
};
|
|
78
|
-
exports.getCoreCryptoDbName = getCoreCryptoDbName;
|
|
79
|
-
const wipeCoreCryptoDb = async (storeEngine) => {
|
|
80
|
-
const coreCryptoDbName = (0, exports.getCoreCryptoDbName)(storeEngine);
|
|
81
47
|
try {
|
|
82
|
-
await
|
|
83
|
-
await (0, idb_1.deleteDB)(coreCryptoDbName);
|
|
84
|
-
logger.log('info', 'CoreCrypto DB wiped successfully');
|
|
48
|
+
key = await generateSecretKey(coreCryptoKeyId);
|
|
85
49
|
}
|
|
86
50
|
catch (error) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
let coreCryptoInstance;
|
|
92
|
-
async function buildClient(storeEngine, { generateSecretKey, nbPrekeys, onNewPrekeys }, { wasmFilePath }) {
|
|
93
|
-
return (
|
|
94
|
-
// We need to initialize the coreCrypto package with the path to the wasm file
|
|
95
|
-
// before we can use it. This is a one time operation and should be done
|
|
96
|
-
// before we create the CoreCrypto instance.
|
|
97
|
-
(0, core_crypto_1.initWasmModule)(wasmFilePath)
|
|
98
|
-
.then(async (output) => {
|
|
99
|
-
logger.log('info', 'CoreCrypto initialized', { output });
|
|
100
|
-
const coreCryptoDbName = (0, exports.getCoreCryptoDbName)(storeEngine);
|
|
101
|
-
// New key format used by coreCrypto
|
|
102
|
-
let key;
|
|
103
|
-
try {
|
|
104
|
-
key = await migrateOnceAndGetKey(generateSecretKey, coreCryptoDbName);
|
|
51
|
+
if (error instanceof secretKeyGenerator_1.CorruptedKeyError) {
|
|
52
|
+
// If we are dealing with a corrupted key, we wipe the key and the coreCrypto DB to start fresh
|
|
53
|
+
await (0, idb_1.deleteDB)(coreCryptoDbName);
|
|
54
|
+
key = await generateSecretKey(coreCryptoKeyId);
|
|
105
55
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// If we are dealing with a corrupted key, we wipe the key and the coreCrypto DB to start fresh
|
|
109
|
-
await (0, exports.wipeCoreCryptoDb)(storeEngine);
|
|
110
|
-
key = await migrateOnceAndGetKey(generateSecretKey, coreCryptoDbName);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
56
|
+
else {
|
|
57
|
+
throw error;
|
|
115
58
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
.catch(async (error) => {
|
|
126
|
-
logger.error('error', 'CoreCrypto initialization failed', { error });
|
|
127
|
-
// If the initialization fails, we wipe the coreCrypto DB to start fresh
|
|
128
|
-
await (0, exports.wipeCoreCryptoDb)(storeEngine);
|
|
129
|
-
throw error;
|
|
130
|
-
}));
|
|
59
|
+
}
|
|
60
|
+
const coreCrypto = await core_crypto_1.CoreCrypto.deferredInit({
|
|
61
|
+
databaseName: coreCryptoDbName,
|
|
62
|
+
key: bazinga64_1.Encoder.toBase64(key.key).asString,
|
|
63
|
+
wasmFilePath,
|
|
64
|
+
});
|
|
65
|
+
(0, core_crypto_1.setLogger)(coreCryptoLogger);
|
|
66
|
+
(0, core_crypto_1.setMaxLogLevel)(core_crypto_1.CoreCryptoLogLevel.Info);
|
|
67
|
+
return new CoreCryptoWrapper(coreCrypto, { nbPrekeys, onNewPrekeys, onWipe: key.deleteKey });
|
|
131
68
|
}
|
|
132
69
|
class CoreCryptoWrapper {
|
|
133
70
|
coreCrypto;
|
|
71
|
+
config;
|
|
134
72
|
prekeyTracker;
|
|
135
73
|
version;
|
|
136
74
|
constructor(coreCrypto, config) {
|
|
137
75
|
this.coreCrypto = coreCrypto;
|
|
138
|
-
this.
|
|
76
|
+
this.config = config;
|
|
77
|
+
this.version = core_crypto_1.CoreCrypto.version();
|
|
139
78
|
this.prekeyTracker = new PrekeysTracker_1.PrekeyTracker(this, config);
|
|
140
79
|
}
|
|
141
80
|
getNativeClient() {
|
|
142
81
|
return this.coreCrypto;
|
|
143
82
|
}
|
|
144
83
|
encrypt(sessions, plainText) {
|
|
145
|
-
return this.coreCrypto.
|
|
84
|
+
return this.coreCrypto.proteusEncryptBatched(sessions, plainText);
|
|
146
85
|
}
|
|
147
86
|
decrypt(sessionId, message) {
|
|
148
|
-
return this.coreCrypto.
|
|
87
|
+
return this.coreCrypto.proteusDecrypt(sessionId, message);
|
|
149
88
|
}
|
|
150
89
|
init(nbInitialPrekeys) {
|
|
151
90
|
if (nbInitialPrekeys) {
|
|
152
91
|
this.prekeyTracker.setInitialState(nbInitialPrekeys);
|
|
153
92
|
}
|
|
154
|
-
return this.coreCrypto.
|
|
93
|
+
return this.coreCrypto.proteusInit();
|
|
155
94
|
}
|
|
156
95
|
async create(nbPrekeys, entropy) {
|
|
157
96
|
if (entropy) {
|
|
@@ -162,7 +101,7 @@ class CoreCryptoWrapper {
|
|
|
162
101
|
for (let id = 0; id < nbPrekeys; id++) {
|
|
163
102
|
prekeys.push(await this.newPrekey());
|
|
164
103
|
}
|
|
165
|
-
const lastPrekeyBytes = await this.coreCrypto.
|
|
104
|
+
const lastPrekeyBytes = await this.coreCrypto.proteusLastResortPrekey();
|
|
166
105
|
const lastPrekey = bazinga64_1.Encoder.toBase64(lastPrekeyBytes).asString;
|
|
167
106
|
const lastPrekeyId = core_crypto_1.CoreCrypto.proteusLastResortPrekeyId();
|
|
168
107
|
return {
|
|
@@ -170,9 +109,6 @@ class CoreCryptoWrapper {
|
|
|
170
109
|
lastPrekey: { id: lastPrekeyId, key: lastPrekey },
|
|
171
110
|
};
|
|
172
111
|
}
|
|
173
|
-
setMaxLogLevel(level) {
|
|
174
|
-
(0, core_crypto_1.setMaxLogLevel)(level);
|
|
175
|
-
}
|
|
176
112
|
getFingerprint() {
|
|
177
113
|
return this.coreCrypto.proteusFingerprint();
|
|
178
114
|
}
|
|
@@ -181,25 +117,25 @@ class CoreCryptoWrapper {
|
|
|
181
117
|
}
|
|
182
118
|
async sessionFromMessage(sessionId, message) {
|
|
183
119
|
await this.consumePrekey(); // we need to mark a prekey as consumed since if we create a session from a message, it means the sender has consumed one of our prekeys
|
|
184
|
-
return this.coreCrypto.
|
|
120
|
+
return this.coreCrypto.proteusSessionFromMessage(sessionId, message);
|
|
185
121
|
}
|
|
186
122
|
sessionFromPrekey(sessionId, prekey) {
|
|
187
|
-
return this.coreCrypto.
|
|
123
|
+
return this.coreCrypto.proteusSessionFromPrekey(sessionId, prekey);
|
|
188
124
|
}
|
|
189
125
|
sessionExists(sessionId) {
|
|
190
126
|
return this.coreCrypto.proteusSessionExists(sessionId);
|
|
191
127
|
}
|
|
192
128
|
saveSession(sessionId) {
|
|
193
|
-
return this.coreCrypto.
|
|
129
|
+
return this.coreCrypto.proteusSessionSave(sessionId);
|
|
194
130
|
}
|
|
195
131
|
deleteSession(sessionId) {
|
|
196
|
-
return this.coreCrypto.
|
|
132
|
+
return this.coreCrypto.proteusSessionDelete(sessionId);
|
|
197
133
|
}
|
|
198
134
|
consumePrekey() {
|
|
199
135
|
return this.prekeyTracker.consumePrekey();
|
|
200
136
|
}
|
|
201
137
|
async newPrekey() {
|
|
202
|
-
const { id, pkb } = await this.coreCrypto.
|
|
138
|
+
const { id, pkb } = await this.coreCrypto.proteusNewPrekeyAuto();
|
|
203
139
|
return { id, key: bazinga64_1.Encoder.toBase64(pkb).asString };
|
|
204
140
|
}
|
|
205
141
|
async debugBreakSession(sessionId) {
|
|
@@ -209,7 +145,36 @@ class CoreCryptoWrapper {
|
|
|
209
145
|
200, 16, 166, 184, 70, 21, 81, 43, 80, 21, 231, 182, 142, 51, 220, 131, 162, 11, 255, 162, 74, 78, 162, 95, 156,
|
|
210
146
|
131, 48, 203, 5, 77, 122, 4, 246,
|
|
211
147
|
];
|
|
212
|
-
await this.coreCrypto.
|
|
148
|
+
await this.coreCrypto.proteusSessionFromPrekey(sessionId, Uint8Array.from(fakePrekey));
|
|
149
|
+
}
|
|
150
|
+
async debugResetIdentity() {
|
|
151
|
+
await this.coreCrypto.wipe();
|
|
152
|
+
}
|
|
153
|
+
async migrateFromCryptobox(dbName) {
|
|
154
|
+
return this.coreCrypto.proteusCryptoboxMigrate(dbName);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Will call the callback once corecrypto is ready.
|
|
158
|
+
* @param callback - Function to be called once corecrypto is ready.
|
|
159
|
+
* @see https://github.com/wireapp/wire-web-packages/pull/4972
|
|
160
|
+
*/
|
|
161
|
+
onReady(callback) {
|
|
162
|
+
if (!this.coreCrypto.isLocked()) {
|
|
163
|
+
return callback();
|
|
164
|
+
}
|
|
165
|
+
return new Promise(resolve => {
|
|
166
|
+
const intervalId = setInterval(async () => {
|
|
167
|
+
if (!this.coreCrypto.isLocked()) {
|
|
168
|
+
clearInterval(intervalId);
|
|
169
|
+
await callback();
|
|
170
|
+
return resolve();
|
|
171
|
+
}
|
|
172
|
+
}, 100);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
async wipe() {
|
|
176
|
+
await this.config.onWipe();
|
|
177
|
+
await this.onReady(() => this.coreCrypto.wipe());
|
|
213
178
|
}
|
|
214
179
|
}
|
|
215
180
|
exports.CoreCryptoWrapper = CoreCryptoWrapper;
|
|
@@ -30,5 +30,11 @@ export interface CryptoClient<T = unknown> {
|
|
|
30
30
|
deleteSession(sessionId: string): Promise<void>;
|
|
31
31
|
newPrekey(): Promise<PreKey>;
|
|
32
32
|
debugBreakSession(sessionId: string): void;
|
|
33
|
+
debugResetIdentity(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Will migrate the database from a different client type
|
|
36
|
+
*/
|
|
37
|
+
migrateFromCryptobox?(dbName: string): Promise<void>;
|
|
38
|
+
wipe(): Promise<void>;
|
|
33
39
|
}
|
|
34
40
|
//# sourceMappingURL=CryptoClient.types.d.ts.map
|
package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoClient.types.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,oBAAY,gBAAgB;IAC1B,WAAW,IAAA;IACX,SAAS,IAAA;CACV;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,eAAe,IAAI,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAErE;;OAEG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACzE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChF,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"CryptoClient.types.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,oBAAY,gBAAgB;IAC1B,WAAW,IAAA;IACX,SAAS,IAAA;CACV;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,eAAe,IAAI,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OA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CAAC,CAAC;CACvB"}
|
|
@@ -8,10 +8,15 @@ export declare const ProteusErrors: {
|
|
|
8
8
|
readonly DuplicateMessage: 209;
|
|
9
9
|
readonly Unknown: 999;
|
|
10
10
|
};
|
|
11
|
+
export declare const CORE_CRYPTO_PROTEUS_ERROR_NAMES: {
|
|
12
|
+
ProteusErrorSessionNotFound: string;
|
|
13
|
+
ProteusErrorRemoteIdentityChanged: string;
|
|
14
|
+
ProteusErrorDuplicateMessage: string;
|
|
15
|
+
};
|
|
11
16
|
type SenderInfo = {
|
|
12
17
|
clientId: string;
|
|
13
18
|
userId: QualifiedId;
|
|
14
19
|
};
|
|
15
|
-
export declare const generateDecryptionError: (senderInfo: SenderInfo, error:
|
|
20
|
+
export declare const generateDecryptionError: (senderInfo: SenderInfo, error: any) => DecryptionError;
|
|
16
21
|
export {};
|
|
17
22
|
//# sourceMappingURL=DecryptionErrorGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecryptionErrorGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"DecryptionErrorGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AAEnE,eAAO,MAAM,aAAa;;;;;;;CAOhB,CAAC;AAYX,eAAO,MAAM,+BAA+B;;;;CAI3C,CAAC;AAEF,KAAK,UAAU,GAAG;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAC,CAAC;AA0B1D,eAAO,MAAM,uBAAuB,eAAgB,UAAU,SAAS,GAAG,KAAG,eAS5E,CAAC"}
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.generateDecryptionError = exports.ProteusErrors = void 0;
|
|
22
|
-
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
21
|
+
exports.generateDecryptionError = exports.CORE_CRYPTO_PROTEUS_ERROR_NAMES = exports.ProteusErrors = void 0;
|
|
23
22
|
const DecryptionError_1 = require("../../../../errors/DecryptionError");
|
|
24
23
|
exports.ProteusErrors = {
|
|
25
24
|
SessionNotFound: 102,
|
|
@@ -29,36 +28,40 @@ exports.ProteusErrors = {
|
|
|
29
28
|
DuplicateMessage: 209,
|
|
30
29
|
Unknown: 999,
|
|
31
30
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
const isCoreCryptoError = (error) => {
|
|
32
|
+
return 'proteusErrorCode' in error;
|
|
33
|
+
};
|
|
34
|
+
const isCryptoboxError = (error) => {
|
|
35
|
+
return 'code' in error;
|
|
36
|
+
};
|
|
37
|
+
exports.CORE_CRYPTO_PROTEUS_ERROR_NAMES = {
|
|
38
|
+
ProteusErrorSessionNotFound: 'ProteusErrorSessionNotFound',
|
|
39
|
+
ProteusErrorRemoteIdentityChanged: 'ProteusErrorRemoteIdentityChanged',
|
|
40
|
+
ProteusErrorDuplicateMessage: 'ProteusErrorDuplicateMessage',
|
|
41
|
+
};
|
|
34
42
|
function getErrorCode(error) {
|
|
35
|
-
if ((
|
|
43
|
+
if (isCoreCryptoError(error) && typeof error.proteusErrorCode === 'number') {
|
|
44
|
+
return error.proteusErrorCode;
|
|
45
|
+
}
|
|
46
|
+
if (isCryptoboxError(error) && typeof error.code === 'number') {
|
|
47
|
+
return error.code;
|
|
48
|
+
}
|
|
49
|
+
if (error.name === exports.CORE_CRYPTO_PROTEUS_ERROR_NAMES.ProteusErrorSessionNotFound) {
|
|
36
50
|
return exports.ProteusErrors.SessionNotFound;
|
|
37
51
|
}
|
|
38
|
-
if (
|
|
52
|
+
if (error.name === exports.CORE_CRYPTO_PROTEUS_ERROR_NAMES.ProteusErrorRemoteIdentityChanged) {
|
|
39
53
|
return exports.ProteusErrors.RemoteIdentityChanged;
|
|
40
54
|
}
|
|
41
|
-
if (
|
|
55
|
+
if (error.name === exports.CORE_CRYPTO_PROTEUS_ERROR_NAMES.ProteusErrorDuplicateMessage) {
|
|
42
56
|
return exports.ProteusErrors.DuplicateMessage;
|
|
43
57
|
}
|
|
44
|
-
if ((0, core_crypto_1.isProteusError)(error, core_crypto_1.ProteusErrorType.Other)) {
|
|
45
|
-
return exports.ProteusErrors.Unknown;
|
|
46
|
-
}
|
|
47
|
-
if (hasProteusErrorCode(error)) {
|
|
48
|
-
return error.proteusErrorCode;
|
|
49
|
-
}
|
|
50
|
-
if (isCryptoboxError(error)) {
|
|
51
|
-
return error.code;
|
|
52
|
-
}
|
|
53
58
|
return exports.ProteusErrors.Unknown;
|
|
54
59
|
}
|
|
55
60
|
const generateDecryptionError = (senderInfo, error) => {
|
|
56
61
|
const { clientId, userId } = senderInfo;
|
|
57
62
|
const sender = `${userId.id} (${clientId})`;
|
|
58
63
|
const code = getErrorCode(error);
|
|
59
|
-
const
|
|
60
|
-
const text = error?.message ?? String(error);
|
|
61
|
-
const message = `Decryption error from ${sender} (name: ${name}) (message: ${text})`;
|
|
64
|
+
const message = `Decryption error from ${sender} (name: ${error.name}) (message: ${error.message})`;
|
|
62
65
|
return new DecryptionError_1.DecryptionError(message, code);
|
|
63
66
|
};
|
|
64
67
|
exports.generateDecryptionError = generateDecryptionError;
|
|
@@ -20,13 +20,11 @@ export declare class ProteusService {
|
|
|
20
20
|
private readonly apiClient;
|
|
21
21
|
private readonly cryptoClient;
|
|
22
22
|
private readonly config;
|
|
23
|
-
private readonly storeEngine;
|
|
24
23
|
private readonly messageService;
|
|
25
24
|
private readonly logger;
|
|
26
|
-
|
|
27
|
-
constructor(apiClient: APIClient, cryptoClient: CryptoClient, config: ProteusServiceConfig, storeEngine: CRUDEngine);
|
|
25
|
+
constructor(apiClient: APIClient, cryptoClient: CryptoClient, config: ProteusServiceConfig);
|
|
28
26
|
handleOtrMessageAddEvent(event: ConversationOtrMessageAddEvent): Promise<HandledEventPayload>;
|
|
29
|
-
initClient(context: Context): Promise<void>;
|
|
27
|
+
initClient(storeEngine: CRUDEngine, context: Context): Promise<void>;
|
|
30
28
|
createClient(entropy?: Uint8Array): Promise<import("./CryptoClient").InitialPrekeys>;
|
|
31
29
|
/**
|
|
32
30
|
* Get the fingerprint of the local client.
|
|
@@ -52,6 +50,6 @@ export declare class ProteusService {
|
|
|
52
50
|
consumePrekey(): Promise<void>;
|
|
53
51
|
deleteSession(userId: QualifiedId, clientId: string): Promise<void>;
|
|
54
52
|
encrypt(plainText: Uint8Array, recipients: QualifiedUserPreKeyBundleMap | QualifiedUserClients): Promise<EncryptionResult>;
|
|
55
|
-
wipe(): Promise<void>;
|
|
53
|
+
wipe(storeEngine?: CRUDEngine): Promise<void>;
|
|
56
54
|
}
|
|
57
55
|
//# sourceMappingURL=ProteusService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAGL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAG5F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EACV,mCAAmC,EACnC,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAEL,iCAAiC,EAEjC,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAY1D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wEAAwE;IACxE,QAAQ,EAAE,sBAAsB,CAAC;IACjC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,sGAAsG;IACtG,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,qBAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAGL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAG5F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EACV,mCAAmC,EACnC,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAEL,iCAAiC,EAEjC,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;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,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;IA6CpC,OAAO,CAAC,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAuB9E,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAQ7C,OAAO,CAClB,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,4BAA4B,GAAG,oBAAoB,GAC9D,OAAO,CAAC,gBAAgB,CAAC;IAiBtB,IAAI,CAAC,WAAW,CAAC,EAAE,UAAU;CAMpC"}
|
|
@@ -37,17 +37,13 @@ class ProteusService {
|
|
|
37
37
|
apiClient;
|
|
38
38
|
cryptoClient;
|
|
39
39
|
config;
|
|
40
|
-
storeEngine;
|
|
41
40
|
messageService;
|
|
42
41
|
logger = commons_1.LogFactory.getLogger('@wireapp/core/ProteusService');
|
|
43
|
-
|
|
44
|
-
constructor(apiClient, cryptoClient, config, storeEngine) {
|
|
42
|
+
constructor(apiClient, cryptoClient, config) {
|
|
45
43
|
this.apiClient = apiClient;
|
|
46
44
|
this.cryptoClient = cryptoClient;
|
|
47
45
|
this.config = config;
|
|
48
|
-
this.storeEngine = storeEngine;
|
|
49
46
|
this.messageService = new MessageService_1.MessageService(this.apiClient, this);
|
|
50
|
-
this.dbName = storeEngine.storeName;
|
|
51
47
|
}
|
|
52
48
|
async handleOtrMessageAddEvent(event) {
|
|
53
49
|
return (0, events_1.handleOtrMessageAdd)({
|
|
@@ -55,16 +51,30 @@ class ProteusService {
|
|
|
55
51
|
proteusService: this,
|
|
56
52
|
});
|
|
57
53
|
}
|
|
58
|
-
async initClient(context) {
|
|
54
|
+
async initClient(storeEngine, context) {
|
|
55
|
+
const dbName = storeEngine.storeName;
|
|
59
56
|
if (context.domain) {
|
|
60
57
|
// We want sessions to be fully qualified from now on
|
|
61
|
-
if (!cryptoMigrationStateStore_1.cryptoMigrationStore.qualifiedSessions.isReady(
|
|
58
|
+
if (!cryptoMigrationStateStore_1.cryptoMigrationStore.qualifiedSessions.isReady(dbName)) {
|
|
62
59
|
this.logger.info(`Migrating existing session ids to qualified ids.`);
|
|
63
|
-
await (0, sessionIdMigrator_1.migrateToQualifiedSessionIds)(
|
|
64
|
-
cryptoMigrationStateStore_1.cryptoMigrationStore.qualifiedSessions.markAsReady(
|
|
60
|
+
await (0, sessionIdMigrator_1.migrateToQualifiedSessionIds)(storeEngine, context.domain);
|
|
61
|
+
cryptoMigrationStateStore_1.cryptoMigrationStore.qualifiedSessions.markAsReady(dbName);
|
|
65
62
|
this.logger.info(`Successfully migrated session ids to qualified ids.`);
|
|
66
63
|
}
|
|
67
64
|
}
|
|
65
|
+
if (!cryptoMigrationStateStore_1.cryptoMigrationStore.coreCrypto.isReady(dbName) && this.cryptoClient.migrateFromCryptobox) {
|
|
66
|
+
this.logger.info(`Migrating from cryptobox to corecrypto.`);
|
|
67
|
+
try {
|
|
68
|
+
const startTime = Date.now();
|
|
69
|
+
await this.cryptoClient.migrateFromCryptobox(dbName);
|
|
70
|
+
cryptoMigrationStateStore_1.cryptoMigrationStore.coreCrypto.markAsReady(dbName);
|
|
71
|
+
this.logger.info(`Successfully migrated from cryptobox to corecrypto (took ${Date.now() - startTime}ms).`);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
this.logger.error('Client was not able to perform DB migration: ', error);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
68
78
|
const backendPrekeys = await this.apiClient.api.client.getClientPreKeys(context.clientId ?? '');
|
|
69
79
|
const totalUsableBackedPrekeys = backendPrekeys.length - 1; // we remove the last resort prekey from the total number of available prekeys
|
|
70
80
|
return this.cryptoClient.init(totalUsableBackedPrekeys);
|
|
@@ -261,8 +271,11 @@ class ProteusService {
|
|
|
261
271
|
failed,
|
|
262
272
|
};
|
|
263
273
|
}
|
|
264
|
-
async wipe() {
|
|
265
|
-
|
|
274
|
+
async wipe(storeEngine) {
|
|
275
|
+
if (storeEngine) {
|
|
276
|
+
await (0, identityClearer_1.deleteIdentity)(storeEngine);
|
|
277
|
+
}
|
|
278
|
+
return this.cryptoClient.wipe();
|
|
266
279
|
}
|
|
267
280
|
}
|
|
268
281
|
exports.ProteusService = ProteusService;
|