@wireapp/core 17.29.0 → 17.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/package.json +8 -8
  3. package/src/main/conversation/ConversationMapper.js +2 -0
  4. package/src/main/conversation/ConversationService.d.ts +5 -2
  5. package/src/main/conversation/ConversationService.js +0 -2
  6. package/src/main/conversation/message/PayloadBundle.d.ts +3 -0
  7. package/src/main/cryptography/GenericMessageMapper.d.ts +0 -1
  8. package/src/main/cryptography/GenericMessageMapper.js +23 -158
  9. package/src/main/Account.js.map +0 -1
  10. package/src/main/Account.test.browser.js +0 -114
  11. package/src/main/Account.test.node.d.ts +0 -1
  12. package/src/main/Account.test.node.js +0 -214
  13. package/src/main/Account.test.node.js.map +0 -1
  14. package/src/main/Account.test.node.ts +0 -236
  15. package/src/main/Account.ts +0 -401
  16. package/src/main/CoreError.js.map +0 -1
  17. package/src/main/CoreError.ts +0 -30
  18. package/src/main/auth/LoginSanitizer.js.map +0 -1
  19. package/src/main/auth/LoginSanitizer.test.node.d.ts +0 -1
  20. package/src/main/auth/LoginSanitizer.test.node.js +0 -56
  21. package/src/main/auth/LoginSanitizer.test.node.js.map +0 -1
  22. package/src/main/auth/LoginSanitizer.test.node.ts +0 -68
  23. package/src/main/auth/LoginSanitizer.ts +0 -44
  24. package/src/main/auth/index.js.map +0 -1
  25. package/src/main/auth/index.ts +0 -20
  26. package/src/main/broadcast/AvailabilityType.js.map +0 -1
  27. package/src/main/broadcast/AvailabilityType.ts +0 -22
  28. package/src/main/broadcast/BroadcastService.js.map +0 -1
  29. package/src/main/broadcast/BroadcastService.ts +0 -66
  30. package/src/main/broadcast/index.js.map +0 -1
  31. package/src/main/broadcast/index.ts +0 -21
  32. package/src/main/client/ClientBackendRepository.js.map +0 -1
  33. package/src/main/client/ClientBackendRepository.ts +0 -33
  34. package/src/main/client/ClientDatabaseRepository.js.map +0 -1
  35. package/src/main/client/ClientDatabaseRepository.ts +0 -130
  36. package/src/main/client/ClientInfo.js.map +0 -1
  37. package/src/main/client/ClientInfo.ts +0 -28
  38. package/src/main/client/ClientService.js.map +0 -1
  39. package/src/main/client/ClientService.ts +0 -116
  40. package/src/main/client/index.js.map +0 -1
  41. package/src/main/client/index.ts +0 -23
  42. package/src/main/connection/ConnectionService.js.map +0 -1
  43. package/src/main/connection/ConnectionService.ts +0 -49
  44. package/src/main/connection/index.js.map +0 -1
  45. package/src/main/connection/index.ts +0 -20
  46. package/src/main/conversation/AbortReason.js.map +0 -1
  47. package/src/main/conversation/AbortReason.ts +0 -22
  48. package/src/main/conversation/AssetService.js.map +0 -1
  49. package/src/main/conversation/AssetService.test.node.d.ts +0 -1
  50. package/src/main/conversation/AssetService.test.node.js +0 -61
  51. package/src/main/conversation/AssetService.test.node.js.map +0 -1
  52. package/src/main/conversation/AssetService.test.node.ts +0 -65
  53. package/src/main/conversation/AssetService.ts +0 -60
  54. package/src/main/conversation/AssetTransferState.js.map +0 -1
  55. package/src/main/conversation/AssetTransferState.ts +0 -23
  56. package/src/main/conversation/ClientActionType.js.map +0 -1
  57. package/src/main/conversation/ClientActionType.ts +0 -20
  58. package/src/main/conversation/ConversationMapper.js.map +0 -1
  59. package/src/main/conversation/ConversationMapper.test.node.d.ts +0 -1
  60. package/src/main/conversation/ConversationMapper.test.node.js +0 -111
  61. package/src/main/conversation/ConversationMapper.test.node.js.map +0 -1
  62. package/src/main/conversation/ConversationMapper.test.node.ts +0 -154
  63. package/src/main/conversation/ConversationMapper.ts +0 -54
  64. package/src/main/conversation/ConversationService.js.map +0 -1
  65. package/src/main/conversation/ConversationService.test.node.d.ts +0 -1
  66. package/src/main/conversation/ConversationService.test.node.js +0 -344
  67. package/src/main/conversation/ConversationService.test.node.js.map +0 -1
  68. package/src/main/conversation/ConversationService.test.node.ts +0 -416
  69. package/src/main/conversation/ConversationService.ts +0 -1020
  70. package/src/main/conversation/GenericMessageType.js.map +0 -1
  71. package/src/main/conversation/GenericMessageType.ts +0 -44
  72. package/src/main/conversation/MessageTimer.js.map +0 -1
  73. package/src/main/conversation/MessageTimer.test.node.d.ts +0 -1
  74. package/src/main/conversation/MessageTimer.test.node.js +0 -88
  75. package/src/main/conversation/MessageTimer.test.node.js.map +0 -1
  76. package/src/main/conversation/MessageTimer.test.node.ts +0 -103
  77. package/src/main/conversation/MessageTimer.ts +0 -56
  78. package/src/main/conversation/ReactionType.js.map +0 -1
  79. package/src/main/conversation/ReactionType.ts +0 -23
  80. package/src/main/conversation/content/AssetContent.js.map +0 -1
  81. package/src/main/conversation/content/AssetContent.ts +0 -71
  82. package/src/main/conversation/content/ButtonActionConfirmationContent.js.map +0 -1
  83. package/src/main/conversation/content/ButtonActionConfirmationContent.ts +0 -21
  84. package/src/main/conversation/content/ButtonActionContent.js.map +0 -1
  85. package/src/main/conversation/content/ButtonActionContent.ts +0 -21
  86. package/src/main/conversation/content/CallingContent.js.map +0 -1
  87. package/src/main/conversation/content/CallingContent.ts +0 -20
  88. package/src/main/conversation/content/ClearedContent.js.map +0 -1
  89. package/src/main/conversation/content/ClearedContent.ts +0 -21
  90. package/src/main/conversation/content/ClientActionContent.js.map +0 -1
  91. package/src/main/conversation/content/ClientActionContent.ts +0 -22
  92. package/src/main/conversation/content/ClientAddContent.js.map +0 -1
  93. package/src/main/conversation/content/ClientAddContent.ts +0 -24
  94. package/src/main/conversation/content/ClientRemoveContent.js.map +0 -1
  95. package/src/main/conversation/content/ClientRemoveContent.ts +0 -25
  96. package/src/main/conversation/content/CompositeContent.js.map +0 -1
  97. package/src/main/conversation/content/CompositeContent.ts +0 -21
  98. package/src/main/conversation/content/ConfirmationContent.js.map +0 -1
  99. package/src/main/conversation/content/ConfirmationContent.ts +0 -21
  100. package/src/main/conversation/content/ContentType.js.map +0 -1
  101. package/src/main/conversation/content/ContentType.ts +0 -112
  102. package/src/main/conversation/content/ConversationContent.js.map +0 -1
  103. package/src/main/conversation/content/ConversationContent.ts +0 -71
  104. package/src/main/conversation/content/DeletedContent.js.map +0 -1
  105. package/src/main/conversation/content/DeletedContent.ts +0 -21
  106. package/src/main/conversation/content/EditedTextContent.js.map +0 -1
  107. package/src/main/conversation/content/EditedTextContent.ts +0 -31
  108. package/src/main/conversation/content/FileContent.js.map +0 -1
  109. package/src/main/conversation/content/FileContent.ts +0 -32
  110. package/src/main/conversation/content/HiddenContent.js.map +0 -1
  111. package/src/main/conversation/content/HiddenContent.ts +0 -21
  112. package/src/main/conversation/content/ImageContent.js.map +0 -1
  113. package/src/main/conversation/content/ImageContent.ts +0 -25
  114. package/src/main/conversation/content/KnockContent.js.map +0 -1
  115. package/src/main/conversation/content/KnockContent.ts +0 -21
  116. package/src/main/conversation/content/LinkPreviewContent.js.map +0 -1
  117. package/src/main/conversation/content/LinkPreviewContent.ts +0 -32
  118. package/src/main/conversation/content/LocationContent.js.map +0 -1
  119. package/src/main/conversation/content/LocationContent.ts +0 -29
  120. package/src/main/conversation/content/MentionContent.js.map +0 -1
  121. package/src/main/conversation/content/MentionContent.ts +0 -21
  122. package/src/main/conversation/content/QuoteContent.js.map +0 -1
  123. package/src/main/conversation/content/QuoteContent.ts +0 -29
  124. package/src/main/conversation/content/ReactionContent.js.map +0 -1
  125. package/src/main/conversation/content/ReactionContent.ts +0 -27
  126. package/src/main/conversation/content/TextContent.js.map +0 -1
  127. package/src/main/conversation/content/TextContent.ts +0 -29
  128. package/src/main/conversation/content/TweetContent.js.map +0 -1
  129. package/src/main/conversation/content/TweetContent.ts +0 -21
  130. package/src/main/conversation/content/index.js.map +0 -1
  131. package/src/main/conversation/content/index.ts +0 -49
  132. package/src/main/conversation/index.js.map +0 -1
  133. package/src/main/conversation/index.ts +0 -28
  134. package/src/main/conversation/message/CompositeContentBuilder.js.map +0 -1
  135. package/src/main/conversation/message/CompositeContentBuilder.ts +0 -60
  136. package/src/main/conversation/message/Message.js.map +0 -1
  137. package/src/main/conversation/message/Message.ts +0 -24
  138. package/src/main/conversation/message/MessageBuilder.js.map +0 -1
  139. package/src/main/conversation/message/MessageBuilder.test.browser.js +0 -27
  140. package/src/main/conversation/message/MessageBuilder.ts +0 -488
  141. package/src/main/conversation/message/MessageService.js.map +0 -1
  142. package/src/main/conversation/message/MessageService.test.node.d.ts +0 -1
  143. package/src/main/conversation/message/MessageService.test.node.js +0 -308
  144. package/src/main/conversation/message/MessageService.test.node.js.map +0 -1
  145. package/src/main/conversation/message/MessageService.test.node.ts +0 -398
  146. package/src/main/conversation/message/MessageService.ts +0 -383
  147. package/src/main/conversation/message/MessageToProtoMapper.js.map +0 -1
  148. package/src/main/conversation/message/MessageToProtoMapper.ts +0 -114
  149. package/src/main/conversation/message/OtrMessage.js.map +0 -1
  150. package/src/main/conversation/message/OtrMessage.ts +0 -160
  151. package/src/main/conversation/message/PayloadBundle.js.map +0 -1
  152. package/src/main/conversation/message/PayloadBundle.ts +0 -98
  153. package/src/main/conversation/message/TeamMessage.js.map +0 -1
  154. package/src/main/conversation/message/TeamMessage.ts +0 -72
  155. package/src/main/conversation/message/TextContentBuilder.js.map +0 -1
  156. package/src/main/conversation/message/TextContentBuilder.ts +0 -88
  157. package/src/main/conversation/message/UserClientsUtil.js.map +0 -1
  158. package/src/main/conversation/message/UserClientsUtil.ts +0 -44
  159. package/src/main/conversation/message/UserClientsUtils.test.node.d.ts +0 -1
  160. package/src/main/conversation/message/UserClientsUtils.test.node.js +0 -42
  161. package/src/main/conversation/message/UserClientsUtils.test.node.js.map +0 -1
  162. package/src/main/conversation/message/UserClientsUtils.test.node.ts +0 -44
  163. package/src/main/conversation/message/UserMessage.js.map +0 -1
  164. package/src/main/conversation/message/UserMessage.ts +0 -95
  165. package/src/main/cryptography/AssetCryptography.browser.js.map +0 -1
  166. package/src/main/cryptography/AssetCryptography.browser.ts +0 -76
  167. package/src/main/cryptography/AssetCryptography.node.js.map +0 -1
  168. package/src/main/cryptography/AssetCryptography.node.ts +0 -85
  169. package/src/main/cryptography/CryptographyDatabaseRepository.js.map +0 -1
  170. package/src/main/cryptography/CryptographyDatabaseRepository.ts +0 -44
  171. package/src/main/cryptography/CryptographyService.js.map +0 -1
  172. package/src/main/cryptography/CryptographyService.test.browser.js +0 -195
  173. package/src/main/cryptography/CryptographyService.test.node.d.ts +0 -1
  174. package/src/main/cryptography/CryptographyService.test.node.js +0 -228
  175. package/src/main/cryptography/CryptographyService.test.node.js.map +0 -1
  176. package/src/main/cryptography/CryptographyService.test.node.ts +0 -246
  177. package/src/main/cryptography/CryptographyService.ts +0 -246
  178. package/src/main/cryptography/EncryptedAsset.js.map +0 -1
  179. package/src/main/cryptography/EncryptedAsset.ts +0 -30
  180. package/src/main/cryptography/GenericMessageMapper.js.map +0 -1
  181. package/src/main/cryptography/GenericMessageMapper.ts +0 -364
  182. package/src/main/cryptography/MessageHashService.js.map +0 -1
  183. package/src/main/cryptography/MessageHashService.test.browser.js +0 -176
  184. package/src/main/cryptography/MessageHashService.test.node.d.ts +0 -1
  185. package/src/main/cryptography/MessageHashService.test.node.js +0 -138
  186. package/src/main/cryptography/MessageHashService.test.node.js.map +0 -1
  187. package/src/main/cryptography/MessageHashService.test.node.ts +0 -176
  188. package/src/main/cryptography/MessageHashService.ts +0 -109
  189. package/src/main/cryptography/SessionPayloadBundle.js.map +0 -1
  190. package/src/main/cryptography/SessionPayloadBundle.ts +0 -23
  191. package/src/main/cryptography/index.js.map +0 -1
  192. package/src/main/cryptography/index.ts +0 -23
  193. package/src/main/giphy/GiphyService.js.map +0 -1
  194. package/src/main/giphy/GiphyService.ts +0 -37
  195. package/src/main/giphy/index.js.map +0 -1
  196. package/src/main/giphy/index.ts +0 -20
  197. package/src/main/index.js.map +0 -1
  198. package/src/main/index.test.browser.js +0 -22
  199. package/src/main/index.ts +0 -34
  200. package/src/main/notification/NotificationBackendRepository.js.map +0 -1
  201. package/src/main/notification/NotificationBackendRepository.ts +0 -33
  202. package/src/main/notification/NotificationDatabaseRepository.js.map +0 -1
  203. package/src/main/notification/NotificationDatabaseRepository.ts +0 -74
  204. package/src/main/notification/NotificationService.js.map +0 -1
  205. package/src/main/notification/NotificationService.test.browser.js +0 -179
  206. package/src/main/notification/NotificationService.test.node.d.ts +0 -1
  207. package/src/main/notification/NotificationService.test.node.js +0 -99
  208. package/src/main/notification/NotificationService.test.node.js.map +0 -1
  209. package/src/main/notification/NotificationService.test.node.ts +0 -124
  210. package/src/main/notification/NotificationService.ts +0 -260
  211. package/src/main/notification/index.js.map +0 -1
  212. package/src/main/notification/index.ts +0 -20
  213. package/src/main/self/SelfService.js.map +0 -1
  214. package/src/main/self/SelfService.ts +0 -59
  215. package/src/main/self/index.js.map +0 -1
  216. package/src/main/self/index.ts +0 -20
  217. package/src/main/team/TeamService.js.map +0 -1
  218. package/src/main/team/TeamService.ts +0 -68
  219. package/src/main/team/index.js.map +0 -1
  220. package/src/main/team/index.ts +0 -20
  221. package/src/main/test/CryptographyHelper.js.map +0 -1
  222. package/src/main/test/CryptographyHelper.ts +0 -57
  223. package/src/main/test/PayloadHelper.js.map +0 -1
  224. package/src/main/test/PayloadHelper.ts +0 -60
  225. package/src/main/user/UserMapper.js.map +0 -1
  226. package/src/main/user/UserMapper.test.node.d.ts +0 -1
  227. package/src/main/user/UserMapper.test.node.js +0 -55
  228. package/src/main/user/UserMapper.test.node.js.map +0 -1
  229. package/src/main/user/UserMapper.test.node.ts +0 -63
  230. package/src/main/user/UserMapper.ts +0 -92
  231. package/src/main/user/UserService.js.map +0 -1
  232. package/src/main/user/UserService.test.node.js +0 -141
  233. package/src/main/user/UserService.ts +0 -98
  234. package/src/main/user/index.js.map +0 -1
  235. package/src/main/user/index.ts +0 -20
  236. package/src/main/util/TypePredicateUtil.js.map +0 -1
  237. package/src/main/util/TypePredicateUtil.test.node.d.ts +0 -1
  238. package/src/main/util/TypePredicateUtil.test.node.js +0 -42
  239. package/src/main/util/TypePredicateUtil.test.node.js.map +0 -1
  240. package/src/main/util/TypePredicateUtil.test.node.ts +0 -44
  241. package/src/main/util/TypePredicateUtil.ts +0 -52
  242. package/src/main/util/index.js.map +0 -1
  243. package/src/main/util/index.ts +0 -20
@@ -1 +0,0 @@
1
- {"version":3,"file":"BroadcastService.js","sourceRoot":"","sources":["BroadcastService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAKH,oEAA2D;AAE3D,2EAAsE;AAGtE,MAAa,gBAAgB;IAG3B,YAA6B,SAAoB,EAAmB,mBAAwC;QAA/E,cAAS,GAAT,SAAS,CAAW;QAAmB,wBAAmB,GAAnB,mBAAmB,CAAqB;QAC1G,IAAI,CAAC,cAAc,GAAG,IAAI,+BAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACrF,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,MAAc,EAAE,cAAc,GAAG,KAAK;QAC1E,MAAM,EAAC,OAAO,EAAE,WAAW,EAAC,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAE3F,IAAI,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAC,EAAE,EAAE,MAAM,CAAC,IAAI,EAAC,CAAC,CAAC,CAAC;QAE7D,IAAI,cAAc,EAAE;YAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACzD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE5G,OAAO,OAAO,CAAC,MAAM,CAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;YAC/D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAC5B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;gBACnC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;aACvD;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAClC,cAA8B,EAC9B,aAAkC,EAClC,cAAwB;QAExB,MAAM,cAAc,GAAG,mCAAc,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC;QACtE,OAAO,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE;YACtG,cAAc;SACf,CAAC,CAAC;IACL,CAAC;CACF;AAtCD,4CAsCC"}
@@ -1,66 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- import type {APIClient} from '@wireapp/api-client';
21
- import {ClientMismatch} from '@wireapp/api-client/src/conversation';
22
- import type {UserPreKeyBundleMap} from '@wireapp/api-client/src/user/';
23
- import {GenericMessage} from '@wireapp/protocol-messaging';
24
-
25
- import {MessageService} from '../conversation/message/MessageService';
26
- import type {CryptographyService} from '../cryptography/';
27
-
28
- export class BroadcastService {
29
- private readonly messageService: MessageService;
30
-
31
- constructor(private readonly apiClient: APIClient, private readonly cryptographyService: CryptographyService) {
32
- this.messageService = new MessageService(this.apiClient, this.cryptographyService);
33
- }
34
-
35
- public async getPreKeyBundlesFromTeam(teamId: string, skipOwnClients = false): Promise<UserPreKeyBundleMap> {
36
- const {members: teamMembers} = await this.apiClient.teams.member.api.getAllMembers(teamId);
37
-
38
- let members = teamMembers.map(member => ({id: member.user}));
39
-
40
- if (skipOwnClients) {
41
- const selfUser = await this.apiClient.self.api.getSelf();
42
- members = members.filter(member => member.id !== selfUser.id);
43
- }
44
-
45
- const preKeys = await Promise.all(members.map(member => this.apiClient.user.api.getUserPreKeys(member.id)));
46
-
47
- return preKeys.reduce<UserPreKeyBundleMap>((bundleMap, bundle) => {
48
- bundleMap[bundle.user] = {};
49
- for (const client of bundle.clients) {
50
- bundleMap[bundle.user][client.client] = client.prekey;
51
- }
52
- return bundleMap;
53
- }, {});
54
- }
55
-
56
- public async broadcastGenericMessage(
57
- genericMessage: GenericMessage,
58
- preKeyBundles: UserPreKeyBundleMap,
59
- sendAsProtobuf?: boolean,
60
- ): Promise<ClientMismatch> {
61
- const plainTextArray = GenericMessage.encode(genericMessage).finish();
62
- return this.messageService.sendMessage(this.apiClient.validatedClientId, preKeyBundles, plainTextArray, {
63
- sendAsProtobuf,
64
- });
65
- }
66
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,qDAAmC;AACnC,qDAAmC"}
@@ -1,21 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- export * from './AvailabilityType';
21
- export * from './BroadcastService';
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClientBackendRepository.js","sourceRoot":"","sources":["ClientBackendRepository.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAKH,MAAa,uBAAuB;IAClC,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE9C,UAAU;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAChD,CAAC;IAEM,UAAU,CAAC,MAAiB;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;CACF;AAVD,0DAUC"}
@@ -1,33 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- import type {APIClient} from '@wireapp/api-client';
21
- import type {NewClient, RegisteredClient} from '@wireapp/api-client/src/client/';
22
-
23
- export class ClientBackendRepository {
24
- constructor(private readonly apiClient: APIClient) {}
25
-
26
- public getClients(): Promise<RegisteredClient[]> {
27
- return this.apiClient.client.api.getClients();
28
- }
29
-
30
- public postClient(client: NewClient): Promise<RegisteredClient> {
31
- return this.apiClient.client.api.postClient(client);
32
- }
33
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClientDatabaseRepository.js","sourceRoot":"","sources":["ClientDatabaseRepository.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAKH,mDAAqD;AAGrD,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qCAAmB,CAAA;AACrB,CAAC,EAFW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAEzB;AAED,MAAa,wBAAwB;IAOnC,YAA6B,WAAuB;QAAvB,gBAAW,GAAX,WAAW,CAAY;IAAG,CAAC;IAEjD,cAAc;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACtE,CAAC;IAEM,SAAS,CAAC,SAAiB;QAChC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAa,wBAAwB,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC/F,CAAC;IAEM,iBAAiB;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAC5B,wBAAwB,CAAC,MAAM,CAAC,OAAO,EACvC,wBAAwB,CAAC,IAAI,CAAC,cAAc,CAC7C,CAAC;IACJ,CAAC;IAEM,YAAY,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACrF,CAAC;IAEM,gBAAgB,CACrB,MAAc,EACd,UAA8B,EAC9B,MAAqB;QAErB,MAAM,iBAAiB,GAA0B,EAAE,CAAC;QACpD,KAAK,MAAM,MAAM,IAAI,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AAC;IAEM,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,MAAwB,EAAE,MAAqB;QACvF,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC9E,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAC3B,wBAAwB,CAAC,MAAM,CAAC,OAAO,EACvC,kCAAmB,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EACjE,iBAAiB,CAClB,CAAC;QACF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,eAAe,CACrB,MAAc,EACd,MAAwB,EACxB,QAAiB,EACjB,MAAqB;QAErB,uCACK,MAAM,KACT,MAAM,EACN,IAAI,EAAE,EAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAmB,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAC,IAC7G;IACJ,CAAC;IAEO,oBAAoB,CAAC,MAAwB,EAAE,MAAqB;QAC1E,uCACK,MAAM,KACT,MAAM,EACN,IAAI,EAAE,EAAC,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,wBAAwB,CAAC,IAAI,CAAC,cAAc,EAAC,IACpF;IACJ,CAAC;;AAnGH,4DAoGC;AAnGwB,+BAAM,GAAG,cAAc,CAAC;AAEjC,6BAAI,GAAG;IACnB,cAAc,EAAE,gBAAgB;CACjC,CAAC"}
@@ -1,130 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- import type {RegisteredClient} from '@wireapp/api-client/src/client/';
21
- import type {CRUDEngine} from '@wireapp/store-engine';
22
-
23
- import {CryptographyService} from '../cryptography/';
24
- import type {MetaClient} from './ClientService';
25
-
26
- export enum DatabaseStores {
27
- CLIENTS = 'clients',
28
- }
29
-
30
- export class ClientDatabaseRepository {
31
- public static readonly STORES = DatabaseStores;
32
-
33
- public static KEYS = {
34
- LOCAL_IDENTITY: 'local_identity',
35
- };
36
-
37
- constructor(private readonly storeEngine: CRUDEngine) {}
38
-
39
- public getLocalClient(): Promise<MetaClient> {
40
- return this.getClient(ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
41
- }
42
-
43
- public getClient(sessionId: string): Promise<MetaClient> {
44
- return this.storeEngine.read<MetaClient>(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
45
- }
46
-
47
- public deleteLocalClient(): Promise<string> {
48
- return this.storeEngine.delete(
49
- ClientDatabaseRepository.STORES.CLIENTS,
50
- ClientDatabaseRepository.KEYS.LOCAL_IDENTITY,
51
- );
52
- }
53
-
54
- public deleteClient(sessionId: string): Promise<string> {
55
- return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
56
- }
57
-
58
- public createClientList(
59
- userId: string,
60
- clientList: RegisteredClient[],
61
- domain: string | null,
62
- ): Promise<MetaClient[]> {
63
- const createClientTasks: Promise<MetaClient>[] = [];
64
- for (const client of clientList) {
65
- createClientTasks.push(this.createClient(userId, client, domain));
66
- }
67
- return Promise.all(createClientTasks);
68
- }
69
-
70
- public async createLocalClient(client: RegisteredClient, domain: string | null): Promise<MetaClient> {
71
- const transformedClient = this.transformLocalClient(client, domain);
72
- await this.storeEngine.create(
73
- ClientDatabaseRepository.STORES.CLIENTS,
74
- ClientDatabaseRepository.KEYS.LOCAL_IDENTITY,
75
- transformedClient,
76
- );
77
- return transformedClient;
78
- }
79
-
80
- public async updateLocalClient(client: RegisteredClient, domain: string | null): Promise<MetaClient> {
81
- const transformedClient = this.transformLocalClient(client, domain);
82
- await this.storeEngine.update(
83
- ClientDatabaseRepository.STORES.CLIENTS,
84
- ClientDatabaseRepository.KEYS.LOCAL_IDENTITY,
85
- transformedClient,
86
- );
87
- return transformedClient;
88
- }
89
-
90
- public async updateClient(userId: string, client: RegisteredClient, domain: string | null): Promise<MetaClient> {
91
- const transformedClient = this.transformClient(userId, client, false, domain);
92
- await this.storeEngine.update(
93
- ClientDatabaseRepository.STORES.CLIENTS,
94
- CryptographyService.constructSessionId(userId, client.id, domain),
95
- transformedClient,
96
- );
97
- return transformedClient;
98
- }
99
-
100
- public async createClient(userId: string, client: RegisteredClient, domain: string | null): Promise<MetaClient> {
101
- const transformedClient = this.transformClient(userId, client, false, domain);
102
- await this.storeEngine.create(
103
- ClientDatabaseRepository.STORES.CLIENTS,
104
- CryptographyService.constructSessionId(userId, client.id, domain),
105
- transformedClient,
106
- );
107
- return transformedClient;
108
- }
109
-
110
- private transformClient(
111
- userId: string,
112
- client: RegisteredClient,
113
- verified: boolean,
114
- domain: string | null,
115
- ): MetaClient {
116
- return {
117
- ...client,
118
- domain,
119
- meta: {is_verified: verified, primary_key: CryptographyService.constructSessionId(userId, client.id, domain)},
120
- };
121
- }
122
-
123
- private transformLocalClient(client: RegisteredClient, domain: string | null): MetaClient {
124
- return {
125
- ...client,
126
- domain,
127
- meta: {is_verified: true, primary_key: ClientDatabaseRepository.KEYS.LOCAL_IDENTITY},
128
- };
129
- }
130
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClientInfo.js","sourceRoot":"","sources":["ClientInfo.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -1,28 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- import type {ClientClassification, Location} from '@wireapp/api-client/src/client/';
21
-
22
- export interface ClientInfo {
23
- classification: ClientClassification.DESKTOP | ClientClassification.PHONE | ClientClassification.TABLET;
24
- cookieLabel: string;
25
- label?: string;
26
- location?: Location;
27
- model: string;
28
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClientService.js","sourceRoot":"","sources":["ClientService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAIH,4DAA8G;AAI9G,yBAAiF;AAUjF,MAAa,aAAa;IAIxB,YACmB,SAAoB,EACpB,WAAuB,EACvB,mBAAwC;QAFxC,cAAS,GAAT,SAAS,CAAW;QACpB,gBAAW,GAAX,WAAW,CAAY;QACvB,wBAAmB,GAAnB,mBAAmB,CAAqB;QAEzD,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;IAEM,iBAAiB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;IAC3C,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;IACxC,CAAC;IAEM,iBAAiB,CAAC,MAAwB,E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Ac;YAChC,MAAM,EAAE,UAAU,CAAC,WAAW;YAC9B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,gBAAgB,CAAC;YACjH,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;YACrE,OAAO,EAAE,iBAAiB;YAC1B,IAAI,EAAE,SAAS,CAAC,UAAU;SAC3B,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACxD,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;QAC5E,MAAM,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,CAAC;QAE/C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAhFD,sCAgFC"}
@@ -1,116 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- import type {APIClient} from '@wireapp/api-client';
21
- import type {LoginData, PreKey} from '@wireapp/api-client/src/auth/';
22
- import {ClientClassification, ClientType, NewClient, RegisteredClient} from '@wireapp/api-client/src/client/';
23
- import type {CRUDEngine} from '@wireapp/store-engine';
24
-
25
- import type {CryptographyService} from '../cryptography/';
26
- import {ClientInfo, ClientBackendRepository, ClientDatabaseRepository} from './';
27
-
28
- export interface MetaClient extends RegisteredClient {
29
- domain: string | null;
30
- meta: {
31
- is_verified?: boolean;
32
- primary_key: string;
33
- };
34
- }
35
-
36
- export class ClientService {
37
- private readonly database: ClientDatabaseRepository;
38
- private readonly backend: ClientBackendRepository;
39
-
40
- constructor(
41
- private readonly apiClient: APIClient,
42
- private readonly storeEngine: CRUDEngine,
43
- private readonly cryptographyService: CryptographyService,
44
- ) {
45
- this.database = new ClientDatabaseRepository(this.storeEngine);
46
- this.backend = new ClientBackendRepository(this.apiClient);
47
- }
48
-
49
- public deleteLocalClient(): Promise<string> {
50
- return this.database.deleteLocalClient();
51
- }
52
-
53
- public getClients(): Promise<RegisteredClient[]> {
54
- return this.backend.getClients();
55
- }
56
-
57
- public getLocalClient(): Promise<MetaClient> {
58
- return this.database.getLocalClient();
59
- }
60
-
61
- public createLocalClient(client: RegisteredClient, domain: string | null): Promise<MetaClient> {
62
- return this.database.createLocalClient(client, domain);
63
- }
64
-
65
- public async synchronizeClients(): Promise<MetaClient[]> {
66
- const registeredClients = await this.backend.getClients();
67
- const filteredClients = registeredClients.filter(client => client.id !== this.apiClient.context!.clientId);
68
- return this.database.createClientList(
69
- this.apiClient.context!.userId,
70
- filteredClients,
71
- this.apiClient.context!.domain || null,
72
- );
73
- }
74
-
75
- // TODO: Split functionality into "create" and "register" client
76
- public async register(
77
- loginData: LoginData,
78
- clientInfo: ClientInfo = {
79
- classification: ClientClassification.DESKTOP,
80
- cookieLabel: 'default',
81
- model: '@wireapp/core',
82
- },
83
- ): Promise<RegisteredClient> {
84
- if (!this.apiClient.context) {
85
- throw new Error('Context is not set.');
86
- }
87
-
88
- if (loginData.clientType === ClientType.NONE) {
89
- throw new Error(`Can't register client of type "${ClientType.NONE}"`);
90
- }
91
-
92
- const serializedPreKeys: PreKey[] = await this.cryptographyService.createCryptobox();
93
-
94
- if (!this.cryptographyService.cryptobox.lastResortPreKey) {
95
- throw new Error('Cryptobox got initialized without a last resort PreKey.');
96
- }
97
-
98
- const newClient: NewClient = {
99
- class: clientInfo.classification,
100
- cookie: clientInfo.cookieLabel,
101
- label: clientInfo.label,
102
- lastkey: this.cryptographyService.cryptobox.serialize_prekey(this.cryptographyService.cryptobox.lastResortPreKey),
103
- location: clientInfo.location,
104
- model: clientInfo.model,
105
- password: loginData.password ? String(loginData.password) : undefined,
106
- prekeys: serializedPreKeys,
107
- type: loginData.clientType,
108
- };
109
-
110
- const client = await this.backend.postClient(newClient);
111
- await this.createLocalClient(client, this.apiClient.context.domain || null);
112
- await this.cryptographyService.initCryptobox();
113
-
114
- return client;
115
- }
116
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,kDAAgC;AAChC,4DAA0C;AAC1C,6DAA2C"}
@@ -1,23 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- export * from './ClientInfo';
21
- export * from './ClientService';
22
- export * from './ClientBackendRepository';
23
- export * from './ClientDatabaseRepository';
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConnectionService.js","sourceRoot":"","sources":["ConnectionService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAGH,oEAAiF;AAEjF,MAAa,iBAAiB;IAC5B,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE9C,cAAc;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;IAC3D,CAAC;IAEM,gBAAgB,CAAC,MAAc;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;YACzD,MAAM,EAAE,6BAAgB,CAAC,QAAQ;SAClC,CAAC,CAAC;IACL,CAAC;IAEM,gBAAgB,CAAC,MAAc;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;YACzD,MAAM,EAAE,6BAAgB,CAAC,OAAO;SACjC,CAAC,CAAC;IACL,CAAC;IAEM,gBAAgB,CAAC,MAAc;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC;YAClD,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;CACF;AA1BD,8CA0BC"}
@@ -1,49 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- import type {APIClient} from '@wireapp/api-client';
21
- import {Connection, ConnectionStatus} from '@wireapp/api-client/src/connection/';
22
-
23
- export class ConnectionService {
24
- constructor(private readonly apiClient: APIClient) {}
25
-
26
- public getConnections(): Promise<Connection[]> {
27
- return this.apiClient.connection.api.getAllConnections();
28
- }
29
-
30
- public acceptConnection(userId: string): Promise<Connection> {
31
- return this.apiClient.connection.api.putConnection(userId, {
32
- status: ConnectionStatus.ACCEPTED,
33
- });
34
- }
35
-
36
- public ignoreConnection(userId: string): Promise<Connection> {
37
- return this.apiClient.connection.api.putConnection(userId, {
38
- status: ConnectionStatus.IGNORED,
39
- });
40
- }
41
-
42
- public createConnection(userId: string): Promise<Connection> {
43
- return this.apiClient.connection.api.postConnection({
44
- message: ' ',
45
- name: ' ',
46
- user: userId,
47
- });
48
- }
49
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,sDAAoC"}
@@ -1,20 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- export * from './ConnectionService';
@@ -1 +0,0 @@
1
- {"version":3,"file":"AbortReason.js","sourceRoot":"","sources":["AbortReason.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -1,22 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 Wire Swiss GmbH
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see http://www.gnu.org/licenses/.
17
- *
18
- */
19
-
20
- import type {Asset} from '@wireapp/protocol-messaging';
21
-
22
- export type AbortReason = Asset.NotUploaded;
@@ -1 +0,0 @@
1
- {"version":3,"file":"AssetService.js","sourceRoot":"","sources":["AssetService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;AAQH,0FAA4E;AAE5E,MAAa,YAAY;IACvB,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE7C,KAAK,CAAC,SAAS,CACrB,SAA8B,EAC9B,OAAsB,EACtB,gBAAmC;QAEnC,MAAM,EAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,MAAM,iBAAiB,CAAC,YAAY,CAAC;YAC1E,SAAS;YACT,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS;YAC7B,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;SACpB,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAChH,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC;QAE5C,OAAO;YACL,UAAU;YACV,GAAG;YACH,QAAQ;YACR,MAAM;YACN,KAAK;SACN,CAAC;IACJ,CAAC;IAEM,gBAAgB,CAAC,KAAmB,EAAE,OAAsB;QACjE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAEM,eAAe,CAAC,IAAiB,EAAE,OAAsB;QAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF;AAhCD,oCAgCC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,61 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2018 Wire Swiss GmbH
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see http://www.gnu.org/licenses/.
18
- *
19
- */
20
- var __importDefault = (this && this.__importDefault) || function (mod) {
21
- return (mod && mod.__esModule) ? mod : { "default": mod };
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- const api_client_1 = require("@wireapp/api-client");
25
- const store_engine_1 = require("@wireapp/store-engine");
26
- const uuidjs_1 = __importDefault(require("uuidjs"));
27
- const Account_1 = require("../Account");
28
- describe('AssetService', () => {
29
- let account;
30
- beforeAll(async () => {
31
- const client = new api_client_1.APIClient({ urls: api_client_1.APIClient.BACKEND.STAGING });
32
- account = new Account_1.Account(client);
33
- await account.initServices(new store_engine_1.MemoryEngine());
34
- });
35
- describe('"uploadImageAsset"', () => {
36
- it('builds an encrypted asset payload', async () => {
37
- const assetServerData = {
38
- key: `3-2-${uuidjs_1.default.genV4().toString()}`,
39
- keyBytes: Buffer.from(uuidjs_1.default.genV4().toString()),
40
- sha256: uuidjs_1.default.genV4().toString(),
41
- token: uuidjs_1.default.genV4().toString(),
42
- };
43
- const assetService = account.service.conversation['assetService'];
44
- const image = {
45
- data: Buffer.from([1, 2, 3]),
46
- height: 600,
47
- type: 'image/png',
48
- width: 600,
49
- };
50
- spyOn(assetService, 'postAsset').and.returnValue(Promise.resolve(assetServerData));
51
- const asset = await assetService.uploadImageAsset(image);
52
- expect(asset).toEqual(jasmine.objectContaining({
53
- key: assetServerData.key,
54
- keyBytes: assetServerData.keyBytes,
55
- sha256: assetServerData.sha256,
56
- token: assetServerData.token,
57
- }));
58
- });
59
- });
60
- });
61
- //# sourceMappingURL=AssetService.test.node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AssetService.test.node.js","sourceRoot":"","sources":["AssetService.test.node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;AAEH,oDAA8C;AAC9C,wDAAmD;AACnD,oDAA0B;AAC1B,wCAAmC;AAEnC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,OAAgB,CAAC;IAErB,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,EAAC,IAAI,EAAE,sBAAS,CAAC,OAAO,CAAC,OAAO,EAAC,CAAC,CAAC;QAChE,OAAO,GAAG,IAAI,iBAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,OAAO,CAAC,YAAY,CAAC,IAAI,2BAAY,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;YACjD,MAAM,eAAe,GAAG;gBACt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