@wireapp/core 37.5.0 → 38.0.0-beta

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 (458) hide show
  1. package/package.json +9 -8
  2. package/LICENSE +0 -674
  3. package/lib/Account.d.ts +0 -213
  4. package/lib/Account.d.ts.map +0 -1
  5. package/lib/Account.js +0 -543
  6. package/lib/CoreError.d.ts +0 -10
  7. package/lib/CoreError.d.ts.map +0 -1
  8. package/lib/CoreError.js +0 -25
  9. package/lib/account/AccountService.d.ts +0 -8
  10. package/lib/account/AccountService.d.ts.map +0 -1
  11. package/lib/account/AccountService.js +0 -32
  12. package/lib/account/index.d.ts +0 -2
  13. package/lib/account/index.d.ts.map +0 -1
  14. package/lib/account/index.js +0 -35
  15. package/lib/auth/LoginSanitizer.d.ts +0 -6
  16. package/lib/auth/LoginSanitizer.d.ts.map +0 -1
  17. package/lib/auth/LoginSanitizer.js +0 -40
  18. package/lib/auth/index.d.ts +0 -2
  19. package/lib/auth/index.d.ts.map +0 -1
  20. package/lib/auth/index.js +0 -35
  21. package/lib/broadcast/AvailabilityType.d.ts +0 -3
  22. package/lib/broadcast/AvailabilityType.d.ts.map +0 -1
  23. package/lib/broadcast/AvailabilityType.js +0 -20
  24. package/lib/broadcast/BroadcastService.d.ts +0 -21
  25. package/lib/broadcast/BroadcastService.d.ts.map +0 -1
  26. package/lib/broadcast/BroadcastService.js +0 -77
  27. package/lib/broadcast/index.d.ts +0 -3
  28. package/lib/broadcast/index.d.ts.map +0 -1
  29. package/lib/broadcast/index.js +0 -36
  30. package/lib/client/ClientBackendRepository.d.ts +0 -12
  31. package/lib/client/ClientBackendRepository.d.ts.map +0 -1
  32. package/lib/client/ClientBackendRepository.js +0 -42
  33. package/lib/client/ClientDatabaseRepository.d.ts +0 -28
  34. package/lib/client/ClientDatabaseRepository.d.ts.map +0 -1
  35. package/lib/client/ClientDatabaseRepository.js +0 -84
  36. package/lib/client/ClientInfo.d.ts +0 -9
  37. package/lib/client/ClientInfo.d.ts.map +0 -1
  38. package/lib/client/ClientInfo.js +0 -20
  39. package/lib/client/ClientService.d.ts +0 -41
  40. package/lib/client/ClientService.d.ts.map +0 -1
  41. package/lib/client/ClientService.js +0 -102
  42. package/lib/client/index.d.ts +0 -5
  43. package/lib/client/index.d.ts.map +0 -1
  44. package/lib/client/index.js +0 -38
  45. package/lib/connection/ConnectionService.d.ts +0 -12
  46. package/lib/connection/ConnectionService.d.ts.map +0 -1
  47. package/lib/connection/ConnectionService.js +0 -44
  48. package/lib/connection/index.d.ts +0 -2
  49. package/lib/connection/index.d.ts.map +0 -1
  50. package/lib/connection/index.js +0 -35
  51. package/lib/conversation/AbortReason.d.ts +0 -3
  52. package/lib/conversation/AbortReason.d.ts.map +0 -1
  53. package/lib/conversation/AbortReason.js +0 -20
  54. package/lib/conversation/AssetService/AssetService.d.ts +0 -66
  55. package/lib/conversation/AssetService/AssetService.d.ts.map +0 -1
  56. package/lib/conversation/AssetService/AssetService.js +0 -87
  57. package/lib/conversation/AssetService/index.d.ts +0 -2
  58. package/lib/conversation/AssetService/index.d.ts.map +0 -1
  59. package/lib/conversation/AssetService/index.js +0 -35
  60. package/lib/conversation/AssetTransferState.d.ts +0 -5
  61. package/lib/conversation/AssetTransferState.d.ts.map +0 -1
  62. package/lib/conversation/AssetTransferState.js +0 -26
  63. package/lib/conversation/ClientActionType.d.ts +0 -2
  64. package/lib/conversation/ClientActionType.d.ts.map +0 -1
  65. package/lib/conversation/ClientActionType.js +0 -23
  66. package/lib/conversation/ConversationMapper/ConversationMapper.d.ts +0 -8
  67. package/lib/conversation/ConversationMapper/ConversationMapper.d.ts.map +0 -1
  68. package/lib/conversation/ConversationMapper/ConversationMapper.js +0 -57
  69. package/lib/conversation/ConversationService/ConversationService.d.ts +0 -98
  70. package/lib/conversation/ConversationService/ConversationService.d.ts.map +0 -1
  71. package/lib/conversation/ConversationService/ConversationService.js +0 -316
  72. package/lib/conversation/ConversationService/ConversationService.types.d.ts +0 -95
  73. package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +0 -1
  74. package/lib/conversation/ConversationService/ConversationService.types.js +0 -27
  75. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts +0 -9
  76. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +0 -1
  77. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.js +0 -34
  78. package/lib/conversation/ConversationService/index.d.ts +0 -3
  79. package/lib/conversation/ConversationService/index.d.ts.map +0 -1
  80. package/lib/conversation/ConversationService/index.js +0 -36
  81. package/lib/conversation/GenericMessageType.d.ts +0 -26
  82. package/lib/conversation/GenericMessageType.d.ts.map +0 -1
  83. package/lib/conversation/GenericMessageType.js +0 -48
  84. package/lib/conversation/MessageTimer/MessageTimer.d.ts +0 -11
  85. package/lib/conversation/MessageTimer/MessageTimer.d.ts.map +0 -1
  86. package/lib/conversation/MessageTimer/MessageTimer.js +0 -53
  87. package/lib/conversation/MessageTimer/index.d.ts +0 -2
  88. package/lib/conversation/MessageTimer/index.d.ts.map +0 -1
  89. package/lib/conversation/MessageTimer/index.js +0 -35
  90. package/lib/conversation/ReactionType.d.ts +0 -5
  91. package/lib/conversation/ReactionType.d.ts.map +0 -1
  92. package/lib/conversation/ReactionType.js +0 -26
  93. package/lib/conversation/content/AssetContent.d.ts +0 -43
  94. package/lib/conversation/content/AssetContent.d.ts.map +0 -1
  95. package/lib/conversation/content/AssetContent.js +0 -20
  96. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts +0 -3
  97. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts.map +0 -1
  98. package/lib/conversation/content/ButtonActionConfirmationContent.js +0 -20
  99. package/lib/conversation/content/ButtonActionContent.d.ts +0 -3
  100. package/lib/conversation/content/ButtonActionContent.d.ts.map +0 -1
  101. package/lib/conversation/content/ButtonActionContent.js +0 -20
  102. package/lib/conversation/content/CallingContent.d.ts +0 -2
  103. package/lib/conversation/content/CallingContent.d.ts.map +0 -1
  104. package/lib/conversation/content/CallingContent.js +0 -20
  105. package/lib/conversation/content/ClearedContent.d.ts +0 -3
  106. package/lib/conversation/content/ClearedContent.d.ts.map +0 -1
  107. package/lib/conversation/content/ClearedContent.js +0 -20
  108. package/lib/conversation/content/ClientActionContent.d.ts +0 -3
  109. package/lib/conversation/content/ClientActionContent.d.ts.map +0 -1
  110. package/lib/conversation/content/ClientActionContent.js +0 -20
  111. package/lib/conversation/content/ClientAddContent.d.ts +0 -5
  112. package/lib/conversation/content/ClientAddContent.d.ts.map +0 -1
  113. package/lib/conversation/content/ClientAddContent.js +0 -20
  114. package/lib/conversation/content/ClientRemoveContent.d.ts +0 -7
  115. package/lib/conversation/content/ClientRemoveContent.d.ts.map +0 -1
  116. package/lib/conversation/content/ClientRemoveContent.js +0 -20
  117. package/lib/conversation/content/CompositeContent.d.ts +0 -3
  118. package/lib/conversation/content/CompositeContent.d.ts.map +0 -1
  119. package/lib/conversation/content/CompositeContent.js +0 -20
  120. package/lib/conversation/content/ConfirmationContent.d.ts +0 -3
  121. package/lib/conversation/content/ConfirmationContent.d.ts.map +0 -1
  122. package/lib/conversation/content/ConfirmationContent.js +0 -20
  123. package/lib/conversation/content/ContentType.d.ts +0 -22
  124. package/lib/conversation/content/ContentType.d.ts.map +0 -1
  125. package/lib/conversation/content/ContentType.js +0 -93
  126. package/lib/conversation/content/ConversationContent.d.ts +0 -4
  127. package/lib/conversation/content/ConversationContent.d.ts.map +0 -1
  128. package/lib/conversation/content/ConversationContent.js +0 -20
  129. package/lib/conversation/content/DeletedContent.d.ts +0 -3
  130. package/lib/conversation/content/DeletedContent.d.ts.map +0 -1
  131. package/lib/conversation/content/DeletedContent.js +0 -20
  132. package/lib/conversation/content/EditedTextContent.d.ts +0 -12
  133. package/lib/conversation/content/EditedTextContent.d.ts.map +0 -1
  134. package/lib/conversation/content/EditedTextContent.js +0 -20
  135. package/lib/conversation/content/FileContent.d.ts +0 -14
  136. package/lib/conversation/content/FileContent.d.ts.map +0 -1
  137. package/lib/conversation/content/FileContent.js +0 -20
  138. package/lib/conversation/content/HiddenContent.d.ts +0 -3
  139. package/lib/conversation/content/HiddenContent.d.ts.map +0 -1
  140. package/lib/conversation/content/HiddenContent.js +0 -20
  141. package/lib/conversation/content/ImageContent.d.ts +0 -8
  142. package/lib/conversation/content/ImageContent.d.ts.map +0 -1
  143. package/lib/conversation/content/ImageContent.js +0 -20
  144. package/lib/conversation/content/KnockContent.d.ts +0 -3
  145. package/lib/conversation/content/KnockContent.d.ts.map +0 -1
  146. package/lib/conversation/content/KnockContent.js +0 -20
  147. package/lib/conversation/content/LinkPreviewContent.d.ts +0 -11
  148. package/lib/conversation/content/LinkPreviewContent.d.ts.map +0 -1
  149. package/lib/conversation/content/LinkPreviewContent.js +0 -20
  150. package/lib/conversation/content/LocationContent.d.ts +0 -10
  151. package/lib/conversation/content/LocationContent.d.ts.map +0 -1
  152. package/lib/conversation/content/LocationContent.js +0 -20
  153. package/lib/conversation/content/MentionContent.d.ts +0 -3
  154. package/lib/conversation/content/MentionContent.d.ts.map +0 -1
  155. package/lib/conversation/content/MentionContent.js +0 -20
  156. package/lib/conversation/content/QuoteContent.d.ts +0 -8
  157. package/lib/conversation/content/QuoteContent.d.ts.map +0 -1
  158. package/lib/conversation/content/QuoteContent.js +0 -20
  159. package/lib/conversation/content/ReactionContent.d.ts +0 -8
  160. package/lib/conversation/content/ReactionContent.d.ts.map +0 -1
  161. package/lib/conversation/content/ReactionContent.js +0 -20
  162. package/lib/conversation/content/TextContent.d.ts +0 -10
  163. package/lib/conversation/content/TextContent.d.ts.map +0 -1
  164. package/lib/conversation/content/TextContent.js +0 -20
  165. package/lib/conversation/content/TweetContent.d.ts +0 -3
  166. package/lib/conversation/content/TweetContent.d.ts.map +0 -1
  167. package/lib/conversation/content/TweetContent.js +0 -20
  168. package/lib/conversation/content/index.d.ts +0 -29
  169. package/lib/conversation/content/index.d.ts.map +0 -1
  170. package/lib/conversation/content/index.js +0 -75
  171. package/lib/conversation/index.d.ts +0 -11
  172. package/lib/conversation/index.d.ts.map +0 -1
  173. package/lib/conversation/index.js +0 -44
  174. package/lib/conversation/message/Message.d.ts +0 -5
  175. package/lib/conversation/message/Message.d.ts.map +0 -1
  176. package/lib/conversation/message/Message.js +0 -20
  177. package/lib/conversation/message/Message.types.d.ts +0 -7
  178. package/lib/conversation/message/Message.types.d.ts.map +0 -1
  179. package/lib/conversation/message/Message.types.js +0 -28
  180. package/lib/conversation/message/MessageBuilder.d.ts +0 -26
  181. package/lib/conversation/message/MessageBuilder.d.ts.map +0 -1
  182. package/lib/conversation/message/MessageBuilder.js +0 -291
  183. package/lib/conversation/message/MessageService.d.ts +0 -68
  184. package/lib/conversation/message/MessageService.d.ts.map +0 -1
  185. package/lib/conversation/message/MessageService.js +0 -291
  186. package/lib/conversation/message/MessageToProtoMapper.d.ts +0 -7
  187. package/lib/conversation/message/MessageToProtoMapper.d.ts.map +0 -1
  188. package/lib/conversation/message/MessageToProtoMapper.js +0 -98
  189. package/lib/conversation/message/OtrMessage.d.ts +0 -81
  190. package/lib/conversation/message/OtrMessage.d.ts.map +0 -1
  191. package/lib/conversation/message/OtrMessage.js +0 -20
  192. package/lib/conversation/message/PayloadBundle.d.ts +0 -68
  193. package/lib/conversation/message/PayloadBundle.d.ts.map +0 -1
  194. package/lib/conversation/message/PayloadBundle.js +0 -67
  195. package/lib/conversation/message/TeamMessage.d.ts +0 -32
  196. package/lib/conversation/message/TeamMessage.d.ts.map +0 -1
  197. package/lib/conversation/message/TeamMessage.js +0 -20
  198. package/lib/conversation/message/TextContentBuilder.d.ts +0 -12
  199. package/lib/conversation/message/TextContentBuilder.d.ts.map +0 -1
  200. package/lib/conversation/message/TextContentBuilder.js +0 -61
  201. package/lib/conversation/message/UserClientsUtil.d.ts +0 -23
  202. package/lib/conversation/message/UserClientsUtil.d.ts.map +0 -1
  203. package/lib/conversation/message/UserClientsUtil.js +0 -37
  204. package/lib/conversation/message/UserMessage.d.ts +0 -44
  205. package/lib/conversation/message/UserMessage.d.ts.map +0 -1
  206. package/lib/conversation/message/UserMessage.js +0 -20
  207. package/lib/conversation/message/index.d.ts +0 -2
  208. package/lib/conversation/message/index.d.ts.map +0 -1
  209. package/lib/conversation/message/index.js +0 -35
  210. package/lib/conversation/message/messageSender.d.ts +0 -7
  211. package/lib/conversation/message/messageSender.d.ts.map +0 -1
  212. package/lib/conversation/message/messageSender.js +0 -43
  213. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts +0 -12
  214. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts.map +0 -1
  215. package/lib/cryptography/AssetCryptography/EncryptedAsset.js +0 -20
  216. package/lib/cryptography/AssetCryptography/crypto.browser.d.ts +0 -3
  217. package/lib/cryptography/AssetCryptography/crypto.browser.d.ts.map +0 -1
  218. package/lib/cryptography/AssetCryptography/crypto.browser.js +0 -45
  219. package/lib/cryptography/AssetCryptography/crypto.node.d.ts +0 -3
  220. package/lib/cryptography/AssetCryptography/crypto.node.d.ts.map +0 -1
  221. package/lib/cryptography/AssetCryptography/crypto.node.js +0 -71
  222. package/lib/cryptography/AssetCryptography/index.d.ts +0 -9
  223. package/lib/cryptography/AssetCryptography/index.d.ts.map +0 -1
  224. package/lib/cryptography/AssetCryptography/index.js +0 -52
  225. package/lib/cryptography/AssetCryptography/interfaces.d.ts +0 -10
  226. package/lib/cryptography/AssetCryptography/interfaces.d.ts.map +0 -1
  227. package/lib/cryptography/AssetCryptography/interfaces.js +0 -20
  228. package/lib/cryptography/CryptographyDatabaseRepository.d.ts +0 -16
  229. package/lib/cryptography/CryptographyDatabaseRepository.d.ts.map +0 -1
  230. package/lib/cryptography/CryptographyDatabaseRepository.js +0 -42
  231. package/lib/cryptography/CryptographyService.d.ts +0 -77
  232. package/lib/cryptography/CryptographyService.d.ts.map +0 -1
  233. package/lib/cryptography/CryptographyService.js +0 -222
  234. package/lib/cryptography/GenericMessageMapper.d.ts +0 -8
  235. package/lib/cryptography/GenericMessageMapper.d.ts.map +0 -1
  236. package/lib/cryptography/GenericMessageMapper.js +0 -159
  237. package/lib/cryptography/MessageHashService.d.ts +0 -17
  238. package/lib/cryptography/MessageHashService.d.ts.map +0 -1
  239. package/lib/cryptography/MessageHashService.js +0 -117
  240. package/lib/cryptography/SessionPayloadBundle.d.ts +0 -5
  241. package/lib/cryptography/SessionPayloadBundle.d.ts.map +0 -1
  242. package/lib/cryptography/SessionPayloadBundle.js +0 -20
  243. package/lib/cryptography/Utlility/generateDecryptionError.d.ts +0 -6
  244. package/lib/cryptography/Utlility/generateDecryptionError.d.ts.map +0 -1
  245. package/lib/cryptography/Utlility/generateDecryptionError.js +0 -50
  246. package/lib/cryptography/index.d.ts +0 -5
  247. package/lib/cryptography/index.d.ts.map +0 -1
  248. package/lib/cryptography/index.js +0 -38
  249. package/lib/errors/DecryptionError.d.ts +0 -6
  250. package/lib/errors/DecryptionError.d.ts.map +0 -1
  251. package/lib/errors/DecryptionError.js +0 -29
  252. package/lib/giphy/GiphyService.d.ts +0 -10
  253. package/lib/giphy/GiphyService.d.ts.map +0 -1
  254. package/lib/giphy/GiphyService.js +0 -36
  255. package/lib/giphy/index.d.ts +0 -2
  256. package/lib/giphy/index.d.ts.map +0 -1
  257. package/lib/giphy/index.js +0 -35
  258. package/lib/index.d.ts +0 -8
  259. package/lib/index.d.ts.map +0 -1
  260. package/lib/index.js +0 -54
  261. package/lib/linkPreview/LinkPreviewService.d.ts +0 -8
  262. package/lib/linkPreview/LinkPreviewService.d.ts.map +0 -1
  263. package/lib/linkPreview/LinkPreviewService.js +0 -51
  264. package/lib/linkPreview/index.d.ts +0 -2
  265. package/lib/linkPreview/index.d.ts.map +0 -1
  266. package/lib/linkPreview/index.js +0 -35
  267. package/lib/messagingProtocols/common.types.d.ts +0 -3
  268. package/lib/messagingProtocols/common.types.d.ts.map +0 -1
  269. package/lib/messagingProtocols/common.types.js +0 -20
  270. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/ConversationEvent.d.ts +0 -5
  271. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/ConversationEvent.d.ts.map +0 -1
  272. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/ConversationEvent.js +0 -37
  273. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/index.d.ts +0 -3
  274. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/index.d.ts.map +0 -1
  275. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/index.js +0 -36
  276. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/index.d.ts +0 -2
  277. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/index.d.ts.map +0 -1
  278. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/index.js +0 -35
  279. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.d.ts +0 -12
  280. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.d.ts.map +0 -1
  281. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.js +0 -62
  282. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/index.d.ts +0 -2
  283. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/index.d.ts.map +0 -1
  284. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/index.js +0 -35
  285. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/welcomeMessage.d.ts +0 -10
  286. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/welcomeMessage.d.ts.map +0 -1
  287. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/welcomeMessage.js +0 -36
  288. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/index.d.ts +0 -2
  289. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/index.d.ts.map +0 -1
  290. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/index.js +0 -35
  291. package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts +0 -5
  292. package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts.map +0 -1
  293. package/lib/messagingProtocols/mls/EventHandler/EventHandler.js +0 -24
  294. package/lib/messagingProtocols/mls/EventHandler/EventHandler.types.d.ts +0 -11
  295. package/lib/messagingProtocols/mls/EventHandler/EventHandler.types.d.ts.map +0 -1
  296. package/lib/messagingProtocols/mls/EventHandler/EventHandler.types.js +0 -20
  297. package/lib/messagingProtocols/mls/EventHandler/index.d.ts +0 -3
  298. package/lib/messagingProtocols/mls/EventHandler/index.d.ts.map +0 -1
  299. package/lib/messagingProtocols/mls/EventHandler/index.js +0 -36
  300. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +0 -126
  301. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +0 -1
  302. package/lib/messagingProtocols/mls/MLSService/MLSService.js +0 -428
  303. package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts +0 -16
  304. package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts.map +0 -1
  305. package/lib/messagingProtocols/mls/MLSService/MLSService.types.js +0 -20
  306. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.d.ts +0 -8
  307. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.d.ts.map +0 -1
  308. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +0 -50
  309. package/lib/messagingProtocols/mls/MLSService/index.d.ts +0 -2
  310. package/lib/messagingProtocols/mls/MLSService/index.d.ts.map +0 -1
  311. package/lib/messagingProtocols/mls/MLSService/index.js +0 -35
  312. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts +0 -2
  313. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts.map +0 -1
  314. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.js +0 -35
  315. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +0 -11
  316. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts.map +0 -1
  317. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +0 -50
  318. package/lib/messagingProtocols/mls/MLSService/stores/pendingProposalsStore/index.d.ts +0 -2
  319. package/lib/messagingProtocols/mls/MLSService/stores/pendingProposalsStore/index.d.ts.map +0 -1
  320. package/lib/messagingProtocols/mls/MLSService/stores/pendingProposalsStore/index.js +0 -35
  321. package/lib/messagingProtocols/mls/MLSService/stores/pendingProposalsStore/pendingProposalsStore.d.ts +0 -10
  322. package/lib/messagingProtocols/mls/MLSService/stores/pendingProposalsStore/pendingProposalsStore.d.ts.map +0 -1
  323. package/lib/messagingProtocols/mls/MLSService/stores/pendingProposalsStore/pendingProposalsStore.js +0 -50
  324. package/lib/messagingProtocols/mls/MLSService/stores/stores.mock.d.ts +0 -9
  325. package/lib/messagingProtocols/mls/MLSService/stores/stores.mock.d.ts.map +0 -1
  326. package/lib/messagingProtocols/mls/MLSService/stores/stores.mock.js +0 -43
  327. package/lib/messagingProtocols/mls/index.d.ts +0 -2
  328. package/lib/messagingProtocols/mls/index.d.ts.map +0 -1
  329. package/lib/messagingProtocols/mls/index.js +0 -35
  330. package/lib/messagingProtocols/mls/types.d.ts +0 -55
  331. package/lib/messagingProtocols/mls/types.d.ts.map +0 -1
  332. package/lib/messagingProtocols/mls/types.js +0 -20
  333. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/ConversationEvent.d.ts +0 -5
  334. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/ConversationEvent.d.ts.map +0 -1
  335. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/ConversationEvent.js +0 -29
  336. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/index.d.ts +0 -2
  337. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/index.d.ts.map +0 -1
  338. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/index.js +0 -35
  339. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/index.d.ts +0 -2
  340. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/index.d.ts.map +0 -1
  341. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/index.js +0 -35
  342. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.d.ts +0 -10
  343. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.d.ts.map +0 -1
  344. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.js +0 -46
  345. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/index.d.ts +0 -2
  346. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/index.d.ts.map +0 -1
  347. package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/index.js +0 -35
  348. package/lib/messagingProtocols/proteus/EventHandler/EventHandler.d.ts +0 -5
  349. package/lib/messagingProtocols/proteus/EventHandler/EventHandler.d.ts.map +0 -1
  350. package/lib/messagingProtocols/proteus/EventHandler/EventHandler.js +0 -24
  351. package/lib/messagingProtocols/proteus/EventHandler/EventHandler.types.d.ts +0 -11
  352. package/lib/messagingProtocols/proteus/EventHandler/EventHandler.types.d.ts.map +0 -1
  353. package/lib/messagingProtocols/proteus/EventHandler/EventHandler.types.js +0 -20
  354. package/lib/messagingProtocols/proteus/EventHandler/index.d.ts +0 -3
  355. package/lib/messagingProtocols/proteus/EventHandler/index.d.ts.map +0 -1
  356. package/lib/messagingProtocols/proteus/EventHandler/index.js +0 -36
  357. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +0 -20
  358. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +0 -1
  359. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +0 -93
  360. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +0 -25
  361. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +0 -1
  362. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.js +0 -20
  363. package/lib/messagingProtocols/proteus/ProteusService/Utility/PreKeyBundle.d.ts +0 -24
  364. package/lib/messagingProtocols/proteus/ProteusService/Utility/PreKeyBundle.d.ts.map +0 -1
  365. package/lib/messagingProtocols/proteus/ProteusService/Utility/PreKeyBundle.js +0 -86
  366. package/lib/messagingProtocols/proteus/ProteusService/Utility/Recipients.d.ts +0 -17
  367. package/lib/messagingProtocols/proteus/ProteusService/Utility/Recipients.d.ts.map +0 -1
  368. package/lib/messagingProtocols/proteus/ProteusService/Utility/Recipients.js +0 -43
  369. package/lib/messagingProtocols/proteus/ProteusService/Utility/UserIds.d.ts +0 -12
  370. package/lib/messagingProtocols/proteus/ProteusService/Utility/UserIds.d.ts.map +0 -1
  371. package/lib/messagingProtocols/proteus/ProteusService/Utility/UserIds.js +0 -38
  372. package/lib/messagingProtocols/proteus/ProteusService/Utility/getGenericMessageParams.d.ts +0 -35
  373. package/lib/messagingProtocols/proteus/ProteusService/Utility/getGenericMessageParams.d.ts.map +0 -1
  374. package/lib/messagingProtocols/proteus/ProteusService/Utility/getGenericMessageParams.js +0 -87
  375. package/lib/messagingProtocols/proteus/ProteusService/Utility/index.d.ts +0 -6
  376. package/lib/messagingProtocols/proteus/ProteusService/Utility/index.d.ts.map +0 -1
  377. package/lib/messagingProtocols/proteus/ProteusService/Utility/index.js +0 -39
  378. package/lib/messagingProtocols/proteus/ProteusService/Utility/isClearFromMismatch.d.ts +0 -4
  379. package/lib/messagingProtocols/proteus/ProteusService/Utility/isClearFromMismatch.d.ts.map +0 -1
  380. package/lib/messagingProtocols/proteus/ProteusService/Utility/isClearFromMismatch.js +0 -29
  381. package/lib/messagingProtocols/proteus/ProteusService/index.d.ts +0 -4
  382. package/lib/messagingProtocols/proteus/ProteusService/index.d.ts.map +0 -1
  383. package/lib/messagingProtocols/proteus/ProteusService/index.js +0 -37
  384. package/lib/messagingProtocols/proteus/index.d.ts +0 -2
  385. package/lib/messagingProtocols/proteus/index.d.ts.map +0 -1
  386. package/lib/messagingProtocols/proteus/index.js +0 -35
  387. package/lib/notification/NotificationBackendRepository.d.ts +0 -12
  388. package/lib/notification/NotificationBackendRepository.d.ts.map +0 -1
  389. package/lib/notification/NotificationBackendRepository.js +0 -33
  390. package/lib/notification/NotificationDatabaseRepository.d.ts +0 -21
  391. package/lib/notification/NotificationDatabaseRepository.d.ts.map +0 -1
  392. package/lib/notification/NotificationDatabaseRepository.js +0 -67
  393. package/lib/notification/NotificationService.d.ts +0 -70
  394. package/lib/notification/NotificationService.d.ts.map +0 -1
  395. package/lib/notification/NotificationService.js +0 -224
  396. package/lib/notification/Notifications.types.d.ts +0 -6
  397. package/lib/notification/Notifications.types.d.ts.map +0 -1
  398. package/lib/notification/Notifications.types.js +0 -27
  399. package/lib/notification/index.d.ts +0 -3
  400. package/lib/notification/index.d.ts.map +0 -1
  401. package/lib/notification/index.js +0 -36
  402. package/lib/self/SelfService.d.ts +0 -14
  403. package/lib/self/SelfService.d.ts.map +0 -1
  404. package/lib/self/SelfService.js +0 -54
  405. package/lib/self/index.d.ts +0 -2
  406. package/lib/self/index.d.ts.map +0 -1
  407. package/lib/self/index.js +0 -35
  408. package/lib/team/TeamService.d.ts +0 -16
  409. package/lib/team/TeamService.d.ts.map +0 -1
  410. package/lib/team/TeamService.js +0 -54
  411. package/lib/team/index.d.ts +0 -2
  412. package/lib/team/index.d.ts.map +0 -1
  413. package/lib/team/index.js +0 -35
  414. package/lib/user/UserMapper.d.ts +0 -7
  415. package/lib/user/UserMapper.d.ts.map +0 -1
  416. package/lib/user/UserMapper.js +0 -87
  417. package/lib/user/UserService.d.ts +0 -24
  418. package/lib/user/UserService.d.ts.map +0 -1
  419. package/lib/user/UserService.js +0 -81
  420. package/lib/user/index.d.ts +0 -2
  421. package/lib/user/index.d.ts.map +0 -1
  422. package/lib/user/index.js +0 -35
  423. package/lib/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts +0 -22
  424. package/lib/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts.map +0 -1
  425. package/lib/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +0 -66
  426. package/lib/util/LowPrecisionTaskScheduler/index.d.ts +0 -2
  427. package/lib/util/LowPrecisionTaskScheduler/index.d.ts.map +0 -1
  428. package/lib/util/LowPrecisionTaskScheduler/index.js +0 -35
  429. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.d.ts +0 -9
  430. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.d.ts.map +0 -1
  431. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.js +0 -52
  432. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.store.d.ts +0 -4
  433. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.store.d.ts.map +0 -1
  434. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.store.js +0 -34
  435. package/lib/util/RecurringTaskScheduler/index.d.ts +0 -2
  436. package/lib/util/RecurringTaskScheduler/index.d.ts.map +0 -1
  437. package/lib/util/RecurringTaskScheduler/index.js +0 -35
  438. package/lib/util/TaskScheduler/TaskScheduler.d.ts +0 -11
  439. package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +0 -1
  440. package/lib/util/TaskScheduler/TaskScheduler.js +0 -70
  441. package/lib/util/TaskScheduler/index.d.ts +0 -2
  442. package/lib/util/TaskScheduler/index.d.ts.map +0 -1
  443. package/lib/util/TaskScheduler/index.js +0 -35
  444. package/lib/util/TypePredicateUtil.d.ts +0 -10
  445. package/lib/util/TypePredicateUtil.d.ts.map +0 -1
  446. package/lib/util/TypePredicateUtil.js +0 -60
  447. package/lib/util/encryptedStore.d.ts +0 -46
  448. package/lib/util/encryptedStore.d.ts.map +0 -1
  449. package/lib/util/encryptedStore.js +0 -115
  450. package/lib/util/encryptedStore.test.node.d.ts +0 -2
  451. package/lib/util/encryptedStore.test.node.d.ts.map +0 -1
  452. package/lib/util/encryptedStore.test.node.js +0 -53
  453. package/lib/util/fullyQualifiedClientIdUtils.d.ts +0 -14
  454. package/lib/util/fullyQualifiedClientIdUtils.d.ts.map +0 -1
  455. package/lib/util/fullyQualifiedClientIdUtils.js +0 -41
  456. package/lib/util/index.d.ts +0 -2
  457. package/lib/util/index.d.ts.map +0 -1
  458. package/lib/util/index.js +0 -35
package/lib/Account.js DELETED
@@ -1,543 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2018 Wire Swiss GmbH
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see http://www.gnu.org/licenses/.
18
- *
19
- */
20
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- var desc = Object.getOwnPropertyDescriptor(m, k);
23
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
- desc = { enumerable: true, get: function() { return m[k]; } };
25
- }
26
- Object.defineProperty(o, k2, desc);
27
- }) : (function(o, m, k, k2) {
28
- if (k2 === undefined) k2 = k;
29
- o[k2] = m[k];
30
- }));
31
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
32
- Object.defineProperty(o, "default", { enumerable: true, value: v });
33
- }) : function(o, v) {
34
- o["default"] = v;
35
- });
36
- var __importStar = (this && this.__importStar) || function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
40
- __setModuleDefault(result, mod);
41
- return result;
42
- };
43
- var __asyncValues = (this && this.__asyncValues) || function (o) {
44
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
45
- var m = o[Symbol.asyncIterator], i;
46
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
47
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
48
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
49
- };
50
- var __importDefault = (this && this.__importDefault) || function (mod) {
51
- return (mod && mod.__esModule) ? mod : { "default": mod };
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.Account = exports.ConnectionState = void 0;
55
- const auth_1 = require("@wireapp/api-client/lib/auth");
56
- const client_1 = require("@wireapp/api-client/lib/client/");
57
- const event_1 = require("@wireapp/api-client/lib/event");
58
- const tcp_1 = require("@wireapp/api-client/lib/tcp/");
59
- const ReconnectingWebsocket_1 = require("@wireapp/api-client/lib/tcp/ReconnectingWebsocket");
60
- const axios_1 = __importDefault(require("axios"));
61
- const bazinga64_1 = require("bazinga64");
62
- const http_status_codes_1 = require("http-status-codes");
63
- const logdown_1 = __importDefault(require("logdown"));
64
- const events_1 = require("events");
65
- const api_client_1 = require("@wireapp/api-client");
66
- const core_crypto_1 = require("@wireapp/core-crypto");
67
- const cryptobox = __importStar(require("@wireapp/cryptobox"));
68
- const store_engine_1 = require("@wireapp/store-engine");
69
- const account_1 = require("./account/");
70
- const auth_2 = require("./auth/");
71
- const broadcast_1 = require("./broadcast/");
72
- const client_2 = require("./client/");
73
- const connection_1 = require("./connection/");
74
- const conversation_1 = require("./conversation/");
75
- const messageSender_1 = require("./conversation/message/messageSender");
76
- const cryptography_1 = require("./cryptography/");
77
- const giphy_1 = require("./giphy/");
78
- const linkPreview_1 = require("./linkPreview");
79
- const mls_1 = require("./messagingProtocols/mls");
80
- const proteus_1 = require("./messagingProtocols/proteus");
81
- const notification_1 = require("./notification/");
82
- const self_1 = require("./self/");
83
- const team_1 = require("./team/");
84
- const user_1 = require("./user/");
85
- const encryptedStore_1 = require("./util/encryptedStore");
86
- var TOPIC;
87
- (function (TOPIC) {
88
- TOPIC["ERROR"] = "Account.TOPIC.ERROR";
89
- })(TOPIC || (TOPIC = {}));
90
- var ConnectionState;
91
- (function (ConnectionState) {
92
- /** The websocket is closed and notifications stream is not being processed */
93
- ConnectionState["CLOSED"] = "closed";
94
- /** The websocket is being opened */
95
- ConnectionState["CONNECTING"] = "connecting";
96
- /** The websocket is open but locked and notifications stream is being processed */
97
- ConnectionState["PROCESSING_NOTIFICATIONS"] = "processing_notifications";
98
- /** The websocket is open and message will go through and notifications stream is fully processed */
99
- ConnectionState["LIVE"] = "live";
100
- })(ConnectionState = exports.ConnectionState || (exports.ConnectionState = {}));
101
- const coreDefaultClient = {
102
- classification: client_1.ClientClassification.DESKTOP,
103
- cookieLabel: 'default',
104
- model: '@wireapp/core',
105
- };
106
- class Account extends events_1.EventEmitter {
107
- /**
108
- * @param apiClient The apiClient instance to use in the core (will create a new new one if undefined)
109
- * @param accountOptions
110
- */
111
- constructor(apiClient = new api_client_1.APIClient(), { createStore = () => undefined, nbPrekeys = 2, cryptoProtocolConfig } = {}) {
112
- super();
113
- this.apiClient = apiClient;
114
- this.backendFeatures = this.apiClient.backendFeatures;
115
- this.cryptoProtocolConfig = cryptoProtocolConfig;
116
- this.nbPrekeys = nbPrekeys;
117
- this.createStore = createStore;
118
- apiClient.on(api_client_1.APIClient.TOPIC.COOKIE_REFRESH, async (cookie) => {
119
- if (cookie && this.storeEngine) {
120
- try {
121
- await this.persistCookie(this.storeEngine, cookie);
122
- }
123
- catch (error) {
124
- this.logger.error(`Failed to save cookie: ${error.message}`, error);
125
- }
126
- }
127
- });
128
- this.logger = (0, logdown_1.default)('@wireapp/core/Account', {
129
- logger: console,
130
- markdown: false,
131
- });
132
- }
133
- /**
134
- * Will set the APIClient to use a specific version of the API (by default uses version 0)
135
- * It will fetch the API Config and use the highest possible version
136
- * @param acceptedVersions Which version the consumer supports
137
- * @param useDevVersion allow the api-client to use development version of the api (if present). The dev version also need to be listed on the supportedVersions given as parameters
138
- * If we have version 2 that is a dev version, this is going to be the output of those calls
139
- * - useVersion([0, 1, 2], true) > version 2 is used
140
- * - useVersion([0, 1, 2], false) > version 1 is used
141
- * - useVersion([0, 1], true) > version 1 is used
142
- * @return The highest version that is both supported by client and backend
143
- */
144
- async useAPIVersion(supportedVersions, useDevVersion) {
145
- const features = await this.apiClient.useVersion(supportedVersions, useDevVersion);
146
- this.backendFeatures = features;
147
- return features;
148
- }
149
- persistCookie(storeEngine, cookie) {
150
- const entity = { expiration: cookie.expiration, zuid: cookie.zuid };
151
- return storeEngine.updateOrCreate(auth_1.AUTH_TABLE_NAME, auth_1.AUTH_COOKIE_KEY, entity);
152
- }
153
- get clientId() {
154
- return this.apiClient.validatedClientId;
155
- }
156
- get userId() {
157
- return this.apiClient.validatedUserId;
158
- }
159
- /**
160
- * Will register a new user to the backend
161
- *
162
- * @param registration The user's data
163
- * @param clientType Type of client to create (temporary or permanent)
164
- */
165
- async register(registration, clientType) {
166
- const context = await this.apiClient.register(registration, clientType);
167
- await this.initServices(context);
168
- return context;
169
- }
170
- /**
171
- * Will init the core with an already existing client (both on backend and local)
172
- * Will fail if local client cannot be found
173
- *
174
- * @param clientType The type of client the user is using (temporary or permanent)
175
- */
176
- async init(clientType, { cookie, initClient = true, onNewClient } = {}) {
177
- var _a, _b, _c, _d;
178
- const context = await this.apiClient.init(clientType, cookie);
179
- await this.initServices(context);
180
- /** @fixme
181
- * When we will start migrating to CoreCrypto encryption/decryption, those hooks won't be available anymore
182
- * We will need to implement
183
- * - the mechanism to handle messages from an unknown sender
184
- * - the mechanism to generate new prekeys when we reach a certain threshold of prekeys
185
- */
186
- this.service.cryptography.setCryptoboxHooks({
187
- onNewPrekeys: async (prekeys) => {
188
- this.logger.debug(`Received '${prekeys.length}' new PreKeys.`);
189
- await this.apiClient.api.client.putClient(context.clientId, { prekeys });
190
- this.logger.debug(`Successfully uploaded '${prekeys.length}' PreKeys.`);
191
- },
192
- onNewSession: onNewClient,
193
- });
194
- // Assumption: client gets only initialized once
195
- if (initClient) {
196
- const { localClient } = await this.initClient({ clientType });
197
- //call /access endpoint with client_id after client initialisation
198
- await this.apiClient.transport.http.associateClientWithSession(localClient.id);
199
- if (((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls) && this.backendFeatures.supportsMLS) {
200
- // initialize schedulers for pending mls proposals once client is initialized
201
- await ((_b = this.service) === null || _b === void 0 ? void 0 : _b.mls.checkExistingPendingProposals());
202
- // initialize schedulers for renewing key materials
203
- (_c = this.service) === null || _c === void 0 ? void 0 : _c.mls.checkForKeyMaterialsUpdate();
204
- // initialize scheduler for syncing key packages with backend
205
- (_d = this.service) === null || _d === void 0 ? void 0 : _d.mls.checkForKeyPackagesBackendSync();
206
- }
207
- }
208
- return context;
209
- }
210
- /**
211
- * Will log the user in with the given credential.
212
- * Will also create the local client and store it in DB
213
- *
214
- * @param loginData The credentials of the user
215
- * @param initClient Should the call also create the local client
216
- * @param clientInfo Info about the client to create (name, type...)
217
- */
218
- async login(loginData, initClient = true, clientInfo = coreDefaultClient) {
219
- this.resetContext();
220
- auth_2.LoginSanitizer.removeNonPrintableCharacters(loginData);
221
- const context = await this.apiClient.login(loginData);
222
- await this.initServices(context);
223
- if (initClient) {
224
- await this.initClient(loginData, clientInfo);
225
- }
226
- return context;
227
- }
228
- /**
229
- * Will try to get the load the local client from local DB.
230
- * If clientInfo are provided, will also create the client on backend and DB
231
- * If clientInfo are not provided, the method will fail if local client cannot be found
232
- *
233
- * @param loginData User's credentials
234
- * @param clientInfo Will allow creating the client if the local client cannot be found (else will fail if local client is not found)
235
- * @param entropyData Additional entropy data
236
- * @returns The local existing client or newly created client
237
- */
238
- async initClient(loginData, clientInfo, entropyData) {
239
- var _a, _b;
240
- if (!this.service) {
241
- throw new Error('Services are not set.');
242
- }
243
- try {
244
- const localClient = await this.loadAndValidateLocalClient(entropyData);
245
- return { isNewClient: false, localClient };
246
- }
247
- catch (error) {
248
- if (!clientInfo) {
249
- // If no client info provided, the client should not be created
250
- throw error;
251
- }
252
- // There was no client so we need to "create" and "register" a client
253
- const notFoundInDatabase = error instanceof cryptobox.error.CryptoboxError ||
254
- error.constructor.name === 'CryptoboxError' ||
255
- error instanceof store_engine_1.error.RecordNotFoundError ||
256
- error.constructor.name === store_engine_1.error.RecordNotFoundError.name;
257
- const notFoundOnBackend = axios_1.default.isAxiosError(error) ? ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === http_status_codes_1.StatusCodes.NOT_FOUND : false;
258
- if (notFoundInDatabase) {
259
- this.logger.log(`Could not find valid client in database "${(_b = this.storeEngine) === null || _b === void 0 ? void 0 : _b.storeName}".`);
260
- return this.registerClient(loginData, clientInfo, entropyData);
261
- }
262
- if (notFoundOnBackend) {
263
- this.logger.log('Could not find valid client on backend');
264
- const client = await this.service.client.getLocalClient();
265
- const shouldDeleteWholeDatabase = client.type === client_1.ClientType.TEMPORARY;
266
- if (shouldDeleteWholeDatabase) {
267
- this.logger.log('Last client was temporary - Deleting database');
268
- if (this.storeEngine) {
269
- await this.storeEngine.clearTables();
270
- }
271
- const context = await this.apiClient.init(loginData.clientType);
272
- await this.initEngine(context);
273
- return this.registerClient(loginData, clientInfo, entropyData);
274
- }
275
- this.logger.log('Last client was permanent - Deleting cryptography stores');
276
- await this.service.cryptography.deleteCryptographyStores();
277
- return this.registerClient(loginData, clientInfo, entropyData);
278
- }
279
- throw error;
280
- }
281
- }
282
- /**
283
- * In order to be able to send MLS messages, the core needs a few information from the consumer.
284
- * Namely:
285
- * - is the current user allowed to administrate a specific conversation
286
- * - what is the groupId of a conversation
287
- * @param mlsCallbacks
288
- */
289
- configureMLSCallbacks(mlsCallbacks) {
290
- var _a;
291
- (_a = this.service) === null || _a === void 0 ? void 0 : _a.mls.configureMLSCallbacks(mlsCallbacks);
292
- }
293
- async initServices(context) {
294
- var _a;
295
- this.storeEngine = await this.initEngine(context);
296
- const accountService = new account_1.AccountService(this.apiClient);
297
- const assetService = new conversation_1.AssetService(this.apiClient);
298
- const cryptographyService = new cryptography_1.CryptographyService(this.apiClient, this.storeEngine, {
299
- // We want to encrypt with fully qualified session ids, only if the backend is federated with other backends
300
- useQualifiedIds: this.backendFeatures.isFederated,
301
- nbPrekeys: this.nbPrekeys,
302
- });
303
- const clientService = new client_2.ClientService(this.apiClient, this.storeEngine, cryptographyService);
304
- const mlsService = new mls_1.MLSService(this.apiClient, () => this.coreCryptoClient, Object.assign(Object.assign({}, (_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls), { nbKeyPackages: this.nbPrekeys }));
305
- const proteusService = new proteus_1.ProteusService(this.apiClient, cryptographyService, {
306
- // We can use qualified ids to send messages as long as the backend supports federated endpoints
307
- useQualifiedIds: this.backendFeatures.federationEndpoints,
308
- });
309
- const connectionService = new connection_1.ConnectionService(this.apiClient);
310
- const giphyService = new giphy_1.GiphyService(this.apiClient);
311
- const linkPreviewService = new linkPreview_1.LinkPreviewService(assetService);
312
- const notificationService = new notification_1.NotificationService(this.apiClient, mlsService, proteusService, this.storeEngine);
313
- const conversationService = new conversation_1.ConversationService(this.apiClient, cryptographyService, {
314
- // We can use qualified ids to send messages as long as the backend supports federated endpoints
315
- useQualifiedIds: this.backendFeatures.federationEndpoints,
316
- }, mlsService, proteusService);
317
- const selfService = new self_1.SelfService(this.apiClient);
318
- const teamService = new team_1.TeamService(this.apiClient);
319
- const broadcastService = new broadcast_1.BroadcastService(this.apiClient, cryptographyService);
320
- const userService = new user_1.UserService(this.apiClient, broadcastService, connectionService);
321
- this.service = {
322
- mls: mlsService,
323
- account: accountService,
324
- asset: assetService,
325
- broadcast: broadcastService,
326
- client: clientService,
327
- connection: connectionService,
328
- conversation: conversationService,
329
- cryptography: cryptographyService,
330
- giphy: giphyService,
331
- linkPreview: linkPreviewService,
332
- notification: notificationService,
333
- self: selfService,
334
- team: teamService,
335
- user: userService,
336
- };
337
- }
338
- async loadAndValidateLocalClient(entropyData) {
339
- var _a;
340
- const loadedClient = await this.service.client.getLocalClient();
341
- await this.apiClient.api.client.getClient(loadedClient.id);
342
- this.apiClient.context.clientId = loadedClient.id;
343
- await this.service.cryptography.initCryptobox();
344
- if (((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls) && this.backendFeatures.supportsMLS) {
345
- this.coreCryptoClient = await this.createMLSClient(loadedClient, this.apiClient.context, this.cryptoProtocolConfig, entropyData);
346
- }
347
- return loadedClient;
348
- }
349
- async createMLSClient(client, context, cryptoProtocolConfig, entropyData) {
350
- if (!this.service) {
351
- throw new Error('Services are not set.');
352
- }
353
- const coreCryptoKeyId = 'corecrypto-key';
354
- const dbName = this.generateSecretsDbName(context);
355
- const secretStore = cryptoProtocolConfig.systemCrypto
356
- ? await (0, encryptedStore_1.createCustomEncryptedStore)(dbName, cryptoProtocolConfig.systemCrypto)
357
- : await (0, encryptedStore_1.createEncryptedStore)(dbName);
358
- let key = await secretStore.getsecretValue(coreCryptoKeyId);
359
- let isNewMLSDevice = false;
360
- if (!key) {
361
- key = window.crypto.getRandomValues(new Uint8Array(16));
362
- await secretStore.saveSecretValue(coreCryptoKeyId, key);
363
- // Keeping track that this device is a new MLS device (but can be an old proteus device)
364
- isNewMLSDevice = true;
365
- }
366
- const { userId, domain } = this.apiClient.context;
367
- const mlsClient = await core_crypto_1.CoreCrypto.init({
368
- databaseName: `corecrypto-${this.generateDbName(context)}`,
369
- key: bazinga64_1.Encoder.toBase64(key).asString,
370
- clientId: `${userId}:${client.id}@${domain}`,
371
- wasmFilePath: cryptoProtocolConfig.coreCrypoWasmFilePath,
372
- entropySeed: entropyData,
373
- });
374
- if (isNewMLSDevice) {
375
- // If the device is new, we need to upload keypackages and public key to the backend
376
- await this.service.mls.uploadMLSPublicKeys(await mlsClient.clientPublicKey(), client.id);
377
- await this.service.mls.uploadMLSKeyPackages(await mlsClient.clientKeypackages(this.nbPrekeys), client.id);
378
- }
379
- return mlsClient;
380
- }
381
- async registerClient(loginData, clientInfo = coreDefaultClient, entropyData) {
382
- if (!this.service) {
383
- throw new Error('Services are not set.');
384
- }
385
- this.logger.info(`Creating new client {mls: ${!!this.cryptoProtocolConfig}}`);
386
- const registeredClient = await this.service.client.register(loginData, clientInfo, entropyData);
387
- if (this.cryptoProtocolConfig && this.backendFeatures.supportsMLS) {
388
- this.coreCryptoClient = await this.createMLSClient(registeredClient, this.apiClient.context, this.cryptoProtocolConfig, entropyData);
389
- }
390
- this.apiClient.context.clientId = registeredClient.id;
391
- this.logger.info('Client is created');
392
- await this.service.notification.initializeNotificationStream();
393
- await this.service.client.synchronizeClients();
394
- await this.service.cryptography.initCryptobox();
395
- return { isNewClient: true, localClient: registeredClient };
396
- }
397
- resetContext() {
398
- delete this.apiClient.context;
399
- delete this.service;
400
- }
401
- /**
402
- * Will logout the current user
403
- * @param clearData if set to `true` will completely wipe any database that was created by the Account
404
- */
405
- async logout(clearData = false) {
406
- if (clearData && this.coreCryptoClient) {
407
- await this.coreCryptoClient.wipe();
408
- await (0, encryptedStore_1.deleteEncryptedStore)(this.generateSecretsDbName(this.apiClient.context));
409
- }
410
- await this.apiClient.logout();
411
- this.resetContext();
412
- }
413
- /**
414
- * Will download and handle the notification stream since last stored notification id.
415
- * Once the notification stream has been handled from backend, will then connect to the websocket and start listening to incoming events
416
- *
417
- * @param callbacks callbacks that will be called to handle different events
418
- * @returns close a function that will disconnect from the websocket
419
- */
420
- listen({ onEvent = () => { }, onConnectionStateChanged = () => { }, onNotificationStreamProgress = () => { }, onMissedNotifications = () => { }, dryRun = false, } = {}) {
421
- if (!this.apiClient.context) {
422
- throw new Error('Context is not set - please login first');
423
- }
424
- const handleEvent = async (payload, source) => {
425
- const { event } = payload;
426
- switch (event === null || event === void 0 ? void 0 : event.type) {
427
- case event_1.CONVERSATION_EVENT.MESSAGE_TIMER_UPDATE: {
428
- const { data: { message_timer }, conversation, } = event;
429
- const expireAfterMillis = Number(message_timer);
430
- this.service.conversation.messageTimer.setConversationLevelTimer(conversation, expireAfterMillis);
431
- break;
432
- }
433
- }
434
- onEvent(payload, source);
435
- };
436
- const handleNotification = async (notification, source) => {
437
- var _a, e_1, _b, _c;
438
- try {
439
- const messages = this.service.notification.handleNotification(notification, source, dryRun);
440
- try {
441
- for (var _d = true, messages_1 = __asyncValues(messages), messages_1_1; messages_1_1 = await messages_1.next(), _a = messages_1_1.done, !_a;) {
442
- _c = messages_1_1.value;
443
- _d = false;
444
- try {
445
- const message = _c;
446
- await handleEvent(message, source);
447
- }
448
- finally {
449
- _d = true;
450
- }
451
- }
452
- }
453
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
454
- finally {
455
- try {
456
- if (!_d && !_a && (_b = messages_1.return)) await _b.call(messages_1);
457
- }
458
- finally { if (e_1) throw e_1.error; }
459
- }
460
- }
461
- catch (error) {
462
- this.logger.error(`Failed to handle notification ID "${notification.id}": ${error.message}`, error);
463
- }
464
- };
465
- this.apiClient.transport.ws.removeAllListeners(tcp_1.WebSocketClient.TOPIC.ON_MESSAGE);
466
- this.apiClient.transport.ws.on(tcp_1.WebSocketClient.TOPIC.ON_MESSAGE, notification => handleNotification(notification, notification_1.NotificationSource.WEBSOCKET));
467
- this.apiClient.transport.ws.on(tcp_1.WebSocketClient.TOPIC.ON_STATE_CHANGE, wsState => {
468
- const mapping = {
469
- [ReconnectingWebsocket_1.WEBSOCKET_STATE.CLOSED]: ConnectionState.CLOSED,
470
- [ReconnectingWebsocket_1.WEBSOCKET_STATE.CONNECTING]: ConnectionState.CONNECTING,
471
- };
472
- const connectionState = mapping[wsState];
473
- if (connectionState) {
474
- onConnectionStateChanged(connectionState);
475
- }
476
- });
477
- const handleMissedNotifications = async (notificationId) => {
478
- var _a, _b;
479
- if (((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls) && this.backendFeatures.supportsMLS) {
480
- await ((_b = this.service) === null || _b === void 0 ? void 0 : _b.conversation.handleEpochMismatch());
481
- }
482
- return onMissedNotifications(notificationId);
483
- };
484
- const processNotificationStream = async (abortHandler) => {
485
- // Lock websocket in order to buffer any message that arrives while we handle the notification stream
486
- this.apiClient.transport.ws.lock();
487
- (0, messageSender_1.pauseMessageSending)();
488
- onConnectionStateChanged(ConnectionState.PROCESSING_NOTIFICATIONS);
489
- const results = await this.service.notification.processNotificationStream(async (notification, source, progress) => {
490
- await handleNotification(notification, source);
491
- onNotificationStreamProgress(progress);
492
- }, handleMissedNotifications, abortHandler);
493
- this.logger.log(`Finished processing notifications ${JSON.stringify(results)}`, results);
494
- if (abortHandler.isAborted()) {
495
- this.logger.warn('Ending connection process as websocket was closed');
496
- return;
497
- }
498
- onConnectionStateChanged(ConnectionState.LIVE);
499
- // We can now unlock the websocket and let the new messages being handled and decrypted
500
- this.apiClient.transport.ws.unlock();
501
- // We need to wait for the notification stream to be fully handled before releasing the message sending queue.
502
- // This is due to the nature of how message are encrypted, any change in mls epoch needs to happen before we start encrypting any kind of messages
503
- this.logger.info(`Resuming message sending. ${(0, messageSender_1.getQueueLength)()} messages to be sent`);
504
- (0, messageSender_1.resumeMessageSending)();
505
- };
506
- this.apiClient.connect(processNotificationStream);
507
- return () => {
508
- this.apiClient.disconnect();
509
- onConnectionStateChanged(ConnectionState.CLOSED);
510
- this.apiClient.transport.ws.removeAllListeners();
511
- };
512
- }
513
- generateDbName(context) {
514
- const clientType = context.clientType === client_1.ClientType.NONE ? '' : `@${context.clientType}`;
515
- return `wire@${this.apiClient.config.urls.name}@${context.userId}${clientType}`;
516
- }
517
- generateSecretsDbName(context) {
518
- return `secrets-${this.generateDbName(context)}`;
519
- }
520
- async initEngine(context) {
521
- const dbName = this.generateDbName(context);
522
- this.logger.log(`Initialising store with name "${dbName}"...`);
523
- const openDb = async () => {
524
- const initializedDb = await this.createStore(dbName, context);
525
- if (initializedDb) {
526
- this.logger.log(`Initialized store with existing engine "${dbName}".`);
527
- return initializedDb;
528
- }
529
- this.logger.log(`Initialized store with new memory engine "${dbName}".`);
530
- const memoryEngine = new store_engine_1.MemoryEngine();
531
- await memoryEngine.init(dbName);
532
- return memoryEngine;
533
- };
534
- const storeEngine = await openDb();
535
- const cookie = auth_1.CookieStore.getCookie();
536
- if (cookie) {
537
- await this.persistCookie(storeEngine, cookie);
538
- }
539
- return storeEngine;
540
- }
541
- }
542
- exports.Account = Account;
543
- Account.TOPIC = TOPIC;
@@ -1,10 +0,0 @@
1
- import { Notification } from '@wireapp/api-client/lib/notification';
2
- export declare enum CoreError {
3
- NOTIFICATION_ERROR = "CoreError.NOTIFICATION_ERROR"
4
- }
5
- export interface NotificationError {
6
- error: Error;
7
- notification: Notification;
8
- type: CoreError.NOTIFICATION_ERROR;
9
- }
10
- //# sourceMappingURL=CoreError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreError.d.ts","sourceRoot":"","sources":["../src/CoreError.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,sCAAsC,CAAC;AAElE,oBAAY,SAAS;IACnB,kBAAkB,iCAAiC;CACpD;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC,kBAAkB,CAAC;CACpC"}
package/lib/CoreError.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2019 Wire Swiss GmbH
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see http://www.gnu.org/licenses/.
18
- *
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.CoreError = void 0;
22
- var CoreError;
23
- (function (CoreError) {
24
- CoreError["NOTIFICATION_ERROR"] = "CoreError.NOTIFICATION_ERROR";
25
- })(CoreError = exports.CoreError || (exports.CoreError = {}));
@@ -1,8 +0,0 @@
1
- import { CallConfigData } from '@wireapp/api-client/lib/account/CallConfigData';
2
- import { APIClient } from '@wireapp/api-client';
3
- export declare class AccountService {
4
- private readonly apiClient;
5
- constructor(apiClient: APIClient);
6
- getCallConfig(): Promise<CallConfigData>;
7
- }
8
- //# sourceMappingURL=AccountService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccountService.d.ts","sourceRoot":"","sources":["../../src/account/AccountService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,cAAc,EAAC,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAG9C,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,aAAa,IAAI,OAAO,CAAC,cAAc,CAAC;CAIzC"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2020 Wire Swiss GmbH
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see http://www.gnu.org/licenses/.
18
- *
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.AccountService = void 0;
22
- const commons_1 = require("@wireapp/commons");
23
- class AccountService {
24
- constructor(apiClient) {
25
- this.apiClient = apiClient;
26
- }
27
- getCallConfig() {
28
- const iceCandidateLimit = commons_1.Runtime.isFirefox() ? 3 : undefined;
29
- return this.apiClient.api.account.getCallConfig(iceCandidateLimit);
30
- }
31
- }
32
- exports.AccountService = AccountService;
@@ -1,2 +0,0 @@
1
- export * from './AccountService';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAmBA,cAAc,kBAAkB,CAAC"}