@unwanted/matrix-sdk-mini 34.12.0-2 → 34.12.0-3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (467) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/global.d.js +0 -2
  3. package/lib/@types/global.d.js.map +1 -1
  4. package/lib/browser-index.d.ts.map +1 -1
  5. package/lib/browser-index.js +0 -11
  6. package/lib/browser-index.js.map +1 -1
  7. package/lib/client.d.ts +2 -1176
  8. package/lib/client.d.ts.map +1 -1
  9. package/lib/client.js +346 -2717
  10. package/lib/client.js.map +1 -1
  11. package/lib/embedded.d.ts +0 -22
  12. package/lib/embedded.d.ts.map +1 -1
  13. package/lib/embedded.js +24 -166
  14. package/lib/embedded.js.map +1 -1
  15. package/lib/event-mapper.d.ts.map +1 -1
  16. package/lib/event-mapper.js +0 -4
  17. package/lib/event-mapper.js.map +1 -1
  18. package/lib/matrix.d.ts +0 -19
  19. package/lib/matrix.d.ts.map +1 -1
  20. package/lib/matrix.js +1 -26
  21. package/lib/matrix.js.map +1 -1
  22. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  23. package/lib/models/MSC3089Branch.js +0 -3
  24. package/lib/models/MSC3089Branch.js.map +1 -1
  25. package/lib/models/event.d.ts +0 -94
  26. package/lib/models/event.d.ts.map +1 -1
  27. package/lib/models/event.js +0 -274
  28. package/lib/models/event.js.map +1 -1
  29. package/lib/models/poll.d.ts.map +1 -1
  30. package/lib/models/poll.js +1 -5
  31. package/lib/models/poll.js.map +1 -1
  32. package/lib/models/relations-container.d.ts.map +1 -1
  33. package/lib/models/relations-container.js +1 -7
  34. package/lib/models/relations-container.js.map +1 -1
  35. package/lib/models/relations.d.ts +0 -1
  36. package/lib/models/relations.d.ts.map +1 -1
  37. package/lib/models/relations.js +0 -8
  38. package/lib/models/relations.js.map +1 -1
  39. package/lib/models/room-state.d.ts.map +1 -1
  40. package/lib/models/room-state.js +10 -26
  41. package/lib/models/room-state.js.map +1 -1
  42. package/lib/models/room.d.ts +0 -18
  43. package/lib/models/room.d.ts.map +1 -1
  44. package/lib/models/room.js +94 -148
  45. package/lib/models/room.js.map +1 -1
  46. package/lib/models/thread.d.ts.map +1 -1
  47. package/lib/models/thread.js +0 -1
  48. package/lib/models/thread.js.map +1 -1
  49. package/lib/sliding-sync-sdk.d.ts +2 -3
  50. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  51. package/lib/sliding-sync-sdk.js +41 -90
  52. package/lib/sliding-sync-sdk.js.map +1 -1
  53. package/lib/sync.d.ts +0 -12
  54. package/lib/sync.d.ts.map +1 -1
  55. package/lib/sync.js +1 -73
  56. package/lib/sync.js.map +1 -1
  57. package/lib/testing.d.ts +0 -48
  58. package/lib/testing.d.ts.map +1 -1
  59. package/lib/testing.js +0 -105
  60. package/lib/testing.js.map +1 -1
  61. package/package.json +1 -3
  62. package/src/@types/global.d.ts +0 -3
  63. package/src/browser-index.ts +0 -11
  64. package/src/client.ts +57 -2732
  65. package/src/embedded.ts +3 -130
  66. package/src/event-mapper.ts +0 -4
  67. package/src/matrix.ts +0 -28
  68. package/src/models/MSC3089Branch.ts +0 -3
  69. package/src/models/event.ts +0 -289
  70. package/src/models/poll.ts +0 -6
  71. package/src/models/relations-container.ts +1 -8
  72. package/src/models/relations.ts +0 -8
  73. package/src/models/room-state.ts +2 -8
  74. package/src/models/room.ts +0 -62
  75. package/src/models/thread.ts +0 -1
  76. package/src/sliding-sync-sdk.ts +2 -72
  77. package/src/sync.ts +1 -98
  78. package/src/testing.ts +0 -108
  79. package/lib/@types/crypto.d.ts +0 -47
  80. package/lib/@types/crypto.d.ts.map +0 -1
  81. package/lib/@types/crypto.js +0 -1
  82. package/lib/@types/crypto.js.map +0 -1
  83. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  84. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  85. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  86. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  87. package/lib/common-crypto/CryptoBackend.js +0 -73
  88. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  89. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  90. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  91. package/lib/common-crypto/key-passphrase.js +0 -33
  92. package/lib/common-crypto/key-passphrase.js.map +0 -1
  93. package/lib/crypto/CrossSigning.d.ts +0 -184
  94. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  95. package/lib/crypto/CrossSigning.js +0 -718
  96. package/lib/crypto/CrossSigning.js.map +0 -1
  97. package/lib/crypto/DeviceList.d.ts +0 -216
  98. package/lib/crypto/DeviceList.d.ts.map +0 -1
  99. package/lib/crypto/DeviceList.js +0 -892
  100. package/lib/crypto/DeviceList.js.map +0 -1
  101. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  102. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  103. package/lib/crypto/EncryptionSetup.js +0 -356
  104. package/lib/crypto/EncryptionSetup.js.map +0 -1
  105. package/lib/crypto/OlmDevice.d.ts +0 -457
  106. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  107. package/lib/crypto/OlmDevice.js +0 -1241
  108. package/lib/crypto/OlmDevice.js.map +0 -1
  109. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  110. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  111. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  112. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  113. package/lib/crypto/RoomList.d.ts +0 -26
  114. package/lib/crypto/RoomList.d.ts.map +0 -1
  115. package/lib/crypto/RoomList.js +0 -71
  116. package/lib/crypto/RoomList.js.map +0 -1
  117. package/lib/crypto/SecretSharing.d.ts +0 -24
  118. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  119. package/lib/crypto/SecretSharing.js +0 -194
  120. package/lib/crypto/SecretSharing.js.map +0 -1
  121. package/lib/crypto/SecretStorage.d.ts +0 -55
  122. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  123. package/lib/crypto/SecretStorage.js +0 -118
  124. package/lib/crypto/SecretStorage.js.map +0 -1
  125. package/lib/crypto/aes.d.ts +0 -6
  126. package/lib/crypto/aes.d.ts.map +0 -1
  127. package/lib/crypto/aes.js +0 -24
  128. package/lib/crypto/aes.js.map +0 -1
  129. package/lib/crypto/algorithms/base.d.ts +0 -156
  130. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  131. package/lib/crypto/algorithms/base.js +0 -187
  132. package/lib/crypto/algorithms/base.js.map +0 -1
  133. package/lib/crypto/algorithms/index.d.ts +0 -4
  134. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  135. package/lib/crypto/algorithms/index.js +0 -20
  136. package/lib/crypto/algorithms/index.js.map +0 -1
  137. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  138. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  139. package/lib/crypto/algorithms/megolm.js +0 -1822
  140. package/lib/crypto/algorithms/megolm.js.map +0 -1
  141. package/lib/crypto/algorithms/olm.d.ts +0 -5
  142. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  143. package/lib/crypto/algorithms/olm.js +0 -299
  144. package/lib/crypto/algorithms/olm.js.map +0 -1
  145. package/lib/crypto/api.d.ts +0 -32
  146. package/lib/crypto/api.d.ts.map +0 -1
  147. package/lib/crypto/api.js +0 -22
  148. package/lib/crypto/api.js.map +0 -1
  149. package/lib/crypto/backup.d.ts +0 -227
  150. package/lib/crypto/backup.d.ts.map +0 -1
  151. package/lib/crypto/backup.js +0 -824
  152. package/lib/crypto/backup.js.map +0 -1
  153. package/lib/crypto/crypto.d.ts +0 -3
  154. package/lib/crypto/crypto.d.ts.map +0 -1
  155. package/lib/crypto/crypto.js +0 -19
  156. package/lib/crypto/crypto.js.map +0 -1
  157. package/lib/crypto/dehydration.d.ts +0 -34
  158. package/lib/crypto/dehydration.d.ts.map +0 -1
  159. package/lib/crypto/dehydration.js +0 -252
  160. package/lib/crypto/dehydration.js.map +0 -1
  161. package/lib/crypto/device-converter.d.ts +0 -9
  162. package/lib/crypto/device-converter.d.ts.map +0 -1
  163. package/lib/crypto/device-converter.js +0 -42
  164. package/lib/crypto/device-converter.js.map +0 -1
  165. package/lib/crypto/deviceinfo.d.ts +0 -99
  166. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  167. package/lib/crypto/deviceinfo.js +0 -148
  168. package/lib/crypto/deviceinfo.js.map +0 -1
  169. package/lib/crypto/index.d.ts +0 -1209
  170. package/lib/crypto/index.d.ts.map +0 -1
  171. package/lib/crypto/index.js +0 -4097
  172. package/lib/crypto/index.js.map +0 -1
  173. package/lib/crypto/key_passphrase.d.ts +0 -14
  174. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  175. package/lib/crypto/key_passphrase.js +0 -44
  176. package/lib/crypto/key_passphrase.js.map +0 -1
  177. package/lib/crypto/keybackup.d.ts +0 -18
  178. package/lib/crypto/keybackup.d.ts.map +0 -1
  179. package/lib/crypto/keybackup.js +0 -1
  180. package/lib/crypto/keybackup.js.map +0 -1
  181. package/lib/crypto/olmlib.d.ts +0 -129
  182. package/lib/crypto/olmlib.d.ts.map +0 -1
  183. package/lib/crypto/olmlib.js +0 -492
  184. package/lib/crypto/olmlib.js.map +0 -1
  185. package/lib/crypto/recoverykey.d.ts +0 -2
  186. package/lib/crypto/recoverykey.d.ts.map +0 -1
  187. package/lib/crypto/recoverykey.js +0 -19
  188. package/lib/crypto/recoverykey.js.map +0 -1
  189. package/lib/crypto/store/base.d.ts +0 -252
  190. package/lib/crypto/store/base.d.ts.map +0 -1
  191. package/lib/crypto/store/base.js +0 -64
  192. package/lib/crypto/store/base.js.map +0 -1
  193. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  194. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  195. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  196. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  197. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  198. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  199. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  200. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  201. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  202. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  203. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  204. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  205. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  206. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  207. package/lib/crypto/store/memory-crypto-store.js +0 -622
  208. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  209. package/lib/crypto/verification/Base.d.ts +0 -105
  210. package/lib/crypto/verification/Base.d.ts.map +0 -1
  211. package/lib/crypto/verification/Base.js +0 -372
  212. package/lib/crypto/verification/Base.js.map +0 -1
  213. package/lib/crypto/verification/Error.d.ts +0 -35
  214. package/lib/crypto/verification/Error.d.ts.map +0 -1
  215. package/lib/crypto/verification/Error.js +0 -86
  216. package/lib/crypto/verification/Error.js.map +0 -1
  217. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  218. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  219. package/lib/crypto/verification/IllegalMethod.js +0 -43
  220. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  221. package/lib/crypto/verification/QRCode.d.ts +0 -51
  222. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  223. package/lib/crypto/verification/QRCode.js +0 -277
  224. package/lib/crypto/verification/QRCode.js.map +0 -1
  225. package/lib/crypto/verification/SAS.d.ts +0 -27
  226. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  227. package/lib/crypto/verification/SAS.js +0 -485
  228. package/lib/crypto/verification/SAS.js.map +0 -1
  229. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  230. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  231. package/lib/crypto/verification/SASDecimal.js +0 -34
  232. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  233. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  234. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  235. package/lib/crypto/verification/request/Channel.js +0 -1
  236. package/lib/crypto/verification/request/Channel.js.map +0 -1
  237. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  238. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  239. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  240. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  241. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  242. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  243. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  244. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  245. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  246. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  247. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  248. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  249. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  250. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  251. package/lib/crypto-api/CryptoEvent.js +0 -33
  252. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  253. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  254. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  255. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  256. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  257. package/lib/crypto-api/index.d.ts +0 -978
  258. package/lib/crypto-api/index.d.ts.map +0 -1
  259. package/lib/crypto-api/index.js +0 -304
  260. package/lib/crypto-api/index.js.map +0 -1
  261. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  262. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  263. package/lib/crypto-api/key-passphrase.js +0 -51
  264. package/lib/crypto-api/key-passphrase.js.map +0 -1
  265. package/lib/crypto-api/keybackup.d.ts +0 -88
  266. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  267. package/lib/crypto-api/keybackup.js +0 -1
  268. package/lib/crypto-api/keybackup.js.map +0 -1
  269. package/lib/crypto-api/recovery-key.d.ts +0 -11
  270. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  271. package/lib/crypto-api/recovery-key.js +0 -65
  272. package/lib/crypto-api/recovery-key.js.map +0 -1
  273. package/lib/crypto-api/verification.d.ts +0 -344
  274. package/lib/crypto-api/verification.d.ts.map +0 -1
  275. package/lib/crypto-api/verification.js +0 -91
  276. package/lib/crypto-api/verification.js.map +0 -1
  277. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  278. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  279. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  280. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  281. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  282. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  283. package/lib/rendezvous/RendezvousChannel.js +0 -1
  284. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  285. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  286. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  287. package/lib/rendezvous/RendezvousCode.js +0 -1
  288. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  289. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  290. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  291. package/lib/rendezvous/RendezvousError.js +0 -23
  292. package/lib/rendezvous/RendezvousError.js.map +0 -1
  293. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  294. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  295. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  296. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  297. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  298. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  299. package/lib/rendezvous/RendezvousIntent.js +0 -22
  300. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  301. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  302. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  303. package/lib/rendezvous/RendezvousTransport.js +0 -1
  304. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  305. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  306. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  307. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  308. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  309. package/lib/rendezvous/channels/index.d.ts +0 -2
  310. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  311. package/lib/rendezvous/channels/index.js +0 -18
  312. package/lib/rendezvous/channels/index.js.map +0 -1
  313. package/lib/rendezvous/index.d.ts +0 -10
  314. package/lib/rendezvous/index.d.ts.map +0 -1
  315. package/lib/rendezvous/index.js +0 -23
  316. package/lib/rendezvous/index.js.map +0 -1
  317. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  318. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  319. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  320. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  321. package/lib/rendezvous/transports/index.d.ts +0 -2
  322. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  323. package/lib/rendezvous/transports/index.js +0 -18
  324. package/lib/rendezvous/transports/index.js.map +0 -1
  325. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  326. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  327. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  328. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  329. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  330. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  331. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  332. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  333. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  334. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  335. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  336. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  337. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  338. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  339. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  340. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  341. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  342. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  343. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  344. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  345. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  346. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  347. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  348. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  349. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  350. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  351. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  352. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  353. package/lib/rust-crypto/backup.d.ts +0 -254
  354. package/lib/rust-crypto/backup.d.ts.map +0 -1
  355. package/lib/rust-crypto/backup.js +0 -837
  356. package/lib/rust-crypto/backup.js.map +0 -1
  357. package/lib/rust-crypto/constants.d.ts +0 -3
  358. package/lib/rust-crypto/constants.d.ts.map +0 -1
  359. package/lib/rust-crypto/constants.js +0 -19
  360. package/lib/rust-crypto/constants.js.map +0 -1
  361. package/lib/rust-crypto/device-converter.d.ts +0 -28
  362. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  363. package/lib/rust-crypto/device-converter.js +0 -123
  364. package/lib/rust-crypto/device-converter.js.map +0 -1
  365. package/lib/rust-crypto/index.d.ts +0 -61
  366. package/lib/rust-crypto/index.d.ts.map +0 -1
  367. package/lib/rust-crypto/index.js +0 -152
  368. package/lib/rust-crypto/index.js.map +0 -1
  369. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  370. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  371. package/lib/rust-crypto/libolm_migration.js +0 -459
  372. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  373. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  374. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  375. package/lib/rust-crypto/rust-crypto.js +0 -2016
  376. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  377. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  378. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  379. package/lib/rust-crypto/secret-storage.js +0 -63
  380. package/lib/rust-crypto/secret-storage.js.map +0 -1
  381. package/lib/rust-crypto/verification.d.ts +0 -319
  382. package/lib/rust-crypto/verification.d.ts.map +0 -1
  383. package/lib/rust-crypto/verification.js +0 -816
  384. package/lib/rust-crypto/verification.js.map +0 -1
  385. package/lib/secret-storage.d.ts +0 -370
  386. package/lib/secret-storage.d.ts.map +0 -1
  387. package/lib/secret-storage.js +0 -466
  388. package/lib/secret-storage.js.map +0 -1
  389. package/src/@types/crypto.ts +0 -73
  390. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  391. package/src/common-crypto/CryptoBackend.ts +0 -302
  392. package/src/common-crypto/README.md +0 -4
  393. package/src/common-crypto/key-passphrase.ts +0 -43
  394. package/src/crypto/CrossSigning.ts +0 -773
  395. package/src/crypto/DeviceList.ts +0 -989
  396. package/src/crypto/EncryptionSetup.ts +0 -351
  397. package/src/crypto/OlmDevice.ts +0 -1500
  398. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  399. package/src/crypto/RoomList.ts +0 -70
  400. package/src/crypto/SecretSharing.ts +0 -240
  401. package/src/crypto/SecretStorage.ts +0 -136
  402. package/src/crypto/aes.ts +0 -23
  403. package/src/crypto/algorithms/base.ts +0 -236
  404. package/src/crypto/algorithms/index.ts +0 -20
  405. package/src/crypto/algorithms/megolm.ts +0 -2216
  406. package/src/crypto/algorithms/olm.ts +0 -381
  407. package/src/crypto/api.ts +0 -70
  408. package/src/crypto/backup.ts +0 -922
  409. package/src/crypto/crypto.ts +0 -18
  410. package/src/crypto/dehydration.ts +0 -272
  411. package/src/crypto/device-converter.ts +0 -45
  412. package/src/crypto/deviceinfo.ts +0 -158
  413. package/src/crypto/index.ts +0 -4414
  414. package/src/crypto/key_passphrase.ts +0 -42
  415. package/src/crypto/keybackup.ts +0 -47
  416. package/src/crypto/olmlib.ts +0 -539
  417. package/src/crypto/recoverykey.ts +0 -18
  418. package/src/crypto/store/base.ts +0 -348
  419. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  420. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  421. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  422. package/src/crypto/store/memory-crypto-store.ts +0 -680
  423. package/src/crypto/verification/Base.ts +0 -409
  424. package/src/crypto/verification/Error.ts +0 -76
  425. package/src/crypto/verification/IllegalMethod.ts +0 -50
  426. package/src/crypto/verification/QRCode.ts +0 -310
  427. package/src/crypto/verification/SAS.ts +0 -494
  428. package/src/crypto/verification/SASDecimal.ts +0 -37
  429. package/src/crypto/verification/request/Channel.ts +0 -34
  430. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  431. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  432. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  433. package/src/crypto-api/CryptoEvent.ts +0 -93
  434. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  435. package/src/crypto-api/index.ts +0 -1175
  436. package/src/crypto-api/key-passphrase.ts +0 -58
  437. package/src/crypto-api/keybackup.ts +0 -115
  438. package/src/crypto-api/recovery-key.ts +0 -69
  439. package/src/crypto-api/verification.ts +0 -408
  440. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  441. package/src/rendezvous/RendezvousChannel.ts +0 -48
  442. package/src/rendezvous/RendezvousCode.ts +0 -25
  443. package/src/rendezvous/RendezvousError.ts +0 -26
  444. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  445. package/src/rendezvous/RendezvousIntent.ts +0 -20
  446. package/src/rendezvous/RendezvousTransport.ts +0 -58
  447. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  448. package/src/rendezvous/channels/index.ts +0 -17
  449. package/src/rendezvous/index.ts +0 -25
  450. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  451. package/src/rendezvous/transports/index.ts +0 -17
  452. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  453. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  454. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  455. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  456. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  457. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  458. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  459. package/src/rust-crypto/backup.ts +0 -881
  460. package/src/rust-crypto/constants.ts +0 -18
  461. package/src/rust-crypto/device-converter.ts +0 -128
  462. package/src/rust-crypto/index.ts +0 -237
  463. package/src/rust-crypto/libolm_migration.ts +0 -530
  464. package/src/rust-crypto/rust-crypto.ts +0 -2205
  465. package/src/rust-crypto/secret-storage.ts +0 -60
  466. package/src/rust-crypto/verification.ts +0 -830
  467. package/src/secret-storage.ts +0 -693
@@ -1 +1 @@
1
- {"version":3,"file":"sliding-sync-sdk.js","names":["NotificationCountType","Room","RoomEvent","logger","promiseMapSeries","EventTimeline","ClientEvent","SyncState","_createAndReEmitRoom","defaultClientOpts","defaultSyncApiOpts","MatrixError","ExtensionState","SlidingSyncEvent","SlidingSyncState","EventType","RoomStateEvent","RoomMemberEvent","KnownMembership","FAILED_SYNC_ERROR_THRESHOLD","ExtensionE2EE","constructor","crypto","name","when","PreProcess","onRequest","isInitial","undefined","enabled","onResponse","data","_this","_asyncToGenerator","device_lists","processDeviceLists","processKeyCounts","device_one_time_keys_count","onSyncCompleted","ExtensionToDevice","client","cryptoCallbacks","_defineProperty","extReq","since","nextBatch","_this2","cancelledKeyVerificationTxns","events","length","preprocessToDeviceMessages","map","getEventMapper","toDeviceEvent","getType","txnId","getContent","push","forEach","content","msgtype","log","getSender","includes","flagCancelled","emit","ToDeviceEvent","next_batch","ExtensionAccountData","PostProcess","_this3","global","processGlobalAccountData","roomId","rooms","accountDataEvents","mapEvents","room","getRoom","warn","addAccountData","e","Event","globalAccountData","prevEventsMap","reduce","m","c","store","getAccountData","storeAccountDataEvents","accountDataEvent","PushRules","rules","setPushRules","prevEvent","AccountData","ExtensionTyping","_this4","processEphemeralEvents","ExtensionReceipts","_this5","SlidingSyncSdk","slidingSync","opts","syncOpts","getNotifTimelineSet","reEmitter","reEmit","Timeline","TimelineReset","on","Lifecycle","onLifecycle","bind","RoomData","onRoomData","extensions","ext","registerExtension","roomData","_this6","initial","debug","processRoomData","state","resp","err","Complete","purgeNotifications","lastPos","updateSyncState","Prepared","oldSyncToken","nextSyncToken","pos","catchingUp","fromCache","Syncing","RequestFinished","failCount","Error","Reconnecting","error","shouldAbortSync","syncLeftRooms","peek","stopPeeking","setPresence","presence","getSyncState","syncState","getSyncStateData","_this$syncStateData","syncStateData","createRoom","timelineSupport","getUserId","lazyLoadMembers","pendingEventOrdering","Name","Redaction","RedactionCancelled","Receipt","Tags","LocalEchoUpdated","MyMembership","registerStateListeners","currentState","Events","Members","NewMember","Update","event","member","_this$client$getUser","user","getUser","userId","Typing","PowerLevel","Membership","errcode","stop","_this7","ensureNameEvent","stateEvents","required_state","timelineEvents","timeline","ephemeralEvents","knownEvents","Set","getLiveTimeline","getEvents","add","getId","oldEvents","newEvents","seenKnownEvent","i","recvEvent","has","unshift","addEventsToTimeline","prev_batch","encrypted","hasEncryptionStateEvent","notification_count","setUnreadNotificationCount","Total","highlight_count","getUnreadNotificationCount","Highlight","Number","isInteger","invited_count","setInvitedMemberCount","joined_count","setJoinedMemberCount","invite_state","inviteStateEvents","injectRoomEvents","recalculate","storeRoom","updateMyMembership","Invite","_roomData$prev_batch","setPaginationToken","BACKWARDS","num_live","addEphemeralEvents","Join","addNotifications","processRoomEvent","_ref","isState","RoomEncryption","onCryptoEvent","_x","apply","arguments","decryptCriticalEvents","stateEventList","timelineEventList","numLive","_this8","liveTimeline","timelineWasEmpty","ev","getPushActionsForEvent","initialiseState","oldState","setStateEvents","liveTimelineEvents","slice","addLiveEvents","resolveInvites","resolveInvitesToProfiles","getMembersWithMembership","requestedProfileInfo","promise","Promise","resolve","avatar_url","avatarUrl","displayname","displayName","getProfileInfo","then","info","inviteEvent","membership","setMembershipEvent","_err","retryImmediately","sync","_this9","isGuest","result","getPushRules","pushRules","start","newState","old","Sync","timelineEvent","pushActions","notify","tweaks","highlight","notifEvents","sort","a","b","getTs","_this$client$getNotif","addLiveEvent","stateEvent","type","RoomName","state_key","event_id","sender","origin_server_ts","Date","getTime","decrypt","mapper","room_id","ephEvents"],"sources":["../src/sliding-sync-sdk.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport type { SyncCryptoCallbacks } from \"./common-crypto/CryptoBackend.ts\";\nimport { NotificationCountType, Room, RoomEvent } from \"./models/room.ts\";\nimport { logger } from \"./logger.ts\";\nimport { promiseMapSeries } from \"./utils.ts\";\nimport { EventTimeline } from \"./models/event-timeline.ts\";\nimport { ClientEvent, IStoredClientOpts, MatrixClient } from \"./client.ts\";\nimport {\n ISyncStateData,\n SyncState,\n _createAndReEmitRoom,\n SyncApiOptions,\n defaultClientOpts,\n defaultSyncApiOpts,\n SetPresence,\n} from \"./sync.ts\";\nimport { MatrixEvent } from \"./models/event.ts\";\nimport { Crypto } from \"./crypto/index.ts\";\nimport { IMinimalEvent, IRoomEvent, IStateEvent, IStrippedState, ISyncResponse } from \"./sync-accumulator.ts\";\nimport { MatrixError } from \"./http-api/index.ts\";\nimport {\n Extension,\n ExtensionState,\n MSC3575RoomData,\n MSC3575SlidingSyncResponse,\n SlidingSync,\n SlidingSyncEvent,\n SlidingSyncState,\n} from \"./sliding-sync.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { IPushRules } from \"./@types/PushRules.ts\";\nimport { RoomStateEvent } from \"./models/room-state.ts\";\nimport { RoomMemberEvent } from \"./models/room-member.ts\";\nimport { KnownMembership } from \"./@types/membership.ts\";\n\n// Number of consecutive failed syncs that will lead to a syncState of ERROR as opposed\n// to RECONNECTING. This is needed to inform the client of server issues when the\n// keepAlive is successful but the server /sync fails.\nconst FAILED_SYNC_ERROR_THRESHOLD = 3;\n\ntype ExtensionE2EERequest = {\n enabled: boolean;\n};\n\ntype ExtensionE2EEResponse = Pick<\n ISyncResponse,\n | \"device_lists\"\n | \"device_one_time_keys_count\"\n | \"device_unused_fallback_key_types\"\n | \"org.matrix.msc2732.device_unused_fallback_key_types\"\n>;\n\nclass ExtensionE2EE implements Extension<ExtensionE2EERequest, ExtensionE2EEResponse> {\n public constructor(private readonly crypto: Crypto) {}\n\n public name(): string {\n return \"e2ee\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PreProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionE2EERequest | undefined {\n if (!isInitial) {\n return undefined;\n }\n return {\n enabled: true, // this is sticky so only send it on the initial request\n };\n }\n\n public async onResponse(data: ExtensionE2EEResponse): Promise<void> {\n // Handle device list updates\n if (data.device_lists) {\n await this.crypto.processDeviceLists(data.device_lists);\n }\n\n // Handle one_time_keys_count and unused_fallback_key_types\n await this.crypto.processKeyCounts(\n data.device_one_time_keys_count,\n data[\"device_unused_fallback_key_types\"] || data[\"org.matrix.msc2732.device_unused_fallback_key_types\"],\n );\n\n this.crypto.onSyncCompleted({});\n }\n}\n\ntype ExtensionToDeviceRequest = {\n since?: string;\n limit?: number;\n enabled?: boolean;\n};\n\ntype ExtensionToDeviceResponse = {\n events: Required<ISyncResponse>[\"to_device\"][\"events\"];\n next_batch: string | null;\n};\n\nclass ExtensionToDevice implements Extension<ExtensionToDeviceRequest, ExtensionToDeviceResponse> {\n private nextBatch: string | null = null;\n\n public constructor(\n private readonly client: MatrixClient,\n private readonly cryptoCallbacks?: SyncCryptoCallbacks,\n ) {}\n\n public name(): string {\n return \"to_device\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PreProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionToDeviceRequest {\n const extReq: ExtensionToDeviceRequest = {\n since: this.nextBatch !== null ? this.nextBatch : undefined,\n };\n if (isInitial) {\n extReq[\"limit\"] = 100;\n extReq[\"enabled\"] = true;\n }\n return extReq;\n }\n\n public async onResponse(data: ExtensionToDeviceResponse): Promise<void> {\n const cancelledKeyVerificationTxns: string[] = [];\n let events = data[\"events\"] || [];\n if (events.length > 0 && this.cryptoCallbacks) {\n events = await this.cryptoCallbacks.preprocessToDeviceMessages(events);\n }\n events\n .map(this.client.getEventMapper())\n .map((toDeviceEvent) => {\n // map is a cheap inline forEach\n // We want to flag m.key.verification.start events as cancelled\n // if there's an accompanying m.key.verification.cancel event, so\n // we pull out the transaction IDs from the cancellation events\n // so we can flag the verification events as cancelled in the loop\n // below.\n if (toDeviceEvent.getType() === \"m.key.verification.cancel\") {\n const txnId: string | undefined = toDeviceEvent.getContent()[\"transaction_id\"];\n if (txnId) {\n cancelledKeyVerificationTxns.push(txnId);\n }\n }\n\n // as mentioned above, .map is a cheap inline forEach, so return\n // the unmodified event.\n return toDeviceEvent;\n })\n .forEach((toDeviceEvent) => {\n const content = toDeviceEvent.getContent();\n if (toDeviceEvent.getType() == \"m.room.message\" && content.msgtype == \"m.bad.encrypted\") {\n // the mapper already logged a warning.\n logger.log(\"Ignoring undecryptable to-device event from \" + toDeviceEvent.getSender());\n return;\n }\n\n if (\n toDeviceEvent.getType() === \"m.key.verification.start\" ||\n toDeviceEvent.getType() === \"m.key.verification.request\"\n ) {\n const txnId = content[\"transaction_id\"];\n if (cancelledKeyVerificationTxns.includes(txnId)) {\n toDeviceEvent.flagCancelled();\n }\n }\n\n this.client.emit(ClientEvent.ToDeviceEvent, toDeviceEvent);\n });\n\n this.nextBatch = data.next_batch;\n }\n}\n\ntype ExtensionAccountDataRequest = {\n enabled: boolean;\n};\n\ntype ExtensionAccountDataResponse = {\n global: IMinimalEvent[];\n rooms: Record<string, IMinimalEvent[]>;\n};\n\nclass ExtensionAccountData implements Extension<ExtensionAccountDataRequest, ExtensionAccountDataResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"account_data\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionAccountDataRequest | undefined {\n if (!isInitial) {\n return undefined;\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionAccountDataResponse): Promise<void> {\n if (data.global && data.global.length > 0) {\n this.processGlobalAccountData(data.global);\n }\n\n for (const roomId in data.rooms) {\n const accountDataEvents = mapEvents(this.client, roomId, data.rooms[roomId]);\n const room = this.client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got account data for room but room doesn't exist on client:\", roomId);\n continue;\n }\n room.addAccountData(accountDataEvents);\n accountDataEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n }\n }\n\n private processGlobalAccountData(globalAccountData: IMinimalEvent[]): void {\n const events = mapEvents(this.client, undefined, globalAccountData);\n const prevEventsMap = events.reduce<Record<string, MatrixEvent | undefined>>((m, c) => {\n m[c.getType()] = this.client.store.getAccountData(c.getType());\n return m;\n }, {});\n this.client.store.storeAccountDataEvents(events);\n events.forEach((accountDataEvent) => {\n // Honour push rules that come down the sync stream but also\n // honour push rules that were previously cached. Base rules\n // will be updated when we receive push rules via getPushRules\n // (see sync) before syncing over the network.\n if (accountDataEvent.getType() === EventType.PushRules) {\n const rules = accountDataEvent.getContent<IPushRules>();\n this.client.setPushRules(rules);\n }\n const prevEvent = prevEventsMap[accountDataEvent.getType()];\n this.client.emit(ClientEvent.AccountData, accountDataEvent, prevEvent);\n return accountDataEvent;\n });\n }\n}\n\ntype ExtensionTypingRequest = {\n enabled: boolean;\n};\n\ntype ExtensionTypingResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionTyping implements Extension<ExtensionTypingRequest, ExtensionTypingResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"typing\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionTypingRequest | undefined {\n if (!isInitial) {\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionTypingResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\ntype ExtensionReceiptsRequest = {\n enabled: boolean;\n};\n\ntype ExtensionReceiptsResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionReceipts implements Extension<ExtensionReceiptsRequest, ExtensionReceiptsResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"receipts\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionReceiptsRequest | undefined {\n if (isInitial) {\n return {\n enabled: true,\n };\n }\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n\n public async onResponse(data: ExtensionReceiptsResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\n/**\n * A copy of SyncApi such that it can be used as a drop-in replacement for sync v2. For the actual\n * sliding sync API, see sliding-sync.ts or the class SlidingSync.\n */\nexport class SlidingSyncSdk {\n private readonly opts: IStoredClientOpts;\n private readonly syncOpts: SyncApiOptions;\n private syncState: SyncState | null = null;\n private syncStateData?: ISyncStateData;\n private lastPos: string | null = null;\n private failCount = 0;\n private notifEvents: MatrixEvent[] = []; // accumulator of sync events in the current sync response\n\n public constructor(\n private readonly slidingSync: SlidingSync,\n private readonly client: MatrixClient,\n opts?: IStoredClientOpts,\n syncOpts?: SyncApiOptions,\n ) {\n this.opts = defaultClientOpts(opts);\n this.syncOpts = defaultSyncApiOpts(syncOpts);\n\n if (client.getNotifTimelineSet()) {\n client.reEmitter.reEmit(client.getNotifTimelineSet()!, [RoomEvent.Timeline, RoomEvent.TimelineReset]);\n }\n\n this.slidingSync.on(SlidingSyncEvent.Lifecycle, this.onLifecycle.bind(this));\n this.slidingSync.on(SlidingSyncEvent.RoomData, this.onRoomData.bind(this));\n const extensions: Extension<any, any>[] = [\n new ExtensionToDevice(this.client, this.syncOpts.cryptoCallbacks),\n new ExtensionAccountData(this.client),\n new ExtensionTyping(this.client),\n new ExtensionReceipts(this.client),\n ];\n if (this.syncOpts.crypto) {\n extensions.push(new ExtensionE2EE(this.syncOpts.crypto));\n }\n extensions.forEach((ext) => {\n this.slidingSync.registerExtension(ext);\n });\n }\n\n private async onRoomData(roomId: string, roomData: MSC3575RoomData): Promise<void> {\n let room = this.client.store.getRoom(roomId);\n if (!room) {\n if (!roomData.initial) {\n logger.debug(\"initial flag not set but no stored room exists for room \", roomId, roomData);\n return;\n }\n room = _createAndReEmitRoom(this.client, roomId, this.opts);\n }\n await this.processRoomData(this.client, room!, roomData);\n }\n\n private onLifecycle(state: SlidingSyncState, resp: MSC3575SlidingSyncResponse | null, err?: Error): void {\n if (err) {\n logger.debug(\"onLifecycle\", state, err);\n }\n switch (state) {\n case SlidingSyncState.Complete:\n this.purgeNotifications();\n if (!resp) {\n break;\n }\n // Element won't stop showing the initial loading spinner unless we fire SyncState.Prepared\n if (!this.lastPos) {\n this.updateSyncState(SyncState.Prepared, {\n oldSyncToken: undefined,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n }\n // Conversely, Element won't show the room list unless there is at least 1x SyncState.Syncing\n // so hence for the very first sync we will fire prepared then immediately syncing.\n this.updateSyncState(SyncState.Syncing, {\n oldSyncToken: this.lastPos!,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n this.lastPos = resp.pos;\n break;\n case SlidingSyncState.RequestFinished:\n if (err) {\n this.failCount += 1;\n this.updateSyncState(\n this.failCount > FAILED_SYNC_ERROR_THRESHOLD ? SyncState.Error : SyncState.Reconnecting,\n {\n error: new MatrixError(err),\n },\n );\n if (this.shouldAbortSync(new MatrixError(err))) {\n return; // shouldAbortSync actually stops syncing too so we don't need to do anything.\n }\n } else {\n this.failCount = 0;\n }\n break;\n }\n }\n\n /**\n * Sync rooms the user has left.\n * @returns Resolved when they've been added to the store.\n */\n public async syncLeftRooms(): Promise<Room[]> {\n return []; // TODO\n }\n\n /**\n * Peek into a room. This will result in the room in question being synced so it\n * is accessible via getRooms(). Live updates for the room will be provided.\n * @param roomId - The room ID to peek into.\n * @returns A promise which resolves once the room has been added to the\n * store.\n */\n public async peek(roomId: string): Promise<Room> {\n return null!; // TODO\n }\n\n /**\n * Stop polling for updates in the peeked room. NOPs if there is no room being\n * peeked.\n */\n public stopPeeking(): void {\n // TODO\n }\n\n /**\n * Specify the set_presence value to be used for subsequent calls to the Sync API.\n * @param presence - the presence to specify to set_presence of sync calls\n */\n public setPresence(presence?: SetPresence): void {\n // TODO not possible in sliding sync yet\n }\n\n /**\n * Returns the current state of this sync object\n * @see MatrixClient#event:\"sync\"\n */\n public getSyncState(): SyncState | null {\n return this.syncState;\n }\n\n /**\n * Returns the additional data object associated with\n * the current sync state, or null if there is no\n * such data.\n * Sync errors, if available, are put in the 'error' key of\n * this object.\n */\n public getSyncStateData(): ISyncStateData | null {\n return this.syncStateData ?? null;\n }\n\n // Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts\n\n public createRoom(roomId: string): Room {\n // XXX cargoculted from sync.ts\n const { timelineSupport } = this.client;\n const room = new Room(roomId, this.client, this.client.getUserId()!, {\n lazyLoadMembers: this.opts.lazyLoadMembers,\n pendingEventOrdering: this.opts.pendingEventOrdering,\n timelineSupport,\n });\n this.client.reEmitter.reEmit(room, [\n RoomEvent.Name,\n RoomEvent.Redaction,\n RoomEvent.RedactionCancelled,\n RoomEvent.Receipt,\n RoomEvent.Tags,\n RoomEvent.LocalEchoUpdated,\n RoomEvent.AccountData,\n RoomEvent.MyMembership,\n RoomEvent.Timeline,\n RoomEvent.TimelineReset,\n ]);\n this.registerStateListeners(room);\n return room;\n }\n\n private registerStateListeners(room: Room): void {\n // XXX cargoculted from sync.ts\n // we need to also re-emit room state and room member events, so hook it up\n // to the client now. We need to add a listener for RoomState.members in\n // order to hook them correctly.\n this.client.reEmitter.reEmit(room.currentState, [\n RoomStateEvent.Events,\n RoomStateEvent.Members,\n RoomStateEvent.NewMember,\n RoomStateEvent.Update,\n ]);\n room.currentState.on(RoomStateEvent.NewMember, (event, state, member) => {\n member.user = this.client.getUser(member.userId) ?? undefined;\n this.client.reEmitter.reEmit(member, [\n RoomMemberEvent.Name,\n RoomMemberEvent.Typing,\n RoomMemberEvent.PowerLevel,\n RoomMemberEvent.Membership,\n ]);\n });\n }\n\n /*\n private deregisterStateListeners(room: Room): void { // XXX cargoculted from sync.ts\n // could do with a better way of achieving this.\n room.currentState.removeAllListeners(RoomStateEvent.Events);\n room.currentState.removeAllListeners(RoomStateEvent.Members);\n room.currentState.removeAllListeners(RoomStateEvent.NewMember);\n } */\n\n private shouldAbortSync(error: MatrixError): boolean {\n if (error.errcode === \"M_UNKNOWN_TOKEN\") {\n // The logout already happened, we just need to stop.\n logger.warn(\"Token no longer valid - assuming logout\");\n this.stop();\n this.updateSyncState(SyncState.Error, { error });\n return true;\n }\n return false;\n }\n\n private async processRoomData(client: MatrixClient, room: Room, roomData: MSC3575RoomData): Promise<void> {\n roomData = ensureNameEvent(client, room.roomId, roomData);\n const stateEvents = mapEvents(this.client, room.roomId, roomData.required_state);\n // Prevent events from being decrypted ahead of time\n // this helps large account to speed up faster\n // room::decryptCriticalEvent is in charge of decrypting all the events\n // required for a client to function properly\n let timelineEvents = mapEvents(this.client, room.roomId, roomData.timeline, false);\n const ephemeralEvents: MatrixEvent[] = []; // TODO this.mapSyncEventsFormat(joinObj.ephemeral);\n\n // TODO: handle threaded / beacon events\n\n if (roomData.initial) {\n // we should not know about any of these timeline entries if this is a genuinely new room.\n // If we do, then we've effectively done scrollback (e.g requesting timeline_limit: 1 for\n // this room, then timeline_limit: 50).\n const knownEvents = new Set<string>();\n room.getLiveTimeline()\n .getEvents()\n .forEach((e) => {\n knownEvents.add(e.getId()!);\n });\n // all unknown events BEFORE a known event must be scrollback e.g:\n // D E <-- what we know\n // A B C D E F <-- what we just received\n // means:\n // A B C <-- scrollback\n // D E <-- dupes\n // F <-- new event\n // We bucket events based on if we have seen a known event yet.\n const oldEvents: MatrixEvent[] = [];\n const newEvents: MatrixEvent[] = [];\n let seenKnownEvent = false;\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const recvEvent = timelineEvents[i];\n if (knownEvents.has(recvEvent.getId()!)) {\n seenKnownEvent = true;\n continue; // don't include this event, it's a dupe\n }\n if (seenKnownEvent) {\n // old -> new\n oldEvents.push(recvEvent);\n } else {\n // old -> new\n newEvents.unshift(recvEvent);\n }\n }\n timelineEvents = newEvents;\n if (oldEvents.length > 0) {\n // old events are scrollback, insert them now\n room.addEventsToTimeline(oldEvents, true, room.getLiveTimeline(), roomData.prev_batch);\n }\n }\n\n const encrypted = room.hasEncryptionStateEvent();\n // we do this first so it's correct when any of the events fire\n if (roomData.notification_count != null) {\n room.setUnreadNotificationCount(NotificationCountType.Total, roomData.notification_count);\n }\n\n if (roomData.highlight_count != null) {\n // We track unread notifications ourselves in encrypted rooms, so don't\n // bother setting it here. We trust our calculations better than the\n // server's for this case, and therefore will assume that our non-zero\n // count is accurate.\n if (!encrypted || (encrypted && room.getUnreadNotificationCount(NotificationCountType.Highlight) <= 0)) {\n room.setUnreadNotificationCount(NotificationCountType.Highlight, roomData.highlight_count);\n }\n }\n\n if (Number.isInteger(roomData.invited_count)) {\n room.currentState.setInvitedMemberCount(roomData.invited_count!);\n }\n if (Number.isInteger(roomData.joined_count)) {\n room.currentState.setJoinedMemberCount(roomData.joined_count!);\n }\n\n if (roomData.invite_state) {\n const inviteStateEvents = mapEvents(this.client, room.roomId, roomData.invite_state);\n await this.injectRoomEvents(room, inviteStateEvents);\n if (roomData.initial) {\n room.recalculate();\n this.client.store.storeRoom(room);\n this.client.emit(ClientEvent.Room, room);\n }\n inviteStateEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n room.updateMyMembership(KnownMembership.Invite);\n return;\n }\n\n if (roomData.initial) {\n // set the back-pagination token. Do this *before* adding any\n // events so that clients can start back-paginating.\n room.getLiveTimeline().setPaginationToken(roomData.prev_batch ?? null, EventTimeline.BACKWARDS);\n }\n\n /* TODO\n else if (roomData.limited) {\n\n let limited = true;\n\n // we've got a limited sync, so we *probably* have a gap in the\n // timeline, so should reset. But we might have been peeking or\n // paginating and already have some of the events, in which\n // case we just want to append any subsequent events to the end\n // of the existing timeline.\n //\n // This is particularly important in the case that we already have\n // *all* of the events in the timeline - in that case, if we reset\n // the timeline, we'll end up with an entirely empty timeline,\n // which we'll try to paginate but not get any new events (which\n // will stop us linking the empty timeline into the chain).\n //\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const eventId = timelineEvents[i].getId();\n if (room.getTimelineForEvent(eventId)) {\n logger.debug(\"Already have event \" + eventId + \" in limited \" +\n \"sync - not resetting\");\n limited = false;\n\n // we might still be missing some of the events before i;\n // we don't want to be adding them to the end of the\n // timeline because that would put them out of order.\n timelineEvents.splice(0, i);\n\n // XXX: there's a problem here if the skipped part of the\n // timeline modifies the state set in stateEvents, because\n // we'll end up using the state from stateEvents rather\n // than the later state from timelineEvents. We probably\n // need to wind stateEvents forward over the events we're\n // skipping.\n break;\n }\n }\n\n if (limited) {\n room.resetLiveTimeline(\n roomData.prev_batch,\n null, // TODO this.syncOpts.canResetEntireTimeline(room.roomId) ? null : syncEventData.oldSyncToken,\n );\n\n // We have to assume any gap in any timeline is\n // reason to stop incrementally tracking notifications and\n // reset the timeline.\n this.client.resetNotifTimelineSet();\n this.registerStateListeners(room);\n }\n } */\n\n await this.injectRoomEvents(room, stateEvents, timelineEvents, roomData.num_live);\n\n // we deliberately don't add ephemeral events to the timeline\n room.addEphemeralEvents(ephemeralEvents);\n\n // local fields must be set before any async calls because call site assumes\n // synchronous execution prior to emitting SlidingSyncState.Complete\n room.updateMyMembership(KnownMembership.Join);\n\n room.recalculate();\n if (roomData.initial) {\n client.store.storeRoom(room);\n client.emit(ClientEvent.Room, room);\n }\n\n // check if any timeline events should bing and add them to the notifEvents array:\n // we'll purge this once we've fully processed the sync response\n this.addNotifications(timelineEvents);\n\n const processRoomEvent = async (e: MatrixEvent): Promise<void> => {\n client.emit(ClientEvent.Event, e);\n if (e.isState() && e.getType() == EventType.RoomEncryption && this.syncOpts.cryptoCallbacks) {\n await this.syncOpts.cryptoCallbacks.onCryptoEvent(room, e);\n }\n };\n\n await promiseMapSeries(stateEvents, processRoomEvent);\n await promiseMapSeries(timelineEvents, processRoomEvent);\n ephemeralEvents.forEach(function (e) {\n client.emit(ClientEvent.Event, e);\n });\n\n // Decrypt only the last message in all rooms to make sure we can generate a preview\n // And decrypt all events after the recorded read receipt to ensure an accurate\n // notification count\n room.decryptCriticalEvents();\n }\n\n /**\n * Injects events into a room's model.\n * @param stateEventList - A list of state events. This is the state\n * at the *START* of the timeline list if it is supplied.\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n * @param numLive - the number of events in timelineEventList which just happened,\n * supplied from the server.\n */\n public async injectRoomEvents(\n room: Room,\n stateEventList: MatrixEvent[],\n timelineEventList?: MatrixEvent[],\n numLive?: number,\n ): Promise<void> {\n timelineEventList = timelineEventList || [];\n stateEventList = stateEventList || [];\n numLive = numLive || 0;\n\n // If there are no events in the timeline yet, initialise it with\n // the given state events\n const liveTimeline = room.getLiveTimeline();\n const timelineWasEmpty = liveTimeline.getEvents().length == 0;\n if (timelineWasEmpty) {\n // Passing these events into initialiseState will freeze them, so we need\n // to compute and cache the push actions for them now, otherwise sync dies\n // with an attempt to assign to read only property.\n // XXX: This is pretty horrible and is assuming all sorts of behaviour from\n // these functions that it shouldn't be. We should probably either store the\n // push actions cache elsewhere so we can freeze MatrixEvents, or otherwise\n // find some solution where MatrixEvents are immutable but allow for a cache\n // field.\n for (const ev of stateEventList) {\n this.client.getPushActionsForEvent(ev);\n }\n liveTimeline.initialiseState(stateEventList);\n }\n\n // If the timeline wasn't empty, we process the state events here: they're\n // defined as updates to the state before the start of the timeline, so this\n // starts to roll the state forward.\n // XXX: That's what we *should* do, but this can happen if we were previously\n // peeking in a room, in which case we obviously do *not* want to add the\n // state events here onto the end of the timeline. Historically, the js-sdk\n // has just set these new state events on the old and new state. This seems\n // very wrong because there could be events in the timeline that diverge the\n // state, in which case this is going to leave things out of sync. However,\n // for now I think it;s best to behave the same as the code has done previously.\n if (!timelineWasEmpty) {\n // XXX: As above, don't do this...\n //room.addLiveEvents(stateEventList || []);\n // Do this instead...\n room.oldState.setStateEvents(stateEventList);\n room.currentState.setStateEvents(stateEventList);\n }\n\n // the timeline is broken into 'live' events which just happened and normal timeline events\n // which are still to be appended to the end of the live timeline but happened a while ago.\n // The live events are marked as fromCache=false to ensure that downstream components know\n // this is a live event, not historical (from a remote server cache).\n\n let liveTimelineEvents: MatrixEvent[] = [];\n if (numLive > 0) {\n // last numLive events are live\n liveTimelineEvents = timelineEventList.slice(-1 * numLive);\n // everything else is not live\n timelineEventList = timelineEventList.slice(0, -1 * liveTimelineEvents.length);\n }\n\n // execute the timeline events. This will continue to diverge the current state\n // if the timeline has any state events in it.\n // This also needs to be done before running push rules on the events as they need\n // to be decorated with sender etc.\n await room.addLiveEvents(timelineEventList, {\n fromCache: true,\n });\n if (liveTimelineEvents.length > 0) {\n await room.addLiveEvents(liveTimelineEvents, {\n fromCache: false,\n });\n }\n\n room.recalculate();\n\n // resolve invites now we have set the latest state\n this.resolveInvites(room);\n }\n\n private resolveInvites(room: Room): void {\n if (!room || !this.opts.resolveInvitesToProfiles) {\n return;\n }\n const client = this.client;\n // For each invited room member we want to give them a displayname/avatar url\n // if they have one (the m.room.member invites don't contain this).\n room.getMembersWithMembership(KnownMembership.Invite).forEach(function (member) {\n if (member.requestedProfileInfo) return;\n member.requestedProfileInfo = true;\n // try to get a cached copy first.\n const user = client.getUser(member.userId);\n let promise: ReturnType<MatrixClient[\"getProfileInfo\"]>;\n if (user) {\n promise = Promise.resolve({\n avatar_url: user.avatarUrl,\n displayname: user.displayName,\n });\n } else {\n promise = client.getProfileInfo(member.userId);\n }\n promise.then(\n function (info) {\n // slightly naughty by doctoring the invite event but this means all\n // the code paths remain the same between invite/join display name stuff\n // which is a worthy trade-off for some minor pollution.\n const inviteEvent = member.events.member!;\n if (inviteEvent.getContent().membership !== KnownMembership.Invite) {\n // between resolving and now they have since joined, so don't clobber\n return;\n }\n inviteEvent.getContent().avatar_url = info.avatar_url;\n inviteEvent.getContent().displayname = info.displayname;\n // fire listeners\n member.setMembershipEvent(inviteEvent, room.currentState);\n },\n function (_err) {\n // OH WELL.\n },\n );\n });\n }\n\n public retryImmediately(): boolean {\n return true;\n }\n\n /**\n * Main entry point. Blocks until stop() is called.\n */\n public async sync(): Promise<void> {\n logger.debug(\"Sliding sync init loop\");\n\n // 1) We need to get push rules so we can check if events should bing as we get\n // them from /sync.\n while (!this.client.isGuest()) {\n try {\n logger.debug(\"Getting push rules...\");\n const result = await this.client.getPushRules();\n logger.debug(\"Got push rules\");\n this.client.pushRules = result;\n break;\n } catch (err) {\n logger.error(\"Getting push rules failed\", err);\n if (this.shouldAbortSync(<MatrixError>err)) {\n return;\n }\n }\n }\n\n // start syncing\n await this.slidingSync.start();\n }\n\n /**\n * Stops the sync object from syncing.\n */\n public stop(): void {\n logger.debug(\"SyncApi.stop\");\n this.slidingSync.stop();\n }\n\n /**\n * Sets the sync state and emits an event to say so\n * @param newState - The new state string\n * @param data - Object of additional data to emit in the event\n */\n private updateSyncState(newState: SyncState, data?: ISyncStateData): void {\n const old = this.syncState;\n this.syncState = newState;\n this.syncStateData = data;\n this.client.emit(ClientEvent.Sync, this.syncState, old, data);\n }\n\n /**\n * Takes a list of timelineEvents and adds and adds to notifEvents\n * as appropriate.\n * This must be called after the room the events belong to has been stored.\n *\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n */\n private addNotifications(timelineEventList: MatrixEvent[]): void {\n // gather our notifications into this.notifEvents\n if (!this.client.getNotifTimelineSet()) {\n return;\n }\n for (const timelineEvent of timelineEventList) {\n const pushActions = this.client.getPushActionsForEvent(timelineEvent);\n if (pushActions && pushActions.notify && pushActions.tweaks && pushActions.tweaks.highlight) {\n this.notifEvents.push(timelineEvent);\n }\n }\n }\n\n /**\n * Purge any events in the notifEvents array. Used after a /sync has been complete.\n * This should not be called at a per-room scope (e.g in onRoomData) because otherwise the ordering\n * will be messed up e.g room A gets a bing, room B gets a newer bing, but both in the same /sync\n * response. If we purge at a per-room scope then we could process room B before room A leading to\n * room B appearing earlier in the notifications timeline, even though it has the higher origin_server_ts.\n */\n private purgeNotifications(): void {\n this.notifEvents.sort(function (a, b) {\n return a.getTs() - b.getTs();\n });\n this.notifEvents.forEach((event) => {\n this.client.getNotifTimelineSet()?.addLiveEvent(event);\n });\n this.notifEvents = [];\n }\n}\n\nfunction ensureNameEvent(client: MatrixClient, roomId: string, roomData: MSC3575RoomData): MSC3575RoomData {\n // make sure m.room.name is in required_state if there is a name, replacing anything previously\n // there if need be. This ensures clients transparently 'calculate' the right room name. Native\n // sliding sync clients should just read the \"name\" field.\n if (!roomData.name) {\n return roomData;\n }\n for (const stateEvent of roomData.required_state) {\n if (stateEvent.type === EventType.RoomName && stateEvent.state_key === \"\") {\n stateEvent.content = {\n name: roomData.name,\n };\n return roomData;\n }\n }\n roomData.required_state.push({\n event_id: \"$fake-sliding-sync-name-event-\" + roomId,\n state_key: \"\",\n type: EventType.RoomName,\n content: {\n name: roomData.name,\n },\n sender: client.getUserId()!,\n origin_server_ts: new Date().getTime(),\n });\n return roomData;\n}\n\ntype TaggedEvent = (IStrippedState | IRoomEvent | IStateEvent | IMinimalEvent) & { room_id?: string };\n\n// Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts,\n// just outside the class.\nfunction mapEvents(client: MatrixClient, roomId: string | undefined, events: object[], decrypt = true): MatrixEvent[] {\n const mapper = client.getEventMapper({ decrypt });\n return (events as TaggedEvent[]).map(function (e) {\n e.room_id = roomId;\n return mapper(e);\n });\n}\n\nfunction processEphemeralEvents(client: MatrixClient, roomId: string, ephEvents: IMinimalEvent[]): void {\n const ephemeralEvents = mapEvents(client, roomId, ephEvents);\n const room = client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got ephemeral events for room but room doesn't exist on client:\", roomId);\n return;\n }\n room.addEphemeralEvents(ephemeralEvents);\n ephemeralEvents.forEach((e) => {\n client.emit(ClientEvent.Event, e);\n });\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,qBAAqB,EAAEC,IAAI,EAAEC,SAAS,QAAQ,kBAAkB;AACzE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,WAAW,QAAyC,aAAa;AAC1E,SAEIC,SAAS,EACTC,oBAAoB,EAEpBC,iBAAiB,EACjBC,kBAAkB,QAEf,WAAW;AAIlB,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAEIC,cAAc,EAIdC,gBAAgB,EAChBC,gBAAgB,QACb,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,mBAAmB;AAE7C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,wBAAwB;;AAExD;AACA;AACA;AACA,IAAMC,2BAA2B,GAAG,CAAC;AAcrC,MAAMC,aAAa,CAAmE;EAC3EC,WAAWA,CAAkBC,MAAc,EAAE;IAAA,KAAhBA,MAAc,GAAdA,MAAc;EAAG;EAE9CC,IAAIA,CAAA,EAAW;IAClB,OAAO,MAAM;EACjB;EAEOC,IAAIA,CAAA,EAAmB;IAC1B,OAAOZ,cAAc,CAACa,UAAU;EACpC;EAEOC,SAASA,CAACC,SAAkB,EAAoC;IACnE,IAAI,CAACA,SAAS,EAAE;MACZ,OAAOC,SAAS;IACpB;IACA,OAAO;MACHC,OAAO,EAAE,IAAI,CAAE;IACnB,CAAC;EACL;EAEaC,UAAUA,CAACC,IAA2B,EAAiB;IAAA,IAAAC,KAAA;IAAA,OA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SAAA,MAAG,IAAI;EACjG,IAAMmE,MAAM,GAAG5Q,MAAM,CAACY,cAAc,CAAC;IAAE+P;EAAQ,CAAC,CAAC;EACjD,OAAQnQ,MAAM,CAAmBG,GAAG,CAAC,UAAU8B,CAAC,EAAE;IAC9CA,CAAC,CAACoO,OAAO,GAAG5O,MAAM;IAClB,OAAO2O,MAAM,CAACnO,CAAC,CAAC;EACpB,CAAC,CAAC;AACN;AAEA,SAASkB,sBAAsBA,CAAC3D,MAAoB,EAAEiC,MAAc,EAAE6O,SAA0B,EAAQ;EACpG,IAAMxH,eAAe,GAAGlH,SAAS,CAACpC,MAAM,EAAEiC,MAAM,EAAE6O,SAAS,CAAC;EAC5D,IAAMzO,IAAI,GAAGrC,MAAM,CAACsC,OAAO,CAACL,MAAM,CAAC;EACnC,IAAI,CAACI,IAAI,EAAE;IACP1E,MAAM,CAAC4E,IAAI,CAAC,iEAAiE,EAAEN,MAAM,CAAC;IACtF;EACJ;EACAI,IAAI,CAAC0J,kBAAkB,CAACzC,eAAe,CAAC;EACxCA,eAAe,CAACpI,OAAO,CAAEuB,CAAC,IAAK;IAC3BzC,MAAM,CAACyB,IAAI,CAAC3D,WAAW,CAAC4E,KAAK,EAAED,CAAC,CAAC;EACrC,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"file":"sliding-sync-sdk.js","names":["NotificationCountType","Room","RoomEvent","logger","promiseMapSeries","EventTimeline","ClientEvent","SyncState","_createAndReEmitRoom","defaultClientOpts","MatrixError","ExtensionState","SlidingSyncEvent","SlidingSyncState","EventType","RoomStateEvent","RoomMemberEvent","KnownMembership","FAILED_SYNC_ERROR_THRESHOLD","ExtensionToDevice","constructor","client","_defineProperty","name","when","PreProcess","onRequest","isInitial","extReq","since","nextBatch","undefined","onResponse","data","_this","_asyncToGenerator","cancelledKeyVerificationTxns","events","map","getEventMapper","toDeviceEvent","getType","txnId","getContent","push","forEach","content","msgtype","log","getSender","includes","flagCancelled","emit","ToDeviceEvent","next_batch","ExtensionAccountData","PostProcess","enabled","_this2","global","length","processGlobalAccountData","roomId","rooms","accountDataEvents","mapEvents","room","getRoom","warn","addAccountData","e","Event","globalAccountData","prevEventsMap","reduce","m","c","store","getAccountData","storeAccountDataEvents","accountDataEvent","PushRules","rules","setPushRules","prevEvent","AccountData","ExtensionTyping","_this3","processEphemeralEvents","ExtensionReceipts","_this4","SlidingSyncSdk","slidingSync","opts","getNotifTimelineSet","reEmitter","reEmit","Timeline","TimelineReset","on","Lifecycle","onLifecycle","bind","RoomData","onRoomData","extensions","ext","registerExtension","roomData","_this5","initial","debug","processRoomData","state","resp","err","Complete","purgeNotifications","lastPos","updateSyncState","Prepared","oldSyncToken","nextSyncToken","pos","catchingUp","fromCache","Syncing","RequestFinished","failCount","Error","Reconnecting","error","shouldAbortSync","syncLeftRooms","peek","stopPeeking","setPresence","presence","getSyncState","syncState","getSyncStateData","_this$syncStateData","syncStateData","createRoom","timelineSupport","getUserId","lazyLoadMembers","pendingEventOrdering","Name","Redaction","RedactionCancelled","Receipt","Tags","LocalEchoUpdated","MyMembership","registerStateListeners","currentState","Events","Members","NewMember","Update","event","member","_this$client$getUser","user","getUser","userId","Typing","PowerLevel","Membership","errcode","stop","_this6","ensureNameEvent","stateEvents","required_state","timelineEvents","timeline","ephemeralEvents","knownEvents","Set","getLiveTimeline","getEvents","add","getId","oldEvents","newEvents","seenKnownEvent","i","recvEvent","has","unshift","addEventsToTimeline","prev_batch","encrypted","hasEncryptionStateEvent","notification_count","setUnreadNotificationCount","Total","highlight_count","getUnreadNotificationCount","Highlight","Number","isInteger","invited_count","setInvitedMemberCount","joined_count","setJoinedMemberCount","invite_state","inviteStateEvents","injectRoomEvents","recalculate","storeRoom","updateMyMembership","Invite","_roomData$prev_batch","setPaginationToken","BACKWARDS","num_live","addEphemeralEvents","Join","addNotifications","processRoomEvent","_ref","_x","apply","arguments","stateEventList","timelineEventList","numLive","_this7","liveTimeline","timelineWasEmpty","ev","getPushActionsForEvent","initialiseState","oldState","setStateEvents","liveTimelineEvents","slice","addLiveEvents","resolveInvites","resolveInvitesToProfiles","getMembersWithMembership","requestedProfileInfo","promise","Promise","resolve","avatar_url","avatarUrl","displayname","displayName","getProfileInfo","then","info","inviteEvent","membership","setMembershipEvent","_err","retryImmediately","sync","_this8","isGuest","result","getPushRules","pushRules","start","newState","old","Sync","timelineEvent","pushActions","notify","tweaks","highlight","notifEvents","sort","a","b","getTs","_this$client$getNotif","addLiveEvent","stateEvent","type","RoomName","state_key","event_id","sender","origin_server_ts","Date","getTime","decrypt","mapper","room_id","ephEvents"],"sources":["../src/sliding-sync-sdk.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { NotificationCountType, Room, RoomEvent } from \"./models/room.ts\";\nimport { logger } from \"./logger.ts\";\nimport { promiseMapSeries } from \"./utils.ts\";\nimport { EventTimeline } from \"./models/event-timeline.ts\";\nimport { ClientEvent, IStoredClientOpts, MatrixClient } from \"./client.ts\";\nimport {\n ISyncStateData,\n SyncState,\n _createAndReEmitRoom,\n defaultClientOpts,\n SetPresence,\n} from \"./sync.ts\";\nimport { MatrixEvent } from \"./models/event.ts\";\nimport { IMinimalEvent, IRoomEvent, IStateEvent, IStrippedState, ISyncResponse } from \"./sync-accumulator.ts\";\nimport { MatrixError } from \"./http-api/index.ts\";\nimport {\n Extension,\n ExtensionState,\n MSC3575RoomData,\n MSC3575SlidingSyncResponse,\n SlidingSync,\n SlidingSyncEvent,\n SlidingSyncState,\n} from \"./sliding-sync.ts\";\nimport { EventType } from \"./@types/event.ts\";\nimport { IPushRules } from \"./@types/PushRules.ts\";\nimport { RoomStateEvent } from \"./models/room-state.ts\";\nimport { RoomMemberEvent } from \"./models/room-member.ts\";\nimport { KnownMembership } from \"./@types/membership.ts\";\n\n// Number of consecutive failed syncs that will lead to a syncState of ERROR as opposed\n// to RECONNECTING. This is needed to inform the client of server issues when the\n// keepAlive is successful but the server /sync fails.\nconst FAILED_SYNC_ERROR_THRESHOLD = 3;\n\ntype ExtensionToDeviceRequest = {\n since?: string;\n limit?: number;\n enabled?: boolean;\n};\n\ntype ExtensionToDeviceResponse = {\n events: Required<ISyncResponse>[\"to_device\"][\"events\"];\n next_batch: string | null;\n};\n\nclass ExtensionToDevice implements Extension<ExtensionToDeviceRequest, ExtensionToDeviceResponse> {\n private nextBatch: string | null = null;\n\n public constructor(\n private readonly client: MatrixClient,\n ) {}\n\n public name(): string {\n return \"to_device\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PreProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionToDeviceRequest {\n const extReq: ExtensionToDeviceRequest = {\n since: this.nextBatch !== null ? this.nextBatch : undefined,\n };\n if (isInitial) {\n extReq[\"limit\"] = 100;\n extReq[\"enabled\"] = true;\n }\n return extReq;\n }\n\n public async onResponse(data: ExtensionToDeviceResponse): Promise<void> {\n const cancelledKeyVerificationTxns: string[] = [];\n const events = data[\"events\"] || [];\n events\n .map(this.client.getEventMapper())\n .map((toDeviceEvent) => {\n // map is a cheap inline forEach\n // We want to flag m.key.verification.start events as cancelled\n // if there's an accompanying m.key.verification.cancel event, so\n // we pull out the transaction IDs from the cancellation events\n // so we can flag the verification events as cancelled in the loop\n // below.\n if (toDeviceEvent.getType() === \"m.key.verification.cancel\") {\n const txnId: string | undefined = toDeviceEvent.getContent()[\"transaction_id\"];\n if (txnId) {\n cancelledKeyVerificationTxns.push(txnId);\n }\n }\n\n // as mentioned above, .map is a cheap inline forEach, so return\n // the unmodified event.\n return toDeviceEvent;\n })\n .forEach((toDeviceEvent) => {\n const content = toDeviceEvent.getContent();\n if (toDeviceEvent.getType() == \"m.room.message\" && content.msgtype == \"m.bad.encrypted\") {\n // the mapper already logged a warning.\n logger.log(\"Ignoring undecryptable to-device event from \" + toDeviceEvent.getSender());\n return;\n }\n\n if (\n toDeviceEvent.getType() === \"m.key.verification.start\" ||\n toDeviceEvent.getType() === \"m.key.verification.request\"\n ) {\n const txnId = content[\"transaction_id\"];\n if (cancelledKeyVerificationTxns.includes(txnId)) {\n toDeviceEvent.flagCancelled();\n }\n }\n\n this.client.emit(ClientEvent.ToDeviceEvent, toDeviceEvent);\n });\n\n this.nextBatch = data.next_batch;\n }\n}\n\ntype ExtensionAccountDataRequest = {\n enabled: boolean;\n};\n\ntype ExtensionAccountDataResponse = {\n global: IMinimalEvent[];\n rooms: Record<string, IMinimalEvent[]>;\n};\n\nclass ExtensionAccountData implements Extension<ExtensionAccountDataRequest, ExtensionAccountDataResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"account_data\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionAccountDataRequest | undefined {\n if (!isInitial) {\n return undefined;\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionAccountDataResponse): Promise<void> {\n if (data.global && data.global.length > 0) {\n this.processGlobalAccountData(data.global);\n }\n\n for (const roomId in data.rooms) {\n const accountDataEvents = mapEvents(this.client, roomId, data.rooms[roomId]);\n const room = this.client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got account data for room but room doesn't exist on client:\", roomId);\n continue;\n }\n room.addAccountData(accountDataEvents);\n accountDataEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n }\n }\n\n private processGlobalAccountData(globalAccountData: IMinimalEvent[]): void {\n const events = mapEvents(this.client, undefined, globalAccountData);\n const prevEventsMap = events.reduce<Record<string, MatrixEvent | undefined>>((m, c) => {\n m[c.getType()] = this.client.store.getAccountData(c.getType());\n return m;\n }, {});\n this.client.store.storeAccountDataEvents(events);\n events.forEach((accountDataEvent) => {\n // Honour push rules that come down the sync stream but also\n // honour push rules that were previously cached. Base rules\n // will be updated when we receive push rules via getPushRules\n // (see sync) before syncing over the network.\n if (accountDataEvent.getType() === EventType.PushRules) {\n const rules = accountDataEvent.getContent<IPushRules>();\n this.client.setPushRules(rules);\n }\n const prevEvent = prevEventsMap[accountDataEvent.getType()];\n this.client.emit(ClientEvent.AccountData, accountDataEvent, prevEvent);\n return accountDataEvent;\n });\n }\n}\n\ntype ExtensionTypingRequest = {\n enabled: boolean;\n};\n\ntype ExtensionTypingResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionTyping implements Extension<ExtensionTypingRequest, ExtensionTypingResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"typing\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionTypingRequest | undefined {\n if (!isInitial) {\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n return {\n enabled: true,\n };\n }\n\n public async onResponse(data: ExtensionTypingResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\ntype ExtensionReceiptsRequest = {\n enabled: boolean;\n};\n\ntype ExtensionReceiptsResponse = {\n rooms: Record<string, IMinimalEvent>;\n};\n\nclass ExtensionReceipts implements Extension<ExtensionReceiptsRequest, ExtensionReceiptsResponse> {\n public constructor(private readonly client: MatrixClient) {}\n\n public name(): string {\n return \"receipts\";\n }\n\n public when(): ExtensionState {\n return ExtensionState.PostProcess;\n }\n\n public onRequest(isInitial: boolean): ExtensionReceiptsRequest | undefined {\n if (isInitial) {\n return {\n enabled: true,\n };\n }\n return undefined; // don't send a JSON object for subsequent requests, we don't need to.\n }\n\n public async onResponse(data: ExtensionReceiptsResponse): Promise<void> {\n if (!data?.rooms) {\n return;\n }\n\n for (const roomId in data.rooms) {\n processEphemeralEvents(this.client, roomId, [data.rooms[roomId]]);\n }\n }\n}\n\n/**\n * A copy of SyncApi such that it can be used as a drop-in replacement for sync v2. For the actual\n * sliding sync API, see sliding-sync.ts or the class SlidingSync.\n */\nexport class SlidingSyncSdk {\n private readonly opts: IStoredClientOpts;\n private syncState: SyncState | null = null;\n private syncStateData?: ISyncStateData;\n private lastPos: string | null = null;\n private failCount = 0;\n private notifEvents: MatrixEvent[] = []; // accumulator of sync events in the current sync response\n\n public constructor(\n private readonly slidingSync: SlidingSync,\n private readonly client: MatrixClient,\n opts?: IStoredClientOpts,\n ) {\n this.opts = defaultClientOpts(opts);\n\n if (client.getNotifTimelineSet()) {\n client.reEmitter.reEmit(client.getNotifTimelineSet()!, [RoomEvent.Timeline, RoomEvent.TimelineReset]);\n }\n\n this.slidingSync.on(SlidingSyncEvent.Lifecycle, this.onLifecycle.bind(this));\n this.slidingSync.on(SlidingSyncEvent.RoomData, this.onRoomData.bind(this));\n const extensions: Extension<any, any>[] = [\n new ExtensionToDevice(this.client),\n new ExtensionAccountData(this.client),\n new ExtensionTyping(this.client),\n new ExtensionReceipts(this.client),\n ];\n extensions.forEach((ext) => {\n this.slidingSync.registerExtension(ext);\n });\n }\n\n private async onRoomData(roomId: string, roomData: MSC3575RoomData): Promise<void> {\n let room = this.client.store.getRoom(roomId);\n if (!room) {\n if (!roomData.initial) {\n logger.debug(\"initial flag not set but no stored room exists for room \", roomId, roomData);\n return;\n }\n room = _createAndReEmitRoom(this.client, roomId, this.opts);\n }\n await this.processRoomData(this.client, room!, roomData);\n }\n\n private onLifecycle(state: SlidingSyncState, resp: MSC3575SlidingSyncResponse | null, err?: Error): void {\n if (err) {\n logger.debug(\"onLifecycle\", state, err);\n }\n switch (state) {\n case SlidingSyncState.Complete:\n this.purgeNotifications();\n if (!resp) {\n break;\n }\n // Element won't stop showing the initial loading spinner unless we fire SyncState.Prepared\n if (!this.lastPos) {\n this.updateSyncState(SyncState.Prepared, {\n oldSyncToken: undefined,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n }\n // Conversely, Element won't show the room list unless there is at least 1x SyncState.Syncing\n // so hence for the very first sync we will fire prepared then immediately syncing.\n this.updateSyncState(SyncState.Syncing, {\n oldSyncToken: this.lastPos!,\n nextSyncToken: resp.pos,\n catchingUp: false,\n fromCache: false,\n });\n this.lastPos = resp.pos;\n break;\n case SlidingSyncState.RequestFinished:\n if (err) {\n this.failCount += 1;\n this.updateSyncState(\n this.failCount > FAILED_SYNC_ERROR_THRESHOLD ? SyncState.Error : SyncState.Reconnecting,\n {\n error: new MatrixError(err),\n },\n );\n if (this.shouldAbortSync(new MatrixError(err))) {\n return; // shouldAbortSync actually stops syncing too so we don't need to do anything.\n }\n } else {\n this.failCount = 0;\n }\n break;\n }\n }\n\n /**\n * Sync rooms the user has left.\n * @returns Resolved when they've been added to the store.\n */\n public async syncLeftRooms(): Promise<Room[]> {\n return []; // TODO\n }\n\n /**\n * Peek into a room. This will result in the room in question being synced so it\n * is accessible via getRooms(). Live updates for the room will be provided.\n * @param roomId - The room ID to peek into.\n * @returns A promise which resolves once the room has been added to the\n * store.\n */\n public async peek(roomId: string): Promise<Room> {\n return null!; // TODO\n }\n\n /**\n * Stop polling for updates in the peeked room. NOPs if there is no room being\n * peeked.\n */\n public stopPeeking(): void {\n // TODO\n }\n\n /**\n * Specify the set_presence value to be used for subsequent calls to the Sync API.\n * @param presence - the presence to specify to set_presence of sync calls\n */\n public setPresence(presence?: SetPresence): void {\n // TODO not possible in sliding sync yet\n }\n\n /**\n * Returns the current state of this sync object\n * @see MatrixClient#event:\"sync\"\n */\n public getSyncState(): SyncState | null {\n return this.syncState;\n }\n\n /**\n * Returns the additional data object associated with\n * the current sync state, or null if there is no\n * such data.\n * Sync errors, if available, are put in the 'error' key of\n * this object.\n */\n public getSyncStateData(): ISyncStateData | null {\n return this.syncStateData ?? null;\n }\n\n // Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts\n\n public createRoom(roomId: string): Room {\n // XXX cargoculted from sync.ts\n const { timelineSupport } = this.client;\n const room = new Room(roomId, this.client, this.client.getUserId()!, {\n lazyLoadMembers: this.opts.lazyLoadMembers,\n pendingEventOrdering: this.opts.pendingEventOrdering,\n timelineSupport,\n });\n this.client.reEmitter.reEmit(room, [\n RoomEvent.Name,\n RoomEvent.Redaction,\n RoomEvent.RedactionCancelled,\n RoomEvent.Receipt,\n RoomEvent.Tags,\n RoomEvent.LocalEchoUpdated,\n RoomEvent.AccountData,\n RoomEvent.MyMembership,\n RoomEvent.Timeline,\n RoomEvent.TimelineReset,\n ]);\n this.registerStateListeners(room);\n return room;\n }\n\n private registerStateListeners(room: Room): void {\n // XXX cargoculted from sync.ts\n // we need to also re-emit room state and room member events, so hook it up\n // to the client now. We need to add a listener for RoomState.members in\n // order to hook them correctly.\n this.client.reEmitter.reEmit(room.currentState, [\n RoomStateEvent.Events,\n RoomStateEvent.Members,\n RoomStateEvent.NewMember,\n RoomStateEvent.Update,\n ]);\n room.currentState.on(RoomStateEvent.NewMember, (event, state, member) => {\n member.user = this.client.getUser(member.userId) ?? undefined;\n this.client.reEmitter.reEmit(member, [\n RoomMemberEvent.Name,\n RoomMemberEvent.Typing,\n RoomMemberEvent.PowerLevel,\n RoomMemberEvent.Membership,\n ]);\n });\n }\n\n /*\n private deregisterStateListeners(room: Room): void { // XXX cargoculted from sync.ts\n // could do with a better way of achieving this.\n room.currentState.removeAllListeners(RoomStateEvent.Events);\n room.currentState.removeAllListeners(RoomStateEvent.Members);\n room.currentState.removeAllListeners(RoomStateEvent.NewMember);\n } */\n\n private shouldAbortSync(error: MatrixError): boolean {\n if (error.errcode === \"M_UNKNOWN_TOKEN\") {\n // The logout already happened, we just need to stop.\n logger.warn(\"Token no longer valid - assuming logout\");\n this.stop();\n this.updateSyncState(SyncState.Error, { error });\n return true;\n }\n return false;\n }\n\n private async processRoomData(client: MatrixClient, room: Room, roomData: MSC3575RoomData): Promise<void> {\n roomData = ensureNameEvent(client, room.roomId, roomData);\n const stateEvents = mapEvents(this.client, room.roomId, roomData.required_state);\n // Prevent events from being decrypted ahead of time\n // this helps large account to speed up faster\n // room::decryptCriticalEvent is in charge of decrypting all the events\n // required for a client to function properly\n let timelineEvents = mapEvents(this.client, room.roomId, roomData.timeline, false);\n const ephemeralEvents: MatrixEvent[] = []; // TODO this.mapSyncEventsFormat(joinObj.ephemeral);\n\n // TODO: handle threaded / beacon events\n\n if (roomData.initial) {\n // we should not know about any of these timeline entries if this is a genuinely new room.\n // If we do, then we've effectively done scrollback (e.g requesting timeline_limit: 1 for\n // this room, then timeline_limit: 50).\n const knownEvents = new Set<string>();\n room.getLiveTimeline()\n .getEvents()\n .forEach((e) => {\n knownEvents.add(e.getId()!);\n });\n // all unknown events BEFORE a known event must be scrollback e.g:\n // D E <-- what we know\n // A B C D E F <-- what we just received\n // means:\n // A B C <-- scrollback\n // D E <-- dupes\n // F <-- new event\n // We bucket events based on if we have seen a known event yet.\n const oldEvents: MatrixEvent[] = [];\n const newEvents: MatrixEvent[] = [];\n let seenKnownEvent = false;\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const recvEvent = timelineEvents[i];\n if (knownEvents.has(recvEvent.getId()!)) {\n seenKnownEvent = true;\n continue; // don't include this event, it's a dupe\n }\n if (seenKnownEvent) {\n // old -> new\n oldEvents.push(recvEvent);\n } else {\n // old -> new\n newEvents.unshift(recvEvent);\n }\n }\n timelineEvents = newEvents;\n if (oldEvents.length > 0) {\n // old events are scrollback, insert them now\n room.addEventsToTimeline(oldEvents, true, room.getLiveTimeline(), roomData.prev_batch);\n }\n }\n\n const encrypted = room.hasEncryptionStateEvent();\n // we do this first so it's correct when any of the events fire\n if (roomData.notification_count != null) {\n room.setUnreadNotificationCount(NotificationCountType.Total, roomData.notification_count);\n }\n\n if (roomData.highlight_count != null) {\n // We track unread notifications ourselves in encrypted rooms, so don't\n // bother setting it here. We trust our calculations better than the\n // server's for this case, and therefore will assume that our non-zero\n // count is accurate.\n if (!encrypted || (encrypted && room.getUnreadNotificationCount(NotificationCountType.Highlight) <= 0)) {\n room.setUnreadNotificationCount(NotificationCountType.Highlight, roomData.highlight_count);\n }\n }\n\n if (Number.isInteger(roomData.invited_count)) {\n room.currentState.setInvitedMemberCount(roomData.invited_count!);\n }\n if (Number.isInteger(roomData.joined_count)) {\n room.currentState.setJoinedMemberCount(roomData.joined_count!);\n }\n\n if (roomData.invite_state) {\n const inviteStateEvents = mapEvents(this.client, room.roomId, roomData.invite_state);\n await this.injectRoomEvents(room, inviteStateEvents);\n if (roomData.initial) {\n room.recalculate();\n this.client.store.storeRoom(room);\n this.client.emit(ClientEvent.Room, room);\n }\n inviteStateEvents.forEach((e) => {\n this.client.emit(ClientEvent.Event, e);\n });\n room.updateMyMembership(KnownMembership.Invite);\n return;\n }\n\n if (roomData.initial) {\n // set the back-pagination token. Do this *before* adding any\n // events so that clients can start back-paginating.\n room.getLiveTimeline().setPaginationToken(roomData.prev_batch ?? null, EventTimeline.BACKWARDS);\n }\n\n /* TODO\n else if (roomData.limited) {\n\n let limited = true;\n\n // we've got a limited sync, so we *probably* have a gap in the\n // timeline, so should reset. But we might have been peeking or\n // paginating and already have some of the events, in which\n // case we just want to append any subsequent events to the end\n // of the existing timeline.\n //\n // This is particularly important in the case that we already have\n // *all* of the events in the timeline - in that case, if we reset\n // the timeline, we'll end up with an entirely empty timeline,\n // which we'll try to paginate but not get any new events (which\n // will stop us linking the empty timeline into the chain).\n //\n for (let i = timelineEvents.length - 1; i >= 0; i--) {\n const eventId = timelineEvents[i].getId();\n if (room.getTimelineForEvent(eventId)) {\n logger.debug(\"Already have event \" + eventId + \" in limited \" +\n \"sync - not resetting\");\n limited = false;\n\n // we might still be missing some of the events before i;\n // we don't want to be adding them to the end of the\n // timeline because that would put them out of order.\n timelineEvents.splice(0, i);\n\n // XXX: there's a problem here if the skipped part of the\n // timeline modifies the state set in stateEvents, because\n // we'll end up using the state from stateEvents rather\n // than the later state from timelineEvents. We probably\n // need to wind stateEvents forward over the events we're\n // skipping.\n break;\n }\n }\n\n if (limited) {\n room.resetLiveTimeline(\n roomData.prev_batch,\n null, // TODO this.syncOpts.canResetEntireTimeline(room.roomId) ? null : syncEventData.oldSyncToken,\n );\n\n // We have to assume any gap in any timeline is\n // reason to stop incrementally tracking notifications and\n // reset the timeline.\n this.client.resetNotifTimelineSet();\n this.registerStateListeners(room);\n }\n } */\n\n await this.injectRoomEvents(room, stateEvents, timelineEvents, roomData.num_live);\n\n // we deliberately don't add ephemeral events to the timeline\n room.addEphemeralEvents(ephemeralEvents);\n\n // local fields must be set before any async calls because call site assumes\n // synchronous execution prior to emitting SlidingSyncState.Complete\n room.updateMyMembership(KnownMembership.Join);\n\n room.recalculate();\n if (roomData.initial) {\n client.store.storeRoom(room);\n client.emit(ClientEvent.Room, room);\n }\n\n // check if any timeline events should bing and add them to the notifEvents array:\n // we'll purge this once we've fully processed the sync response\n this.addNotifications(timelineEvents);\n\n const processRoomEvent = async (e: MatrixEvent): Promise<void> => {\n client.emit(ClientEvent.Event, e);\n };\n\n await promiseMapSeries(stateEvents, processRoomEvent);\n await promiseMapSeries(timelineEvents, processRoomEvent);\n ephemeralEvents.forEach(function (e) {\n client.emit(ClientEvent.Event, e);\n });\n }\n\n /**\n * Injects events into a room's model.\n * @param stateEventList - A list of state events. This is the state\n * at the *START* of the timeline list if it is supplied.\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n * @param numLive - the number of events in timelineEventList which just happened,\n * supplied from the server.\n */\n public async injectRoomEvents(\n room: Room,\n stateEventList: MatrixEvent[],\n timelineEventList?: MatrixEvent[],\n numLive?: number,\n ): Promise<void> {\n timelineEventList = timelineEventList || [];\n stateEventList = stateEventList || [];\n numLive = numLive || 0;\n\n // If there are no events in the timeline yet, initialise it with\n // the given state events\n const liveTimeline = room.getLiveTimeline();\n const timelineWasEmpty = liveTimeline.getEvents().length == 0;\n if (timelineWasEmpty) {\n // Passing these events into initialiseState will freeze them, so we need\n // to compute and cache the push actions for them now, otherwise sync dies\n // with an attempt to assign to read only property.\n // XXX: This is pretty horrible and is assuming all sorts of behaviour from\n // these functions that it shouldn't be. We should probably either store the\n // push actions cache elsewhere so we can freeze MatrixEvents, or otherwise\n // find some solution where MatrixEvents are immutable but allow for a cache\n // field.\n for (const ev of stateEventList) {\n this.client.getPushActionsForEvent(ev);\n }\n liveTimeline.initialiseState(stateEventList);\n }\n\n // If the timeline wasn't empty, we process the state events here: they're\n // defined as updates to the state before the start of the timeline, so this\n // starts to roll the state forward.\n // XXX: That's what we *should* do, but this can happen if we were previously\n // peeking in a room, in which case we obviously do *not* want to add the\n // state events here onto the end of the timeline. Historically, the js-sdk\n // has just set these new state events on the old and new state. This seems\n // very wrong because there could be events in the timeline that diverge the\n // state, in which case this is going to leave things out of sync. However,\n // for now I think it;s best to behave the same as the code has done previously.\n if (!timelineWasEmpty) {\n // XXX: As above, don't do this...\n //room.addLiveEvents(stateEventList || []);\n // Do this instead...\n room.oldState.setStateEvents(stateEventList);\n room.currentState.setStateEvents(stateEventList);\n }\n\n // the timeline is broken into 'live' events which just happened and normal timeline events\n // which are still to be appended to the end of the live timeline but happened a while ago.\n // The live events are marked as fromCache=false to ensure that downstream components know\n // this is a live event, not historical (from a remote server cache).\n\n let liveTimelineEvents: MatrixEvent[] = [];\n if (numLive > 0) {\n // last numLive events are live\n liveTimelineEvents = timelineEventList.slice(-1 * numLive);\n // everything else is not live\n timelineEventList = timelineEventList.slice(0, -1 * liveTimelineEvents.length);\n }\n\n // execute the timeline events. This will continue to diverge the current state\n // if the timeline has any state events in it.\n // This also needs to be done before running push rules on the events as they need\n // to be decorated with sender etc.\n await room.addLiveEvents(timelineEventList, {\n fromCache: true,\n });\n if (liveTimelineEvents.length > 0) {\n await room.addLiveEvents(liveTimelineEvents, {\n fromCache: false,\n });\n }\n\n room.recalculate();\n\n // resolve invites now we have set the latest state\n this.resolveInvites(room);\n }\n\n private resolveInvites(room: Room): void {\n if (!room || !this.opts.resolveInvitesToProfiles) {\n return;\n }\n const client = this.client;\n // For each invited room member we want to give them a displayname/avatar url\n // if they have one (the m.room.member invites don't contain this).\n room.getMembersWithMembership(KnownMembership.Invite).forEach(function (member) {\n if (member.requestedProfileInfo) return;\n member.requestedProfileInfo = true;\n // try to get a cached copy first.\n const user = client.getUser(member.userId);\n let promise: ReturnType<MatrixClient[\"getProfileInfo\"]>;\n if (user) {\n promise = Promise.resolve({\n avatar_url: user.avatarUrl,\n displayname: user.displayName,\n });\n } else {\n promise = client.getProfileInfo(member.userId);\n }\n promise.then(\n function (info) {\n // slightly naughty by doctoring the invite event but this means all\n // the code paths remain the same between invite/join display name stuff\n // which is a worthy trade-off for some minor pollution.\n const inviteEvent = member.events.member!;\n if (inviteEvent.getContent().membership !== KnownMembership.Invite) {\n // between resolving and now they have since joined, so don't clobber\n return;\n }\n inviteEvent.getContent().avatar_url = info.avatar_url;\n inviteEvent.getContent().displayname = info.displayname;\n // fire listeners\n member.setMembershipEvent(inviteEvent, room.currentState);\n },\n function (_err) {\n // OH WELL.\n },\n );\n });\n }\n\n public retryImmediately(): boolean {\n return true;\n }\n\n /**\n * Main entry point. Blocks until stop() is called.\n */\n public async sync(): Promise<void> {\n logger.debug(\"Sliding sync init loop\");\n\n // 1) We need to get push rules so we can check if events should bing as we get\n // them from /sync.\n while (!this.client.isGuest()) {\n try {\n logger.debug(\"Getting push rules...\");\n const result = await this.client.getPushRules();\n logger.debug(\"Got push rules\");\n this.client.pushRules = result;\n break;\n } catch (err) {\n logger.error(\"Getting push rules failed\", err);\n if (this.shouldAbortSync(<MatrixError>err)) {\n return;\n }\n }\n }\n\n // start syncing\n await this.slidingSync.start();\n }\n\n /**\n * Stops the sync object from syncing.\n */\n public stop(): void {\n logger.debug(\"SyncApi.stop\");\n this.slidingSync.stop();\n }\n\n /**\n * Sets the sync state and emits an event to say so\n * @param newState - The new state string\n * @param data - Object of additional data to emit in the event\n */\n private updateSyncState(newState: SyncState, data?: ISyncStateData): void {\n const old = this.syncState;\n this.syncState = newState;\n this.syncStateData = data;\n this.client.emit(ClientEvent.Sync, this.syncState, old, data);\n }\n\n /**\n * Takes a list of timelineEvents and adds and adds to notifEvents\n * as appropriate.\n * This must be called after the room the events belong to has been stored.\n *\n * @param timelineEventList - A list of timeline events. Lower index\n * is earlier in time. Higher index is later.\n */\n private addNotifications(timelineEventList: MatrixEvent[]): void {\n // gather our notifications into this.notifEvents\n if (!this.client.getNotifTimelineSet()) {\n return;\n }\n for (const timelineEvent of timelineEventList) {\n const pushActions = this.client.getPushActionsForEvent(timelineEvent);\n if (pushActions && pushActions.notify && pushActions.tweaks && pushActions.tweaks.highlight) {\n this.notifEvents.push(timelineEvent);\n }\n }\n }\n\n /**\n * Purge any events in the notifEvents array. Used after a /sync has been complete.\n * This should not be called at a per-room scope (e.g in onRoomData) because otherwise the ordering\n * will be messed up e.g room A gets a bing, room B gets a newer bing, but both in the same /sync\n * response. If we purge at a per-room scope then we could process room B before room A leading to\n * room B appearing earlier in the notifications timeline, even though it has the higher origin_server_ts.\n */\n private purgeNotifications(): void {\n this.notifEvents.sort(function (a, b) {\n return a.getTs() - b.getTs();\n });\n this.notifEvents.forEach((event) => {\n this.client.getNotifTimelineSet()?.addLiveEvent(event);\n });\n this.notifEvents = [];\n }\n}\n\nfunction ensureNameEvent(client: MatrixClient, roomId: string, roomData: MSC3575RoomData): MSC3575RoomData {\n // make sure m.room.name is in required_state if there is a name, replacing anything previously\n // there if need be. This ensures clients transparently 'calculate' the right room name. Native\n // sliding sync clients should just read the \"name\" field.\n if (!roomData.name) {\n return roomData;\n }\n for (const stateEvent of roomData.required_state) {\n if (stateEvent.type === EventType.RoomName && stateEvent.state_key === \"\") {\n stateEvent.content = {\n name: roomData.name,\n };\n return roomData;\n }\n }\n roomData.required_state.push({\n event_id: \"$fake-sliding-sync-name-event-\" + roomId,\n state_key: \"\",\n type: EventType.RoomName,\n content: {\n name: roomData.name,\n },\n sender: client.getUserId()!,\n origin_server_ts: new Date().getTime(),\n });\n return roomData;\n}\n\ntype TaggedEvent = (IStrippedState | IRoomEvent | IStateEvent | IMinimalEvent) & { room_id?: string };\n\n// Helper functions which set up JS SDK structs are below and are identical to the sync v2 counterparts,\n// just outside the class.\nfunction mapEvents(client: MatrixClient, roomId: string | undefined, events: object[], decrypt = true): MatrixEvent[] {\n const mapper = client.getEventMapper({ decrypt });\n return (events as TaggedEvent[]).map(function (e) {\n e.room_id = roomId;\n return mapper(e);\n });\n}\n\nfunction processEphemeralEvents(client: MatrixClient, roomId: string, ephEvents: IMinimalEvent[]): void {\n const ephemeralEvents = mapEvents(client, roomId, ephEvents);\n const room = client.getRoom(roomId);\n if (!room) {\n logger.warn(\"got ephemeral events for room but room doesn't exist on client:\", roomId);\n return;\n }\n room.addEphemeralEvents(ephemeralEvents);\n ephemeralEvents.forEach((e) => {\n client.emit(ClientEvent.Event, e);\n });\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,qBAAqB,EAAEC,IAAI,EAAEC,SAAS,QAAQ,kBAAkB;AACzE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,WAAW,QAAyC,aAAa;AAC1E,SAEIC,SAAS,EACTC,oBAAoB,EACpBC,iBAAiB,QAEd,WAAW;AAGlB,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAEIC,cAAc,EAIdC,gBAAgB,EAChBC,gBAAgB,QACb,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,mBAAmB;AAE7C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,eAAe,QAAQ,wBAAwB;;AAExD;AACA;AACA;AACA,IAAMC,2BAA2B,GAAG,CAAC;AAarC,MAAMC,iBA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,CAAAtK,MAAA,QAAAsK,SAAA,QAAAnM,SAAA,GAAAmM,SAAA,MAAG,IAAI;EACjG,IAAMkE,MAAM,GAAG/Q,MAAM,CAACkB,cAAc,CAAC;IAAE4P;EAAQ,CAAC,CAAC;EACjD,OAAQ9P,MAAM,CAAmBC,GAAG,CAAC,UAAUgC,CAAC,EAAE;IAC9CA,CAAC,CAAC+N,OAAO,GAAGvO,MAAM;IAClB,OAAOsO,MAAM,CAAC9N,CAAC,CAAC;EACpB,CAAC,CAAC;AACN;AAEA,SAASkB,sBAAsBA,CAACnE,MAAoB,EAAEyC,MAAc,EAAEwO,SAA0B,EAAQ;EACpG,IAAMpH,eAAe,GAAGjH,SAAS,CAAC5C,MAAM,EAAEyC,MAAM,EAAEwO,SAAS,CAAC;EAC5D,IAAMpO,IAAI,GAAG7C,MAAM,CAAC8C,OAAO,CAACL,MAAM,CAAC;EACnC,IAAI,CAACI,IAAI,EAAE;IACP/D,MAAM,CAACiE,IAAI,CAAC,iEAAiE,EAAEN,MAAM,CAAC;IACtF;EACJ;EACAI,IAAI,CAACyJ,kBAAkB,CAACzC,eAAe,CAAC;EACxCA,eAAe,CAACrI,OAAO,CAAEyB,CAAC,IAAK;IAC3BjD,MAAM,CAAC+B,IAAI,CAAC9C,WAAW,CAACiE,KAAK,EAAED,CAAC,CAAC;EACrC,CAAC,CAAC;AACN","ignoreList":[]}
package/lib/sync.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import type { SyncCryptoCallbacks } from "./common-crypto/CryptoBackend.ts";
2
1
  import { Room } from "./models/room.ts";
3
2
  import { IStoredClientOpts, MatrixClient, ResetTimelineCallback } from "./client.ts";
4
3
  import { MatrixEvent } from "./models/event.ts";
5
- import { Crypto } from "./crypto/index.ts";
6
4
  export declare enum SyncState {
7
5
  /** Emitted after we try to sync more than `FAILED_SYNC_ERROR_THRESHOLD`
8
6
  * times and are still failing. Or when we enounter a hard error like the
@@ -26,16 +24,6 @@ export declare enum SyncState {
26
24
  * Options passed into the constructor of SyncApi by MatrixClient
27
25
  */
28
26
  export interface SyncApiOptions {
29
- /**
30
- * Crypto manager
31
- *
32
- * @deprecated in favour of cryptoCallbacks
33
- */
34
- crypto?: Crypto;
35
- /**
36
- * If crypto is enabled on our client, callbacks into the crypto module
37
- */
38
- cryptoCallbacks?: SyncCryptoCallbacks;
39
27
  /**
40
28
  * A function which is called
41
29
  * with a room ID and returns a boolean. It should return 'true' if the SDK can
package/lib/sync.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAyB,IAAI,EAAa,MAAM,kBAAkB,CAAC;AAK1E,OAAO,EAAe,iBAAiB,EAAE,YAAY,EAAwB,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAgBxH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAgB3C,oBAAY,SAAS;IACjB;;8BAE0B;IAC1B,KAAK,UAAU;IACf;gCAC4B;IAC5B,QAAQ,aAAa;IACrB,sDAAsD;IACtD,OAAO,YAAY;IACnB,8CAA8C;IAC9C,OAAO,YAAY;IACnB,gFAAgF;IAChF,OAAO,YAAY;IACnB;;OAEG;IACH,YAAY,iBAAiB;CAChC;AAmBD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC;IAEtC;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,qBAAqB,CAAC;CAClD;AAOD,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC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C,mBAAmB;IAM3B,OAAO,CAAC,eAAe;IAQvB;;;;;;;OAOG;IACU,gBAAgB,CACzB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,WAAW,EAAE,EAC7B,iBAAiB,CAAC,EAAE,WAAW,EAAE,EACjC,SAAS,UAAQ,GAClB,OAAO,CAAC,IAAI,CAAC;IAgEhB;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,cAAc;IAMtB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAOvB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAGd;CACL;AAID,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI,CA2CjH"}
package/lib/sync.js CHANGED
@@ -170,10 +170,6 @@ export class SyncApi {
170
170
  }
171
171
  _this.opts.filter.setLazyLoadMembers(true);
172
172
  }
173
- if (_this.opts.lazyLoadMembers) {
174
- var _this$syncOpts$crypto;
175
- (_this$syncOpts$crypto = _this.syncOpts.crypto) === null || _this$syncOpts$crypto === void 0 || _this$syncOpts$crypto.enableLazyLoading();
176
- }
177
173
  }));
178
174
  _defineProperty(this, "storeClientOptions", /*#__PURE__*/_asyncToGenerator(function* () {
179
175
  try {
@@ -750,11 +746,6 @@ export class SyncApi {
750
746
  nextSyncToken: data.next_batch,
751
747
  catchingUp: _this7.catchingUp
752
748
  };
753
- if (_this7.syncOpts.crypto) {
754
- // tell the crypto module we're about to process a sync
755
- // response
756
- yield _this7.syncOpts.crypto.onSyncWillProcess(syncEventData);
757
- }
758
749
  try {
759
750
  yield _this7.processSyncResponse(syncEventData, data);
760
751
  } catch (e) {
@@ -779,24 +770,9 @@ export class SyncApi {
779
770
  syncOptions.hasSyncedBefore = true;
780
771
  }
781
772
 
782
- // tell the crypto module to do its processing. It may block (to do a
783
- // /keys/changes request).
784
- if (_this7.syncOpts.cryptoCallbacks) {
785
- yield _this7.syncOpts.cryptoCallbacks.onSyncCompleted(syncEventData);
786
- }
787
-
788
773
  // keep emitting SYNCING -> SYNCING for clients who want to do bulk updates
789
774
  _this7.updateSyncState(SyncState.Syncing, syncEventData);
790
775
  if (_this7.client.store.wantsSave()) {
791
- // We always save the device list (if it's dirty) before saving the sync data:
792
- // this means we know the saved device list data is at least as fresh as the
793
- // stored sync data which means we don't have to worry that we may have missed
794
- // device changes. We can also skip the delay since we're not calling this very
795
- // frequently (and we don't really want to delay the sync for it).
796
- if (_this7.syncOpts.crypto) {
797
- yield _this7.syncOpts.crypto.saveDeviceList(0);
798
- }
799
-
800
776
  // tell databases that everything is now in a consistent state and can be saved.
801
777
  yield _this7.client.store.save();
802
778
  }
@@ -931,7 +907,7 @@ export class SyncApi {
931
907
  processSyncResponse(syncEventData, data) {
932
908
  var _this9 = this;
933
909
  return _asyncToGenerator(function* () {
934
- var _data$presence, _data$account_data, _this9$syncOpts$crypt, _data$device_unused_f;
910
+ var _data$presence, _data$account_data;
935
911
  var client = _this9.client;
936
912
 
937
913
  // data looks like:
@@ -1020,9 +996,6 @@ export class SyncApi {
1020
996
  // handle to-device events
1021
997
  if (data.to_device && Array.isArray(data.to_device.events) && data.to_device.events.length > 0) {
1022
998
  var toDeviceMessages = data.to_device.events.filter(noUnsafeEventProps);
1023
- if (_this9.syncOpts.cryptoCallbacks) {
1024
- toDeviceMessages = yield _this9.syncOpts.cryptoCallbacks.preprocessToDeviceMessages(toDeviceMessages);
1025
- }
1026
999
  var cancelledKeyVerificationTxns = [];
1027
1000
  toDeviceMessages.map(client.getEventMapper({
1028
1001
  toDevice: true
@@ -1089,23 +1062,9 @@ export class SyncApi {
1089
1062
  // Handle invites
1090
1063
  yield promiseMapSeries(inviteRooms, /*#__PURE__*/function () {
1091
1064
  var _ref7 = _asyncToGenerator(function* (inviteObj) {
1092
- var _room$currentState$ge;
1093
1065
  var room = inviteObj.room;
1094
1066
  var stateEvents = _this9.mapSyncEventsFormat(inviteObj.invite_state, room);
1095
1067
  yield _this9.injectRoomEvents(room, stateEvents);
1096
- var inviter = (_room$currentState$ge = room.currentState.getStateEvents(EventType.RoomMember, client.getUserId())) === null || _room$currentState$ge === void 0 ? void 0 : _room$currentState$ge.getSender();
1097
- var crypto = client.crypto;
1098
- if (crypto) {
1099
- var parkedHistory = yield crypto.cryptoStore.takeParkedSharedHistory(room.roomId);
1100
- for (var parked of parkedHistory) {
1101
- if (parked.senderId === inviter) {
1102
- yield crypto.olmDevice.addInboundGroupSession(room.roomId, parked.senderKey, parked.forwardingCurve25519KeyChain, parked.sessionId, parked.sessionKey, parked.keysClaimed, true, {
1103
- sharedHistory: true,
1104
- untrusted: true
1105
- });
1106
- }
1107
- }
1108
- }
1109
1068
  if (inviteObj.isBrandNewRoom) {
1110
1069
  room.recalculate();
1111
1070
  client.store.storeRoom(room);
@@ -1238,18 +1197,6 @@ export class SyncApi {
1238
1197
  client.resetNotifTimelineSet();
1239
1198
  }
1240
1199
  }
1241
-
1242
- // process any crypto events *before* emitting the RoomStateEvent events. This
1243
- // avoids a race condition if the application tries to send a message after the
1244
- // state event is processed, but before crypto is enabled, which then causes the
1245
- // crypto layer to complain.
1246
- if (_this9.syncOpts.cryptoCallbacks) {
1247
- for (var e of stateEvents.concat(events)) {
1248
- if (e.isState() && e.getType() === EventType.RoomEncryption && e.getStateKey() === "") {
1249
- yield _this9.syncOpts.cryptoCallbacks.onCryptoEvent(room, e);
1250
- }
1251
- }
1252
- }
1253
1200
  try {
1254
1201
  yield _this9.injectRoomEvents(room, stateEvents, events, syncEventData.fromCache);
1255
1202
  } catch (e) {
@@ -1279,11 +1226,6 @@ export class SyncApi {
1279
1226
  events.forEach(emitEvent);
1280
1227
  ephemeralEvents.forEach(emitEvent);
1281
1228
  accountDataEvents.forEach(emitEvent);
1282
-
1283
- // Decrypt only the last message in all rooms to make sure we can generate a preview
1284
- // And decrypt all events after the recorded read receipt to ensure an accurate
1285
- // notification count
1286
- room.decryptCriticalEvents();
1287
1229
  });
1288
1230
  return function (_x4) {
1289
1231
  return _ref8.apply(this, arguments);
@@ -1357,20 +1299,6 @@ export class SyncApi {
1357
1299
  (_client$getNotifTimel = client.getNotifTimelineSet()) === null || _client$getNotifTimel === void 0 || _client$getNotifTimel.addLiveEvent(event);
1358
1300
  });
1359
1301
  }
1360
-
1361
- // Handle device list updates
1362
- if (data.device_lists) {
1363
- if (_this9.syncOpts.cryptoCallbacks) {
1364
- yield _this9.syncOpts.cryptoCallbacks.processDeviceLists(data.device_lists);
1365
- } else {
1366
- // FIXME if we *don't* have a crypto module, we still need to
1367
- // invalidate the device lists. But that would require a
1368
- // substantial bit of rework :/.
1369
- }
1370
- }
1371
-
1372
- // Handle one_time_keys_count and unused fallback keys
1373
- yield (_this9$syncOpts$crypt = _this9.syncOpts.cryptoCallbacks) === null || _this9$syncOpts$crypt === void 0 ? void 0 : _this9$syncOpts$crypt.processKeyCounts(data.device_one_time_keys_count, (_data$device_unused_f = data.device_unused_fallback_key_types) !== null && _data$device_unused_f !== void 0 ? _data$device_unused_f : data["org.matrix.msc2732.device_unused_fallback_key_types"]);
1374
1302
  })();
1375
1303
  }
1376
1304