@wireapp/core 31.1.3 → 31.2.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 (227) hide show
  1. package/package.json +10 -9
  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,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=OtrMessage.js.map
@@ -0,0 +1,76 @@
1
+ import { ConversationEventData, TeamEventData, UserEventData } from '@wireapp/api-client/src/event/';
2
+ import { QualifiedId } from '@wireapp/api-client/src/user';
3
+ import { ConversationContent } from '../content';
4
+ import { Message } from './Message';
5
+ export declare type PayloadBundleContent = ConversationContent | ConversationEventData | TeamEventData | UserEventData;
6
+ export declare enum PayloadBundleSource {
7
+ LOCAL = "PayloadBundleSource.LOCAL",
8
+ NOTIFICATION_STREAM = "PayloadBundleSource.NOTIFICATION_STREAM",
9
+ WEBSOCKET = "PayloadBundleSource.WEBSOCKET"
10
+ }
11
+ export declare enum PayloadBundleState {
12
+ INCOMING = "PayloadBundleState.INCOMING",
13
+ OUTGOING_SENT = "PayloadBundleState.OUTGOING_SENT",
14
+ OUTGOING_UNSENT = "PayloadBundleState.OUTGOING_UNSENT",
15
+ CANCELLED = "PayloadBundleState.CANCELLED"
16
+ }
17
+ export interface BasePayloadBundle {
18
+ content: PayloadBundleContent;
19
+ conversation: string;
20
+ qualifiedConversation?: QualifiedId;
21
+ from: string;
22
+ qualifiedFrom?: QualifiedId;
23
+ fromClientId?: string;
24
+ id: string;
25
+ messageTimer?: number;
26
+ source: PayloadBundleSource;
27
+ state: PayloadBundleState;
28
+ timestamp: number;
29
+ type: PayloadBundleType;
30
+ }
31
+ export declare type PayloadBundle = Message | BasePayloadBundle;
32
+ export declare enum PayloadBundleType {
33
+ ASSET = "PayloadBundleType.ASSET",
34
+ ASSET_ABORT = "PayloadBundleType.ASSET_ABORT",
35
+ ASSET_IMAGE = "PayloadBundleType.ASSET_IMAGE",
36
+ ASSET_META = "PayloadBundleType.ASSET_META",
37
+ BUTTON_ACTION = "PayloadBundleType.BUTTON_ACTION",
38
+ BUTTON_ACTION_CONFIRMATION = "PayloadBundleType.BUTTON_ACTION_CONFIRMATION",
39
+ CALL = "PayloadBundleType.CALL",
40
+ CLIENT_ACTION = "PayloadBundleType.CLIENT_ACTION",
41
+ CLIENT_ADD = "PayloadBundleType.CLIENT_ADD",
42
+ CLIENT_REMOVE = "PayloadBundleType.CLIENT_REMOVE",
43
+ COMPOSITE = "PayloadBundleType.COMPOSITE",
44
+ CONFIRMATION = "PayloadBundleType.CONFIRMATION",
45
+ CONNECTION_REQUEST = "PayloadBundleType.CONNECTION_REQUEST",
46
+ CONVERSATION_CLEAR = "PayloadBundleType.CONVERSATION_CLEAR",
47
+ CONVERSATION_RENAME = "PayloadBundleType.CONVERSATION_RENAME",
48
+ LOCATION = "PayloadBundleType.LOCATION",
49
+ MEMBER_JOIN = "PayloadBundleType.MEMBER_JOIN",
50
+ MESSAGE_DELETE = "PayloadBundleType.MESSAGE_DELETE",
51
+ MESSAGE_EDIT = "PayloadBundleType.MESSAGE_EDIT",
52
+ MESSAGE_HIDE = "PayloadBundleType.MESSAGE_HIDE",
53
+ MLS_WELCOME_MESSAGE = "PayloadBundleType.MLS_WELCOME",
54
+ PING = "PayloadBundleType.PING",
55
+ REACTION = "PayloadBundleType.REACTION",
56
+ TEAM_CONVERSATION_CREATE = "PayloadBundleType.TEAM_CONVERSATION_CREATE",
57
+ TEAM_CONVERSATION_DELETE = "PayloadBundleType.TEAM_CONVERSATION_DELETE",
58
+ TEAM_DELETE = "PayloadBundleType.TEAM_DELETE",
59
+ TEAM_MEMBER_JOIN = "PayloadBundleType.TEAM_MEMBER_JOIN",
60
+ TEAM_MEMBER_LEAVE = "PayloadBundleType.TEAM_MEMBER_LEAVE",
61
+ TEAM_UPDATE = "PayloadBundleType.TEAM_UPDATE",
62
+ TEXT = "PayloadBundleType.TEXT",
63
+ TIMER_UPDATE = "PayloadBundleType.TIMER_UPDATE",
64
+ TYPING = "PayloadBundleType.TYPING",
65
+ UNKNOWN = "PayloadBundleType.UNKNOWN",
66
+ USER_ACTIVATE = "PayloadBundleType.USER_ACTIVATE",
67
+ USER_CLIENT_ADD = "PayloadBundleType.USER_CLIENT_ADD",
68
+ USER_CLIENT_REMOVE = "PayloadBundleType.USER_CLIENT_REMOVE",
69
+ USER_CONNECTION = "PayloadBundleType.USER_CONNECTION",
70
+ USER_DELETE = "PayloadBundleType.USER_DELETE",
71
+ USER_LEGAL_HOLD_DISABLE = "PayloadBundleType.USER_LEGAL_HOLD_DISABLE",
72
+ USER_LEGAL_HOLD_ENABLE = "PayloadBundleType.USER_LEGAL_HOLD_ENABLE",
73
+ USER_LEGAL_HOLD_REQUEST = "PayloadBundleType.USER_LEGAL_HOLD_REQUEST",
74
+ USER_PROPERTIES_SET = "PayloadBundleType.USER_PROPERTIES_SET",
75
+ USER_UPDATE = "PayloadBundleType.USER_UPDATE"
76
+ }
@@ -0,0 +1,81 @@
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.PayloadBundleType = exports.PayloadBundleState = exports.PayloadBundleSource = void 0;
22
+ var PayloadBundleSource;
23
+ (function (PayloadBundleSource) {
24
+ PayloadBundleSource["LOCAL"] = "PayloadBundleSource.LOCAL";
25
+ PayloadBundleSource["NOTIFICATION_STREAM"] = "PayloadBundleSource.NOTIFICATION_STREAM";
26
+ PayloadBundleSource["WEBSOCKET"] = "PayloadBundleSource.WEBSOCKET";
27
+ })(PayloadBundleSource = exports.PayloadBundleSource || (exports.PayloadBundleSource = {}));
28
+ var PayloadBundleState;
29
+ (function (PayloadBundleState) {
30
+ PayloadBundleState["INCOMING"] = "PayloadBundleState.INCOMING";
31
+ PayloadBundleState["OUTGOING_SENT"] = "PayloadBundleState.OUTGOING_SENT";
32
+ PayloadBundleState["OUTGOING_UNSENT"] = "PayloadBundleState.OUTGOING_UNSENT";
33
+ PayloadBundleState["CANCELLED"] = "PayloadBundleState.CANCELLED";
34
+ })(PayloadBundleState = exports.PayloadBundleState || (exports.PayloadBundleState = {}));
35
+ var PayloadBundleType;
36
+ (function (PayloadBundleType) {
37
+ PayloadBundleType["ASSET"] = "PayloadBundleType.ASSET";
38
+ PayloadBundleType["ASSET_ABORT"] = "PayloadBundleType.ASSET_ABORT";
39
+ PayloadBundleType["ASSET_IMAGE"] = "PayloadBundleType.ASSET_IMAGE";
40
+ PayloadBundleType["ASSET_META"] = "PayloadBundleType.ASSET_META";
41
+ PayloadBundleType["BUTTON_ACTION"] = "PayloadBundleType.BUTTON_ACTION";
42
+ PayloadBundleType["BUTTON_ACTION_CONFIRMATION"] = "PayloadBundleType.BUTTON_ACTION_CONFIRMATION";
43
+ PayloadBundleType["CALL"] = "PayloadBundleType.CALL";
44
+ PayloadBundleType["CLIENT_ACTION"] = "PayloadBundleType.CLIENT_ACTION";
45
+ PayloadBundleType["CLIENT_ADD"] = "PayloadBundleType.CLIENT_ADD";
46
+ PayloadBundleType["CLIENT_REMOVE"] = "PayloadBundleType.CLIENT_REMOVE";
47
+ PayloadBundleType["COMPOSITE"] = "PayloadBundleType.COMPOSITE";
48
+ PayloadBundleType["CONFIRMATION"] = "PayloadBundleType.CONFIRMATION";
49
+ PayloadBundleType["CONNECTION_REQUEST"] = "PayloadBundleType.CONNECTION_REQUEST";
50
+ PayloadBundleType["CONVERSATION_CLEAR"] = "PayloadBundleType.CONVERSATION_CLEAR";
51
+ PayloadBundleType["CONVERSATION_RENAME"] = "PayloadBundleType.CONVERSATION_RENAME";
52
+ PayloadBundleType["LOCATION"] = "PayloadBundleType.LOCATION";
53
+ PayloadBundleType["MEMBER_JOIN"] = "PayloadBundleType.MEMBER_JOIN";
54
+ PayloadBundleType["MESSAGE_DELETE"] = "PayloadBundleType.MESSAGE_DELETE";
55
+ PayloadBundleType["MESSAGE_EDIT"] = "PayloadBundleType.MESSAGE_EDIT";
56
+ PayloadBundleType["MESSAGE_HIDE"] = "PayloadBundleType.MESSAGE_HIDE";
57
+ PayloadBundleType["MLS_WELCOME_MESSAGE"] = "PayloadBundleType.MLS_WELCOME";
58
+ PayloadBundleType["PING"] = "PayloadBundleType.PING";
59
+ PayloadBundleType["REACTION"] = "PayloadBundleType.REACTION";
60
+ PayloadBundleType["TEAM_CONVERSATION_CREATE"] = "PayloadBundleType.TEAM_CONVERSATION_CREATE";
61
+ PayloadBundleType["TEAM_CONVERSATION_DELETE"] = "PayloadBundleType.TEAM_CONVERSATION_DELETE";
62
+ PayloadBundleType["TEAM_DELETE"] = "PayloadBundleType.TEAM_DELETE";
63
+ PayloadBundleType["TEAM_MEMBER_JOIN"] = "PayloadBundleType.TEAM_MEMBER_JOIN";
64
+ PayloadBundleType["TEAM_MEMBER_LEAVE"] = "PayloadBundleType.TEAM_MEMBER_LEAVE";
65
+ PayloadBundleType["TEAM_UPDATE"] = "PayloadBundleType.TEAM_UPDATE";
66
+ PayloadBundleType["TEXT"] = "PayloadBundleType.TEXT";
67
+ PayloadBundleType["TIMER_UPDATE"] = "PayloadBundleType.TIMER_UPDATE";
68
+ PayloadBundleType["TYPING"] = "PayloadBundleType.TYPING";
69
+ PayloadBundleType["UNKNOWN"] = "PayloadBundleType.UNKNOWN";
70
+ PayloadBundleType["USER_ACTIVATE"] = "PayloadBundleType.USER_ACTIVATE";
71
+ PayloadBundleType["USER_CLIENT_ADD"] = "PayloadBundleType.USER_CLIENT_ADD";
72
+ PayloadBundleType["USER_CLIENT_REMOVE"] = "PayloadBundleType.USER_CLIENT_REMOVE";
73
+ PayloadBundleType["USER_CONNECTION"] = "PayloadBundleType.USER_CONNECTION";
74
+ PayloadBundleType["USER_DELETE"] = "PayloadBundleType.USER_DELETE";
75
+ PayloadBundleType["USER_LEGAL_HOLD_DISABLE"] = "PayloadBundleType.USER_LEGAL_HOLD_DISABLE";
76
+ PayloadBundleType["USER_LEGAL_HOLD_ENABLE"] = "PayloadBundleType.USER_LEGAL_HOLD_ENABLE";
77
+ PayloadBundleType["USER_LEGAL_HOLD_REQUEST"] = "PayloadBundleType.USER_LEGAL_HOLD_REQUEST";
78
+ PayloadBundleType["USER_PROPERTIES_SET"] = "PayloadBundleType.USER_PROPERTIES_SET";
79
+ PayloadBundleType["USER_UPDATE"] = "PayloadBundleType.USER_UPDATE";
80
+ })(PayloadBundleType = exports.PayloadBundleType || (exports.PayloadBundleType = {}));
81
+ //# sourceMappingURL=PayloadBundle.js.map
@@ -0,0 +1,31 @@
1
+ import { TeamConversationCreateData, TeamConversationDeleteData, TeamMemberJoinData, TeamMemberLeaveData, TeamUpdateData } from '@wireapp/api-client/src/team/data';
2
+ import { BasePayloadBundle, PayloadBundleType } from './PayloadBundle';
3
+ export interface TeamConversationCreateMessage extends BasePayloadBundle {
4
+ content: TeamConversationCreateData;
5
+ type: PayloadBundleType.TEAM_CONVERSATION_CREATE;
6
+ }
7
+ export interface TeamMemberLeaveMessage extends BasePayloadBundle {
8
+ content: TeamMemberLeaveData;
9
+ type: PayloadBundleType.TEAM_MEMBER_LEAVE;
10
+ }
11
+ export interface TeamConversationDeleteMessage extends BasePayloadBundle {
12
+ content: TeamConversationDeleteData;
13
+ type: PayloadBundleType.TEAM_CONVERSATION_DELETE;
14
+ }
15
+ export interface TeamDeleteMessage extends BasePayloadBundle {
16
+ content: null;
17
+ type: PayloadBundleType.TEAM_DELETE;
18
+ }
19
+ export interface TeamMemberJoinMessage extends BasePayloadBundle {
20
+ content: TeamMemberJoinData;
21
+ type: PayloadBundleType.TEAM_MEMBER_JOIN;
22
+ }
23
+ export interface TeamMemberLeaveMesssage extends BasePayloadBundle {
24
+ content: TeamMemberLeaveData;
25
+ type: PayloadBundleType.TEAM_MEMBER_LEAVE;
26
+ }
27
+ export interface TeamUpdateMessage extends BasePayloadBundle {
28
+ content: TeamUpdateData;
29
+ type: PayloadBundleType.TEAM_UPDATE;
30
+ }
31
+ export declare type TeamMessage = TeamConversationCreateMessage | TeamMemberLeaveMessage | TeamConversationDeleteMessage | TeamDeleteMessage | TeamMemberJoinMessage | TeamMemberLeaveMesssage | TeamUpdateMessage;
@@ -0,0 +1,21 @@
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
+ //# sourceMappingURL=TeamMessage.js.map
@@ -0,0 +1,13 @@
1
+ import { LegalHoldStatus, LinkPreviewUploadedContent, MentionContent, QuoteContent } from '../content';
2
+ import { EditedTextMessage, TextMessage, QuotableMessage } from './OtrMessage';
3
+ export declare class TextContentBuilder {
4
+ private readonly content;
5
+ private readonly payloadBundle;
6
+ constructor(payloadBundle: TextMessage | EditedTextMessage);
7
+ build(): TextMessage | EditedTextMessage;
8
+ withLinkPreviews(linkPreviews?: LinkPreviewUploadedContent[]): TextContentBuilder;
9
+ withMentions(mentions?: MentionContent[]): TextContentBuilder;
10
+ withQuote(quote?: QuotableMessage | QuoteContent): TextContentBuilder;
11
+ withReadConfirmation(expectsReadConfirmation?: boolean): TextContentBuilder;
12
+ withLegalHoldStatus(legalHoldStatus?: LegalHoldStatus): TextContentBuilder;
13
+ }
@@ -0,0 +1,75 @@
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.TextContentBuilder = void 0;
22
+ const cryptography_1 = require("../../cryptography");
23
+ const content_1 = require("../content");
24
+ class TextContentBuilder {
25
+ constructor(payloadBundle) {
26
+ this.payloadBundle = payloadBundle;
27
+ this.content = this.payloadBundle.content;
28
+ }
29
+ build() {
30
+ this.payloadBundle.content = this.content;
31
+ return this.payloadBundle;
32
+ }
33
+ withLinkPreviews(linkPreviews) {
34
+ if (linkPreviews === null || linkPreviews === void 0 ? void 0 : linkPreviews.length) {
35
+ this.content.linkPreviews = linkPreviews;
36
+ }
37
+ return this;
38
+ }
39
+ withMentions(mentions) {
40
+ if (mentions === null || mentions === void 0 ? void 0 : mentions.length) {
41
+ this.content.mentions = mentions;
42
+ }
43
+ return this;
44
+ }
45
+ withQuote(quote) {
46
+ if (quote) {
47
+ if (quote.quotedMessageId) {
48
+ this.content.quote = quote;
49
+ }
50
+ else {
51
+ const messageHashService = new cryptography_1.MessageHashService(quote.content, quote.timestamp);
52
+ const messageHashBuffer = messageHashService.getHash();
53
+ this.content.quote = {
54
+ quotedMessageId: quote.id,
55
+ quotedMessageSha256: new Uint8Array(messageHashBuffer),
56
+ };
57
+ }
58
+ }
59
+ return this;
60
+ }
61
+ withReadConfirmation(expectsReadConfirmation = false) {
62
+ if (typeof expectsReadConfirmation !== 'undefined') {
63
+ this.content.expectsReadConfirmation = expectsReadConfirmation;
64
+ }
65
+ return this;
66
+ }
67
+ withLegalHoldStatus(legalHoldStatus = content_1.LegalHoldStatus.UNKNOWN) {
68
+ if (typeof legalHoldStatus !== 'undefined') {
69
+ this.content.legalHoldStatus = legalHoldStatus;
70
+ }
71
+ return this;
72
+ }
73
+ }
74
+ exports.TextContentBuilder = TextContentBuilder;
75
+ //# sourceMappingURL=TextContentBuilder.js.map
@@ -0,0 +1,22 @@
1
+ import { QualifiedId } from '@wireapp/api-client/src/user';
2
+ declare type UserClientsContainer<T> = {
3
+ [userId: string]: T;
4
+ };
5
+ declare type QualifiedUserClientsContainer<T> = {
6
+ [domain: string]: UserClientsContainer<T>;
7
+ };
8
+ export declare function flattenUserClients<T>(userClients: UserClientsContainer<T>, domain?: string): {
9
+ data: T;
10
+ userId: QualifiedId;
11
+ }[];
12
+ /**
13
+ * Will flatten a container of users=>clients infos to an array
14
+ *
15
+ * @param userClients The UserClients (qualified or not) to flatten
16
+ * @return An array containing the qualified user Ids and the clients info
17
+ */
18
+ export declare function flattenQualifiedUserClients<T = unknown>(userClients: QualifiedUserClientsContainer<T>): {
19
+ data: T;
20
+ userId: QualifiedId;
21
+ }[];
22
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2021 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.flattenQualifiedUserClients = exports.flattenUserClients = void 0;
22
+ function flattenUserClients(userClients, domain = '') {
23
+ return Object.entries(userClients).map(([id, data]) => ({ data, userId: { domain, id } }));
24
+ }
25
+ exports.flattenUserClients = flattenUserClients;
26
+ /**
27
+ * Will flatten a container of users=>clients infos to an array
28
+ *
29
+ * @param userClients The UserClients (qualified or not) to flatten
30
+ * @return An array containing the qualified user Ids and the clients info
31
+ */
32
+ function flattenQualifiedUserClients(userClients) {
33
+ return Object.entries(userClients).reduce((ids, [domain, userClients]) => {
34
+ return [...ids, ...flattenUserClients(userClients, domain)];
35
+ }, []);
36
+ }
37
+ exports.flattenQualifiedUserClients = flattenQualifiedUserClients;
38
+ //# sourceMappingURL=UserClientsUtil.js.map
@@ -0,0 +1,43 @@
1
+ import { UserActivateData, UserClientAddData, UserClientRemoveData, UserConnectionData, UserDeleteData, UserLegalHoldDisableData, UserLegalHoldEnableData, UserLegalHoldRequestData, UserPropertiesSetData, UserUpdateData } from '@wireapp/api-client/src/user/data';
2
+ import { BasePayloadBundle, PayloadBundleType } from './PayloadBundle';
3
+ export interface UserActivateMessage extends BasePayloadBundle {
4
+ content: UserActivateData;
5
+ type: PayloadBundleType.USER_ACTIVATE;
6
+ }
7
+ export interface UserClientAddMessage extends BasePayloadBundle {
8
+ content: UserClientAddData;
9
+ type: PayloadBundleType.USER_CLIENT_ADD;
10
+ }
11
+ export interface UserLegalHoldRequestMessage extends BasePayloadBundle {
12
+ content: UserLegalHoldRequestData;
13
+ type: PayloadBundleType.USER_LEGAL_HOLD_REQUEST;
14
+ }
15
+ export interface UserLegalHoldEnableMessage extends BasePayloadBundle {
16
+ content: UserLegalHoldEnableData;
17
+ type: PayloadBundleType.USER_LEGAL_HOLD_ENABLE;
18
+ }
19
+ export interface UserLegalHoldDisableMessage extends BasePayloadBundle {
20
+ content: UserLegalHoldDisableData;
21
+ type: PayloadBundleType.USER_LEGAL_HOLD_DISABLE;
22
+ }
23
+ export interface UserClientRemoveMessage extends BasePayloadBundle {
24
+ content: UserClientRemoveData;
25
+ type: PayloadBundleType.USER_CLIENT_REMOVE;
26
+ }
27
+ export interface UserConnectionMessage extends BasePayloadBundle {
28
+ content: UserConnectionData;
29
+ type: PayloadBundleType.USER_CONNECTION;
30
+ }
31
+ export interface UserDeleteMessage extends BasePayloadBundle {
32
+ content: UserDeleteData;
33
+ type: PayloadBundleType.USER_DELETE;
34
+ }
35
+ export interface UserPropertiesSetEvent extends BasePayloadBundle {
36
+ content: UserPropertiesSetData;
37
+ type: PayloadBundleType.USER_PROPERTIES_SET;
38
+ }
39
+ export interface UserUpdateMessage extends BasePayloadBundle {
40
+ content: UserUpdateData;
41
+ type: PayloadBundleType.USER_UPDATE;
42
+ }
43
+ export declare type UserMessage = UserActivateMessage | UserClientAddMessage | UserLegalHoldRequestMessage | UserLegalHoldEnableMessage | UserLegalHoldDisableMessage | UserClientRemoveMessage | UserConnectionMessage | UserDeleteMessage | UserPropertiesSetEvent | UserUpdateMessage;
@@ -0,0 +1,21 @@
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
+ //# sourceMappingURL=UserMessage.js.map
@@ -0,0 +1,4 @@
1
+ import { Task } from '@wireapp/promise-queue';
2
+ export declare function sendMessage<T>(sendingFunction: Task<T>): Promise<T>;
3
+ export declare function resumeMessageSending(): void;
4
+ export declare function pauseMessageSending(): void;
@@ -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
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.pauseMessageSending = exports.resumeMessageSending = exports.sendMessage = void 0;
22
+ const promise_queue_1 = require("@wireapp/promise-queue");
23
+ const sendingQueue = new promise_queue_1.PromiseQueue({ name: 'message-sender', paused: true });
24
+ function sendMessage(sendingFunction) {
25
+ return sendingQueue.push(sendingFunction);
26
+ }
27
+ exports.sendMessage = sendMessage;
28
+ function resumeMessageSending() {
29
+ sendingQueue.pause(false);
30
+ }
31
+ exports.resumeMessageSending = resumeMessageSending;
32
+ function pauseMessageSending() {
33
+ sendingQueue.pause(true);
34
+ }
35
+ exports.pauseMessageSending = pauseMessageSending;
36
+ //# sourceMappingURL=messageSender.js.map
@@ -0,0 +1,11 @@
1
+ export interface EncryptedAsset {
2
+ cipherText: Uint8Array;
3
+ keyBytes: Uint8Array;
4
+ /** The SHA-256 sum of `cipherText` */
5
+ sha256: Uint8Array;
6
+ }
7
+ export interface EncryptedAssetUploaded extends EncryptedAsset {
8
+ key: string;
9
+ domain?: string;
10
+ token: string;
11
+ }
@@ -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=EncryptedAsset.js.map
@@ -0,0 +1,2 @@
1
+ import { Crypto } from './interfaces';
2
+ export declare const crypto: Crypto;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2021 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.crypto = void 0;
22
+ const cryptoLib = window.crypto;
23
+ exports.crypto = {
24
+ async digest(cipherText) {
25
+ const checksum = await cryptoLib.subtle.digest('SHA-256', cipherText);
26
+ return new Uint8Array(checksum);
27
+ },
28
+ async decrypt(cipherText, keyBytes) {
29
+ const key = await cryptoLib.subtle.importKey('raw', keyBytes, 'AES-CBC', false, ['decrypt']);
30
+ const initializationVector = cipherText.slice(0, 16);
31
+ const assetCipherText = cipherText.slice(16);
32
+ const decipher = await cryptoLib.subtle.decrypt({ iv: initializationVector, name: 'AES-CBC' }, key, assetCipherText);
33
+ return new Uint8Array(decipher);
34
+ },
35
+ getRandomValues(size) {
36
+ return cryptoLib.getRandomValues(new Uint8Array(size));
37
+ },
38
+ async encrypt(plainText, keyBytes, initializationVector) {
39
+ const key = await cryptoLib.subtle.importKey('raw', keyBytes, 'AES-CBC', true, ['encrypt']);
40
+ return {
41
+ key: new Uint8Array(await cryptoLib.subtle.exportKey('raw', key)),
42
+ cipher: await cryptoLib.subtle.encrypt({ iv: initializationVector, name: 'AES-CBC' }, key, plainText),
43
+ };
44
+ },
45
+ };
46
+ //# sourceMappingURL=crypto.browser.js.map
@@ -0,0 +1,2 @@
1
+ import { Crypto } from './interfaces';
2
+ export declare const crypto: Crypto;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2021 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
32
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
33
+ }) : function(o, v) {
34
+ o["default"] = v;
35
+ });
36
+ var __importStar = (this && this.__importStar) || function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.crypto = void 0;
45
+ const cryptoLib = __importStar(require("crypto"));
46
+ exports.crypto = {
47
+ async digest(cipherText) {
48
+ return cryptoLib.createHash('SHA256').update(cipherText).digest();
49
+ },
50
+ async decrypt(cipherText, keyBytes) {
51
+ const initializationVector = cipherText.slice(0, 16);
52
+ const assetCipherText = cipherText.slice(16);
53
+ const decipher = cryptoLib.createDecipheriv('AES-256-CBC', keyBytes, initializationVector);
54
+ const decipherUpdated = decipher.update(assetCipherText);
55
+ const decipherFinal = decipher.final();
56
+ return Buffer.concat([decipherUpdated, decipherFinal]);
57
+ },
58
+ getRandomValues(size) {
59
+ return cryptoLib.randomBytes(size);
60
+ },
61
+ async encrypt(plainText, keyBytes, initializationVector, algorithm) {
62
+ const cipher = cryptoLib.createCipheriv(algorithm, keyBytes, initializationVector);
63
+ const cipherUpdated = cipher.update(plainText);
64
+ const cipherFinal = cipher.final();
65
+ const cipherText = Buffer.concat([cipherUpdated, cipherFinal]);
66
+ return {
67
+ key: keyBytes,
68
+ cipher: cipherText,
69
+ };
70
+ },
71
+ };
72
+ //# sourceMappingURL=crypto.node.js.map