@wireapp/core 31.1.3 → 31.1.4

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 (227) hide show
  1. package/package.json +9 -8
  2. package/src/main/Account.d.ts +214 -0
  3. package/src/main/Account.js +463 -0
  4. package/src/main/CoreError.d.ts +9 -0
  5. package/src/main/CoreError.js +26 -0
  6. package/src/main/account/AccountService.d.ts +7 -0
  7. package/src/main/account/AccountService.js +33 -0
  8. package/src/main/account/AccountService.js.map +1 -0
  9. package/src/main/account/index.d.ts +1 -0
  10. package/src/main/account/index.js +36 -0
  11. package/src/main/account/index.js.map +1 -0
  12. package/src/main/auth/LoginSanitizer.d.ts +5 -0
  13. package/src/main/auth/LoginSanitizer.js +41 -0
  14. package/src/main/auth/index.d.ts +1 -0
  15. package/src/main/auth/index.js +36 -0
  16. package/src/main/broadcast/AvailabilityType.d.ts +2 -0
  17. package/src/main/broadcast/AvailabilityType.js +21 -0
  18. package/src/main/broadcast/BroadcastService.d.ts +24 -0
  19. package/src/main/broadcast/BroadcastService.js +74 -0
  20. package/src/main/broadcast/index.d.ts +2 -0
  21. package/src/main/broadcast/index.js +37 -0
  22. package/src/main/client/ClientBackendRepository.d.ts +11 -0
  23. package/src/main/client/ClientBackendRepository.js +43 -0
  24. package/src/main/client/ClientDatabaseRepository.d.ts +27 -0
  25. package/src/main/client/ClientDatabaseRepository.js +85 -0
  26. package/src/main/client/ClientInfo.d.ts +8 -0
  27. package/src/main/client/ClientInfo.js +21 -0
  28. package/src/main/client/ClientService.d.ts +40 -0
  29. package/src/main/client/ClientService.js +103 -0
  30. package/src/main/client/index.d.ts +4 -0
  31. package/src/main/client/index.js +39 -0
  32. package/src/main/connection/ConnectionService.d.ts +11 -0
  33. package/src/main/connection/ConnectionService.js +45 -0
  34. package/src/main/connection/index.d.ts +1 -0
  35. package/src/main/connection/index.js +36 -0
  36. package/src/main/conversation/AbortReason.d.ts +2 -0
  37. package/src/main/conversation/AbortReason.js +21 -0
  38. package/src/main/conversation/AssetService/AssetService.d.ts +62 -0
  39. package/src/main/conversation/AssetService/AssetService.js +88 -0
  40. package/src/main/conversation/AssetService/index.d.ts +1 -0
  41. package/src/main/conversation/AssetService/index.js +36 -0
  42. package/src/main/conversation/AssetTransferState.d.ts +4 -0
  43. package/src/main/conversation/AssetTransferState.js +27 -0
  44. package/src/main/conversation/ClientActionType.d.ts +1 -0
  45. package/src/main/conversation/ClientActionType.js +24 -0
  46. package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +6 -0
  47. package/src/main/conversation/ConversationMapper/ConversationMapper.js +57 -0
  48. package/src/main/conversation/ConversationMapper/index.d.ts +1 -0
  49. package/src/main/conversation/ConversationMapper/index.js +36 -0
  50. package/src/main/conversation/ConversationService/ConversationService.d.ts +149 -0
  51. package/src/main/conversation/ConversationService/ConversationService.js +584 -0
  52. package/src/main/conversation/ConversationService/ConversationService.types.d.ts +110 -0
  53. package/src/main/conversation/ConversationService/ConversationService.types.js +28 -0
  54. package/src/main/conversation/ConversationService/index.d.ts +2 -0
  55. package/src/main/conversation/ConversationService/index.js +37 -0
  56. package/src/main/conversation/ConversationService/messageGenerator.d.ts +9 -0
  57. package/src/main/conversation/ConversationService/messageGenerator.js +313 -0
  58. package/src/main/conversation/GenericMessageType.d.ts +25 -0
  59. package/src/main/conversation/GenericMessageType.js +49 -0
  60. package/src/main/conversation/MessageTimer/MessageTimer.d.ts +10 -0
  61. package/src/main/conversation/MessageTimer/MessageTimer.js +54 -0
  62. package/src/main/conversation/MessageTimer/index.d.ts +1 -0
  63. package/src/main/conversation/MessageTimer/index.js +36 -0
  64. package/src/main/conversation/ReactionType.d.ts +4 -0
  65. package/src/main/conversation/ReactionType.js +27 -0
  66. package/src/main/conversation/content/AssetContent.d.ts +42 -0
  67. package/src/main/conversation/content/AssetContent.js +21 -0
  68. package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +2 -0
  69. package/src/main/conversation/content/ButtonActionConfirmationContent.js +21 -0
  70. package/src/main/conversation/content/ButtonActionContent.d.ts +2 -0
  71. package/src/main/conversation/content/ButtonActionContent.js +21 -0
  72. package/src/main/conversation/content/CallingContent.d.ts +1 -0
  73. package/src/main/conversation/content/CallingContent.js +21 -0
  74. package/src/main/conversation/content/ClearedContent.d.ts +2 -0
  75. package/src/main/conversation/content/ClearedContent.js +21 -0
  76. package/src/main/conversation/content/ClientActionContent.d.ts +2 -0
  77. package/src/main/conversation/content/ClientActionContent.js +21 -0
  78. package/src/main/conversation/content/ClientAddContent.d.ts +4 -0
  79. package/src/main/conversation/content/ClientAddContent.js +21 -0
  80. package/src/main/conversation/content/ClientRemoveContent.d.ts +6 -0
  81. package/src/main/conversation/content/ClientRemoveContent.js +21 -0
  82. package/src/main/conversation/content/CompositeContent.d.ts +2 -0
  83. package/src/main/conversation/content/CompositeContent.js +21 -0
  84. package/src/main/conversation/content/ConfirmationContent.d.ts +2 -0
  85. package/src/main/conversation/content/ConfirmationContent.js +21 -0
  86. package/src/main/conversation/content/ContentType.d.ts +21 -0
  87. package/src/main/conversation/content/ContentType.js +94 -0
  88. package/src/main/conversation/content/ConversationContent.d.ts +3 -0
  89. package/src/main/conversation/content/ConversationContent.js +21 -0
  90. package/src/main/conversation/content/DeletedContent.d.ts +2 -0
  91. package/src/main/conversation/content/DeletedContent.js +21 -0
  92. package/src/main/conversation/content/EditedTextContent.d.ts +11 -0
  93. package/src/main/conversation/content/EditedTextContent.js +21 -0
  94. package/src/main/conversation/content/FileContent.d.ts +13 -0
  95. package/src/main/conversation/content/FileContent.js +21 -0
  96. package/src/main/conversation/content/HiddenContent.d.ts +2 -0
  97. package/src/main/conversation/content/HiddenContent.js +21 -0
  98. package/src/main/conversation/content/ImageContent.d.ts +7 -0
  99. package/src/main/conversation/content/ImageContent.js +21 -0
  100. package/src/main/conversation/content/KnockContent.d.ts +2 -0
  101. package/src/main/conversation/content/KnockContent.js +21 -0
  102. package/src/main/conversation/content/LinkPreviewContent.d.ts +10 -0
  103. package/src/main/conversation/content/LinkPreviewContent.js +21 -0
  104. package/src/main/conversation/content/LocationContent.d.ts +9 -0
  105. package/src/main/conversation/content/LocationContent.js +21 -0
  106. package/src/main/conversation/content/MentionContent.d.ts +2 -0
  107. package/src/main/conversation/content/MentionContent.js +21 -0
  108. package/src/main/conversation/content/QuoteContent.d.ts +7 -0
  109. package/src/main/conversation/content/QuoteContent.js +21 -0
  110. package/src/main/conversation/content/ReactionContent.d.ts +7 -0
  111. package/src/main/conversation/content/ReactionContent.js +21 -0
  112. package/src/main/conversation/content/TextContent.d.ts +9 -0
  113. package/src/main/conversation/content/TextContent.js +21 -0
  114. package/src/main/conversation/content/TweetContent.d.ts +2 -0
  115. package/src/main/conversation/content/TweetContent.js +21 -0
  116. package/src/main/conversation/content/index.d.ts +28 -0
  117. package/src/main/conversation/content/index.js +76 -0
  118. package/src/main/conversation/index.d.ts +9 -0
  119. package/src/main/conversation/index.js +44 -0
  120. package/src/main/conversation/message/CompositeContentBuilder.d.ts +14 -0
  121. package/src/main/conversation/message/CompositeContentBuilder.js +54 -0
  122. package/src/main/conversation/message/Message.d.ts +4 -0
  123. package/src/main/conversation/message/Message.js +21 -0
  124. package/src/main/conversation/message/MessageBuilder.d.ts +96 -0
  125. package/src/main/conversation/message/MessageBuilder.js +125 -0
  126. package/src/main/conversation/message/MessageService.d.ts +67 -0
  127. package/src/main/conversation/message/MessageService.js +293 -0
  128. package/src/main/conversation/message/MessageToProtoMapper.d.ts +7 -0
  129. package/src/main/conversation/message/MessageToProtoMapper.js +99 -0
  130. package/src/main/conversation/message/OtrMessage.d.ts +80 -0
  131. package/src/main/conversation/message/OtrMessage.js +21 -0
  132. package/src/main/conversation/message/PayloadBundle.d.ts +76 -0
  133. package/src/main/conversation/message/PayloadBundle.js +81 -0
  134. package/src/main/conversation/message/TeamMessage.d.ts +31 -0
  135. package/src/main/conversation/message/TeamMessage.js +21 -0
  136. package/src/main/conversation/message/TextContentBuilder.d.ts +13 -0
  137. package/src/main/conversation/message/TextContentBuilder.js +75 -0
  138. package/src/main/conversation/message/UserClientsUtil.d.ts +22 -0
  139. package/src/main/conversation/message/UserClientsUtil.js +38 -0
  140. package/src/main/conversation/message/UserMessage.d.ts +43 -0
  141. package/src/main/conversation/message/UserMessage.js +21 -0
  142. package/src/main/conversation/message/messageSender.d.ts +4 -0
  143. package/src/main/conversation/message/messageSender.js +36 -0
  144. package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +11 -0
  145. package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +21 -0
  146. package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +2 -0
  147. package/src/main/cryptography/AssetCryptography/crypto.browser.js +46 -0
  148. package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +2 -0
  149. package/src/main/cryptography/AssetCryptography/crypto.node.js +72 -0
  150. package/src/main/cryptography/AssetCryptography/index.d.ts +8 -0
  151. package/src/main/cryptography/AssetCryptography/index.js +53 -0
  152. package/src/main/cryptography/AssetCryptography/interfaces.d.ts +9 -0
  153. package/src/main/cryptography/AssetCryptography/interfaces.js +21 -0
  154. package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +16 -0
  155. package/src/main/cryptography/CryptographyDatabaseRepository.js +44 -0
  156. package/src/main/cryptography/CryptographyService.d.ts +52 -0
  157. package/src/main/cryptography/CryptographyService.js +205 -0
  158. package/src/main/cryptography/GenericMessageMapper.d.ts +6 -0
  159. package/src/main/cryptography/GenericMessageMapper.js +160 -0
  160. package/src/main/cryptography/MessageHashService.d.ts +16 -0
  161. package/src/main/cryptography/MessageHashService.js +118 -0
  162. package/src/main/cryptography/SessionPayloadBundle.d.ts +4 -0
  163. package/src/main/cryptography/SessionPayloadBundle.js +21 -0
  164. package/src/main/cryptography/index.d.ts +4 -0
  165. package/src/main/cryptography/index.js +39 -0
  166. package/src/main/giphy/GiphyService.d.ts +9 -0
  167. package/src/main/giphy/GiphyService.js +37 -0
  168. package/src/main/giphy/index.d.ts +1 -0
  169. package/src/main/giphy/index.js +36 -0
  170. package/src/main/index.d.ts +17 -0
  171. package/src/main/index.js +59 -0
  172. package/src/main/linkPreview/LinkPreviewService.d.ts +7 -0
  173. package/src/main/linkPreview/LinkPreviewService.js +52 -0
  174. package/src/main/linkPreview/index.d.ts +1 -0
  175. package/src/main/linkPreview/index.js +36 -0
  176. package/src/main/mls/MLSService/MLSService.d.ts +39 -0
  177. package/src/main/mls/MLSService/MLSService.js +181 -0
  178. package/src/main/mls/index.d.ts +1 -0
  179. package/src/main/mls/index.js +36 -0
  180. package/src/main/mls/keyMaterialUpdatesStore/index.d.ts +1 -0
  181. package/src/main/mls/keyMaterialUpdatesStore/index.js +36 -0
  182. package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +9 -0
  183. package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +51 -0
  184. package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.d.ts +7 -0
  185. package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.js +42 -0
  186. package/src/main/mls/types.d.ts +33 -0
  187. package/src/main/mls/types.js +21 -0
  188. package/src/main/notification/NotificationBackendRepository.d.ts +11 -0
  189. package/src/main/notification/NotificationBackendRepository.js +34 -0
  190. package/src/main/notification/NotificationDatabaseRepository.d.ts +42 -0
  191. package/src/main/notification/NotificationDatabaseRepository.js +97 -0
  192. package/src/main/notification/NotificationService.d.ts +129 -0
  193. package/src/main/notification/NotificationService.js +501 -0
  194. package/src/main/notification/index.d.ts +1 -0
  195. package/src/main/notification/index.js +36 -0
  196. package/src/main/notification/types.d.ts +16 -0
  197. package/src/main/notification/types.js +21 -0
  198. package/src/main/self/SelfService.d.ts +13 -0
  199. package/src/main/self/SelfService.js +55 -0
  200. package/src/main/self/index.d.ts +1 -0
  201. package/src/main/self/index.js +36 -0
  202. package/src/main/team/TeamService.d.ts +15 -0
  203. package/src/main/team/TeamService.js +55 -0
  204. package/src/main/team/index.d.ts +1 -0
  205. package/src/main/team/index.js +36 -0
  206. package/src/main/test/CryptographyHelper.d.ts +4 -0
  207. package/src/main/test/CryptographyHelper.js +69 -0
  208. package/src/main/test/PayloadHelper.d.ts +3 -0
  209. package/src/main/test/PayloadHelper.js +66 -0
  210. package/src/main/user/UserMapper.d.ts +5 -0
  211. package/src/main/user/UserMapper.js +88 -0
  212. package/src/main/user/UserService.d.ts +25 -0
  213. package/src/main/user/UserService.js +81 -0
  214. package/src/main/user/index.d.ts +1 -0
  215. package/src/main/user/index.js +36 -0
  216. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts +21 -0
  217. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +62 -0
  218. package/src/main/util/TaskScheduler/TaskScheduler.d.ts +10 -0
  219. package/src/main/util/TaskScheduler/TaskScheduler.js +70 -0
  220. package/src/main/util/TypePredicateUtil.d.ts +7 -0
  221. package/src/main/util/TypePredicateUtil.js +55 -0
  222. package/src/main/util/encryptedStore.d.ts +45 -0
  223. package/src/main/util/encryptedStore.js +116 -0
  224. package/src/main/util/fullyQualifiedClientIdUtils.d.ts +13 -0
  225. package/src/main/util/fullyQualifiedClientIdUtils.js +42 -0
  226. package/src/main/util/index.d.ts +1 -0
  227. package/src/main/util/index.js +36 -0
@@ -0,0 +1,36 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ __exportStar(require("./ConnectionService"), exports);
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import { Asset } from '@wireapp/protocol-messaging';
2
+ export declare type AbortReason = Asset.NotUploaded;
@@ -0,0 +1,21 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ //# sourceMappingURL=AbortReason.js.map
@@ -0,0 +1,62 @@
1
+ /// <reference types="node" />
2
+ import { APIClient } from '@wireapp/api-client';
3
+ import { AssetOptions } from '@wireapp/api-client/src/asset';
4
+ import { ProgressCallback, RequestCancelable } from '@wireapp/api-client/src/http';
5
+ import { EncryptedAssetUploaded } from '../../cryptography';
6
+ export interface AssetDataV4 {
7
+ assetKey: string;
8
+ assetToken: string;
9
+ assetDomain: string;
10
+ forceCaching: boolean;
11
+ version: 4;
12
+ }
13
+ export interface AssetDataV3 {
14
+ assetKey: string;
15
+ assetToken: string;
16
+ forceCaching: boolean;
17
+ version: 3;
18
+ }
19
+ export interface AssetDataV2 {
20
+ assetId: string;
21
+ conversationId: string;
22
+ forceCaching: boolean;
23
+ version: 2;
24
+ }
25
+ export interface AssetDataV1 {
26
+ assetId: string;
27
+ conversationId: string;
28
+ forceCaching: boolean;
29
+ version: 1;
30
+ }
31
+ export declare type AssetUrlData = AssetDataV1 | AssetDataV2 | AssetDataV3 | AssetDataV4;
32
+ export declare class AssetService {
33
+ private readonly apiClient;
34
+ constructor(apiClient: APIClient);
35
+ /**
36
+ * Will download an asset on the server.
37
+ * Will route the request to the right endpoint depending on the asset version
38
+ *
39
+ * @param assetData The versioned asset data
40
+ * @param progressCallback?
41
+ * @return Resolves when the asset has been uploaded
42
+ */
43
+ downloadAsset(assetData: AssetUrlData, progressCallback?: ProgressCallback): RequestCancelable<import("@wireapp/api-client/src/asset").AssetResponse>;
44
+ /**
45
+ * Uploads a raw asset to the backend without encrypting it
46
+ *
47
+ * @param plainText The raw content of the asset to upload
48
+ * @param options?
49
+ * @param progressCallback?
50
+ * @return cancellable request that resolves with the uploaded image
51
+ */
52
+ uploadRawAsset(asset: Buffer | Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): RequestCancelable<import("@wireapp/api-client/src/asset").AssetUploadData>;
53
+ /**
54
+ * Will encrypt and upload an asset to the backend
55
+ *
56
+ * @param plainText The raw content of the asset to upload
57
+ * @param options?
58
+ * @param progressCallback?
59
+ * @return cancellable request that resolves with the uploaded image and decryption keys
60
+ */
61
+ uploadAsset(plainText: Buffer | Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): Promise<RequestCancelable<EncryptedAssetUploaded>>;
62
+ }
@@ -0,0 +1,88 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.AssetService = void 0;
22
+ const AssetCryptography_1 = require("../../cryptography/AssetCryptography");
23
+ class AssetService {
24
+ constructor(apiClient) {
25
+ this.apiClient = apiClient;
26
+ }
27
+ /**
28
+ * Will download an asset on the server.
29
+ * Will route the request to the right endpoint depending on the asset version
30
+ *
31
+ * @param assetData The versioned asset data
32
+ * @param progressCallback?
33
+ * @return Resolves when the asset has been uploaded
34
+ */
35
+ downloadAsset(assetData, progressCallback) {
36
+ const { forceCaching } = assetData;
37
+ switch (assetData.version) {
38
+ case 1:
39
+ return this.apiClient.api.asset.getAssetV1(assetData.assetId, assetData.conversationId, forceCaching, progressCallback);
40
+ case 2:
41
+ return this.apiClient.api.asset.getAssetV2(assetData.assetId, assetData.conversationId, forceCaching, progressCallback);
42
+ case 3:
43
+ return this.apiClient.api.asset.getAssetV3(assetData.assetKey, assetData.assetToken, forceCaching, progressCallback);
44
+ case 4:
45
+ return this.apiClient.api.asset.getAssetV4(assetData.assetKey, assetData.assetDomain, assetData.assetToken, forceCaching, progressCallback);
46
+ }
47
+ }
48
+ /**
49
+ * Uploads a raw asset to the backend without encrypting it
50
+ *
51
+ * @param plainText The raw content of the asset to upload
52
+ * @param options?
53
+ * @param progressCallback?
54
+ * @return cancellable request that resolves with the uploaded image
55
+ */
56
+ uploadRawAsset(asset, options, progressCallback) {
57
+ return this.apiClient.api.asset.postAsset(new Uint8Array(asset), options, progressCallback);
58
+ }
59
+ /**
60
+ * Will encrypt and upload an asset to the backend
61
+ *
62
+ * @param plainText The raw content of the asset to upload
63
+ * @param options?
64
+ * @param progressCallback?
65
+ * @return cancellable request that resolves with the uploaded image and decryption keys
66
+ */
67
+ async uploadAsset(plainText, options, progressCallback) {
68
+ const { cipherText, keyBytes, sha256 } = await (0, AssetCryptography_1.encryptAsset)({
69
+ plainText,
70
+ algorithm: options === null || options === void 0 ? void 0 : options.algorithm,
71
+ hash: options === null || options === void 0 ? void 0 : options.hash,
72
+ });
73
+ const request = this.uploadRawAsset(cipherText, options, progressCallback);
74
+ return Object.assign(Object.assign({}, request), { response: request.response.then(response => {
75
+ const { key, token, domain } = response;
76
+ return {
77
+ cipherText,
78
+ domain,
79
+ key,
80
+ keyBytes,
81
+ sha256,
82
+ token,
83
+ };
84
+ }) });
85
+ }
86
+ }
87
+ exports.AssetService = AssetService;
88
+ //# sourceMappingURL=AssetService.js.map
@@ -0,0 +1 @@
1
+ export * from './AssetService';
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ var __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 __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ __exportStar(require("./AssetService"), exports);
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,4 @@
1
+ export declare enum AssetTransferState {
2
+ NOT_UPLOADED = "notUploaded",
3
+ UPLOADED = "uploaded"
4
+ }
@@ -0,0 +1,27 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.AssetTransferState = void 0;
22
+ var AssetTransferState;
23
+ (function (AssetTransferState) {
24
+ AssetTransferState["NOT_UPLOADED"] = "notUploaded";
25
+ AssetTransferState["UPLOADED"] = "uploaded";
26
+ })(AssetTransferState = exports.AssetTransferState || (exports.AssetTransferState = {}));
27
+ //# sourceMappingURL=AssetTransferState.js.map
@@ -0,0 +1 @@
1
+ export { ClientAction as ClientActionType } from '@wireapp/protocol-messaging';
@@ -0,0 +1,24 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ClientActionType = void 0;
22
+ var protocol_messaging_1 = require("@wireapp/protocol-messaging");
23
+ Object.defineProperty(exports, "ClientActionType", { enumerable: true, get: function () { return protocol_messaging_1.ClientAction; } });
24
+ //# sourceMappingURL=ClientActionType.js.map
@@ -0,0 +1,6 @@
1
+ import { ConversationEvent } from '@wireapp/api-client/src/event';
2
+ import { PayloadBundle, PayloadBundleSource } from '../message/PayloadBundle';
3
+ export declare class ConversationMapper {
4
+ static mapConversationEvent(event: ConversationEvent, source: PayloadBundleSource): PayloadBundle;
5
+ private static mapConversationEventType;
6
+ }
@@ -0,0 +1,57 @@
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.ConversationMapper = void 0;
22
+ const event_1 = require("@wireapp/api-client/src/event");
23
+ const MessageBuilder_1 = require("../message/MessageBuilder");
24
+ const PayloadBundle_1 = require("../message/PayloadBundle");
25
+ class ConversationMapper {
26
+ static mapConversationEvent(event, source) {
27
+ return {
28
+ content: event.data,
29
+ conversation: event.conversation,
30
+ qualifiedConversation: event.qualified_conversation,
31
+ qualifiedFrom: event.qualified_from,
32
+ from: event.from,
33
+ id: MessageBuilder_1.MessageBuilder.createId(),
34
+ messageTimer: 0,
35
+ source,
36
+ state: PayloadBundle_1.PayloadBundleState.INCOMING,
37
+ timestamp: new Date(event.time).getTime(),
38
+ type: this.mapConversationEventType(event.type),
39
+ };
40
+ }
41
+ static mapConversationEventType(type) {
42
+ switch (type) {
43
+ case event_1.CONVERSATION_EVENT.MEMBER_JOIN:
44
+ return PayloadBundle_1.PayloadBundleType.MEMBER_JOIN;
45
+ case event_1.CONVERSATION_EVENT.MESSAGE_TIMER_UPDATE:
46
+ return PayloadBundle_1.PayloadBundleType.TIMER_UPDATE;
47
+ case event_1.CONVERSATION_EVENT.RENAME:
48
+ return PayloadBundle_1.PayloadBundleType.CONVERSATION_RENAME;
49
+ case event_1.CONVERSATION_EVENT.TYPING:
50
+ return PayloadBundle_1.PayloadBundleType.TYPING;
51
+ default:
52
+ return PayloadBundle_1.PayloadBundleType.UNKNOWN;
53
+ }
54
+ }
55
+ }
56
+ exports.ConversationMapper = ConversationMapper;
57
+ //# sourceMappingURL=ConversationMapper.js.map
@@ -0,0 +1 @@
1
+ export * from './ConversationMapper';
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ var __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 __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ __exportStar(require("./ConversationMapper"), exports);
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,149 @@
1
+ import { APIClient } from '@wireapp/api-client';
2
+ import { MessageSendingStatus, Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, ClientMismatch } from '@wireapp/api-client/src/conversation';
3
+ import { ConversationMemberLeaveEvent } from '@wireapp/api-client/src/event';
4
+ import { QualifiedId, UserPreKeyBundleMap } from '@wireapp/api-client/src/user';
5
+ import { MessageTimer, RemoveUsersParams } from '../../conversation/';
6
+ import { RemoteData } from '../content';
7
+ import { CryptographyService } from '../../cryptography/';
8
+ import { MLSService } from '../../mls';
9
+ import { NotificationService } from '../../notification';
10
+ import { ClearConversationMessage, OtrMessage } from '../message/OtrMessage';
11
+ import { XOR } from '@wireapp/commons/src/main/util/TypeUtil';
12
+ import { AddUsersParams, MessageSendingOptions, MLSReturnType, SendMlsMessageParams, SendProteusMessageParams } from './ConversationService.types';
13
+ export declare class ConversationService {
14
+ private readonly apiClient;
15
+ private readonly config;
16
+ private readonly notificationService;
17
+ private readonly mlsService;
18
+ readonly messageTimer: MessageTimer;
19
+ private readonly messageService;
20
+ private selfConversationId?;
21
+ constructor(apiClient: APIClient, cryptographyService: CryptographyService, config: {
22
+ useQualifiedIds?: boolean;
23
+ }, notificationService: NotificationService, mlsService: MLSService);
24
+ private getConversationQualifiedMembers;
25
+ /**
26
+ * Will generate a prekey bundle for specific users.
27
+ * If a QualifiedId array is given the bundle will contain all the clients from those users fetched from the server.
28
+ * If a QualifiedUserClients is provided then only the clients in the payload will be targeted (which could generate a ClientMismatch when sending messages)
29
+ *
30
+ * @param {QualifiedId[]|QualifiedUserClients} userIds - Targeted users.
31
+ * @returns {Promise<QualifiedUserPreKeyBundleMap}
32
+ */
33
+ private getQualifiedPreKeyBundle;
34
+ getPreKeyBundleMap(conversationId: string, userIds?: string[] | UserClients): Promise<UserPreKeyBundleMap>;
35
+ private getSelfConversationId;
36
+ private getQualifiedRecipientsForConversation;
37
+ private getRecipientsForConversation;
38
+ /**
39
+ * Sends a message to a conversation
40
+ *
41
+ * @param sendingClientId The clientId from which the message is sent
42
+ * @param conversationId The conversation in which to send the message
43
+ * @param genericMessage The payload of the message to send
44
+ * @return Resolves with the message sending status from backend
45
+ */
46
+ private sendGenericMessage;
47
+ private extractUserIds;
48
+ private extractQualifiedUserIds;
49
+ clearConversation(conversationId: string, timestamp?: number | Date, messageId?: string, sendAsProtobuf?: boolean): Promise<ClearConversationMessage>;
50
+ /**
51
+ * Sends a LastRead message to the current user's self conversation.
52
+ * This will allow all the user's devices to compute which messages are unread
53
+ *
54
+ * @param conversationId The conversation which has been read
55
+ * @param lastReadTimestamp The timestamp at which the conversation was read
56
+ * @param sendingOptions?
57
+ * @return Resolves when the message has been sent
58
+ */
59
+ sendLastRead(conversationId: string, lastReadTimestamp: number, sendingOptions?: MessageSendingOptions): Promise<(MessageSendingStatus & {
60
+ errored?: boolean | undefined;
61
+ }) | (ClientMismatch & {
62
+ errored?: boolean | undefined;
63
+ })>;
64
+ /**
65
+ * Syncs all self user's devices with the countly id
66
+ *
67
+ * @param countlyId The countly id of the current device
68
+ * @param sendingOptions?
69
+ * @return Resolves when the message has been sent
70
+ */
71
+ sendCountlySync(countlyId: string, sendingOptions: MessageSendingOptions): Promise<(MessageSendingStatus & {
72
+ errored?: boolean | undefined;
73
+ }) | (ClientMismatch & {
74
+ errored?: boolean | undefined;
75
+ })>;
76
+ /**
77
+ * Get a fresh list from backend of clients for all the participants of the conversation.
78
+ * This is a hacky way of getting all the clients for a conversation.
79
+ * The idea is to send an empty message to the backend to absolutely no users and let backend reply with a mismatch error.
80
+ * We then get the missing members in the mismatch, that is our fresh list of participants' clients.
81
+ *
82
+ * @deprecated
83
+ * @param {string} conversationId
84
+ * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
85
+ */
86
+ getAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
87
+ /**
88
+ * Get a fresh list from backend of clients for all the participants of the conversation.
89
+ * @fixme there are some case where this method is not enough to detect removed devices
90
+ * @param {string} conversationId
91
+ * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
92
+ */
93
+ fetchAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
94
+ /**
95
+ * Create a group conversation.
96
+ * @param {string} name
97
+ * @param {string|string[]} otherUserIds
98
+ * @deprecated
99
+ * @returns Promise
100
+ */
101
+ createProteusConversation(name: string, otherUserIds: string | string[]): Promise<Conversation>;
102
+ /**
103
+ * Create a group conversation.
104
+ *
105
+ * @note Do not include yourself as the requestor
106
+ * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/createGroupConversation
107
+ *
108
+ * @param conversationData Payload object for group creation
109
+ * @returns Resolves when the conversation was created
110
+ */
111
+ createProteusConversation(conversationData: NewConversation): Promise<Conversation>;
112
+ getConversations(conversationId: string): Promise<Conversation>;
113
+ getConversations(conversationIds?: string[]): Promise<Conversation[]>;
114
+ getAsset({ assetId, assetToken, otrKey, sha256 }: RemoteData): Promise<Uint8Array>;
115
+ getUnencryptedAsset(assetId: string, assetToken?: string): Promise<ArrayBuffer>;
116
+ addUsersToProteusConversation({ conversationId, qualifiedUserIds }: Omit<AddUsersParams, 'groupId'>): Promise<import("@wireapp/api-client/src/event").ConversationMemberJoinEvent>;
117
+ removeUserFromConversation(conversationId: QualifiedId, userId: QualifiedId): Promise<ConversationMemberLeaveEvent>;
118
+ private sendProteusMessage;
119
+ /**
120
+ * Sends a message to a conversation
121
+ * @return resolves with the sent message
122
+ */
123
+ send<T extends OtrMessage>(params: XOR<SendMlsMessageParams<T>, SendProteusMessageParams<T>>): Promise<T>;
124
+ sendTypingStart(conversationId: string): Promise<void>;
125
+ sendTypingStop(conversationId: string): Promise<void>;
126
+ setConversationMutedStatus(conversationId: string, status: MutedStatus, muteTimestamp: number | Date): Promise<void>;
127
+ toggleArchiveConversation(conversationId: string, archived: boolean, archiveTimestamp?: number | Date): Promise<void>;
128
+ setMemberConversationRole(conversationId: string, userId: string, conversationRole: DefaultConversationRoleName | string): Promise<void>;
129
+ private isClearFromMismatch;
130
+ /**
131
+ * ###############################################
132
+ * ################ MLS Functions ################
133
+ * ###############################################
134
+ */
135
+ createMLSConversation(conversationData: NewConversation): Promise<MLSReturnType>;
136
+ private sendMLSMessage;
137
+ addUsersToMLSConversation({ qualifiedUserIds, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSReturnType>;
138
+ private storeLastKeyMaterialUpdateDateWithCurrentTime;
139
+ removeUsersFromMLSConversation({ groupId, conversationId, qualifiedUserIds, }: RemoveUsersParams): Promise<MLSReturnType>;
140
+ /**
141
+ * Will send an external proposal for the current device to join a specific conversation.
142
+ * In order for the external proposal to be sent correctly, the underlying mls conversation needs to be in a non-established state
143
+ * @param conversationGroupId The conversation to join
144
+ * @param epoch The current epoch of the local conversation
145
+ */
146
+ sendExternalJoinProposal(conversationGroupId: string, epoch: number): Promise<void>;
147
+ isMLSConversationEstablished(conversationGroupId: string): Promise<boolean>;
148
+ wipeMLSConversation(conversationId: Uint8Array): Promise<void>;
149
+ }