@wireapp/core 31.1.1 → 31.1.3

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 (229) hide show
  1. package/package.json +7 -7
  2. package/src/main/Account.d.ts +0 -214
  3. package/src/main/Account.js +0 -463
  4. package/src/main/CoreError.d.ts +0 -9
  5. package/src/main/CoreError.js +0 -26
  6. package/src/main/account/AccountService.d.ts +0 -7
  7. package/src/main/account/AccountService.js +0 -33
  8. package/src/main/account/AccountService.js.map +0 -1
  9. package/src/main/account/index.d.ts +0 -1
  10. package/src/main/account/index.js +0 -36
  11. package/src/main/account/index.js.map +0 -1
  12. package/src/main/auth/LoginSanitizer.d.ts +0 -5
  13. package/src/main/auth/LoginSanitizer.js +0 -41
  14. package/src/main/auth/index.d.ts +0 -1
  15. package/src/main/auth/index.js +0 -36
  16. package/src/main/broadcast/AvailabilityType.d.ts +0 -2
  17. package/src/main/broadcast/AvailabilityType.js +0 -21
  18. package/src/main/broadcast/BroadcastService.d.ts +0 -24
  19. package/src/main/broadcast/BroadcastService.js +0 -74
  20. package/src/main/broadcast/index.d.ts +0 -2
  21. package/src/main/broadcast/index.js +0 -37
  22. package/src/main/client/ClientBackendRepository.d.ts +0 -11
  23. package/src/main/client/ClientBackendRepository.js +0 -43
  24. package/src/main/client/ClientDatabaseRepository.d.ts +0 -27
  25. package/src/main/client/ClientDatabaseRepository.js +0 -85
  26. package/src/main/client/ClientInfo.d.ts +0 -8
  27. package/src/main/client/ClientInfo.js +0 -21
  28. package/src/main/client/ClientService.d.ts +0 -40
  29. package/src/main/client/ClientService.js +0 -103
  30. package/src/main/client/index.d.ts +0 -4
  31. package/src/main/client/index.js +0 -39
  32. package/src/main/connection/ConnectionService.d.ts +0 -11
  33. package/src/main/connection/ConnectionService.js +0 -45
  34. package/src/main/connection/index.d.ts +0 -1
  35. package/src/main/connection/index.js +0 -36
  36. package/src/main/conversation/AbortReason.d.ts +0 -2
  37. package/src/main/conversation/AbortReason.js +0 -21
  38. package/src/main/conversation/AssetService/AssetService.d.ts +0 -62
  39. package/src/main/conversation/AssetService/AssetService.js +0 -88
  40. package/src/main/conversation/AssetService/index.d.ts +0 -1
  41. package/src/main/conversation/AssetService/index.js +0 -36
  42. package/src/main/conversation/AssetTransferState.d.ts +0 -4
  43. package/src/main/conversation/AssetTransferState.js +0 -27
  44. package/src/main/conversation/ClientActionType.d.ts +0 -1
  45. package/src/main/conversation/ClientActionType.js +0 -24
  46. package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +0 -6
  47. package/src/main/conversation/ConversationMapper/ConversationMapper.js +0 -57
  48. package/src/main/conversation/ConversationMapper/index.d.ts +0 -1
  49. package/src/main/conversation/ConversationMapper/index.js +0 -36
  50. package/src/main/conversation/ConversationService/ConversationService.d.ts +0 -149
  51. package/src/main/conversation/ConversationService/ConversationService.js +0 -584
  52. package/src/main/conversation/ConversationService/ConversationService.types.d.ts +0 -110
  53. package/src/main/conversation/ConversationService/ConversationService.types.js +0 -28
  54. package/src/main/conversation/ConversationService/index.d.ts +0 -2
  55. package/src/main/conversation/ConversationService/index.js +0 -37
  56. package/src/main/conversation/ConversationService/messageGenerator.d.ts +0 -9
  57. package/src/main/conversation/ConversationService/messageGenerator.js +0 -313
  58. package/src/main/conversation/GenericMessageType.d.ts +0 -25
  59. package/src/main/conversation/GenericMessageType.js +0 -49
  60. package/src/main/conversation/MessageTimer/MessageTimer.d.ts +0 -10
  61. package/src/main/conversation/MessageTimer/MessageTimer.js +0 -54
  62. package/src/main/conversation/MessageTimer/index.d.ts +0 -1
  63. package/src/main/conversation/MessageTimer/index.js +0 -36
  64. package/src/main/conversation/ReactionType.d.ts +0 -4
  65. package/src/main/conversation/ReactionType.js +0 -27
  66. package/src/main/conversation/content/AssetContent.d.ts +0 -42
  67. package/src/main/conversation/content/AssetContent.js +0 -21
  68. package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +0 -2
  69. package/src/main/conversation/content/ButtonActionConfirmationContent.js +0 -21
  70. package/src/main/conversation/content/ButtonActionContent.d.ts +0 -2
  71. package/src/main/conversation/content/ButtonActionContent.js +0 -21
  72. package/src/main/conversation/content/CallingContent.d.ts +0 -1
  73. package/src/main/conversation/content/CallingContent.js +0 -21
  74. package/src/main/conversation/content/ClearedContent.d.ts +0 -2
  75. package/src/main/conversation/content/ClearedContent.js +0 -21
  76. package/src/main/conversation/content/ClientActionContent.d.ts +0 -2
  77. package/src/main/conversation/content/ClientActionContent.js +0 -21
  78. package/src/main/conversation/content/ClientAddContent.d.ts +0 -4
  79. package/src/main/conversation/content/ClientAddContent.js +0 -21
  80. package/src/main/conversation/content/ClientRemoveContent.d.ts +0 -6
  81. package/src/main/conversation/content/ClientRemoveContent.js +0 -21
  82. package/src/main/conversation/content/CompositeContent.d.ts +0 -2
  83. package/src/main/conversation/content/CompositeContent.js +0 -21
  84. package/src/main/conversation/content/ConfirmationContent.d.ts +0 -2
  85. package/src/main/conversation/content/ConfirmationContent.js +0 -21
  86. package/src/main/conversation/content/ContentType.d.ts +0 -21
  87. package/src/main/conversation/content/ContentType.js +0 -94
  88. package/src/main/conversation/content/ConversationContent.d.ts +0 -3
  89. package/src/main/conversation/content/ConversationContent.js +0 -21
  90. package/src/main/conversation/content/DeletedContent.d.ts +0 -2
  91. package/src/main/conversation/content/DeletedContent.js +0 -21
  92. package/src/main/conversation/content/EditedTextContent.d.ts +0 -11
  93. package/src/main/conversation/content/EditedTextContent.js +0 -21
  94. package/src/main/conversation/content/FileContent.d.ts +0 -13
  95. package/src/main/conversation/content/FileContent.js +0 -21
  96. package/src/main/conversation/content/HiddenContent.d.ts +0 -2
  97. package/src/main/conversation/content/HiddenContent.js +0 -21
  98. package/src/main/conversation/content/ImageContent.d.ts +0 -7
  99. package/src/main/conversation/content/ImageContent.js +0 -21
  100. package/src/main/conversation/content/KnockContent.d.ts +0 -2
  101. package/src/main/conversation/content/KnockContent.js +0 -21
  102. package/src/main/conversation/content/LinkPreviewContent.d.ts +0 -10
  103. package/src/main/conversation/content/LinkPreviewContent.js +0 -21
  104. package/src/main/conversation/content/LocationContent.d.ts +0 -9
  105. package/src/main/conversation/content/LocationContent.js +0 -21
  106. package/src/main/conversation/content/MentionContent.d.ts +0 -2
  107. package/src/main/conversation/content/MentionContent.js +0 -21
  108. package/src/main/conversation/content/QuoteContent.d.ts +0 -7
  109. package/src/main/conversation/content/QuoteContent.js +0 -21
  110. package/src/main/conversation/content/ReactionContent.d.ts +0 -7
  111. package/src/main/conversation/content/ReactionContent.js +0 -21
  112. package/src/main/conversation/content/TextContent.d.ts +0 -9
  113. package/src/main/conversation/content/TextContent.js +0 -21
  114. package/src/main/conversation/content/TweetContent.d.ts +0 -2
  115. package/src/main/conversation/content/TweetContent.js +0 -21
  116. package/src/main/conversation/content/index.d.ts +0 -28
  117. package/src/main/conversation/content/index.js +0 -76
  118. package/src/main/conversation/index.d.ts +0 -9
  119. package/src/main/conversation/index.js +0 -44
  120. package/src/main/conversation/message/CompositeContentBuilder.d.ts +0 -14
  121. package/src/main/conversation/message/CompositeContentBuilder.js +0 -54
  122. package/src/main/conversation/message/Message.d.ts +0 -4
  123. package/src/main/conversation/message/Message.js +0 -21
  124. package/src/main/conversation/message/MessageBuilder.d.ts +0 -96
  125. package/src/main/conversation/message/MessageBuilder.js +0 -125
  126. package/src/main/conversation/message/MessageService.d.ts +0 -67
  127. package/src/main/conversation/message/MessageService.js +0 -293
  128. package/src/main/conversation/message/MessageToProtoMapper.d.ts +0 -7
  129. package/src/main/conversation/message/MessageToProtoMapper.js +0 -99
  130. package/src/main/conversation/message/OtrMessage.d.ts +0 -80
  131. package/src/main/conversation/message/OtrMessage.js +0 -21
  132. package/src/main/conversation/message/PayloadBundle.d.ts +0 -76
  133. package/src/main/conversation/message/PayloadBundle.js +0 -81
  134. package/src/main/conversation/message/TeamMessage.d.ts +0 -31
  135. package/src/main/conversation/message/TeamMessage.js +0 -21
  136. package/src/main/conversation/message/TextContentBuilder.d.ts +0 -13
  137. package/src/main/conversation/message/TextContentBuilder.js +0 -75
  138. package/src/main/conversation/message/UserClientsUtil.d.ts +0 -22
  139. package/src/main/conversation/message/UserClientsUtil.js +0 -38
  140. package/src/main/conversation/message/UserMessage.d.ts +0 -43
  141. package/src/main/conversation/message/UserMessage.js +0 -21
  142. package/src/main/conversation/message/messageSender.d.ts +0 -4
  143. package/src/main/conversation/message/messageSender.js +0 -36
  144. package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +0 -11
  145. package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +0 -21
  146. package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +0 -2
  147. package/src/main/cryptography/AssetCryptography/crypto.browser.js +0 -46
  148. package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +0 -2
  149. package/src/main/cryptography/AssetCryptography/crypto.node.js +0 -72
  150. package/src/main/cryptography/AssetCryptography/index.d.ts +0 -8
  151. package/src/main/cryptography/AssetCryptography/index.js +0 -53
  152. package/src/main/cryptography/AssetCryptography/interfaces.d.ts +0 -9
  153. package/src/main/cryptography/AssetCryptography/interfaces.js +0 -21
  154. package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +0 -16
  155. package/src/main/cryptography/CryptographyDatabaseRepository.js +0 -44
  156. package/src/main/cryptography/CryptographyService.d.ts +0 -52
  157. package/src/main/cryptography/CryptographyService.js +0 -205
  158. package/src/main/cryptography/GenericMessageMapper.d.ts +0 -6
  159. package/src/main/cryptography/GenericMessageMapper.js +0 -160
  160. package/src/main/cryptography/MessageHashService.d.ts +0 -16
  161. package/src/main/cryptography/MessageHashService.js +0 -118
  162. package/src/main/cryptography/SessionPayloadBundle.d.ts +0 -4
  163. package/src/main/cryptography/SessionPayloadBundle.js +0 -21
  164. package/src/main/cryptography/index.d.ts +0 -4
  165. package/src/main/cryptography/index.js +0 -39
  166. package/src/main/giphy/GiphyService.d.ts +0 -9
  167. package/src/main/giphy/GiphyService.js +0 -37
  168. package/src/main/giphy/index.d.ts +0 -1
  169. package/src/main/giphy/index.js +0 -36
  170. package/src/main/index.d.ts +0 -17
  171. package/src/main/index.js +0 -59
  172. package/src/main/linkPreview/LinkPreviewService.d.ts +0 -7
  173. package/src/main/linkPreview/LinkPreviewService.js +0 -52
  174. package/src/main/linkPreview/index.d.ts +0 -1
  175. package/src/main/linkPreview/index.js +0 -36
  176. package/src/main/mls/MLSService/MLSService.d.ts +0 -39
  177. package/src/main/mls/MLSService/MLSService.js +0 -181
  178. package/src/main/mls/index.d.ts +0 -1
  179. package/src/main/mls/index.js +0 -36
  180. package/src/main/mls/keyMaterialUpdatesStore/index.d.ts +0 -1
  181. package/src/main/mls/keyMaterialUpdatesStore/index.js +0 -36
  182. package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +0 -9
  183. package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +0 -51
  184. package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.d.ts +0 -7
  185. package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.js +0 -42
  186. package/src/main/mls/types.d.ts +0 -33
  187. package/src/main/mls/types.js +0 -21
  188. package/src/main/notification/NotificationBackendRepository.d.ts +0 -11
  189. package/src/main/notification/NotificationBackendRepository.js +0 -34
  190. package/src/main/notification/NotificationDatabaseRepository.d.ts +0 -42
  191. package/src/main/notification/NotificationDatabaseRepository.js +0 -97
  192. package/src/main/notification/NotificationService.d.ts +0 -129
  193. package/src/main/notification/NotificationService.js +0 -501
  194. package/src/main/notification/index.d.ts +0 -1
  195. package/src/main/notification/index.js +0 -36
  196. package/src/main/notification/types.d.ts +0 -16
  197. package/src/main/notification/types.js +0 -21
  198. package/src/main/self/SelfService.d.ts +0 -13
  199. package/src/main/self/SelfService.js +0 -55
  200. package/src/main/self/index.d.ts +0 -1
  201. package/src/main/self/index.js +0 -36
  202. package/src/main/team/TeamService.d.ts +0 -15
  203. package/src/main/team/TeamService.js +0 -55
  204. package/src/main/team/index.d.ts +0 -1
  205. package/src/main/team/index.js +0 -36
  206. package/src/main/test/CryptographyHelper.d.ts +0 -4
  207. package/src/main/test/CryptographyHelper.js +0 -69
  208. package/src/main/test/PayloadHelper.d.ts +0 -3
  209. package/src/main/test/PayloadHelper.js +0 -66
  210. package/src/main/user/UserMapper.d.ts +0 -5
  211. package/src/main/user/UserMapper.js +0 -88
  212. package/src/main/user/UserService.d.ts +0 -25
  213. package/src/main/user/UserService.js +0 -81
  214. package/src/main/user/index.d.ts +0 -1
  215. package/src/main/user/index.js +0 -36
  216. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts +0 -21
  217. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +0 -62
  218. package/src/main/util/TaskScheduler/TaskScheduler.d.ts +0 -10
  219. package/src/main/util/TaskScheduler/TaskScheduler.js +0 -70
  220. package/src/main/util/TypePredicateUtil.d.ts +0 -7
  221. package/src/main/util/TypePredicateUtil.js +0 -55
  222. package/src/main/util/encryptedStore.d.ts +0 -45
  223. package/src/main/util/encryptedStore.js +0 -116
  224. package/src/main/util/fullyQualifiedClientIdUtils.d.ts +0 -13
  225. package/src/main/util/fullyQualifiedClientIdUtils.js +0 -42
  226. package/src/main/util/index.d.ts +0 -1
  227. package/src/main/util/index.js +0 -36
  228. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.d.ts +0 -8
  229. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.js +0 -32
package/package.json CHANGED
@@ -3,14 +3,14 @@
3
3
  "./src/main/cryptography/AssetCryptography/crypto.node": "./src/main/cryptography/AssetCryptography/crypto.browser.js"
4
4
  },
5
5
  "dependencies": {
6
- "@wireapp/api-client": "^20.5.0",
7
- "@wireapp/commons": "^4.4.0",
6
+ "@wireapp/api-client": "^20.5.3",
7
+ "@wireapp/commons": "^4.4.3",
8
8
  "@wireapp/core-crypto": "0.5.0",
9
9
  "@wireapp/cryptobox": "12.8.0",
10
- "@wireapp/promise-queue": "^1.2.0",
11
- "@wireapp/store-engine-dexie": "^1.7.0",
10
+ "@wireapp/promise-queue": "^1.2.3",
11
+ "@wireapp/store-engine-dexie": "^1.7.3",
12
12
  "axios": "^0.27.2",
13
- "bazinga64": "5.11.0",
13
+ "bazinga64": "5.11.3",
14
14
  "hash.js": "1.1.7",
15
15
  "http-status-codes": "2.1.4",
16
16
  "idb": "7.0.2",
@@ -81,6 +81,6 @@
81
81
  "test": "jest",
82
82
  "watch": "tsc ---watch"
83
83
  },
84
- "version": "31.1.1",
85
- "gitHead": "b95b3e1af8e527cceaa3f770c9c2b06c019d0cb9"
84
+ "version": "31.1.3",
85
+ "gitHead": "fd01ebbb32a4341a6b56590cd007bddc9d2d3229"
86
86
  }
@@ -1,214 +0,0 @@
1
- /// <reference types="node" />
2
- import { APIClient, BackendFeatures } from '@wireapp/api-client';
3
- import { RegisterData } from '@wireapp/api-client/src/auth';
4
- import { Context, Cookie, LoginData } from '@wireapp/api-client/src/auth/';
5
- import { ClientType, RegisteredClient } from '@wireapp/api-client/src/client/';
6
- import * as Events from '@wireapp/api-client/src/event';
7
- import { CRUDEngine } from '@wireapp/store-engine';
8
- import { EventEmitter } from 'events';
9
- import { BroadcastService } from './broadcast/';
10
- import { ClientInfo, ClientService } from './client/';
11
- import { ConnectionService } from './connection/';
12
- import { AssetService, ConversationService, PayloadBundleSource, PayloadBundleType } from './conversation/';
13
- import * as OtrMessage from './conversation/message/OtrMessage';
14
- import * as UserMessage from './conversation/message/UserMessage';
15
- import { CoreError } from './CoreError';
16
- import { CryptographyService } from './cryptography/';
17
- import { GiphyService } from './giphy/';
18
- import { HandledEventPayload, NotificationService } from './notification/';
19
- import { SelfService } from './self/';
20
- import { TeamService } from './team/';
21
- import { UserService } from './user/';
22
- import { AccountService } from './account/';
23
- import { LinkPreviewService } from './linkPreview';
24
- import { WEBSOCKET_STATE } from '@wireapp/api-client/src/tcp/ReconnectingWebsocket';
25
- import { MLSService } from './mls';
26
- import { MLSCallbacks, MLSConfig } from './mls/types';
27
- export declare type ProcessedEventPayload = HandledEventPayload;
28
- declare enum TOPIC {
29
- ERROR = "Account.TOPIC.ERROR"
30
- }
31
- export interface Account {
32
- on(event: PayloadBundleType.ASSET, listener: (payload: OtrMessage.FileAssetMessage | OtrMessage.ImageAssetMessage) => void): this;
33
- on(event: PayloadBundleType.BUTTON_ACTION, listener: (payload: OtrMessage.ButtonActionMessage) => void): this;
34
- on(event: PayloadBundleType.ASSET_ABORT, listener: (payload: OtrMessage.FileAssetAbortMessage) => void): this;
35
- on(event: PayloadBundleType.ASSET_IMAGE, listener: (payload: OtrMessage.ImageAssetMessage) => void): this;
36
- on(event: PayloadBundleType.ASSET_META, listener: (payload: OtrMessage.FileAssetMetaDataMessage) => void): this;
37
- on(event: PayloadBundleType.CALL, listener: (payload: OtrMessage.CallMessage) => void): this;
38
- on(event: PayloadBundleType.CLIENT_ACTION, listener: (payload: OtrMessage.ResetSessionMessage) => void): this;
39
- on(event: PayloadBundleType.CLIENT_ADD, listener: (payload: UserMessage.UserClientAddMessage) => void): this;
40
- on(event: PayloadBundleType.CLIENT_REMOVE, listener: (payload: UserMessage.UserClientRemoveMessage) => void): this;
41
- on(event: PayloadBundleType.CONFIRMATION, listener: (payload: OtrMessage.ConfirmationMessage) => void): this;
42
- on(event: PayloadBundleType.CONNECTION_REQUEST, listener: (payload: UserMessage.UserConnectionMessage) => void): this;
43
- on(event: PayloadBundleType.USER_UPDATE, listener: (payload: UserMessage.UserUpdateMessage) => void): this;
44
- on(event: PayloadBundleType.CONVERSATION_CLEAR, listener: (payload: OtrMessage.ClearConversationMessage) => void): this;
45
- on(event: PayloadBundleType.CONVERSATION_RENAME, listener: (payload: Events.ConversationRenameEvent) => void): this;
46
- on(event: PayloadBundleType.LOCATION, listener: (payload: OtrMessage.LocationMessage) => void): this;
47
- on(event: PayloadBundleType.MEMBER_JOIN, listener: (payload: Events.TeamMemberJoinEvent) => void): this;
48
- on(event: PayloadBundleType.MESSAGE_DELETE, listener: (payload: OtrMessage.DeleteMessage) => void): this;
49
- on(event: PayloadBundleType.MESSAGE_EDIT, listener: (payload: OtrMessage.EditedTextMessage) => void): this;
50
- on(event: PayloadBundleType.MESSAGE_HIDE, listener: (payload: OtrMessage.HideMessage) => void): this;
51
- on(event: PayloadBundleType.PING, listener: (payload: OtrMessage.PingMessage) => void): this;
52
- on(event: PayloadBundleType.REACTION, listener: (payload: OtrMessage.ReactionMessage) => void): this;
53
- on(event: PayloadBundleType.TEXT, listener: (payload: OtrMessage.TextMessage) => void): this;
54
- on(event: PayloadBundleType.TIMER_UPDATE, listener: (payload: Events.ConversationMessageTimerUpdateEvent) => void): this;
55
- on(event: PayloadBundleType.TYPING, listener: (payload: Events.ConversationTypingEvent) => void): this;
56
- on(event: PayloadBundleType.UNKNOWN, listener: (payload: any) => void): this;
57
- on(event: TOPIC.ERROR, listener: (payload: CoreError) => void): this;
58
- }
59
- export declare type CreateStoreFn = (storeName: string, context: Context) => undefined | Promise<CRUDEngine | undefined>;
60
- interface AccountOptions<T> {
61
- /** Used to store info in the database (will create a inMemory engine if returns undefined) */
62
- createStore?: CreateStoreFn;
63
- /** Number of prekeys to generate when creating a new device (defaults to 2)
64
- * Prekeys are Diffie-Hellmann public keys which allow offline initiation of a secure Proteus session between two devices.
65
- * Having a high value will:
66
- * - make creating a new device consuming more CPU resources
67
- * - make it less likely that all prekeys get consumed while the device is offline and the last resort prekey will not be used to create new session
68
- * Having a low value will:
69
- * - make creating a new device fast
70
- * - make it likely that all prekeys get consumed while the device is offline and the last resort prekey will be used to create new session
71
- */
72
- nbPrekeys?: number;
73
- /**
74
- * Config for MLS devices. Will not load corecrypt or create MLS devices if undefined
75
- */
76
- mlsConfig?: MLSConfig<T>;
77
- }
78
- export declare class Account<T = any> extends EventEmitter {
79
- private readonly apiClient;
80
- private readonly logger;
81
- private readonly createStore;
82
- private storeEngine?;
83
- private readonly nbPrekeys;
84
- private readonly mlsConfig?;
85
- private coreCryptoClient?;
86
- static readonly TOPIC: typeof TOPIC;
87
- service?: {
88
- mls: MLSService;
89
- account: AccountService;
90
- asset: AssetService;
91
- broadcast: BroadcastService;
92
- client: ClientService;
93
- connection: ConnectionService;
94
- conversation: ConversationService;
95
- cryptography: CryptographyService;
96
- giphy: GiphyService;
97
- linkPreview: LinkPreviewService;
98
- notification: NotificationService;
99
- self: SelfService;
100
- team: TeamService;
101
- user: UserService;
102
- };
103
- backendFeatures: BackendFeatures;
104
- /**
105
- * @param apiClient The apiClient instance to use in the core (will create a new new one if undefined)
106
- * @param accountOptions
107
- */
108
- constructor(apiClient?: APIClient, { createStore, nbPrekeys, mlsConfig }?: AccountOptions<T>);
109
- private persistCookie;
110
- get clientId(): string;
111
- get userId(): string;
112
- /**
113
- * Will register a new user to the backend
114
- *
115
- * @param registration The user's data
116
- * @param clientType Type of client to create (temporary or permanent)
117
- */
118
- register(registration: RegisterData, clientType: ClientType): Promise<Context>;
119
- /**
120
- * Will init the core with an aleady existing client (both on backend and local)
121
- * Will fail if local client cannot be found
122
- *
123
- * @param clientType The type of client the user is using (temporary or permanent)
124
- * @param cookie The cookie to identify the user against backend (will use the browser's one if not given)
125
- */
126
- init(clientType: ClientType, cookie?: Cookie, initClient?: boolean): Promise<Context>;
127
- /**
128
- * Will log the user in with the given credential.
129
- * Will also create the local client and store it in DB
130
- *
131
- * @param loginData The credentials of the user
132
- * @param initClient Should the call also create the local client
133
- * @param clientInfo Info about the client to create (name, type...)
134
- */
135
- login(loginData: LoginData, initClient?: boolean, clientInfo?: ClientInfo): Promise<Context>;
136
- /**
137
- * Will try to get the load the local client from local DB.
138
- * If clientInfo are provided, will also create the client on backend and DB
139
- * If clientInfo are not provideo, the method will fail if local client cannot be found
140
- *
141
- * @param loginData User's credentials
142
- * @param clientInfo Will allow creating the client if the local client cannot be found (else will fail if local client is not found)
143
- * @param entropyData Additional entropy data
144
- * @returns The local existing client or newly created client
145
- */
146
- initClient(loginData: LoginData, clientInfo?: ClientInfo, entropyData?: Uint8Array): Promise<{
147
- isNewClient: boolean;
148
- localClient: RegisteredClient;
149
- }>;
150
- /**
151
- * In order to be able to send MLS messages, the core needs a few information from the consumer.
152
- * Namely:
153
- * - is the current user allowed to administrate a specific conversation
154
- * - what is the groupId of a conversation
155
- * @param mlsCallbacks
156
- */
157
- configureMLSCallbacks(mlsCallbacks: MLSCallbacks): void;
158
- initServices(context: Context): Promise<void>;
159
- loadAndValidateLocalClient(entropyData?: Uint8Array): Promise<RegisteredClient>;
160
- private createMLSClient;
161
- private registerClient;
162
- private resetContext;
163
- /**
164
- * Will logout the current user
165
- * @param clearData if set to `true` will completely wipe any database that was created by the Account
166
- */
167
- logout(clearData?: boolean): Promise<void>;
168
- /**
169
- * Will download and handle the notification stream since last stored notification id.
170
- * Once the notification stream has been handled from backend, will then connect to the websocket and start listening to incoming events
171
- *
172
- * @param callbacks callbacks that will be called to handle different events
173
- * @returns close a function that will disconnect from the websocket
174
- */
175
- listen({ onEvent, onConnected, onConnectionStateChanged, onNotificationStreamProgress, onMissedNotifications, dryRun, }?: {
176
- /**
177
- * Called when a new event arrives from backend
178
- * @param payload the payload of the event. Contains the raw event received and the decrypted data (if event was encrypted)
179
- * @param source where the message comes from (either websocket or notification stream)
180
- */
181
- onEvent?: (payload: HandledEventPayload, source: PayloadBundleSource) => void;
182
- /**
183
- * During the notification stream processing, this function will be called whenever a new notification has been processed
184
- */
185
- onNotificationStreamProgress?: ({ done, total }: {
186
- done: number;
187
- total: number;
188
- }) => void;
189
- /**
190
- * called when the connection to the websocket is established and the notification stream has been processed
191
- */
192
- onConnected?: () => void;
193
- /**
194
- * called when the connection stateh with the backend has changed
195
- */
196
- onConnectionStateChanged?: (state: WEBSOCKET_STATE) => void;
197
- /**
198
- * called when we detect lost notification from backend.
199
- * When a client doesn't log in for a while (28 days, as of now) notifications that are older than 28 days will be deleted from backend.
200
- * If the client query the backend for the notifications since a particular notification ID and this ID doesn't exist anymore on the backend, we deduce that some messages were not sync before they were removed from backend.
201
- * We can then detect that something was wrong and warn the consumer that there might be some missing old messages
202
- * @param {string} notificationId
203
- */
204
- onMissedNotifications?: (notificationId: string) => void;
205
- /**
206
- * When set will not decrypt and not store the last notification ID. This is useful if you only want to subscribe to unencrypted backend events
207
- */
208
- dryRun?: boolean;
209
- }): Promise<() => void>;
210
- private generateDbName;
211
- private generateSecretsDbName;
212
- private initEngine;
213
- }
214
- export {};