@wireapp/core 30.5.2 → 30.6.0

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 (218) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +2 -2
  3. package/src/main/Account.d.ts +204 -0
  4. package/src/main/Account.js +439 -0
  5. package/src/main/CoreError.d.ts +9 -0
  6. package/src/main/CoreError.js +26 -0
  7. package/src/main/account/AccountService.d.ts +7 -0
  8. package/src/main/account/AccountService.js +33 -0
  9. package/src/main/account/AccountService.js.map +1 -0
  10. package/src/main/account/index.d.ts +1 -0
  11. package/src/main/account/index.js +32 -0
  12. package/src/main/account/index.js.map +1 -0
  13. package/src/main/auth/LoginSanitizer.d.ts +5 -0
  14. package/src/main/auth/LoginSanitizer.js +41 -0
  15. package/src/main/auth/index.d.ts +1 -0
  16. package/src/main/auth/index.js +32 -0
  17. package/src/main/broadcast/AvailabilityType.d.ts +2 -0
  18. package/src/main/broadcast/AvailabilityType.js +21 -0
  19. package/src/main/broadcast/BroadcastService.d.ts +24 -0
  20. package/src/main/broadcast/BroadcastService.js +74 -0
  21. package/src/main/broadcast/index.d.ts +2 -0
  22. package/src/main/broadcast/index.js +33 -0
  23. package/src/main/client/ClientBackendRepository.d.ts +11 -0
  24. package/src/main/client/ClientBackendRepository.js +43 -0
  25. package/src/main/client/ClientDatabaseRepository.d.ts +27 -0
  26. package/src/main/client/ClientDatabaseRepository.js +85 -0
  27. package/src/main/client/ClientInfo.d.ts +8 -0
  28. package/src/main/client/ClientInfo.js +21 -0
  29. package/src/main/client/ClientService.d.ts +48 -0
  30. package/src/main/client/ClientService.js +118 -0
  31. package/src/main/client/index.d.ts +4 -0
  32. package/src/main/client/index.js +35 -0
  33. package/src/main/connection/ConnectionService.d.ts +11 -0
  34. package/src/main/connection/ConnectionService.js +45 -0
  35. package/src/main/connection/index.d.ts +1 -0
  36. package/src/main/connection/index.js +32 -0
  37. package/src/main/conversation/AbortReason.d.ts +2 -0
  38. package/src/main/conversation/AbortReason.js +21 -0
  39. package/src/main/conversation/AssetService/AssetService.d.ts +62 -0
  40. package/src/main/conversation/AssetService/AssetService.js +88 -0
  41. package/src/main/conversation/AssetService/index.d.ts +1 -0
  42. package/src/main/conversation/AssetService/index.js +32 -0
  43. package/src/main/conversation/AssetTransferState.d.ts +4 -0
  44. package/src/main/conversation/AssetTransferState.js +27 -0
  45. package/src/main/conversation/ClientActionType.d.ts +1 -0
  46. package/src/main/conversation/ClientActionType.js +24 -0
  47. package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +6 -0
  48. package/src/main/conversation/ConversationMapper/ConversationMapper.js +57 -0
  49. package/src/main/conversation/ConversationMapper/index.d.ts +1 -0
  50. package/src/main/conversation/ConversationMapper/index.js +32 -0
  51. package/src/main/conversation/ConversationService/ConversationService.d.ts +174 -0
  52. package/src/main/conversation/ConversationService/ConversationService.js +936 -0
  53. package/src/main/conversation/ConversationService/ConversationService.types.d.ts +108 -0
  54. package/src/main/conversation/ConversationService/ConversationService.types.js +28 -0
  55. package/src/main/conversation/ConversationService/index.d.ts +2 -0
  56. package/src/main/conversation/ConversationService/index.js +33 -0
  57. package/src/main/conversation/GenericMessageType.d.ts +25 -0
  58. package/src/main/conversation/GenericMessageType.js +49 -0
  59. package/src/main/conversation/MessageTimer/MessageTimer.d.ts +10 -0
  60. package/src/main/conversation/MessageTimer/MessageTimer.js +54 -0
  61. package/src/main/conversation/MessageTimer/index.d.ts +1 -0
  62. package/src/main/conversation/MessageTimer/index.js +32 -0
  63. package/src/main/conversation/ReactionType.d.ts +4 -0
  64. package/src/main/conversation/ReactionType.js +27 -0
  65. package/src/main/conversation/content/AssetContent.d.ts +42 -0
  66. package/src/main/conversation/content/AssetContent.js +21 -0
  67. package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +2 -0
  68. package/src/main/conversation/content/ButtonActionConfirmationContent.js +21 -0
  69. package/src/main/conversation/content/ButtonActionContent.d.ts +2 -0
  70. package/src/main/conversation/content/ButtonActionContent.js +21 -0
  71. package/src/main/conversation/content/CallingContent.d.ts +1 -0
  72. package/src/main/conversation/content/CallingContent.js +21 -0
  73. package/src/main/conversation/content/ClearedContent.d.ts +2 -0
  74. package/src/main/conversation/content/ClearedContent.js +21 -0
  75. package/src/main/conversation/content/ClientActionContent.d.ts +2 -0
  76. package/src/main/conversation/content/ClientActionContent.js +21 -0
  77. package/src/main/conversation/content/ClientAddContent.d.ts +4 -0
  78. package/src/main/conversation/content/ClientAddContent.js +21 -0
  79. package/src/main/conversation/content/ClientRemoveContent.d.ts +6 -0
  80. package/src/main/conversation/content/ClientRemoveContent.js +21 -0
  81. package/src/main/conversation/content/CompositeContent.d.ts +2 -0
  82. package/src/main/conversation/content/CompositeContent.js +21 -0
  83. package/src/main/conversation/content/ConfirmationContent.d.ts +2 -0
  84. package/src/main/conversation/content/ConfirmationContent.js +21 -0
  85. package/src/main/conversation/content/ContentType.d.ts +21 -0
  86. package/src/main/conversation/content/ContentType.js +94 -0
  87. package/src/main/conversation/content/ConversationContent.d.ts +3 -0
  88. package/src/main/conversation/content/ConversationContent.js +21 -0
  89. package/src/main/conversation/content/DeletedContent.d.ts +2 -0
  90. package/src/main/conversation/content/DeletedContent.js +21 -0
  91. package/src/main/conversation/content/EditedTextContent.d.ts +11 -0
  92. package/src/main/conversation/content/EditedTextContent.js +21 -0
  93. package/src/main/conversation/content/FileContent.d.ts +13 -0
  94. package/src/main/conversation/content/FileContent.js +21 -0
  95. package/src/main/conversation/content/HiddenContent.d.ts +2 -0
  96. package/src/main/conversation/content/HiddenContent.js +21 -0
  97. package/src/main/conversation/content/ImageContent.d.ts +7 -0
  98. package/src/main/conversation/content/ImageContent.js +21 -0
  99. package/src/main/conversation/content/KnockContent.d.ts +2 -0
  100. package/src/main/conversation/content/KnockContent.js +21 -0
  101. package/src/main/conversation/content/LinkPreviewContent.d.ts +10 -0
  102. package/src/main/conversation/content/LinkPreviewContent.js +21 -0
  103. package/src/main/conversation/content/LocationContent.d.ts +9 -0
  104. package/src/main/conversation/content/LocationContent.js +21 -0
  105. package/src/main/conversation/content/MentionContent.d.ts +2 -0
  106. package/src/main/conversation/content/MentionContent.js +21 -0
  107. package/src/main/conversation/content/QuoteContent.d.ts +7 -0
  108. package/src/main/conversation/content/QuoteContent.js +21 -0
  109. package/src/main/conversation/content/ReactionContent.d.ts +7 -0
  110. package/src/main/conversation/content/ReactionContent.js +21 -0
  111. package/src/main/conversation/content/TextContent.d.ts +9 -0
  112. package/src/main/conversation/content/TextContent.js +21 -0
  113. package/src/main/conversation/content/TweetContent.d.ts +2 -0
  114. package/src/main/conversation/content/TweetContent.js +21 -0
  115. package/src/main/conversation/content/index.d.ts +28 -0
  116. package/src/main/conversation/content/index.js +72 -0
  117. package/src/main/conversation/index.d.ts +9 -0
  118. package/src/main/conversation/index.js +40 -0
  119. package/src/main/conversation/message/CompositeContentBuilder.d.ts +14 -0
  120. package/src/main/conversation/message/CompositeContentBuilder.js +54 -0
  121. package/src/main/conversation/message/Message.d.ts +4 -0
  122. package/src/main/conversation/message/Message.js +21 -0
  123. package/src/main/conversation/message/MessageBuilder.d.ts +87 -0
  124. package/src/main/conversation/message/MessageBuilder.js +119 -0
  125. package/src/main/conversation/message/MessageService.d.ts +67 -0
  126. package/src/main/conversation/message/MessageService.js +293 -0
  127. package/src/main/conversation/message/MessageToProtoMapper.d.ts +7 -0
  128. package/src/main/conversation/message/MessageToProtoMapper.js +99 -0
  129. package/src/main/conversation/message/OtrMessage.d.ts +80 -0
  130. package/src/main/conversation/message/OtrMessage.js +21 -0
  131. package/src/main/conversation/message/PayloadBundle.d.ts +76 -0
  132. package/src/main/conversation/message/PayloadBundle.js +81 -0
  133. package/src/main/conversation/message/TeamMessage.d.ts +31 -0
  134. package/src/main/conversation/message/TeamMessage.js +21 -0
  135. package/src/main/conversation/message/TextContentBuilder.d.ts +13 -0
  136. package/src/main/conversation/message/TextContentBuilder.js +75 -0
  137. package/src/main/conversation/message/UserClientsUtil.d.ts +22 -0
  138. package/src/main/conversation/message/UserClientsUtil.js +38 -0
  139. package/src/main/conversation/message/UserMessage.d.ts +43 -0
  140. package/src/main/conversation/message/UserMessage.js +21 -0
  141. package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +11 -0
  142. package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +21 -0
  143. package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +2 -0
  144. package/src/main/cryptography/AssetCryptography/crypto.browser.js +46 -0
  145. package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +2 -0
  146. package/src/main/cryptography/AssetCryptography/crypto.node.js +68 -0
  147. package/src/main/cryptography/AssetCryptography/index.d.ts +8 -0
  148. package/src/main/cryptography/AssetCryptography/index.js +53 -0
  149. package/src/main/cryptography/AssetCryptography/interfaces.d.ts +9 -0
  150. package/src/main/cryptography/AssetCryptography/interfaces.js +21 -0
  151. package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +17 -0
  152. package/src/main/cryptography/CryptographyDatabaseRepository.js +45 -0
  153. package/src/main/cryptography/CryptographyService.d.ts +52 -0
  154. package/src/main/cryptography/CryptographyService.js +205 -0
  155. package/src/main/cryptography/GenericMessageMapper.d.ts +6 -0
  156. package/src/main/cryptography/GenericMessageMapper.js +160 -0
  157. package/src/main/cryptography/MessageHashService.d.ts +16 -0
  158. package/src/main/cryptography/MessageHashService.js +114 -0
  159. package/src/main/cryptography/SessionPayloadBundle.d.ts +4 -0
  160. package/src/main/cryptography/SessionPayloadBundle.js +21 -0
  161. package/src/main/cryptography/index.d.ts +4 -0
  162. package/src/main/cryptography/index.js +35 -0
  163. package/src/main/giphy/GiphyService.d.ts +9 -0
  164. package/src/main/giphy/GiphyService.js +37 -0
  165. package/src/main/giphy/index.d.ts +1 -0
  166. package/src/main/giphy/index.js +32 -0
  167. package/src/main/index.d.ts +17 -0
  168. package/src/main/index.js +55 -0
  169. package/src/main/linkPreview/LinkPreviewService.d.ts +7 -0
  170. package/src/main/linkPreview/LinkPreviewService.js +52 -0
  171. package/src/main/linkPreview/index.d.ts +1 -0
  172. package/src/main/linkPreview/index.js +32 -0
  173. package/src/main/mls/MLSService/MLSService.d.ts +26 -0
  174. package/src/main/mls/MLSService/MLSService.js +131 -0
  175. package/src/main/mls/index.d.ts +1 -0
  176. package/src/main/mls/index.js +32 -0
  177. package/src/main/mls/types.d.ts +22 -0
  178. package/src/main/mls/types.js +21 -0
  179. package/src/main/notification/NotificationBackendRepository.d.ts +11 -0
  180. package/src/main/notification/NotificationBackendRepository.js +34 -0
  181. package/src/main/notification/NotificationDatabaseRepository.d.ts +66 -0
  182. package/src/main/notification/NotificationDatabaseRepository.js +136 -0
  183. package/src/main/notification/NotificationService.d.ts +131 -0
  184. package/src/main/notification/NotificationService.js +468 -0
  185. package/src/main/notification/index.d.ts +1 -0
  186. package/src/main/notification/index.js +32 -0
  187. package/src/main/notification/types.d.ts +20 -0
  188. package/src/main/notification/types.js +21 -0
  189. package/src/main/self/SelfService.d.ts +13 -0
  190. package/src/main/self/SelfService.js +55 -0
  191. package/src/main/self/index.d.ts +1 -0
  192. package/src/main/self/index.js +32 -0
  193. package/src/main/team/TeamService.d.ts +15 -0
  194. package/src/main/team/TeamService.js +55 -0
  195. package/src/main/team/index.d.ts +1 -0
  196. package/src/main/team/index.js +32 -0
  197. package/src/main/test/CryptographyHelper.d.ts +4 -0
  198. package/src/main/test/CryptographyHelper.js +65 -0
  199. package/src/main/test/PayloadHelper.d.ts +3 -0
  200. package/src/main/test/PayloadHelper.js +66 -0
  201. package/src/main/user/UserMapper.d.ts +5 -0
  202. package/src/main/user/UserMapper.js +88 -0
  203. package/src/main/user/UserService.d.ts +25 -0
  204. package/src/main/user/UserService.js +81 -0
  205. package/src/main/user/index.d.ts +1 -0
  206. package/src/main/user/index.js +32 -0
  207. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts +21 -0
  208. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +62 -0
  209. package/src/main/util/TaskScheduler/TaskScheduler.d.ts +10 -0
  210. package/src/main/util/TaskScheduler/TaskScheduler.js +70 -0
  211. package/src/main/util/TypePredicateUtil.d.ts +7 -0
  212. package/src/main/util/TypePredicateUtil.js +55 -0
  213. package/src/main/util/encryptedStore.d.ts +45 -0
  214. package/src/main/util/encryptedStore.js +116 -0
  215. package/src/main/util/index.d.ts +1 -0
  216. package/src/main/util/index.js +32 -0
  217. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.d.ts +8 -0
  218. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.js +32 -0
@@ -0,0 +1,32 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ __exportStar(require("./ConnectionService"), exports);
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import type { 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 type { APIClient } from '@wireapp/api-client';
3
+ import type { AssetOptions } from '@wireapp/api-client/src/asset';
4
+ import type { ProgressCallback, RequestCancelable } from '@wireapp/api-client/src/http';
5
+ import type { 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,32 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ __exportStar(require("./AssetService"), exports);
32
+ //# 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,32 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ __exportStar(require("./ConversationMapper"), exports);
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,174 @@
1
+ import type { APIClient } from '@wireapp/api-client';
2
+ import { MessageSendingStatus, Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, ClientMismatch } from '@wireapp/api-client/src/conversation';
3
+ import type { ConversationMemberLeaveEvent } from '@wireapp/api-client/src/event';
4
+ import type { QualifiedId, UserPreKeyBundleMap } from '@wireapp/api-client/src/user';
5
+ import { MessageTimer, RemoveUsersParams } from '../../conversation/';
6
+ import type { RemoteData } from '../content';
7
+ import type { CryptographyService } from '../../cryptography/';
8
+ import type { MLSService } from '../../mls';
9
+ import type { NotificationService } from '../../notification';
10
+ import type { ClearConversationMessage, DeleteMessage, HideMessage, OtrMessage } from '../message/OtrMessage';
11
+ import { XOR } from '@wireapp/commons/src/main/util/TypeUtil';
12
+ import { AddUsersParams, MessageSendingCallbacks, 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 createEphemeral;
25
+ private getConversationQualifiedMembers;
26
+ /**
27
+ * Will generate a prekey bundle for specific users.
28
+ * If a QualifiedId array is given the bundle will contain all the clients from those users fetched from the server.
29
+ * If a QualifiedUserClients is provided then only the clients in the payload will be targeted (which could generate a ClientMismatch when sending messages)
30
+ *
31
+ * @param {QualifiedId[]|QualifiedUserClients} userIds - Targeted users.
32
+ * @returns {Promise<QualifiedUserPreKeyBundleMap}
33
+ */
34
+ private getQualifiedPreKeyBundle;
35
+ getPreKeyBundleMap(conversationId: string, userIds?: string[] | UserClients): Promise<UserPreKeyBundleMap>;
36
+ private getSelfConversationId;
37
+ private getQualifiedRecipientsForConversation;
38
+ private getRecipientsForConversation;
39
+ /**
40
+ * Sends a message to a conversation
41
+ *
42
+ * @param sendingClientId The clientId from which the message is sent
43
+ * @param conversationId The conversation in which to send the message
44
+ * @param genericMessage The payload of the message to send
45
+ * @return Resolves with the message sending status from backend
46
+ */
47
+ private sendGenericMessage;
48
+ private extractUserIds;
49
+ private extractQualifiedUserIds;
50
+ private generateButtonActionGenericMessage;
51
+ private generateButtonActionConfirmationGenericMessage;
52
+ private generateCompositeGenericMessage;
53
+ private generateConfirmationGenericMessage;
54
+ private generateEditedTextGenericMessage;
55
+ private generateFileDataGenericMessage;
56
+ private generateFileMetaDataGenericMessage;
57
+ private generateFileAbortGenericMessage;
58
+ private generateAsset;
59
+ private generateImageGenericMessage;
60
+ private generateLocationGenericMessage;
61
+ private generatePingGenericMessage;
62
+ private generateReactionGenericMessage;
63
+ private generateSessionResetGenericMessage;
64
+ private generateCallGenericMessage;
65
+ private generateTextGenericMessage;
66
+ clearConversation(conversationId: string, timestamp?: number | Date, messageId?: string, sendAsProtobuf?: boolean): Promise<ClearConversationMessage>;
67
+ /**
68
+ * Sends a LastRead message to the current user's self conversation.
69
+ * This will allow all the user's devices to compute which messages are unread
70
+ *
71
+ * @param conversationId The conversation which has been read
72
+ * @param lastReadTimestamp The timestamp at which the conversation was read
73
+ * @param sendingOptions?
74
+ * @return Resolves when the message has been sent
75
+ */
76
+ sendLastRead(conversationId: string, lastReadTimestamp: number, sendingOptions?: MessageSendingOptions): Promise<(MessageSendingStatus & {
77
+ errored?: boolean | undefined;
78
+ }) | (ClientMismatch & {
79
+ errored?: boolean | undefined;
80
+ })>;
81
+ /**
82
+ * Syncs all self user's devices with the countly id
83
+ *
84
+ * @param countlyId The countly id of the current device
85
+ * @param sendingOptions?
86
+ * @return Resolves when the message has been sent
87
+ */
88
+ sendCountlySync(countlyId: string, sendingOptions: MessageSendingOptions): Promise<(MessageSendingStatus & {
89
+ errored?: boolean | undefined;
90
+ }) | (ClientMismatch & {
91
+ errored?: boolean | undefined;
92
+ })>;
93
+ /**
94
+ * Get a fresh list from backend of clients for all the participants of the conversation.
95
+ * This is a hacky way of getting all the clients for a conversation.
96
+ * The idea is to send an empty message to the backend to absolutely no users and let backend reply with a mismatch error.
97
+ * We then get the missing members in the mismatch, that is our fresh list of participants' clients.
98
+ *
99
+ * @deprecated
100
+ * @param {string} conversationId
101
+ * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
102
+ */
103
+ getAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
104
+ /**
105
+ * Get a fresh list from backend of clients for all the participants of the conversation.
106
+ * @fixme there are some case where this method is not enough to detect removed devices
107
+ * @param {string} conversationId
108
+ * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
109
+ */
110
+ fetchAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
111
+ deleteMessageLocal(conversationId: string, messageIdToHide: string, sendAsProtobuf?: boolean, conversationDomain?: string): Promise<HideMessage>;
112
+ deleteMessageEveryone(conversationId: string, messageIdToDelete: string, userIds?: string[] | QualifiedId[] | UserClients | QualifiedUserClients, sendAsProtobuf?: boolean, conversationDomain?: string, callbacks?: MessageSendingCallbacks): Promise<DeleteMessage>;
113
+ leaveConversation(conversationId: QualifiedId): Promise<ConversationMemberLeaveEvent>;
114
+ leaveMLSConversation(conversationId: QualifiedId): Promise<ConversationMemberLeaveEvent>;
115
+ /**
116
+ * @depricated seems not to be used and is outdated. use leaveConversation instead
117
+ */
118
+ leaveConversations(conversationIds?: string[]): Promise<ConversationMemberLeaveEvent[]>;
119
+ /**
120
+ * Create a group conversation.
121
+ * @param {string} name
122
+ * @param {string|string[]} otherUserIds
123
+ * @deprecated
124
+ * @returns Promise
125
+ */
126
+ createProteusConversation(name: string, otherUserIds: string | string[]): Promise<Conversation>;
127
+ /**
128
+ * Create a group conversation.
129
+ *
130
+ * @note Do not include yourself as the requestor
131
+ * @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/conversations/createGroupConversation
132
+ *
133
+ * @param conversationData Payload object for group creation
134
+ * @returns Resolves when the conversation was created
135
+ */
136
+ createProteusConversation(conversationData: NewConversation): Promise<Conversation>;
137
+ getConversations(conversationId: string): Promise<Conversation>;
138
+ getConversations(conversationIds?: string[]): Promise<Conversation[]>;
139
+ getAsset({ assetId, assetToken, otrKey, sha256 }: RemoteData): Promise<Uint8Array>;
140
+ getUnencryptedAsset(assetId: string, assetToken?: string): Promise<ArrayBuffer>;
141
+ addUsersToProteusConversation({ conversationId, qualifiedUserIds }: Omit<AddUsersParams, 'groupId'>): Promise<import("@wireapp/api-client/src/event").ConversationMemberJoinEvent>;
142
+ removeUserFromProteusConversation(conversationId: QualifiedId, userId: QualifiedId): Promise<ConversationMemberLeaveEvent>;
143
+ private sendProteusMessage;
144
+ /**
145
+ * Sends a message to a conversation
146
+ * @return resolves with the sent message
147
+ */
148
+ send<T extends OtrMessage>(params: XOR<SendMlsMessageParams<T>, SendProteusMessageParams<T>>): Promise<T>;
149
+ sendTypingStart(conversationId: string): Promise<void>;
150
+ sendTypingStop(conversationId: string): Promise<void>;
151
+ setConversationMutedStatus(conversationId: string, status: MutedStatus, muteTimestamp: number | Date): Promise<void>;
152
+ toggleArchiveConversation(conversationId: string, archived: boolean, archiveTimestamp?: number | Date): Promise<void>;
153
+ setMemberConversationRole(conversationId: string, userId: string, conversationRole: DefaultConversationRoleName | string): Promise<void>;
154
+ private isClearFromMismatch;
155
+ private generateGenericMessage;
156
+ /**
157
+ * ###############################################
158
+ * ################ MLS Functions ################
159
+ * ###############################################
160
+ */
161
+ createMLSConversation(conversationData: NewConversation): Promise<MLSReturnType>;
162
+ private sendMLSMessage;
163
+ addUsersToMLSConversation({ qualifiedUserIds, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSReturnType>;
164
+ private storeLastKeyMaterialUpdateDateWithCurrentTime;
165
+ removeUsersFromMLSConversation({ groupId, conversationId, qualifiedUserIds, }: RemoveUsersParams): Promise<MLSReturnType>;
166
+ /**
167
+ * Will send an external proposal for the current device to join a specific conversation.
168
+ * In order for the external proposal to be sent correctly, the underlying mls conversation needs to be in a non-established state
169
+ * @param conversationGroupId The conversation to join
170
+ * @param epoch The current epoch of the local conversation
171
+ */
172
+ sendExternalJoinProposal(conversationGroupId: string, epoch: number): Promise<void>;
173
+ isMLSConversationEstablished(conversationGroupId: string): Promise<boolean>;
174
+ }