@wireapp/core 30.4.1 → 30.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.json +3 -3
  3. package/src/main/Account.d.ts +0 -220
  4. package/src/main/Account.js +0 -435
  5. package/src/main/CoreError.d.ts +0 -9
  6. package/src/main/CoreError.js +0 -26
  7. package/src/main/account/AccountService.d.ts +0 -7
  8. package/src/main/account/AccountService.js +0 -33
  9. package/src/main/account/AccountService.js.map +0 -1
  10. package/src/main/account/index.d.ts +0 -1
  11. package/src/main/account/index.js +0 -32
  12. package/src/main/account/index.js.map +0 -1
  13. package/src/main/auth/LoginSanitizer.d.ts +0 -5
  14. package/src/main/auth/LoginSanitizer.js +0 -41
  15. package/src/main/auth/index.d.ts +0 -1
  16. package/src/main/auth/index.js +0 -32
  17. package/src/main/broadcast/AvailabilityType.d.ts +0 -2
  18. package/src/main/broadcast/AvailabilityType.js +0 -21
  19. package/src/main/broadcast/BroadcastService.d.ts +0 -24
  20. package/src/main/broadcast/BroadcastService.js +0 -74
  21. package/src/main/broadcast/index.d.ts +0 -2
  22. package/src/main/broadcast/index.js +0 -33
  23. package/src/main/client/ClientBackendRepository.d.ts +0 -11
  24. package/src/main/client/ClientBackendRepository.js +0 -43
  25. package/src/main/client/ClientDatabaseRepository.d.ts +0 -27
  26. package/src/main/client/ClientDatabaseRepository.js +0 -85
  27. package/src/main/client/ClientInfo.d.ts +0 -8
  28. package/src/main/client/ClientInfo.js +0 -21
  29. package/src/main/client/ClientService.d.ts +0 -48
  30. package/src/main/client/ClientService.js +0 -118
  31. package/src/main/client/index.d.ts +0 -4
  32. package/src/main/client/index.js +0 -35
  33. package/src/main/connection/ConnectionService.d.ts +0 -11
  34. package/src/main/connection/ConnectionService.js +0 -45
  35. package/src/main/connection/index.d.ts +0 -1
  36. package/src/main/connection/index.js +0 -32
  37. package/src/main/conversation/AbortReason.d.ts +0 -2
  38. package/src/main/conversation/AbortReason.js +0 -21
  39. package/src/main/conversation/AssetService/AssetService.d.ts +0 -62
  40. package/src/main/conversation/AssetService/AssetService.js +0 -88
  41. package/src/main/conversation/AssetService/index.d.ts +0 -1
  42. package/src/main/conversation/AssetService/index.js +0 -32
  43. package/src/main/conversation/AssetTransferState.d.ts +0 -4
  44. package/src/main/conversation/AssetTransferState.js +0 -27
  45. package/src/main/conversation/ClientActionType.d.ts +0 -1
  46. package/src/main/conversation/ClientActionType.js +0 -24
  47. package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +0 -6
  48. package/src/main/conversation/ConversationMapper/ConversationMapper.js +0 -57
  49. package/src/main/conversation/ConversationMapper/index.d.ts +0 -1
  50. package/src/main/conversation/ConversationMapper/index.js +0 -32
  51. package/src/main/conversation/ConversationService/ConversationService.d.ts +0 -164
  52. package/src/main/conversation/ConversationService/ConversationService.js +0 -951
  53. package/src/main/conversation/ConversationService/ConversationService.types.d.ts +0 -108
  54. package/src/main/conversation/ConversationService/ConversationService.types.js +0 -28
  55. package/src/main/conversation/ConversationService/index.d.ts +0 -2
  56. package/src/main/conversation/ConversationService/index.js +0 -33
  57. package/src/main/conversation/GenericMessageType.d.ts +0 -25
  58. package/src/main/conversation/GenericMessageType.js +0 -49
  59. package/src/main/conversation/MessageTimer/MessageTimer.d.ts +0 -10
  60. package/src/main/conversation/MessageTimer/MessageTimer.js +0 -54
  61. package/src/main/conversation/MessageTimer/index.d.ts +0 -1
  62. package/src/main/conversation/MessageTimer/index.js +0 -32
  63. package/src/main/conversation/ReactionType.d.ts +0 -4
  64. package/src/main/conversation/ReactionType.js +0 -27
  65. package/src/main/conversation/content/AssetContent.d.ts +0 -42
  66. package/src/main/conversation/content/AssetContent.js +0 -21
  67. package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +0 -2
  68. package/src/main/conversation/content/ButtonActionConfirmationContent.js +0 -21
  69. package/src/main/conversation/content/ButtonActionContent.d.ts +0 -2
  70. package/src/main/conversation/content/ButtonActionContent.js +0 -21
  71. package/src/main/conversation/content/CallingContent.d.ts +0 -1
  72. package/src/main/conversation/content/CallingContent.js +0 -21
  73. package/src/main/conversation/content/ClearedContent.d.ts +0 -2
  74. package/src/main/conversation/content/ClearedContent.js +0 -21
  75. package/src/main/conversation/content/ClientActionContent.d.ts +0 -2
  76. package/src/main/conversation/content/ClientActionContent.js +0 -21
  77. package/src/main/conversation/content/ClientAddContent.d.ts +0 -4
  78. package/src/main/conversation/content/ClientAddContent.js +0 -21
  79. package/src/main/conversation/content/ClientRemoveContent.d.ts +0 -6
  80. package/src/main/conversation/content/ClientRemoveContent.js +0 -21
  81. package/src/main/conversation/content/CompositeContent.d.ts +0 -2
  82. package/src/main/conversation/content/CompositeContent.js +0 -21
  83. package/src/main/conversation/content/ConfirmationContent.d.ts +0 -2
  84. package/src/main/conversation/content/ConfirmationContent.js +0 -21
  85. package/src/main/conversation/content/ContentType.d.ts +0 -21
  86. package/src/main/conversation/content/ContentType.js +0 -94
  87. package/src/main/conversation/content/ConversationContent.d.ts +0 -3
  88. package/src/main/conversation/content/ConversationContent.js +0 -21
  89. package/src/main/conversation/content/DeletedContent.d.ts +0 -2
  90. package/src/main/conversation/content/DeletedContent.js +0 -21
  91. package/src/main/conversation/content/EditedTextContent.d.ts +0 -11
  92. package/src/main/conversation/content/EditedTextContent.js +0 -21
  93. package/src/main/conversation/content/FileContent.d.ts +0 -13
  94. package/src/main/conversation/content/FileContent.js +0 -21
  95. package/src/main/conversation/content/HiddenContent.d.ts +0 -2
  96. package/src/main/conversation/content/HiddenContent.js +0 -21
  97. package/src/main/conversation/content/ImageContent.d.ts +0 -7
  98. package/src/main/conversation/content/ImageContent.js +0 -21
  99. package/src/main/conversation/content/KnockContent.d.ts +0 -2
  100. package/src/main/conversation/content/KnockContent.js +0 -21
  101. package/src/main/conversation/content/LinkPreviewContent.d.ts +0 -10
  102. package/src/main/conversation/content/LinkPreviewContent.js +0 -21
  103. package/src/main/conversation/content/LocationContent.d.ts +0 -9
  104. package/src/main/conversation/content/LocationContent.js +0 -21
  105. package/src/main/conversation/content/MentionContent.d.ts +0 -2
  106. package/src/main/conversation/content/MentionContent.js +0 -21
  107. package/src/main/conversation/content/QuoteContent.d.ts +0 -7
  108. package/src/main/conversation/content/QuoteContent.js +0 -21
  109. package/src/main/conversation/content/ReactionContent.d.ts +0 -7
  110. package/src/main/conversation/content/ReactionContent.js +0 -21
  111. package/src/main/conversation/content/TextContent.d.ts +0 -9
  112. package/src/main/conversation/content/TextContent.js +0 -21
  113. package/src/main/conversation/content/TweetContent.d.ts +0 -2
  114. package/src/main/conversation/content/TweetContent.js +0 -21
  115. package/src/main/conversation/content/index.d.ts +0 -28
  116. package/src/main/conversation/content/index.js +0 -72
  117. package/src/main/conversation/index.d.ts +0 -9
  118. package/src/main/conversation/index.js +0 -40
  119. package/src/main/conversation/message/CompositeContentBuilder.d.ts +0 -14
  120. package/src/main/conversation/message/CompositeContentBuilder.js +0 -54
  121. package/src/main/conversation/message/Message.d.ts +0 -4
  122. package/src/main/conversation/message/Message.js +0 -21
  123. package/src/main/conversation/message/MessageBuilder.d.ts +0 -87
  124. package/src/main/conversation/message/MessageBuilder.js +0 -119
  125. package/src/main/conversation/message/MessageService.d.ts +0 -67
  126. package/src/main/conversation/message/MessageService.js +0 -293
  127. package/src/main/conversation/message/MessageToProtoMapper.d.ts +0 -7
  128. package/src/main/conversation/message/MessageToProtoMapper.js +0 -99
  129. package/src/main/conversation/message/OtrMessage.d.ts +0 -80
  130. package/src/main/conversation/message/OtrMessage.js +0 -21
  131. package/src/main/conversation/message/PayloadBundle.d.ts +0 -76
  132. package/src/main/conversation/message/PayloadBundle.js +0 -81
  133. package/src/main/conversation/message/TeamMessage.d.ts +0 -31
  134. package/src/main/conversation/message/TeamMessage.js +0 -21
  135. package/src/main/conversation/message/TextContentBuilder.d.ts +0 -13
  136. package/src/main/conversation/message/TextContentBuilder.js +0 -75
  137. package/src/main/conversation/message/UserClientsUtil.d.ts +0 -22
  138. package/src/main/conversation/message/UserClientsUtil.js +0 -38
  139. package/src/main/conversation/message/UserMessage.d.ts +0 -43
  140. package/src/main/conversation/message/UserMessage.js +0 -21
  141. package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +0 -11
  142. package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +0 -21
  143. package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +0 -2
  144. package/src/main/cryptography/AssetCryptography/crypto.browser.js +0 -46
  145. package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +0 -2
  146. package/src/main/cryptography/AssetCryptography/crypto.node.js +0 -68
  147. package/src/main/cryptography/AssetCryptography/index.d.ts +0 -8
  148. package/src/main/cryptography/AssetCryptography/index.js +0 -53
  149. package/src/main/cryptography/AssetCryptography/interfaces.d.ts +0 -9
  150. package/src/main/cryptography/AssetCryptography/interfaces.js +0 -21
  151. package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +0 -16
  152. package/src/main/cryptography/CryptographyDatabaseRepository.js +0 -42
  153. package/src/main/cryptography/CryptographyService.d.ts +0 -52
  154. package/src/main/cryptography/CryptographyService.js +0 -205
  155. package/src/main/cryptography/GenericMessageMapper.d.ts +0 -6
  156. package/src/main/cryptography/GenericMessageMapper.js +0 -160
  157. package/src/main/cryptography/MessageHashService.d.ts +0 -16
  158. package/src/main/cryptography/MessageHashService.js +0 -114
  159. package/src/main/cryptography/SessionPayloadBundle.d.ts +0 -4
  160. package/src/main/cryptography/SessionPayloadBundle.js +0 -21
  161. package/src/main/cryptography/index.d.ts +0 -4
  162. package/src/main/cryptography/index.js +0 -35
  163. package/src/main/giphy/GiphyService.d.ts +0 -9
  164. package/src/main/giphy/GiphyService.js +0 -37
  165. package/src/main/giphy/index.d.ts +0 -1
  166. package/src/main/giphy/index.js +0 -32
  167. package/src/main/index.d.ts +0 -17
  168. package/src/main/index.js +0 -55
  169. package/src/main/linkPreview/LinkPreviewService.d.ts +0 -7
  170. package/src/main/linkPreview/LinkPreviewService.js +0 -52
  171. package/src/main/linkPreview/index.d.ts +0 -1
  172. package/src/main/linkPreview/index.js +0 -32
  173. package/src/main/notification/NotificationBackendRepository.d.ts +0 -11
  174. package/src/main/notification/NotificationBackendRepository.js +0 -34
  175. package/src/main/notification/NotificationDatabaseRepository.d.ts +0 -45
  176. package/src/main/notification/NotificationDatabaseRepository.js +0 -107
  177. package/src/main/notification/NotificationService.d.ts +0 -107
  178. package/src/main/notification/NotificationService.js +0 -411
  179. package/src/main/notification/index.d.ts +0 -1
  180. package/src/main/notification/index.js +0 -32
  181. package/src/main/notification/types.d.ts +0 -17
  182. package/src/main/notification/types.js +0 -21
  183. package/src/main/self/SelfService.d.ts +0 -13
  184. package/src/main/self/SelfService.js +0 -55
  185. package/src/main/self/index.d.ts +0 -1
  186. package/src/main/self/index.js +0 -32
  187. package/src/main/team/TeamService.d.ts +0 -15
  188. package/src/main/team/TeamService.js +0 -55
  189. package/src/main/team/index.d.ts +0 -1
  190. package/src/main/team/index.js +0 -32
  191. package/src/main/test/CryptographyHelper.d.ts +0 -4
  192. package/src/main/test/CryptographyHelper.js +0 -65
  193. package/src/main/test/PayloadHelper.d.ts +0 -3
  194. package/src/main/test/PayloadHelper.js +0 -66
  195. package/src/main/user/UserMapper.d.ts +0 -5
  196. package/src/main/user/UserMapper.js +0 -88
  197. package/src/main/user/UserService.d.ts +0 -25
  198. package/src/main/user/UserService.js +0 -81
  199. package/src/main/user/index.d.ts +0 -1
  200. package/src/main/user/index.js +0 -32
  201. package/src/main/util/TaskScheduler/TaskScheduler.d.ts +0 -10
  202. package/src/main/util/TaskScheduler/TaskScheduler.js +0 -70
  203. package/src/main/util/TypePredicateUtil.d.ts +0 -7
  204. package/src/main/util/TypePredicateUtil.js +0 -55
  205. package/src/main/util/encryptedStore.d.ts +0 -45
  206. package/src/main/util/encryptedStore.js +0 -116
  207. package/src/main/util/index.d.ts +0 -1
  208. package/src/main/util/index.js +0 -32
  209. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.d.ts +0 -8
  210. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.js +0 -32
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [30.5.2](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.5.1...@wireapp/core@30.5.2) (2022-09-12)
7
+
8
+ **Note:** Version bump only for package @wireapp/core
9
+
10
+
11
+
12
+
13
+
14
+ ## [30.5.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.5.0...@wireapp/core@30.5.1) (2022-09-12)
15
+
16
+ **Note:** Version bump only for package @wireapp/core
17
+
18
+
19
+
20
+
21
+
22
+ # [30.5.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.4.1...@wireapp/core@30.5.0) (2022-09-09)
23
+
24
+
25
+ ### Features
26
+
27
+ * **core:** update keys periodically (FS-562) ([#4374](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4374)) ([9b9d362](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/9b9d362bca320691fb15314cb1a3ef940a51892c))
28
+
29
+
30
+
31
+
32
+
6
33
  ## [30.4.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.4.0...@wireapp/core@30.4.1) (2022-09-08)
7
34
 
8
35
  **Note:** Version bump only for package @wireapp/core
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "@otak/core-crypto": "0.3.0-es2017",
8
8
  "@types/long": "4.0.1",
9
9
  "@types/node": "~14",
10
- "@wireapp/api-client": "20.2.1",
10
+ "@wireapp/api-client": "20.3.0",
11
11
  "@wireapp/commons": "4.3.0",
12
12
  "@wireapp/cryptobox": "12.8.0",
13
13
  "@wireapp/store-engine-dexie": "1.6.10",
@@ -77,6 +77,6 @@
77
77
  "test:node": "nyc jasmine --config=jasmine.json",
78
78
  "watch": "tsc ---watch"
79
79
  },
80
- "version": "30.4.1",
81
- "gitHead": "4cc5f40299b0b8fb593f169073c5c6740a2939f1"
80
+ "version": "30.5.2",
81
+ "gitHead": "12f1b177ec3b46fcbfcba4e615cb63542cf99167"
82
82
  }
@@ -1,220 +0,0 @@
1
- /// <reference types="node" />
2
- import { APIClient, BackendFeatures } from '@wireapp/api-client';
3
- import type { 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 type { 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
- export declare type ProcessedEventPayload = HandledEventPayload;
26
- declare enum TOPIC {
27
- ERROR = "Account.TOPIC.ERROR"
28
- }
29
- export interface Account {
30
- on(event: PayloadBundleType.ASSET, listener: (payload: OtrMessage.FileAssetMessage | OtrMessage.ImageAssetMessage) => void): this;
31
- on(event: PayloadBundleType.BUTTON_ACTION, listener: (payload: OtrMessage.ButtonActionMessage) => void): this;
32
- on(event: PayloadBundleType.ASSET_ABORT, listener: (payload: OtrMessage.FileAssetAbortMessage) => void): this;
33
- on(event: PayloadBundleType.ASSET_IMAGE, listener: (payload: OtrMessage.ImageAssetMessage) => void): this;
34
- on(event: PayloadBundleType.ASSET_META, listener: (payload: OtrMessage.FileAssetMetaDataMessage) => void): this;
35
- on(event: PayloadBundleType.CALL, listener: (payload: OtrMessage.CallMessage) => void): this;
36
- on(event: PayloadBundleType.CLIENT_ACTION, listener: (payload: OtrMessage.ResetSessionMessage) => void): this;
37
- on(event: PayloadBundleType.CLIENT_ADD, listener: (payload: UserMessage.UserClientAddMessage) => void): this;
38
- on(event: PayloadBundleType.CLIENT_REMOVE, listener: (payload: UserMessage.UserClientRemoveMessage) => void): this;
39
- on(event: PayloadBundleType.CONFIRMATION, listener: (payload: OtrMessage.ConfirmationMessage) => void): this;
40
- on(event: PayloadBundleType.CONNECTION_REQUEST, listener: (payload: UserMessage.UserConnectionMessage) => void): this;
41
- on(event: PayloadBundleType.USER_UPDATE, listener: (payload: UserMessage.UserUpdateMessage) => void): this;
42
- on(event: PayloadBundleType.CONVERSATION_CLEAR, listener: (payload: OtrMessage.ClearConversationMessage) => void): this;
43
- on(event: PayloadBundleType.CONVERSATION_RENAME, listener: (payload: Events.ConversationRenameEvent) => void): this;
44
- on(event: PayloadBundleType.LOCATION, listener: (payload: OtrMessage.LocationMessage) => void): this;
45
- on(event: PayloadBundleType.MEMBER_JOIN, listener: (payload: Events.TeamMemberJoinEvent) => void): this;
46
- on(event: PayloadBundleType.MESSAGE_DELETE, listener: (payload: OtrMessage.DeleteMessage) => void): this;
47
- on(event: PayloadBundleType.MESSAGE_EDIT, listener: (payload: OtrMessage.EditedTextMessage) => void): this;
48
- on(event: PayloadBundleType.MESSAGE_HIDE, listener: (payload: OtrMessage.HideMessage) => void): this;
49
- on(event: PayloadBundleType.PING, listener: (payload: OtrMessage.PingMessage) => void): this;
50
- on(event: PayloadBundleType.REACTION, listener: (payload: OtrMessage.ReactionMessage) => void): this;
51
- on(event: PayloadBundleType.TEXT, listener: (payload: OtrMessage.TextMessage) => void): this;
52
- on(event: PayloadBundleType.TIMER_UPDATE, listener: (payload: Events.ConversationMessageTimerUpdateEvent) => void): this;
53
- on(event: PayloadBundleType.TYPING, listener: (payload: Events.ConversationTypingEvent) => void): this;
54
- on(event: PayloadBundleType.UNKNOWN, listener: (payload: any) => void): this;
55
- on(event: TOPIC.ERROR, listener: (payload: CoreError) => void): this;
56
- }
57
- export declare type CreateStoreFn = (storeName: string, context: Context) => undefined | Promise<CRUDEngine | undefined>;
58
- declare type SecretCrypto<T> = {
59
- encrypt: (value: Uint8Array) => Promise<T>;
60
- decrypt: (payload: T) => Promise<Uint8Array>;
61
- };
62
- interface MLSConfig<T = any> {
63
- /**
64
- * encrypt/decrypt function pair that will be called before storing/fetching secrets in the secrets database.
65
- * If not provided will use the built in encryption mechanism
66
- */
67
- secretsCrypto?: SecretCrypto<T>;
68
- /**
69
- * path on the public server to the core crypto wasm file.
70
- * This file will be downloaded lazily when corecrypto is needed.
71
- * It, thus, needs to know where, on the server, the file can be found
72
- */
73
- coreCrypoWasmFilePath: string;
74
- }
75
- interface AccountOptions<T> {
76
- /** Used to store info in the database (will create a inMemory engine if returns undefined) */
77
- createStore?: CreateStoreFn;
78
- /** Number of prekeys to generate when creating a new device (defaults to 2)
79
- * Prekeys are Diffie-Hellmann public keys which allow offline initiation of a secure Proteus session between two devices.
80
- * Having a high value will:
81
- * - make creating a new device consuming more CPU resources
82
- * - 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
83
- * Having a low value will:
84
- * - make creating a new device fast
85
- * - 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
86
- */
87
- nbPrekeys?: number;
88
- /**
89
- * Config for MLS devices. Will not load corecrypt or create MLS devices if undefined
90
- */
91
- mlsConfig?: MLSConfig<T>;
92
- }
93
- export declare class Account<T = any> extends EventEmitter {
94
- private readonly apiClient;
95
- private readonly logger;
96
- private readonly createStore;
97
- private storeEngine?;
98
- private readonly nbPrekeys;
99
- private readonly mlsConfig?;
100
- private coreCryptoClient?;
101
- static readonly TOPIC: typeof TOPIC;
102
- service?: {
103
- account: AccountService;
104
- asset: AssetService;
105
- broadcast: BroadcastService;
106
- client: ClientService;
107
- connection: ConnectionService;
108
- conversation: ConversationService;
109
- cryptography: CryptographyService;
110
- giphy: GiphyService;
111
- linkPreview: LinkPreviewService;
112
- notification: NotificationService;
113
- self: SelfService;
114
- team: TeamService;
115
- user: UserService;
116
- };
117
- backendFeatures: BackendFeatures;
118
- /**
119
- * @param apiClient The apiClient instance to use in the core (will create a new new one if undefined)
120
- * @param accountOptions
121
- */
122
- constructor(apiClient?: APIClient, { createStore, nbPrekeys, mlsConfig }?: AccountOptions<T>);
123
- private persistCookie;
124
- get clientId(): string;
125
- get userId(): string;
126
- /**
127
- * Will register a new user to the backend
128
- *
129
- * @param registration The user's data
130
- * @param clientType Type of client to create (temporary or permanent)
131
- */
132
- register(registration: RegisterData, clientType: ClientType): Promise<Context>;
133
- /**
134
- * Will init the core with an aleady existing client (both on backend and local)
135
- * Will fail if local client cannot be found
136
- *
137
- * @param clientType The type of client the user is using (temporary or permanent)
138
- * @param cookie The cookie to identify the user against backend (will use the browser's one if not given)
139
- */
140
- init(clientType: ClientType, cookie?: Cookie, initClient?: boolean): Promise<Context>;
141
- /**
142
- * Will log the user in with the given credential.
143
- * Will also create the local client and store it in DB
144
- *
145
- * @param loginData The credentials of the user
146
- * @param initClient Should the call also create the local client
147
- * @param clientInfo Info about the client to create (name, type...)
148
- */
149
- login(loginData: LoginData, initClient?: boolean, clientInfo?: ClientInfo): Promise<Context>;
150
- /**
151
- * Will try to get the load the local client from local DB.
152
- * If clientInfo are provided, will also create the client on backend and DB
153
- * If clientInfo are not provideo, the method will fail if local client cannot be found
154
- *
155
- * @param loginData User's credentials
156
- * @param clientInfo Will allow creating the client if the local client cannot be found (else will fail if local client is not found)
157
- * @param entropyData Additional entropy data
158
- * @returns The local existing client or newly created client
159
- */
160
- initClient(loginData: LoginData, clientInfo?: ClientInfo, entropyData?: Uint8Array): Promise<{
161
- isNewClient: boolean;
162
- localClient: RegisteredClient;
163
- }>;
164
- initServices(context: Context): Promise<void>;
165
- loadAndValidateLocalClient(entropyData?: Uint8Array): Promise<RegisteredClient>;
166
- private createMLSClient;
167
- private registerClient;
168
- private resetContext;
169
- /**
170
- * Will logout the current user
171
- * @param clearData if set to `true` will completely wipe any database that was created by the Account
172
- */
173
- logout(clearData?: boolean): Promise<void>;
174
- /**
175
- * Will download and handle the notification stream since last stored notification id.
176
- * Once the notification stream has been handled from backend, will then connect to the websocket and start listening to incoming events
177
- *
178
- * @param callbacks callbacks that will be called to handle different events
179
- * @returns close a function that will disconnect from the websocket
180
- */
181
- listen({ onEvent, onConnected, onConnectionStateChanged, onNotificationStreamProgress, onMissedNotifications, dryRun, }?: {
182
- /**
183
- * Called when a new event arrives from backend
184
- * @param payload the payload of the event. Contains the raw event received and the decrypted data (if event was encrypted)
185
- * @param source where the message comes from (either websocket or notification stream)
186
- */
187
- onEvent?: (payload: HandledEventPayload, source: PayloadBundleSource) => void;
188
- /**
189
- * During the notification stream processing, this function will be called whenever a new notification has been processed
190
- */
191
- onNotificationStreamProgress?: ({ done, total }: {
192
- done: number;
193
- total: number;
194
- }) => void;
195
- /**
196
- * called when the connection to the websocket is established and the notification stream has been processed
197
- */
198
- onConnected?: () => void;
199
- /**
200
- * called when the connection stateh with the backend has changed
201
- */
202
- onConnectionStateChanged?: (state: WEBSOCKET_STATE) => void;
203
- /**
204
- * called when we detect lost notification from backend.
205
- * 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.
206
- * 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.
207
- * We can then detect that something was wrong and warn the consumer that there might be some missing old messages
208
- * @param {string} notificationId
209
- */
210
- onMissedNotifications?: (notificationId: string) => void;
211
- /**
212
- * 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
213
- */
214
- dryRun?: boolean;
215
- }): Promise<() => void>;
216
- private generateDbName;
217
- private generateSecretsDbName;
218
- private initEngine;
219
- }
220
- export {};