@wireapp/core 46.46.6-beta.14.f6fd03fe6 → 46.46.6

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.
Files changed (195) hide show
  1. package/lib/Account.d.ts +156 -51
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +503 -127
  4. package/lib/Account.test.js +158 -147
  5. package/lib/broadcast/AvailabilityType.d.ts +1 -1
  6. package/lib/broadcast/AvailabilityType.d.ts.map +1 -1
  7. package/lib/broadcast/BroadcastService.d.ts +1 -1
  8. package/lib/broadcast/BroadcastService.d.ts.map +1 -1
  9. package/lib/broadcast/BroadcastService.js +1 -1
  10. package/lib/client/ClientService.d.ts +4 -3
  11. package/lib/client/ClientService.d.ts.map +1 -1
  12. package/lib/client/ClientService.js +19 -5
  13. package/lib/conversation/AbortReason.d.ts +1 -1
  14. package/lib/conversation/AbortReason.d.ts.map +1 -1
  15. package/lib/conversation/AssetService/AssetService.d.ts +12 -30
  16. package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
  17. package/lib/conversation/AssetService/AssetService.js +1 -10
  18. package/lib/conversation/AssetService/AssetService.test.js +8 -3
  19. package/lib/conversation/ClientActionType.d.ts +1 -1
  20. package/lib/conversation/ClientActionType.d.ts.map +1 -1
  21. package/lib/conversation/ClientActionType.js +1 -1
  22. package/lib/conversation/ConversationService/ConversationService.d.ts +98 -14
  23. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  24. package/lib/conversation/ConversationService/ConversationService.js +314 -101
  25. package/lib/conversation/ConversationService/ConversationService.test.js +441 -47
  26. package/lib/conversation/ConversationService/ConversationService.types.d.ts +5 -4
  27. package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
  28. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
  29. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.js +6 -3
  30. package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
  31. package/lib/conversation/SubconversationService/SubconversationService.js +158 -11
  32. package/lib/conversation/SubconversationService/SubconversationService.test.js +8 -2
  33. package/lib/conversation/content/AssetContent.d.ts +1 -1
  34. package/lib/conversation/content/AssetContent.d.ts.map +1 -1
  35. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts +1 -1
  36. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts.map +1 -1
  37. package/lib/conversation/content/ButtonActionContent.d.ts +1 -1
  38. package/lib/conversation/content/ButtonActionContent.d.ts.map +1 -1
  39. package/lib/conversation/content/ClearedContent.d.ts +1 -1
  40. package/lib/conversation/content/ClearedContent.d.ts.map +1 -1
  41. package/lib/conversation/content/ClientActionContent.d.ts +1 -1
  42. package/lib/conversation/content/ClientActionContent.d.ts.map +1 -1
  43. package/lib/conversation/content/CompositeContent.d.ts +1 -1
  44. package/lib/conversation/content/CompositeContent.d.ts.map +1 -1
  45. package/lib/conversation/content/ConfirmationContent.d.ts +1 -1
  46. package/lib/conversation/content/ConfirmationContent.d.ts.map +1 -1
  47. package/lib/conversation/content/DeletedContent.d.ts +1 -1
  48. package/lib/conversation/content/DeletedContent.d.ts.map +1 -1
  49. package/lib/conversation/content/HiddenContent.d.ts +1 -1
  50. package/lib/conversation/content/HiddenContent.d.ts.map +1 -1
  51. package/lib/conversation/content/KnockContent.d.ts +1 -1
  52. package/lib/conversation/content/KnockContent.d.ts.map +1 -1
  53. package/lib/conversation/content/LinkPreviewContent.d.ts +1 -1
  54. package/lib/conversation/content/LinkPreviewContent.d.ts.map +1 -1
  55. package/lib/conversation/content/MentionContent.d.ts +1 -1
  56. package/lib/conversation/content/MentionContent.d.ts.map +1 -1
  57. package/lib/conversation/content/MultipartContent.d.ts +1 -1
  58. package/lib/conversation/content/MultipartContent.d.ts.map +1 -1
  59. package/lib/conversation/content/QuoteContent.d.ts +1 -1
  60. package/lib/conversation/content/QuoteContent.d.ts.map +1 -1
  61. package/lib/conversation/content/TweetContent.d.ts +1 -1
  62. package/lib/conversation/content/TweetContent.d.ts.map +1 -1
  63. package/lib/conversation/content/index.d.ts +1 -1
  64. package/lib/conversation/content/index.d.ts.map +1 -1
  65. package/lib/conversation/content/index.js +1 -1
  66. package/lib/conversation/message/MessageBuilder.d.ts +1 -1
  67. package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
  68. package/lib/conversation/message/MessageBuilder.js +1 -1
  69. package/lib/conversation/message/MessageService.d.ts.map +1 -1
  70. package/lib/conversation/message/MessageService.js +1 -1
  71. package/lib/conversation/message/MessageService.test.js +7 -1
  72. package/lib/conversation/message/MessageToProtoMapper.d.ts +1 -1
  73. package/lib/conversation/message/MessageToProtoMapper.d.ts.map +1 -1
  74. package/lib/conversation/message/MessageToProtoMapper.js +1 -1
  75. package/lib/conversation/message/messageSender.js +2 -2
  76. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts +2 -2
  77. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts.map +1 -1
  78. package/lib/messagingProtocols/common.types.d.ts +9 -0
  79. package/lib/messagingProtocols/common.types.d.ts.map +1 -1
  80. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +2 -2
  81. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -1
  82. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +2 -1
  83. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +1 -1
  84. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
  85. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +13 -11
  86. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +21 -16
  87. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +9 -3
  88. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
  89. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +31 -12
  90. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +6 -0
  91. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
  92. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +19 -1
  93. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts +7 -0
  94. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts.map +1 -0
  95. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.js +48 -0
  96. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/index.d.ts +2 -0
  97. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingMessagesQueue → IncomingProposalsQueue}/index.d.ts.map +1 -1
  98. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingMessagesQueue → IncomingProposalsQueue}/index.js +1 -1
  99. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts +0 -1
  100. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -1
  101. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.js +0 -1
  102. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  103. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +23 -14
  104. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
  105. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +5 -2
  106. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +13 -3
  107. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts +38 -2
  108. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
  109. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.js +41 -6
  110. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts +2 -0
  111. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts.map +1 -0
  112. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.js +124 -0
  113. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +38 -34
  114. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  115. package/lib/messagingProtocols/mls/MLSService/MLSService.js +267 -208
  116. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +157 -160
  117. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +3 -3
  118. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +5 -5
  119. package/lib/messagingProtocols/mls/conversationRejoinQueue.js +2 -2
  120. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts +78 -0
  121. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts.map +1 -0
  122. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.js +173 -0
  123. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts +2 -0
  124. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts.map +1 -0
  125. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.js +117 -0
  126. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts +167 -0
  127. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts.map +1 -0
  128. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.js +317 -0
  129. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts +2 -0
  130. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts.map +1 -0
  131. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.js +248 -0
  132. package/lib/messagingProtocols/mls/recovery/index.d.ts +5 -0
  133. package/lib/messagingProtocols/mls/recovery/index.d.ts.map +1 -0
  134. package/lib/messagingProtocols/mls/recovery/index.js +28 -0
  135. package/lib/messagingProtocols/mls/types.d.ts +0 -8
  136. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  137. package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
  138. package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.js +7 -1
  139. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +8 -15
  140. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
  141. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +97 -62
  142. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +0 -6
  143. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
  144. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts +1 -6
  145. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts.map +1 -1
  146. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +19 -22
  147. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +5 -3
  148. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  149. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +11 -24
  150. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +1 -0
  151. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
  152. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +11 -2
  153. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +13 -9
  154. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +3 -2
  155. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
  156. package/lib/messagingProtocols/proteus/ProteusService/WithMockedGenerics.test.js +11 -4
  157. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +0 -4
  158. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -1
  159. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +0 -5
  160. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts +2 -1
  161. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts.map +1 -1
  162. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +8 -2
  163. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +4 -0
  164. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +1 -1
  165. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
  166. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +1 -1
  167. package/lib/notification/NotificationService.d.ts +20 -6
  168. package/lib/notification/NotificationService.d.ts.map +1 -1
  169. package/lib/notification/NotificationService.js +23 -14
  170. package/lib/notification/NotificationService.test.js +8 -0
  171. package/lib/secretStore/secretKeyGenerator.d.ts +1 -0
  172. package/lib/secretStore/secretKeyGenerator.d.ts.map +1 -1
  173. package/lib/secretStore/secretKeyGenerator.js +3 -1
  174. package/lib/self/SelfService.d.ts +2 -2
  175. package/lib/self/SelfService.d.ts.map +1 -1
  176. package/lib/self/SelfService.test.js +5 -2
  177. package/lib/team/TeamService.d.ts +5 -2
  178. package/lib/team/TeamService.d.ts.map +1 -1
  179. package/lib/team/TeamService.js +12 -2
  180. package/lib/test/StoreHelper.d.ts +2 -0
  181. package/lib/test/StoreHelper.d.ts.map +1 -0
  182. package/lib/test/StoreHelper.js +27 -0
  183. package/lib/user/UserService.d.ts +2 -2
  184. package/lib/user/UserService.d.ts.map +1 -1
  185. package/lib/user/UserService.js +3 -3
  186. package/lib/util/TypePredicateUtil.d.ts.map +1 -1
  187. package/lib/util/TypePredicateUtil.js +2 -2
  188. package/package.json +3 -3
  189. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts +0 -4
  190. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +0 -1
  191. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.js +0 -69
  192. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts +0 -2
  193. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts +0 -2
  194. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts.map +0 -1
  195. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +0 -98
@@ -49,9 +49,10 @@ const MessageBuilder_1 = require("../../../conversation/message/MessageBuilder")
49
49
  const ProteusService_mocks_1 = require("./ProteusService.mocks");
50
50
  const SessionHandler_1 = require("../Utility/SessionHandler");
51
51
  const event_1 = require("@wireapp/api-client/lib/event");
52
- const protocol_messaging_1 = require("@pydio/protocol-messaging");
52
+ const protocol_messaging_1 = require("@wireapp/protocol-messaging");
53
53
  const errors_1 = require("../../../errors");
54
54
  const testUtils_1 = require("../../../testUtils");
55
+ const team_1 = require("@wireapp/api-client/lib/team");
55
56
  jest.mock('./CryptoClient/CoreCryptoWrapper/PrekeysTracker', () => {
56
57
  return {
57
58
  PrekeyTracker: jest.fn().mockImplementation(() => {
@@ -127,6 +128,9 @@ const prepareDataForEncryption = async () => {
127
128
  };
128
129
  };
129
130
  describe('ProteusService', () => {
131
+ afterAll(() => {
132
+ (0, ProteusService_mocks_1.cleanupProteusServiceMocks)();
133
+ });
130
134
  const domain1 = 'domain1';
131
135
  const domain2 = 'domain2';
132
136
  const domain3 = 'domain3';
@@ -346,7 +350,7 @@ describe('ProteusService', () => {
346
350
  const params = {
347
351
  conversationId: (0, testUtils_1.generateQualifiedId)('domain'),
348
352
  payload: message,
349
- protocol: conversation_1.ConversationProtocol.PROTEUS,
353
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
350
354
  targetMode: conversation_2.MessageTargetMode.USERS,
351
355
  };
352
356
  try {
@@ -371,7 +375,7 @@ describe('ProteusService', () => {
371
375
  MockedRecipients.getRecipientsForConversation.mockResolvedValue({});
372
376
  jest.spyOn(proteusService['messageService'], 'sendMessage').mockReturnValue(Promise.resolve({}));
373
377
  await proteusService.sendMessage({
374
- protocol: conversation_1.ConversationProtocol.PROTEUS,
378
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
375
379
  payload: message,
376
380
  targetMode: conversation_2.MessageTargetMode.USERS,
377
381
  userIds: recipients,
@@ -398,7 +402,7 @@ describe('ProteusService', () => {
398
402
  MockedRecipients.getRecipientsForConversation.mockResolvedValue({});
399
403
  jest.spyOn(proteusService['messageService'], 'sendMessage').mockResolvedValue({});
400
404
  await proteusService.sendMessage({
401
- protocol: conversation_1.ConversationProtocol.PROTEUS,
405
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
402
406
  conversationId: { id: 'conv1', domain: 'domain1' },
403
407
  payload: message,
404
408
  targetMode: conversation_2.MessageTargetMode.USERS,
@@ -426,7 +430,7 @@ describe('ProteusService', () => {
426
430
  jest.spyOn(proteusService['messageService'], 'sendMessage').mockReturnValue(Promise.resolve({}));
427
431
  await proteusService.sendMessage({
428
432
  conversationId: { id: 'conv1', domain: '' },
429
- protocol: conversation_1.ConversationProtocol.PROTEUS,
433
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
430
434
  payload: message,
431
435
  targetMode: conversation_2.MessageTargetMode.USERS_CLIENTS,
432
436
  userIds: recipients,
@@ -447,7 +451,7 @@ describe('ProteusService', () => {
447
451
  MockedRecipients.getRecipientsForConversation.mockResolvedValue({});
448
452
  jest.spyOn(proteusService['messageService'], 'sendMessage').mockReturnValue(Promise.resolve({}));
449
453
  await proteusService.sendMessage({
450
- protocol: conversation_1.ConversationProtocol.PROTEUS,
454
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
451
455
  conversationId: { id: 'conv1', domain: 'domain1' },
452
456
  payload: message,
453
457
  targetMode: conversation_2.MessageTargetMode.USERS_CLIENTS,
@@ -473,7 +477,7 @@ describe('ProteusService', () => {
473
477
  deleted: {},
474
478
  });
475
479
  const result = await proteusService.sendMessage({
476
- protocol: conversation_1.ConversationProtocol.PROTEUS,
480
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
477
481
  conversationId: (0, testUtils_1.generateQualifiedId)('domain'),
478
482
  payload: message,
479
483
  targetMode: conversation_2.MessageTargetMode.USERS_CLIENTS,
@@ -556,9 +560,9 @@ describe('ProteusService', () => {
556
560
  describe('createConversation', () => {
557
561
  const newConversation = {
558
562
  qualified_id: { id: '', domain: '' },
559
- id: '',
560
563
  type: conversation_1.CONVERSATION_TYPE.REGULAR,
561
564
  creator: '',
565
+ cells_state: conversation_1.CONVERSATION_CELLS_STATE.DISABLED,
562
566
  access: [],
563
567
  access_role: [conversation_1.CONVERSATION_ACCESS_ROLE.GUEST],
564
568
  members: {
@@ -575,7 +579,7 @@ describe('ProteusService', () => {
575
579
  status_time: '',
576
580
  },
577
581
  },
578
- protocol: conversation_1.ConversationProtocol.PROTEUS,
582
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
579
583
  };
580
584
  it('adds all requested users to a new conversation', async () => {
581
585
  const [proteusService, { apiClient }] = await (0, ProteusService_mocks_1.buildProteusService)();
@@ -1,4 +1,5 @@
1
- import { QualifiedUserClients, MessageSendingStatus, ConversationProtocol, NewConversation } from '@wireapp/api-client/lib/conversation';
1
+ import { QualifiedUserClients, MessageSendingStatus, NewConversation } from '@wireapp/api-client/lib/conversation';
2
+ import { CONVERSATION_PROTOCOL } from '@wireapp/api-client/lib/team';
2
3
  import { QualifiedId } from '@wireapp/api-client/lib/user';
3
4
  import { AddUsersParams, MessageSendingOptions, SendCommonParams } from '../../../conversation';
4
5
  export interface NewClient {
@@ -17,7 +18,7 @@ export type SendProteusMessageParams = SendCommonParams & MessageSendingOptions
17
18
  */
18
19
  userIds?: QualifiedId[] | QualifiedUserClients;
19
20
  onClientMismatch?: (status: MessageSendingStatus, wasSent: boolean) => void | boolean | Promise<boolean>;
20
- protocol: ConversationProtocol.PROTEUS;
21
+ protocol: CONVERSATION_PROTOCOL.PROTEUS;
21
22
  };
22
23
  export type CreateProteusConversationParams = {
23
24
  conversationData: NewConversation | string;
@@ -1 +1 @@
1
- {"version":3,"file":"ProteusService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAE9F,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;CACrB;AACD,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GACrD,qBAAqB,GAAG;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,oBAAoB,CAAC;IAC/C,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzG,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC;CACxC,CAAC;AAEJ,MAAM,MAAM,+BAA+B,GAAG;IAC5C,gBAAgB,EAAE,eAAe,GAAG,MAAM,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"ProteusService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAE,oBAAoB,EAAE,eAAe,EAAC,MAAM,sCAAsC,CAAC;AACjH,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAE9F,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;CACrB;AACD,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GACrD,qBAAqB,GAAG;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,oBAAoB,CAAC;IAC/C,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzG,QAAQ,EAAE,qBAAqB,CAAC,OAAO,CAAC;CACzC,CAAC;AAEJ,MAAM,MAAM,+BAA+B,GAAG;IAC5C,gBAAgB,EAAE,eAAe,GAAG,MAAM,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC"}
@@ -44,8 +44,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
44
44
  /* eslint-disable import/order */
45
45
  const GenericMessageParams = __importStar(require("../Utility/getGenericMessageParams"));
46
46
  const client_1 = require("@wireapp/api-client/lib/client");
47
- const conversation_1 = require("@wireapp/api-client/lib/conversation");
48
- const conversation_2 = require("../../../conversation");
47
+ const team_1 = require("@wireapp/api-client/lib/team");
48
+ const conversation_1 = require("../../../conversation");
49
49
  const MessageBuilder_1 = require("../../../conversation/message/MessageBuilder");
50
50
  const ProteusService_mocks_1 = require("./ProteusService.mocks");
51
51
  jest.mock('../Utility/getGenericMessageParams', () => {
@@ -54,8 +54,10 @@ jest.mock('../Utility/getGenericMessageParams', () => {
54
54
  };
55
55
  });
56
56
  const MockedGenericMessageParams = GenericMessageParams;
57
+ const apiClients = [];
57
58
  const prepareProteusService = async () => {
58
59
  const [proteusService, { apiClient }] = await (0, ProteusService_mocks_1.buildProteusService)();
60
+ apiClients.push(apiClient);
59
61
  jest.spyOn(apiClient.api.user, 'postListClients').mockImplementation(() => Promise.resolve({
60
62
  qualified_user_map: {
61
63
  'test-domain': {
@@ -72,6 +74,11 @@ const prepareProteusService = async () => {
72
74
  .mockImplementation(data => Promise.resolve(data));
73
75
  return proteusService;
74
76
  };
77
+ afterAll(() => {
78
+ jest.clearAllTimers();
79
+ apiClients.forEach(client => client.disconnect());
80
+ (0, ProteusService_mocks_1.cleanupProteusServiceMocks)();
81
+ });
75
82
  describe('sendGenericMessage', () => {
76
83
  describe('targetted messages', () => {
77
84
  it(`indicates when sending was canceled`, async () => {
@@ -86,9 +93,9 @@ describe('sendGenericMessage', () => {
86
93
  const payloadBundle = await proteusService.sendMessage({
87
94
  payload: message,
88
95
  conversationId: { id: 'conv1', domain: '' },
89
- protocol: conversation_1.ConversationProtocol.PROTEUS,
96
+ protocol: team_1.CONVERSATION_PROTOCOL.PROTEUS,
90
97
  });
91
- expect(payloadBundle.state).toBe(conversation_2.MessageSendingState.CANCELED);
98
+ expect(payloadBundle.state).toBe(conversation_1.MessageSendingState.CANCELED);
92
99
  });
93
100
  });
94
101
  });
@@ -3,9 +3,5 @@ export declare const cryptoMigrationStore: {
3
3
  isReady: (dbName: string) => boolean;
4
4
  markAsReady: (dbName: string) => void;
5
5
  };
6
- coreCrypto: {
7
- isReady: (dbName: string) => boolean;
8
- markAsReady: (dbName: string) => void;
9
- };
10
6
  };
11
7
  //# sourceMappingURL=cryptoMigrationStateStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cryptoMigrationStateStore.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,oBAAoB;;0BAPyC,MAAM;8BANJ,MAAM;;;0BAMR,MAAM;8BANJ,MAAM;;CAsBjF,CAAC"}
1
+ {"version":3,"file":"cryptoMigrationStateStore.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,oBAAoB;;0BAPyC,MAAM;8BANJ,MAAM;;CAkBjF,CAAC"}
@@ -29,7 +29,6 @@ function getLocalStorage() {
29
29
  }
30
30
  const MIGRATION_READY_STATE = '1';
31
31
  const getQualifiedSessionsReadyKey = (dbName) => `${dbName}-qualified-sessions-ready`;
32
- const getCoreCryptoReadyKey = (dbName) => `${dbName}-corecrypto-ready`;
33
32
  const markMigrationReady = (getKey) => (dbName) => {
34
33
  const key = getKey(dbName);
35
34
  const localStorage = getLocalStorage();
@@ -46,8 +45,4 @@ exports.cryptoMigrationStore = {
46
45
  isReady: isMigrationReady(getQualifiedSessionsReadyKey),
47
46
  markAsReady: markMigrationReady(getQualifiedSessionsReadyKey),
48
47
  },
49
- coreCrypto: {
50
- isReady: isMigrationReady(getCoreCryptoReadyKey),
51
- markAsReady: markMigrationReady(getCoreCryptoReadyKey),
52
- },
53
48
  };
@@ -2,6 +2,7 @@ import { CRUDEngine } from '@wireapp/store-engine';
2
2
  /**
3
3
  * Will remove any information relative to the client identity.
4
4
  * @param storeEngine The engine that currently holds the identity information
5
+ * @param spareKeys If true, the keys table will not be deleted
5
6
  */
6
- export declare function deleteIdentity(storeEngine: CRUDEngine): Promise<boolean[]>;
7
+ export declare function deleteIdentity(storeEngine: CRUDEngine, spareKeys?: boolean): Promise<boolean[]>;
7
8
  //# sourceMappingURL=identityClearer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identityClearer.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/identityClearer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKjD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAK1E"}
1
+ {"version":3,"file":"identityClearer.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/identityClearer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKjD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,UAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAW7F"}
@@ -24,9 +24,15 @@ const IDENTITY_STORES = ['amplify', 'clients', 'keys', 'prekeys', 'sessions', 'g
24
24
  /**
25
25
  * Will remove any information relative to the client identity.
26
26
  * @param storeEngine The engine that currently holds the identity information
27
+ * @param spareKeys If true, the keys table will not be deleted
27
28
  */
28
- function deleteIdentity(storeEngine) {
29
+ function deleteIdentity(storeEngine, spareKeys = false) {
29
30
  return Promise.all(
30
31
  //make sure we use enum's lowercase values, not uppercase keys
31
- IDENTITY_STORES.map(store => storeEngine.deleteAll(store)));
32
+ IDENTITY_STORES.map(store => {
33
+ if (store === 'keys' && spareKeys) {
34
+ return Promise.resolve(true);
35
+ }
36
+ return storeEngine.deleteAll(store);
37
+ }));
32
38
  }
@@ -59,6 +59,10 @@ describe('SessionHandler', () => {
59
59
  beforeAll(() => {
60
60
  jest.spyOn(apiClient.api.user, 'postMultiPreKeyBundles').mockImplementation(generatePrekeys);
61
61
  });
62
+ afterAll(() => {
63
+ jest.clearAllTimers();
64
+ apiClient.disconnect();
65
+ });
62
66
  describe('constructSessionId', () => {
63
67
  describe('constructs a session ID', () => {
64
68
  it('without a domain', () => {
@@ -1,7 +1,7 @@
1
- import { GenericMessage } from '@pydio/protocol-messaging';
2
1
  import { APIClient } from '@wireapp/api-client/lib/APIClient';
3
2
  import { QualifiedUserClients } from '@wireapp/api-client/lib/conversation';
4
3
  import { QualifiedId, QualifiedUserPreKeyBundleMap } from '@wireapp/api-client/lib/user';
4
+ import { GenericMessage } from '@wireapp/protocol-messaging';
5
5
  import { MessageSendingOptions } from '../../../conversation';
6
6
  export type MessageParams = {
7
7
  sendingClientId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"getGenericMessageParams.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/getGenericMessageParams.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAKvF,OAAO,EAAoB,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAG/E,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,CAAC;IAChE,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE;QACP,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;QAChC,aAAa,EAAE,OAAO,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;KACpD,CAAC;CACH,CAAC;AACF,UAAU,6BAA6B;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,WAAW,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;CACtB;AACD,KAAK,iCAAiC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAEhE,QAAA,MAAM,uBAAuB,kHAM1B,6BAA6B,KAAG,iCA0BlC,CAAC;AAEF,OAAO,EAAC,uBAAuB,EAAC,CAAC"}
1
+ {"version":3,"file":"getGenericMessageParams.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/getGenericMessageParams.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAEvF,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAK3D,OAAO,EAAoB,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAG/E,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,CAAC;IAChE,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE;QACP,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;QAChC,aAAa,EAAE,OAAO,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;KACpD,CAAC;CACH,CAAC;AACF,UAAU,6BAA6B;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,WAAW,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;CACtB;AACD,KAAK,iCAAiC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAEhE,QAAA,MAAM,uBAAuB,kHAM1B,6BAA6B,KAAG,iCA0BlC,CAAC;AAEF,OAAO,EAAC,uBAAuB,EAAC,CAAC"}
@@ -19,7 +19,7 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.getGenericMessageParams = void 0;
22
- const protocol_messaging_1 = require("@pydio/protocol-messaging");
22
+ const protocol_messaging_1 = require("@wireapp/protocol-messaging");
23
23
  const Recipients_1 = require("./Recipients");
24
24
  const UserIds_1 = require("./UserIds");
25
25
  const conversation_1 = require("../../../conversation");
@@ -1,8 +1,8 @@
1
- import { GenericMessage } from '@pydio/protocol-messaging';
2
1
  import { BackendEvent } from '@wireapp/api-client/lib/event';
3
2
  import { Notification } from '@wireapp/api-client/lib/notification/';
4
3
  import { APIClient } from '@wireapp/api-client';
5
4
  import { TypedEventEmitter } from '@wireapp/commons';
5
+ import { GenericMessage } from '@wireapp/protocol-messaging';
6
6
  import { CRUDEngine } from '@wireapp/store-engine';
7
7
  import { NotificationSource } from './Notifications.types';
8
8
  import { ConversationService } from '../conversation';
@@ -49,13 +49,28 @@ export declare class NotificationService extends TypedEventEmitter<Events> {
49
49
  static readonly TOPIC: typeof TOPIC;
50
50
  constructor(apiClient: APIClient, storeEngine: CRUDEngine, conversationService: ConversationService);
51
51
  private getAllNotifications;
52
- /** Should only be called with a completely new client. */
53
- initializeNotificationStream(clientId: string): Promise<string>;
52
+ /**
53
+ * Should only be called with a completely new client.
54
+ *
55
+ * @deprecated This method is used to handle legacy notifications from the backend.
56
+ * It can be removed when all clients are capable of handling consumable notifications.
57
+ */
58
+ legacyInitializeNotificationStream(clientId: string): Promise<string>;
54
59
  hasHistory(): Promise<boolean>;
55
60
  getNotificationEventList(): Promise<BackendEvent[]>;
56
61
  setLastEventDate(eventDate: Date): Promise<Date>;
57
62
  private setLastNotificationId;
58
- processNotificationStream(notificationHandler: NotificationHandler, onMissedNotifications: (notificationId: string) => void, abortHandler: AbortController): Promise<{
63
+ /**
64
+ * Processes the notification stream and calls the provided handler for each notification.
65
+ * If there are missed notifications, it will call the onMissedNotifications callback with the missed notification ID.
66
+ *
67
+ * @param notificationHandler - The handler to process each notification.
68
+ * @param onMissedNotifications - Callback to handle missed notifications.
69
+ * @returns An object containing the total number of notifications processed, number of errors, and successes.
70
+ *
71
+ * @deprecated When all client are migrated to the consumable/async notification stream, this method must be removed.
72
+ */
73
+ legacyProcessNotificationStream(notificationHandler: NotificationHandler, onMissedNotifications: (notificationId: string) => void, abortHandler?: AbortController): Promise<{
59
74
  total: number;
60
75
  error: number;
61
76
  success: number;
@@ -69,11 +84,10 @@ export declare class NotificationService extends TypedEventEmitter<Events> {
69
84
  * @param lastEventDate?
70
85
  */
71
86
  private isOutdatedEvent;
72
- handleNotification(notification: Notification, source: NotificationSource, dryRun?: boolean): AsyncGenerator<HandledEventPayload>;
87
+ handleNotification(notification: Notification, source: NotificationSource): AsyncGenerator<HandledEventPayload>;
73
88
  /**
74
89
  * Will process one event
75
90
  * @param event The backend event to process
76
- * @param dryRun Will not try to decrypt if true
77
91
  * @return event handling status and if event was handled, the payload
78
92
  */
79
93
  private handleEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationService.d.ts","sourceRoot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W;CAQ1B"}
@@ -47,8 +47,13 @@ class NotificationService extends commons_1.TypedEventEmitter {
47
47
  const clientId = this.apiClient.clientId;
48
48
  return this.backend.getAllNotifications(clientId, since, abortController);
49
49
  }
50
- /** Should only be called with a completely new client. */
51
- async initializeNotificationStream(clientId) {
50
+ /**
51
+ * Should only be called with a completely new client.
52
+ *
53
+ * @deprecated This method is used to handle legacy notifications from the backend.
54
+ * It can be removed when all clients are capable of handling consumable notifications.
55
+ */
56
+ async legacyInitializeNotificationStream(clientId) {
52
57
  await this.setLastEventDate(new Date(0));
53
58
  const latestNotification = await this.backend.getLastNotification(clientId);
54
59
  return this.setLastNotificationId(latestNotification);
@@ -80,7 +85,17 @@ class NotificationService extends commons_1.TypedEventEmitter {
80
85
  async setLastNotificationId(lastNotification) {
81
86
  return this.database.updateLastNotificationId(lastNotification);
82
87
  }
83
- async processNotificationStream(notificationHandler, onMissedNotifications, abortHandler) {
88
+ /**
89
+ * Processes the notification stream and calls the provided handler for each notification.
90
+ * If there are missed notifications, it will call the onMissedNotifications callback with the missed notification ID.
91
+ *
92
+ * @param notificationHandler - The handler to process each notification.
93
+ * @param onMissedNotifications - Callback to handle missed notifications.
94
+ * @returns An object containing the total number of notifications processed, number of errors, and successes.
95
+ *
96
+ * @deprecated When all client are migrated to the consumable/async notification stream, this method must be removed.
97
+ */
98
+ async legacyProcessNotificationStream(notificationHandler, onMissedNotifications, abortHandler) {
84
99
  const lastNotificationId = await this.database.getLastNotificationId();
85
100
  const { notifications, missedNotification } = await this.getAllNotifications(lastNotificationId, abortHandler);
86
101
  if (missedNotification) {
@@ -92,7 +107,7 @@ class NotificationService extends commons_1.TypedEventEmitter {
92
107
  : `No notification to process from the stream`;
93
108
  this.logger.log(logMessage);
94
109
  for (const [index, notification] of notifications.entries()) {
95
- if (abortHandler.signal.aborted) {
110
+ if (abortHandler?.signal.aborted) {
96
111
  /* Stop handling notifications if the websocket has been disconnected.
97
112
  * Upon reconnecting we are going to restart handling the notification stream for where we left of
98
113
  */
@@ -132,7 +147,7 @@ class NotificationService extends commons_1.TypedEventEmitter {
132
147
  }
133
148
  return false;
134
149
  }
135
- async *handleNotification(notification, source, dryRun = false) {
150
+ async *handleNotification(notification, source) {
136
151
  for (const event of notification.payload) {
137
152
  this.logger.debug(`Handling event of type "${event.type}"`, event);
138
153
  let lastEventDate = undefined;
@@ -145,7 +160,7 @@ class NotificationService extends commons_1.TypedEventEmitter {
145
160
  continue;
146
161
  }
147
162
  try {
148
- const handledEventResult = await this.handleEvent(event, dryRun);
163
+ const handledEventResult = await this.handleEvent(event);
149
164
  if (handledEventResult.status === 'handled' && handledEventResult.payload) {
150
165
  yield handledEventResult.payload;
151
166
  }
@@ -160,7 +175,7 @@ class NotificationService extends commons_1.TypedEventEmitter {
160
175
  this.emit(NotificationService.TOPIC.NOTIFICATION_ERROR, notificationError);
161
176
  }
162
177
  }
163
- if (!dryRun && !notification.transient) {
178
+ if (!notification.transient) {
164
179
  // keep track of the last handled notification for next time we fetch the notification stream
165
180
  await this.setLastNotificationId(notification);
166
181
  }
@@ -168,15 +183,9 @@ class NotificationService extends commons_1.TypedEventEmitter {
168
183
  /**
169
184
  * Will process one event
170
185
  * @param event The backend event to process
171
- * @param dryRun Will not try to decrypt if true
172
186
  * @return event handling status and if event was handled, the payload
173
187
  */
174
- async handleEvent(event, dryRun = false) {
175
- if (dryRun) {
176
- // In case of a dry run, we do not want to decrypt messages
177
- // We just return the raw event to the caller
178
- return { status: 'handled', payload: { event } };
179
- }
188
+ async handleEvent(event) {
180
189
  const conversationEventResult = await this.conversationService.handleEvent(event);
181
190
  if (conversationEventResult.status !== 'unhandled') {
182
191
  return conversationEventResult;
@@ -28,12 +28,17 @@ const MOCK_BACKEND = {
28
28
  ws: `wss://${BASE_URL}`,
29
29
  };
30
30
  const mockedConversationService = {};
31
+ const apiClients = [];
31
32
  describe('NotificationService', () => {
33
+ afterAll(() => {
34
+ apiClients.forEach(client => client.disconnect());
35
+ });
32
36
  describe('handleEvent', () => {
33
37
  it('propagates errors to the outer calling function', async () => {
34
38
  const storeEngine = new store_engine_1.MemoryEngine();
35
39
  await storeEngine.init('NotificationService.test');
36
40
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
41
+ apiClients.push(apiClient);
37
42
  const notificationService = new _1.NotificationService(apiClient, storeEngine, mockedConversationService);
38
43
  jest.spyOn(notificationService, 'handleEvent').mockImplementation(() => {
39
44
  throw new Error('Test error');
@@ -57,6 +62,7 @@ describe('NotificationService', () => {
57
62
  const storeEngine = new store_engine_1.MemoryEngine();
58
63
  await storeEngine.init('NotificationService.test');
59
64
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
65
+ apiClients.push(apiClient);
60
66
  const notificationService = new _1.NotificationService(apiClient, storeEngine, mockedConversationService);
61
67
  jest.spyOn(notificationService, 'handleEvent').mockReturnValue({});
62
68
  const spySetLastNotificationId = jest
@@ -75,6 +81,7 @@ describe('NotificationService', () => {
75
81
  const storeEngine = new store_engine_1.MemoryEngine();
76
82
  await storeEngine.init('NotificationService.test');
77
83
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
84
+ apiClients.push(apiClient);
78
85
  const notificationService = new _1.NotificationService(apiClient, storeEngine, mockedConversationService);
79
86
  jest.spyOn(notificationService, 'handleEvent').mockReturnValue({});
80
87
  const spySetLastNotificationId = jest
@@ -93,6 +100,7 @@ describe('NotificationService', () => {
93
100
  const storeEngine = new store_engine_1.MemoryEngine();
94
101
  await storeEngine.init('NotificationService.test');
95
102
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
103
+ apiClients.push(apiClient);
96
104
  const notificationService = new _1.NotificationService(apiClient, storeEngine, mockedConversationService);
97
105
  notificationService.on(_1.NotificationService.TOPIC.NOTIFICATION_ERROR, notificationError => {
98
106
  expect(notificationError.error.message).toBe('Test error');
@@ -4,6 +4,7 @@ export declare class CorruptedKeyError extends Error {
4
4
  export type GeneratedKey = {
5
5
  key: Uint8Array;
6
6
  deleteKey: () => Promise<void>;
7
+ freshlyGenerated: boolean;
7
8
  };
8
9
  /**
9
10
  * Will generate (or retrieve) a secret key from the database.
@@ -1 +1 @@
1
- {"version":3,"file":"secretKeyGenerator.d.ts","sourceRoot":"","sources":["../../src/secretStore/secretKeyGenerator.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,OAAY,EACZ,SAAS,GACV,EAAE;IACD,wGAAwG;IACxG,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,SAAS,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,YAAY,CAAC,CA8BxB"}
1
+ {"version":3,"file":"secretKeyGenerator.d.ts","sourceRoot":"","sources":["../../src/secretStore/secretKeyGenerator.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,OAAY,EACZ,SAAS,GACV,EAAE;IACD,wGAAwG;IACxG,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,SAAS,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,YAAY,CAAC,CAgCxB"}
@@ -27,6 +27,7 @@ exports.CorruptedKeyError = CorruptedKeyError;
27
27
  * Will generate (or retrieve) a secret key from the database.
28
28
  */
29
29
  async function generateSecretKey({ keyId, keySize = 16, secretsDb, }) {
30
+ let freshlyGenerated = false;
30
31
  try {
31
32
  let key;
32
33
  try {
@@ -48,8 +49,9 @@ async function generateSecretKey({ keyId, keySize = 16, secretsDb, }) {
48
49
  }, true, ['encrypt', 'decrypt']);
49
50
  key = new Uint8Array(await crypto.subtle.exportKey('raw', key));
50
51
  await secretsDb.saveSecretValue(keyId, key);
52
+ freshlyGenerated = true;
51
53
  }
52
- return { key, deleteKey: () => secretsDb.deleteSecretValue(keyId) };
54
+ return { key, deleteKey: () => secretsDb.deleteSecretValue(keyId), freshlyGenerated };
53
55
  }
54
56
  catch (error) {
55
57
  throw error;
@@ -1,5 +1,5 @@
1
- import { ConversationProtocol } from '@wireapp/api-client/lib/conversation';
2
1
  import { Self } from '@wireapp/api-client/lib/self/';
2
+ import { CONVERSATION_PROTOCOL } from '@wireapp/api-client/lib/team';
3
3
  import { APIClient } from '@wireapp/api-client';
4
4
  export declare class SelfService {
5
5
  private readonly apiClient;
@@ -16,6 +16,6 @@ export declare class SelfService {
16
16
  * Update self user's list of supported-protocols
17
17
  * @param supportedProtocols The list of supported protocols
18
18
  */
19
- putSupportedProtocols(supportedProtocols: ConversationProtocol[]): Promise<void>;
19
+ putSupportedProtocols(supportedProtocols: CONVERSATION_PROTOCOL[]): Promise<void>;
20
20
  }
21
21
  //# sourceMappingURL=SelfService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelfService.d.ts","sourceRoot":"","sources":["../../src/self/SelfService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,IAAI,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AI,OAAO,CAAC,MAAM,CAAC;IAK1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKhD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;;OAGG;IACU,qBAAqB,CAAC,kBAAkB,EAAE,qBAAqB,EAAE;CAY/E"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- const conversation_1 = require("@wireapp/api-client/lib/conversation");
21
+ const team_1 = require("@wireapp/api-client/lib/team");
22
22
  const api_client_1 = require("@wireapp/api-client");
23
23
  const SelfService_1 = require("./SelfService");
24
24
  const BASE_URL = 'mock-backend.wire.com';
@@ -31,9 +31,12 @@ describe('SelfService', () => {
31
31
  describe('putSupportedProtocols', () => {
32
32
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
33
33
  apiClient.backendFeatures.supportsMLS = true;
34
+ afterAll(() => {
35
+ apiClient.disconnect();
36
+ });
34
37
  it('updates the list of self supported protocols', async () => {
35
38
  const selfService = new SelfService_1.SelfService(apiClient);
36
- const supportedProtocols = [conversation_1.ConversationProtocol.PROTEUS, conversation_1.ConversationProtocol.MLS];
39
+ const supportedProtocols = [team_1.CONVERSATION_PROTOCOL.PROTEUS, team_1.CONVERSATION_PROTOCOL.MLS];
37
40
  jest.spyOn(apiClient.api.self, 'putSupportedProtocols').mockImplementation(jest.fn());
38
41
  await selfService.putSupportedProtocols(supportedProtocols);
39
42
  expect(apiClient.api.self.putSupportedProtocols).toHaveBeenCalledWith(supportedProtocols);
@@ -1,4 +1,4 @@
1
- import { MemberData, Members, NewTeamData, TeamChunkData, TeamData, UpdateTeamData } from '@wireapp/api-client/lib/team/';
1
+ import { FeatureList, MemberData, Members, NewTeamData, TeamChunkData, TeamData, UpdateTeamData } from '@wireapp/api-client/lib/team/';
2
2
  import { APIClient } from '@wireapp/api-client';
3
3
  export declare class TeamService {
4
4
  private readonly apiClient;
@@ -12,6 +12,9 @@ export declare class TeamService {
12
12
  removeMember(teamId: string, userId: string, password: string): Promise<void>;
13
13
  updateMember(teamId: string, memberData: MemberData): Promise<void>;
14
14
  updateTeam(teamId: string, teamData: UpdateTeamData): Promise<void>;
15
- getCommonFeatureConfig(): Promise<import("@wireapp/api-client/lib/team/").FeatureList>;
15
+ private commonConfig;
16
+ private commonConfigFetchedAt;
17
+ private readonly CACHE_DURATION_MS;
18
+ getCommonFeatureConfig(): Promise<FeatureList>;
16
19
  }
17
20
  //# sourceMappingURL=TeamService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TeamService.d.ts","sourceRoot":"","sources":["../../src/team/TeamService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAExH,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAE1C,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE,UAAU,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/C,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1C,QAAQ,IAAI,OAAO,CAAC,aAAa,C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E,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAInE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1E,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,qBAAqB,CAAuB;IACpD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuB;IAC5C,sBAAsB;CAcpC"}
@@ -51,8 +51,18 @@ class TeamService {
51
51
  updateTeam(teamId, teamData) {
52
52
  return this.apiClient.api.teams.team.putTeam(teamId, teamData);
53
53
  }
54
- getCommonFeatureConfig() {
55
- return this.apiClient.api.teams.feature.getAllFeatures();
54
+ commonConfig = null;
55
+ commonConfigFetchedAt = null;
56
+ CACHE_DURATION_MS = 24 * 60 * 60 * 1000; // 24 hours
57
+ async getCommonFeatureConfig() {
58
+ const now = Date.now();
59
+ if (this.commonConfig == null ||
60
+ this.commonConfigFetchedAt == null ||
61
+ now - this.commonConfigFetchedAt > this.CACHE_DURATION_MS) {
62
+ this.commonConfig = await this.apiClient.api.teams.feature.getAllFeatures();
63
+ this.commonConfigFetchedAt = now;
64
+ }
65
+ return this.commonConfig;
56
66
  }
57
67
  }
58
68
  exports.TeamService = TeamService;
@@ -0,0 +1,2 @@
1
+ export declare function createMemoryEngine(storeName?: string): Promise<any>;
2
+ //# sourceMappingURL=StoreHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoreHelper.d.ts","sourceRoot":"","sources":["../../src/test/StoreHelper.ts"],"names":[],"mappings":"AAqBA,wBAAsB,kBAAkB,CAAC,SAAS,SAAuB,gBAIxE"}