@unwanted/matrix-sdk-mini 34.12.0-1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1203) hide show
  1. package/CHANGELOG.md +5910 -0
  2. package/LICENSE +177 -0
  3. package/README.md +459 -0
  4. package/git-revision.txt +1 -0
  5. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +14 -0
  6. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +1 -0
  7. package/lib/@types/AESEncryptedSecretStoragePayload.js +1 -0
  8. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +1 -0
  9. package/lib/@types/IIdentityServerProvider.d.ts +9 -0
  10. package/lib/@types/IIdentityServerProvider.d.ts.map +1 -0
  11. package/lib/@types/IIdentityServerProvider.js +1 -0
  12. package/lib/@types/IIdentityServerProvider.js.map +1 -0
  13. package/lib/@types/PushRules.d.ts +140 -0
  14. package/lib/@types/PushRules.d.ts.map +1 -0
  15. package/lib/@types/PushRules.js +94 -0
  16. package/lib/@types/PushRules.js.map +1 -0
  17. package/lib/@types/another-json.d.js +0 -0
  18. package/lib/@types/another-json.d.js.map +1 -0
  19. package/lib/@types/auth.d.ts +208 -0
  20. package/lib/@types/auth.d.ts.map +1 -0
  21. package/lib/@types/auth.js +99 -0
  22. package/lib/@types/auth.js.map +1 -0
  23. package/lib/@types/beacon.d.ts +106 -0
  24. package/lib/@types/beacon.d.ts.map +1 -0
  25. package/lib/@types/beacon.js +119 -0
  26. package/lib/@types/beacon.js.map +1 -0
  27. package/lib/@types/common.d.ts +9 -0
  28. package/lib/@types/common.d.ts.map +1 -0
  29. package/lib/@types/common.js +1 -0
  30. package/lib/@types/common.js.map +1 -0
  31. package/lib/@types/crypto.d.ts +47 -0
  32. package/lib/@types/crypto.d.ts.map +1 -0
  33. package/lib/@types/crypto.js +1 -0
  34. package/lib/@types/crypto.js.map +1 -0
  35. package/lib/@types/event.d.ts +258 -0
  36. package/lib/@types/event.d.ts.map +1 -0
  37. package/lib/@types/event.js +239 -0
  38. package/lib/@types/event.js.map +1 -0
  39. package/lib/@types/events.d.ts +92 -0
  40. package/lib/@types/events.d.ts.map +1 -0
  41. package/lib/@types/events.js +1 -0
  42. package/lib/@types/events.js.map +1 -0
  43. package/lib/@types/extensible_events.d.ts +98 -0
  44. package/lib/@types/extensible_events.d.ts.map +1 -0
  45. package/lib/@types/extensible_events.js +116 -0
  46. package/lib/@types/extensible_events.js.map +1 -0
  47. package/lib/@types/global.d.js +20 -0
  48. package/lib/@types/global.d.js.map +1 -0
  49. package/lib/@types/local_notifications.d.ts +4 -0
  50. package/lib/@types/local_notifications.d.ts.map +1 -0
  51. package/lib/@types/local_notifications.js +1 -0
  52. package/lib/@types/local_notifications.js.map +1 -0
  53. package/lib/@types/location.d.ts +60 -0
  54. package/lib/@types/location.d.ts.map +1 -0
  55. package/lib/@types/location.js +67 -0
  56. package/lib/@types/location.js.map +1 -0
  57. package/lib/@types/matrix-sdk-crypto-wasm.d.js +1 -0
  58. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -0
  59. package/lib/@types/media.d.ts +220 -0
  60. package/lib/@types/media.d.ts.map +1 -0
  61. package/lib/@types/media.js +1 -0
  62. package/lib/@types/media.js.map +1 -0
  63. package/lib/@types/membership.d.ts +41 -0
  64. package/lib/@types/membership.d.ts.map +1 -0
  65. package/lib/@types/membership.js +37 -0
  66. package/lib/@types/membership.js.map +1 -0
  67. package/lib/@types/oidc-client-ts.d.js +18 -0
  68. package/lib/@types/oidc-client-ts.d.js.map +1 -0
  69. package/lib/@types/partials.d.ts +39 -0
  70. package/lib/@types/partials.d.ts.map +1 -0
  71. package/lib/@types/partials.js +53 -0
  72. package/lib/@types/partials.js.map +1 -0
  73. package/lib/@types/polls.d.ts +88 -0
  74. package/lib/@types/polls.d.ts.map +1 -0
  75. package/lib/@types/polls.js +86 -0
  76. package/lib/@types/polls.js.map +1 -0
  77. package/lib/@types/read_receipts.d.ts +36 -0
  78. package/lib/@types/read_receipts.d.ts.map +1 -0
  79. package/lib/@types/read_receipts.js +27 -0
  80. package/lib/@types/read_receipts.js.map +1 -0
  81. package/lib/@types/registration.d.ts +85 -0
  82. package/lib/@types/registration.d.ts.map +1 -0
  83. package/lib/@types/registration.js +1 -0
  84. package/lib/@types/registration.js.map +1 -0
  85. package/lib/@types/requests.d.ts +241 -0
  86. package/lib/@types/requests.d.ts.map +1 -0
  87. package/lib/@types/requests.js +28 -0
  88. package/lib/@types/requests.js.map +1 -0
  89. package/lib/@types/search.d.ts +90 -0
  90. package/lib/@types/search.d.ts.map +1 -0
  91. package/lib/@types/search.js +30 -0
  92. package/lib/@types/search.js.map +1 -0
  93. package/lib/@types/signed.d.ts +9 -0
  94. package/lib/@types/signed.d.ts.map +1 -0
  95. package/lib/@types/signed.js +1 -0
  96. package/lib/@types/signed.js.map +1 -0
  97. package/lib/@types/spaces.d.ts +16 -0
  98. package/lib/@types/spaces.d.ts.map +1 -0
  99. package/lib/@types/spaces.js +1 -0
  100. package/lib/@types/spaces.js.map +1 -0
  101. package/lib/@types/state_events.d.ts +116 -0
  102. package/lib/@types/state_events.d.ts.map +1 -0
  103. package/lib/@types/state_events.js +1 -0
  104. package/lib/@types/state_events.js.map +1 -0
  105. package/lib/@types/synapse.d.ts +19 -0
  106. package/lib/@types/synapse.d.ts.map +1 -0
  107. package/lib/@types/synapse.js +1 -0
  108. package/lib/@types/synapse.js.map +1 -0
  109. package/lib/@types/sync.d.ts +8 -0
  110. package/lib/@types/sync.d.ts.map +1 -0
  111. package/lib/@types/sync.js +25 -0
  112. package/lib/@types/sync.js.map +1 -0
  113. package/lib/@types/threepids.d.ts +12 -0
  114. package/lib/@types/threepids.d.ts.map +1 -0
  115. package/lib/@types/threepids.js +24 -0
  116. package/lib/@types/threepids.js.map +1 -0
  117. package/lib/@types/topic.d.ts +48 -0
  118. package/lib/@types/topic.d.ts.map +1 -0
  119. package/lib/@types/topic.js +57 -0
  120. package/lib/@types/topic.js.map +1 -0
  121. package/lib/@types/uia.d.ts +12 -0
  122. package/lib/@types/uia.d.ts.map +1 -0
  123. package/lib/@types/uia.js +1 -0
  124. package/lib/@types/uia.js.map +1 -0
  125. package/lib/NamespacedValue.d.ts +33 -0
  126. package/lib/NamespacedValue.d.ts.map +1 -0
  127. package/lib/NamespacedValue.js +113 -0
  128. package/lib/NamespacedValue.js.map +1 -0
  129. package/lib/ReEmitter.d.ts +15 -0
  130. package/lib/ReEmitter.d.ts.map +1 -0
  131. package/lib/ReEmitter.js +87 -0
  132. package/lib/ReEmitter.js.map +1 -0
  133. package/lib/ToDeviceMessageQueue.d.ts +28 -0
  134. package/lib/ToDeviceMessageQueue.d.ts.map +1 -0
  135. package/lib/ToDeviceMessageQueue.js +135 -0
  136. package/lib/ToDeviceMessageQueue.js.map +1 -0
  137. package/lib/autodiscovery.d.ts +136 -0
  138. package/lib/autodiscovery.d.ts.map +1 -0
  139. package/lib/autodiscovery.js +464 -0
  140. package/lib/autodiscovery.js.map +1 -0
  141. package/lib/base64.d.ts +28 -0
  142. package/lib/base64.d.ts.map +1 -0
  143. package/lib/base64.js +88 -0
  144. package/lib/base64.js.map +1 -0
  145. package/lib/browser-index.d.ts +8 -0
  146. package/lib/browser-index.d.ts.map +1 -0
  147. package/lib/browser-index.js +35 -0
  148. package/lib/browser-index.js.map +1 -0
  149. package/lib/client.d.ts +4232 -0
  150. package/lib/client.d.ts.map +1 -0
  151. package/lib/client.js +8622 -0
  152. package/lib/client.js.map +1 -0
  153. package/lib/common-crypto/CryptoBackend.d.ts +240 -0
  154. package/lib/common-crypto/CryptoBackend.d.ts.map +1 -0
  155. package/lib/common-crypto/CryptoBackend.js +73 -0
  156. package/lib/common-crypto/CryptoBackend.js.map +1 -0
  157. package/lib/common-crypto/key-passphrase.d.ts +14 -0
  158. package/lib/common-crypto/key-passphrase.d.ts.map +1 -0
  159. package/lib/common-crypto/key-passphrase.js +33 -0
  160. package/lib/common-crypto/key-passphrase.js.map +1 -0
  161. package/lib/content-helpers.d.ts +90 -0
  162. package/lib/content-helpers.d.ts.map +1 -0
  163. package/lib/content-helpers.js +250 -0
  164. package/lib/content-helpers.js.map +1 -0
  165. package/lib/content-repo.d.ts +24 -0
  166. package/lib/content-repo.d.ts.map +1 -0
  167. package/lib/content-repo.js +104 -0
  168. package/lib/content-repo.js.map +1 -0
  169. package/lib/crypto/CrossSigning.d.ts +184 -0
  170. package/lib/crypto/CrossSigning.d.ts.map +1 -0
  171. package/lib/crypto/CrossSigning.js +718 -0
  172. package/lib/crypto/CrossSigning.js.map +1 -0
  173. package/lib/crypto/DeviceList.d.ts +216 -0
  174. package/lib/crypto/DeviceList.d.ts.map +1 -0
  175. package/lib/crypto/DeviceList.js +892 -0
  176. package/lib/crypto/DeviceList.js.map +1 -0
  177. package/lib/crypto/EncryptionSetup.d.ts +152 -0
  178. package/lib/crypto/EncryptionSetup.d.ts.map +1 -0
  179. package/lib/crypto/EncryptionSetup.js +356 -0
  180. package/lib/crypto/EncryptionSetup.js.map +1 -0
  181. package/lib/crypto/OlmDevice.d.ts +457 -0
  182. package/lib/crypto/OlmDevice.d.ts.map +1 -0
  183. package/lib/crypto/OlmDevice.js +1241 -0
  184. package/lib/crypto/OlmDevice.js.map +1 -0
  185. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +109 -0
  186. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +1 -0
  187. package/lib/crypto/OutgoingRoomKeyRequestManager.js +415 -0
  188. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +1 -0
  189. package/lib/crypto/RoomList.d.ts +26 -0
  190. package/lib/crypto/RoomList.d.ts.map +1 -0
  191. package/lib/crypto/RoomList.js +71 -0
  192. package/lib/crypto/RoomList.js.map +1 -0
  193. package/lib/crypto/SecretSharing.d.ts +24 -0
  194. package/lib/crypto/SecretSharing.d.ts.map +1 -0
  195. package/lib/crypto/SecretSharing.js +194 -0
  196. package/lib/crypto/SecretSharing.js.map +1 -0
  197. package/lib/crypto/SecretStorage.d.ts +55 -0
  198. package/lib/crypto/SecretStorage.d.ts.map +1 -0
  199. package/lib/crypto/SecretStorage.js +118 -0
  200. package/lib/crypto/SecretStorage.js.map +1 -0
  201. package/lib/crypto/aes.d.ts +6 -0
  202. package/lib/crypto/aes.d.ts.map +1 -0
  203. package/lib/crypto/aes.js +24 -0
  204. package/lib/crypto/aes.js.map +1 -0
  205. package/lib/crypto/algorithms/base.d.ts +156 -0
  206. package/lib/crypto/algorithms/base.d.ts.map +1 -0
  207. package/lib/crypto/algorithms/base.js +187 -0
  208. package/lib/crypto/algorithms/base.js.map +1 -0
  209. package/lib/crypto/algorithms/index.d.ts +4 -0
  210. package/lib/crypto/algorithms/index.d.ts.map +1 -0
  211. package/lib/crypto/algorithms/index.js +20 -0
  212. package/lib/crypto/algorithms/index.js.map +1 -0
  213. package/lib/crypto/algorithms/megolm.d.ts +385 -0
  214. package/lib/crypto/algorithms/megolm.d.ts.map +1 -0
  215. package/lib/crypto/algorithms/megolm.js +1822 -0
  216. package/lib/crypto/algorithms/megolm.js.map +1 -0
  217. package/lib/crypto/algorithms/olm.d.ts +5 -0
  218. package/lib/crypto/algorithms/olm.d.ts.map +1 -0
  219. package/lib/crypto/algorithms/olm.js +299 -0
  220. package/lib/crypto/algorithms/olm.js.map +1 -0
  221. package/lib/crypto/api.d.ts +32 -0
  222. package/lib/crypto/api.d.ts.map +1 -0
  223. package/lib/crypto/api.js +22 -0
  224. package/lib/crypto/api.js.map +1 -0
  225. package/lib/crypto/backup.d.ts +227 -0
  226. package/lib/crypto/backup.d.ts.map +1 -0
  227. package/lib/crypto/backup.js +824 -0
  228. package/lib/crypto/backup.js.map +1 -0
  229. package/lib/crypto/crypto.d.ts +3 -0
  230. package/lib/crypto/crypto.d.ts.map +1 -0
  231. package/lib/crypto/crypto.js +19 -0
  232. package/lib/crypto/crypto.js.map +1 -0
  233. package/lib/crypto/dehydration.d.ts +34 -0
  234. package/lib/crypto/dehydration.d.ts.map +1 -0
  235. package/lib/crypto/dehydration.js +252 -0
  236. package/lib/crypto/dehydration.js.map +1 -0
  237. package/lib/crypto/device-converter.d.ts +9 -0
  238. package/lib/crypto/device-converter.d.ts.map +1 -0
  239. package/lib/crypto/device-converter.js +42 -0
  240. package/lib/crypto/device-converter.js.map +1 -0
  241. package/lib/crypto/deviceinfo.d.ts +99 -0
  242. package/lib/crypto/deviceinfo.d.ts.map +1 -0
  243. package/lib/crypto/deviceinfo.js +148 -0
  244. package/lib/crypto/deviceinfo.js.map +1 -0
  245. package/lib/crypto/index.d.ts +1209 -0
  246. package/lib/crypto/index.d.ts.map +1 -0
  247. package/lib/crypto/index.js +4097 -0
  248. package/lib/crypto/index.js.map +1 -0
  249. package/lib/crypto/key_passphrase.d.ts +14 -0
  250. package/lib/crypto/key_passphrase.d.ts.map +1 -0
  251. package/lib/crypto/key_passphrase.js +44 -0
  252. package/lib/crypto/key_passphrase.js.map +1 -0
  253. package/lib/crypto/keybackup.d.ts +18 -0
  254. package/lib/crypto/keybackup.d.ts.map +1 -0
  255. package/lib/crypto/keybackup.js +1 -0
  256. package/lib/crypto/keybackup.js.map +1 -0
  257. package/lib/crypto/olmlib.d.ts +129 -0
  258. package/lib/crypto/olmlib.d.ts.map +1 -0
  259. package/lib/crypto/olmlib.js +492 -0
  260. package/lib/crypto/olmlib.js.map +1 -0
  261. package/lib/crypto/recoverykey.d.ts +2 -0
  262. package/lib/crypto/recoverykey.d.ts.map +1 -0
  263. package/lib/crypto/recoverykey.js +19 -0
  264. package/lib/crypto/recoverykey.js.map +1 -0
  265. package/lib/crypto/store/base.d.ts +252 -0
  266. package/lib/crypto/store/base.d.ts.map +1 -0
  267. package/lib/crypto/store/base.js +64 -0
  268. package/lib/crypto/store/base.js.map +1 -0
  269. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +187 -0
  270. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +1 -0
  271. package/lib/crypto/store/indexeddb-crypto-store-backend.js +1145 -0
  272. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -0
  273. package/lib/crypto/store/indexeddb-crypto-store.d.ts +432 -0
  274. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +1 -0
  275. package/lib/crypto/store/indexeddb-crypto-store.js +728 -0
  276. package/lib/crypto/store/indexeddb-crypto-store.js.map +1 -0
  277. package/lib/crypto/store/localStorage-crypto-store.d.ts +119 -0
  278. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +1 -0
  279. package/lib/crypto/store/localStorage-crypto-store.js +531 -0
  280. package/lib/crypto/store/localStorage-crypto-store.js.map +1 -0
  281. package/lib/crypto/store/memory-crypto-store.d.ts +215 -0
  282. package/lib/crypto/store/memory-crypto-store.d.ts.map +1 -0
  283. package/lib/crypto/store/memory-crypto-store.js +622 -0
  284. package/lib/crypto/store/memory-crypto-store.js.map +1 -0
  285. package/lib/crypto/verification/Base.d.ts +105 -0
  286. package/lib/crypto/verification/Base.d.ts.map +1 -0
  287. package/lib/crypto/verification/Base.js +372 -0
  288. package/lib/crypto/verification/Base.js.map +1 -0
  289. package/lib/crypto/verification/Error.d.ts +35 -0
  290. package/lib/crypto/verification/Error.d.ts.map +1 -0
  291. package/lib/crypto/verification/Error.js +86 -0
  292. package/lib/crypto/verification/Error.js.map +1 -0
  293. package/lib/crypto/verification/IllegalMethod.d.ts +15 -0
  294. package/lib/crypto/verification/IllegalMethod.d.ts.map +1 -0
  295. package/lib/crypto/verification/IllegalMethod.js +43 -0
  296. package/lib/crypto/verification/IllegalMethod.js.map +1 -0
  297. package/lib/crypto/verification/QRCode.d.ts +51 -0
  298. package/lib/crypto/verification/QRCode.d.ts.map +1 -0
  299. package/lib/crypto/verification/QRCode.js +277 -0
  300. package/lib/crypto/verification/QRCode.js.map +1 -0
  301. package/lib/crypto/verification/SAS.d.ts +27 -0
  302. package/lib/crypto/verification/SAS.d.ts.map +1 -0
  303. package/lib/crypto/verification/SAS.js +485 -0
  304. package/lib/crypto/verification/SAS.js.map +1 -0
  305. package/lib/crypto/verification/SASDecimal.d.ts +8 -0
  306. package/lib/crypto/verification/SASDecimal.d.ts.map +1 -0
  307. package/lib/crypto/verification/SASDecimal.js +34 -0
  308. package/lib/crypto/verification/SASDecimal.js.map +1 -0
  309. package/lib/crypto/verification/request/Channel.d.ts +18 -0
  310. package/lib/crypto/verification/request/Channel.d.ts.map +1 -0
  311. package/lib/crypto/verification/request/Channel.js +1 -0
  312. package/lib/crypto/verification/request/Channel.js.map +1 -0
  313. package/lib/crypto/verification/request/InRoomChannel.d.ts +113 -0
  314. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +1 -0
  315. package/lib/crypto/verification/request/InRoomChannel.js +351 -0
  316. package/lib/crypto/verification/request/InRoomChannel.js.map +1 -0
  317. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +105 -0
  318. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +1 -0
  319. package/lib/crypto/verification/request/ToDeviceChannel.js +328 -0
  320. package/lib/crypto/verification/request/ToDeviceChannel.js.map +1 -0
  321. package/lib/crypto/verification/request/VerificationRequest.d.ts +227 -0
  322. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +1 -0
  323. package/lib/crypto/verification/request/VerificationRequest.js +937 -0
  324. package/lib/crypto/verification/request/VerificationRequest.js.map +1 -0
  325. package/lib/crypto-api/CryptoEvent.d.ts +69 -0
  326. package/lib/crypto-api/CryptoEvent.d.ts.map +1 -0
  327. package/lib/crypto-api/CryptoEvent.js +33 -0
  328. package/lib/crypto-api/CryptoEvent.js.map +1 -0
  329. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +16 -0
  330. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +1 -0
  331. package/lib/crypto-api/CryptoEventHandlerMap.js +22 -0
  332. package/lib/crypto-api/CryptoEventHandlerMap.js.map +1 -0
  333. package/lib/crypto-api/index.d.ts +978 -0
  334. package/lib/crypto-api/index.d.ts.map +1 -0
  335. package/lib/crypto-api/index.js +304 -0
  336. package/lib/crypto-api/index.js.map +1 -0
  337. package/lib/crypto-api/key-passphrase.d.ts +11 -0
  338. package/lib/crypto-api/key-passphrase.d.ts.map +1 -0
  339. package/lib/crypto-api/key-passphrase.js +51 -0
  340. package/lib/crypto-api/key-passphrase.js.map +1 -0
  341. package/lib/crypto-api/keybackup.d.ts +88 -0
  342. package/lib/crypto-api/keybackup.d.ts.map +1 -0
  343. package/lib/crypto-api/keybackup.js +1 -0
  344. package/lib/crypto-api/keybackup.js.map +1 -0
  345. package/lib/crypto-api/recovery-key.d.ts +11 -0
  346. package/lib/crypto-api/recovery-key.d.ts.map +1 -0
  347. package/lib/crypto-api/recovery-key.js +65 -0
  348. package/lib/crypto-api/recovery-key.js.map +1 -0
  349. package/lib/crypto-api/verification.d.ts +344 -0
  350. package/lib/crypto-api/verification.d.ts.map +1 -0
  351. package/lib/crypto-api/verification.js +91 -0
  352. package/lib/crypto-api/verification.js.map +1 -0
  353. package/lib/digest.d.ts +10 -0
  354. package/lib/digest.d.ts.map +1 -0
  355. package/lib/digest.js +40 -0
  356. package/lib/digest.js.map +1 -0
  357. package/lib/embedded.d.ts +143 -0
  358. package/lib/embedded.d.ts.map +1 -0
  359. package/lib/embedded.js +567 -0
  360. package/lib/embedded.js.map +1 -0
  361. package/lib/errors.d.ts +24 -0
  362. package/lib/errors.d.ts.map +1 -0
  363. package/lib/errors.js +51 -0
  364. package/lib/errors.js.map +1 -0
  365. package/lib/event-mapper.d.ts +10 -0
  366. package/lib/event-mapper.d.ts.map +1 -0
  367. package/lib/event-mapper.js +81 -0
  368. package/lib/event-mapper.js.map +1 -0
  369. package/lib/extensible_events_v1/ExtensibleEvent.d.ts +38 -0
  370. package/lib/extensible_events_v1/ExtensibleEvent.d.ts.map +1 -0
  371. package/lib/extensible_events_v1/ExtensibleEvent.js +57 -0
  372. package/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -0
  373. package/lib/extensible_events_v1/InvalidEventError.d.ts +7 -0
  374. package/lib/extensible_events_v1/InvalidEventError.d.ts.map +1 -0
  375. package/lib/extensible_events_v1/InvalidEventError.js +25 -0
  376. package/lib/extensible_events_v1/InvalidEventError.js.map +1 -0
  377. package/lib/extensible_events_v1/MessageEvent.d.ts +45 -0
  378. package/lib/extensible_events_v1/MessageEvent.d.ts.map +1 -0
  379. package/lib/extensible_events_v1/MessageEvent.js +134 -0
  380. package/lib/extensible_events_v1/MessageEvent.js.map +1 -0
  381. package/lib/extensible_events_v1/PollEndEvent.d.ts +33 -0
  382. package/lib/extensible_events_v1/PollEndEvent.d.ts.map +1 -0
  383. package/lib/extensible_events_v1/PollEndEvent.js +88 -0
  384. package/lib/extensible_events_v1/PollEndEvent.js.map +1 -0
  385. package/lib/extensible_events_v1/PollResponseEvent.d.ts +49 -0
  386. package/lib/extensible_events_v1/PollResponseEvent.d.ts.map +1 -0
  387. package/lib/extensible_events_v1/PollResponseEvent.js +135 -0
  388. package/lib/extensible_events_v1/PollResponseEvent.js.map +1 -0
  389. package/lib/extensible_events_v1/PollStartEvent.d.ts +71 -0
  390. package/lib/extensible_events_v1/PollStartEvent.d.ts.map +1 -0
  391. package/lib/extensible_events_v1/PollStartEvent.js +185 -0
  392. package/lib/extensible_events_v1/PollStartEvent.js.map +1 -0
  393. package/lib/extensible_events_v1/utilities.d.ts +14 -0
  394. package/lib/extensible_events_v1/utilities.d.ts.map +1 -0
  395. package/lib/extensible_events_v1/utilities.js +34 -0
  396. package/lib/extensible_events_v1/utilities.js.map +1 -0
  397. package/lib/feature.d.ts +20 -0
  398. package/lib/feature.d.ts.map +1 -0
  399. package/lib/feature.js +85 -0
  400. package/lib/feature.js.map +1 -0
  401. package/lib/filter-component.d.ts +64 -0
  402. package/lib/filter-component.d.ts.map +1 -0
  403. package/lib/filter-component.js +167 -0
  404. package/lib/filter-component.js.map +1 -0
  405. package/lib/filter.d.ts +97 -0
  406. package/lib/filter.d.ts.map +1 -0
  407. package/lib/filter.js +207 -0
  408. package/lib/filter.js.map +1 -0
  409. package/lib/http-api/errors.d.ts +80 -0
  410. package/lib/http-api/errors.d.ts.map +1 -0
  411. package/lib/http-api/errors.js +185 -0
  412. package/lib/http-api/errors.js.map +1 -0
  413. package/lib/http-api/fetch.d.ts +114 -0
  414. package/lib/http-api/fetch.d.ts.map +1 -0
  415. package/lib/http-api/fetch.js +346 -0
  416. package/lib/http-api/fetch.js.map +1 -0
  417. package/lib/http-api/index.d.ts +33 -0
  418. package/lib/http-api/index.d.ts.map +1 -0
  419. package/lib/http-api/index.js +180 -0
  420. package/lib/http-api/index.js.map +1 -0
  421. package/lib/http-api/interface.d.ts +142 -0
  422. package/lib/http-api/interface.d.ts.map +1 -0
  423. package/lib/http-api/interface.js +35 -0
  424. package/lib/http-api/interface.js.map +1 -0
  425. package/lib/http-api/method.d.ts +10 -0
  426. package/lib/http-api/method.d.ts.map +1 -0
  427. package/lib/http-api/method.js +27 -0
  428. package/lib/http-api/method.js.map +1 -0
  429. package/lib/http-api/prefix.d.ts +31 -0
  430. package/lib/http-api/prefix.d.ts.map +1 -0
  431. package/lib/http-api/prefix.js +32 -0
  432. package/lib/http-api/prefix.js.map +1 -0
  433. package/lib/http-api/utils.d.ts +37 -0
  434. package/lib/http-api/utils.d.ts.map +1 -0
  435. package/lib/http-api/utils.js +178 -0
  436. package/lib/http-api/utils.js.map +1 -0
  437. package/lib/index.d.ts +4 -0
  438. package/lib/index.d.ts.map +1 -0
  439. package/lib/index.js +24 -0
  440. package/lib/index.js.map +1 -0
  441. package/lib/indexeddb-helpers.d.ts +10 -0
  442. package/lib/indexeddb-helpers.d.ts.map +1 -0
  443. package/lib/indexeddb-helpers.js +51 -0
  444. package/lib/indexeddb-helpers.js.map +1 -0
  445. package/lib/indexeddb-worker.d.ts +7 -0
  446. package/lib/indexeddb-worker.d.ts.map +1 -0
  447. package/lib/indexeddb-worker.js +25 -0
  448. package/lib/indexeddb-worker.js.map +1 -0
  449. package/lib/interactive-auth.d.ts +337 -0
  450. package/lib/interactive-auth.d.ts.map +1 -0
  451. package/lib/interactive-auth.js +557 -0
  452. package/lib/interactive-auth.js.map +1 -0
  453. package/lib/logger.d.ts +81 -0
  454. package/lib/logger.d.ts.map +1 -0
  455. package/lib/logger.js +139 -0
  456. package/lib/logger.js.map +1 -0
  457. package/lib/matrix.d.ts +118 -0
  458. package/lib/matrix.d.ts.map +1 -0
  459. package/lib/matrix.js +146 -0
  460. package/lib/matrix.js.map +1 -0
  461. package/lib/matrixrtc/CallMembership.d.ts +66 -0
  462. package/lib/matrixrtc/CallMembership.d.ts.map +1 -0
  463. package/lib/matrixrtc/CallMembership.js +197 -0
  464. package/lib/matrixrtc/CallMembership.js.map +1 -0
  465. package/lib/matrixrtc/LivekitFocus.d.ts +16 -0
  466. package/lib/matrixrtc/LivekitFocus.d.ts.map +1 -0
  467. package/lib/matrixrtc/LivekitFocus.js +20 -0
  468. package/lib/matrixrtc/LivekitFocus.js.map +1 -0
  469. package/lib/matrixrtc/MatrixRTCSession.d.ts +295 -0
  470. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -0
  471. package/lib/matrixrtc/MatrixRTCSession.js +1043 -0
  472. package/lib/matrixrtc/MatrixRTCSession.js.map +1 -0
  473. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +40 -0
  474. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +1 -0
  475. package/lib/matrixrtc/MatrixRTCSessionManager.js +146 -0
  476. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -0
  477. package/lib/matrixrtc/focus.d.ts +10 -0
  478. package/lib/matrixrtc/focus.d.ts.map +1 -0
  479. package/lib/matrixrtc/focus.js +1 -0
  480. package/lib/matrixrtc/focus.js.map +1 -0
  481. package/lib/matrixrtc/index.d.ts +7 -0
  482. package/lib/matrixrtc/index.d.ts.map +1 -0
  483. package/lib/matrixrtc/index.js +21 -0
  484. package/lib/matrixrtc/index.js.map +1 -0
  485. package/lib/matrixrtc/types.d.ts +19 -0
  486. package/lib/matrixrtc/types.d.ts.map +1 -0
  487. package/lib/matrixrtc/types.js +1 -0
  488. package/lib/matrixrtc/types.js.map +1 -0
  489. package/lib/models/MSC3089Branch.d.ts +98 -0
  490. package/lib/models/MSC3089Branch.d.ts.map +1 -0
  491. package/lib/models/MSC3089Branch.js +240 -0
  492. package/lib/models/MSC3089Branch.js.map +1 -0
  493. package/lib/models/MSC3089TreeSpace.d.ts +165 -0
  494. package/lib/models/MSC3089TreeSpace.d.ts.map +1 -0
  495. package/lib/models/MSC3089TreeSpace.js +520 -0
  496. package/lib/models/MSC3089TreeSpace.js.map +1 -0
  497. package/lib/models/ToDeviceMessage.d.ts +17 -0
  498. package/lib/models/ToDeviceMessage.d.ts.map +1 -0
  499. package/lib/models/ToDeviceMessage.js +1 -0
  500. package/lib/models/ToDeviceMessage.js.map +1 -0
  501. package/lib/models/beacon.d.ts +53 -0
  502. package/lib/models/beacon.d.ts.map +1 -0
  503. package/lib/models/beacon.js +174 -0
  504. package/lib/models/beacon.js.map +1 -0
  505. package/lib/models/compare-event-ordering.d.ts +24 -0
  506. package/lib/models/compare-event-ordering.d.ts.map +1 -0
  507. package/lib/models/compare-event-ordering.js +120 -0
  508. package/lib/models/compare-event-ordering.js.map +1 -0
  509. package/lib/models/device.d.ts +45 -0
  510. package/lib/models/device.d.ts.map +1 -0
  511. package/lib/models/device.js +77 -0
  512. package/lib/models/device.js.map +1 -0
  513. package/lib/models/event-context.d.ts +62 -0
  514. package/lib/models/event-context.d.ts.map +1 -0
  515. package/lib/models/event-context.js +113 -0
  516. package/lib/models/event-context.js.map +1 -0
  517. package/lib/models/event-status.d.ts +19 -0
  518. package/lib/models/event-status.d.ts.map +1 -0
  519. package/lib/models/event-status.js +30 -0
  520. package/lib/models/event-status.js.map +1 -0
  521. package/lib/models/event-timeline-set.d.ts +312 -0
  522. package/lib/models/event-timeline-set.d.ts.map +1 -0
  523. package/lib/models/event-timeline-set.js +813 -0
  524. package/lib/models/event-timeline-set.js.map +1 -0
  525. package/lib/models/event-timeline.d.ts +219 -0
  526. package/lib/models/event-timeline.d.ts.map +1 -0
  527. package/lib/models/event-timeline.js +455 -0
  528. package/lib/models/event-timeline.js.map +1 -0
  529. package/lib/models/event.d.ts +811 -0
  530. package/lib/models/event.d.ts.map +1 -0
  531. package/lib/models/event.js +1520 -0
  532. package/lib/models/event.js.map +1 -0
  533. package/lib/models/invites-ignorer.d.ts +136 -0
  534. package/lib/models/invites-ignorer.d.ts.map +1 -0
  535. package/lib/models/invites-ignorer.js +382 -0
  536. package/lib/models/invites-ignorer.js.map +1 -0
  537. package/lib/models/poll.d.ts +67 -0
  538. package/lib/models/poll.d.ts.map +1 -0
  539. package/lib/models/poll.js +241 -0
  540. package/lib/models/poll.js.map +1 -0
  541. package/lib/models/profile-keys.d.ts +8 -0
  542. package/lib/models/profile-keys.d.ts.map +1 -0
  543. package/lib/models/profile-keys.js +8 -0
  544. package/lib/models/profile-keys.js.map +1 -0
  545. package/lib/models/read-receipt.d.ts +115 -0
  546. package/lib/models/read-receipt.d.ts.map +1 -0
  547. package/lib/models/read-receipt.js +366 -0
  548. package/lib/models/read-receipt.js.map +1 -0
  549. package/lib/models/related-relations.d.ts +11 -0
  550. package/lib/models/related-relations.d.ts.map +1 -0
  551. package/lib/models/related-relations.js +33 -0
  552. package/lib/models/related-relations.js.map +1 -0
  553. package/lib/models/relations-container.d.ts +44 -0
  554. package/lib/models/relations-container.d.ts.map +1 -0
  555. package/lib/models/relations-container.js +132 -0
  556. package/lib/models/relations-container.js.map +1 -0
  557. package/lib/models/relations.d.ts +114 -0
  558. package/lib/models/relations.d.ts.map +1 -0
  559. package/lib/models/relations.js +354 -0
  560. package/lib/models/relations.js.map +1 -0
  561. package/lib/models/room-member.d.ts +204 -0
  562. package/lib/models/room-member.d.ts.map +1 -0
  563. package/lib/models/room-member.js +360 -0
  564. package/lib/models/room-member.js.map +1 -0
  565. package/lib/models/room-receipts.d.ts +39 -0
  566. package/lib/models/room-receipts.d.ts.map +1 -0
  567. package/lib/models/room-receipts.js +392 -0
  568. package/lib/models/room-receipts.js.map +1 -0
  569. package/lib/models/room-state.d.ts +468 -0
  570. package/lib/models/room-state.d.ts.map +1 -0
  571. package/lib/models/room-state.js +984 -0
  572. package/lib/models/room-state.js.map +1 -0
  573. package/lib/models/room-summary.d.ts +29 -0
  574. package/lib/models/room-summary.d.ts.map +1 -0
  575. package/lib/models/room-summary.js +28 -0
  576. package/lib/models/room-summary.js.map +1 -0
  577. package/lib/models/room.d.ts +1203 -0
  578. package/lib/models/room.d.ts.map +1 -0
  579. package/lib/models/room.js +3336 -0
  580. package/lib/models/room.js.map +1 -0
  581. package/lib/models/search-result.d.ts +20 -0
  582. package/lib/models/search-result.d.ts.map +1 -0
  583. package/lib/models/search-result.js +52 -0
  584. package/lib/models/search-result.js.map +1 -0
  585. package/lib/models/thread.d.ts +246 -0
  586. package/lib/models/thread.d.ts.map +1 -0
  587. package/lib/models/thread.js +861 -0
  588. package/lib/models/thread.js.map +1 -0
  589. package/lib/models/typed-event-emitter.d.ts +157 -0
  590. package/lib/models/typed-event-emitter.d.ts.map +1 -0
  591. package/lib/models/typed-event-emitter.js +227 -0
  592. package/lib/models/typed-event-emitter.js.map +1 -0
  593. package/lib/models/user.d.ts +195 -0
  594. package/lib/models/user.d.ts.map +1 -0
  595. package/lib/models/user.js +218 -0
  596. package/lib/models/user.js.map +1 -0
  597. package/lib/oidc/authorize.d.ts +90 -0
  598. package/lib/oidc/authorize.d.ts.map +1 -0
  599. package/lib/oidc/authorize.js +278 -0
  600. package/lib/oidc/authorize.js.map +1 -0
  601. package/lib/oidc/discovery.d.ts +14 -0
  602. package/lib/oidc/discovery.d.ts.map +1 -0
  603. package/lib/oidc/discovery.js +66 -0
  604. package/lib/oidc/discovery.js.map +1 -0
  605. package/lib/oidc/error.d.ts +18 -0
  606. package/lib/oidc/error.d.ts.map +1 -0
  607. package/lib/oidc/error.js +35 -0
  608. package/lib/oidc/error.js.map +1 -0
  609. package/lib/oidc/index.d.ts +17 -0
  610. package/lib/oidc/index.d.ts.map +1 -0
  611. package/lib/oidc/index.js +29 -0
  612. package/lib/oidc/index.js.map +1 -0
  613. package/lib/oidc/register.d.ts +43 -0
  614. package/lib/oidc/register.d.ts.map +1 -0
  615. package/lib/oidc/register.js +96 -0
  616. package/lib/oidc/register.js.map +1 -0
  617. package/lib/oidc/tokenRefresher.d.ts +69 -0
  618. package/lib/oidc/tokenRefresher.d.ts.map +1 -0
  619. package/lib/oidc/tokenRefresher.js +148 -0
  620. package/lib/oidc/tokenRefresher.js.map +1 -0
  621. package/lib/oidc/validate.d.ts +90 -0
  622. package/lib/oidc/validate.d.ts.map +1 -0
  623. package/lib/oidc/validate.js +194 -0
  624. package/lib/oidc/validate.js.map +1 -0
  625. package/lib/pushprocessor.d.ts +128 -0
  626. package/lib/pushprocessor.d.ts.map +1 -0
  627. package/lib/pushprocessor.js +685 -0
  628. package/lib/pushprocessor.js.map +1 -0
  629. package/lib/randomstring.d.ts +5 -0
  630. package/lib/randomstring.d.ts.map +1 -0
  631. package/lib/randomstring.js +43 -0
  632. package/lib/randomstring.js.map +1 -0
  633. package/lib/realtime-callbacks.d.ts +18 -0
  634. package/lib/realtime-callbacks.d.ts.map +1 -0
  635. package/lib/realtime-callbacks.js +177 -0
  636. package/lib/realtime-callbacks.js.map +1 -0
  637. package/lib/receipt-accumulator.d.ts +51 -0
  638. package/lib/receipt-accumulator.d.ts.map +1 -0
  639. package/lib/receipt-accumulator.js +164 -0
  640. package/lib/receipt-accumulator.js.map +1 -0
  641. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +112 -0
  642. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -0
  643. package/lib/rendezvous/MSC4108SignInWithQR.js +392 -0
  644. package/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -0
  645. package/lib/rendezvous/RendezvousChannel.d.ts +27 -0
  646. package/lib/rendezvous/RendezvousChannel.d.ts.map +1 -0
  647. package/lib/rendezvous/RendezvousChannel.js +1 -0
  648. package/lib/rendezvous/RendezvousChannel.js.map +1 -0
  649. package/lib/rendezvous/RendezvousCode.d.ts +9 -0
  650. package/lib/rendezvous/RendezvousCode.d.ts.map +1 -0
  651. package/lib/rendezvous/RendezvousCode.js +1 -0
  652. package/lib/rendezvous/RendezvousCode.js.map +1 -0
  653. package/lib/rendezvous/RendezvousError.d.ts +6 -0
  654. package/lib/rendezvous/RendezvousError.d.ts.map +1 -0
  655. package/lib/rendezvous/RendezvousError.js +23 -0
  656. package/lib/rendezvous/RendezvousError.js.map +1 -0
  657. package/lib/rendezvous/RendezvousFailureReason.d.ts +31 -0
  658. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +1 -0
  659. package/lib/rendezvous/RendezvousFailureReason.js +38 -0
  660. package/lib/rendezvous/RendezvousFailureReason.js.map +1 -0
  661. package/lib/rendezvous/RendezvousIntent.d.ts +5 -0
  662. package/lib/rendezvous/RendezvousIntent.d.ts.map +1 -0
  663. package/lib/rendezvous/RendezvousIntent.js +22 -0
  664. package/lib/rendezvous/RendezvousIntent.js.map +1 -0
  665. package/lib/rendezvous/RendezvousTransport.d.ts +36 -0
  666. package/lib/rendezvous/RendezvousTransport.d.ts.map +1 -0
  667. package/lib/rendezvous/RendezvousTransport.js +1 -0
  668. package/lib/rendezvous/RendezvousTransport.js.map +1 -0
  669. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +58 -0
  670. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +1 -0
  671. package/lib/rendezvous/channels/MSC4108SecureChannel.js +246 -0
  672. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -0
  673. package/lib/rendezvous/channels/index.d.ts +2 -0
  674. package/lib/rendezvous/channels/index.d.ts.map +1 -0
  675. package/lib/rendezvous/channels/index.js +18 -0
  676. package/lib/rendezvous/channels/index.js.map +1 -0
  677. package/lib/rendezvous/index.d.ts +10 -0
  678. package/lib/rendezvous/index.d.ts.map +1 -0
  679. package/lib/rendezvous/index.js +23 -0
  680. package/lib/rendezvous/index.js.map +1 -0
  681. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +61 -0
  682. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +1 -0
  683. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +253 -0
  684. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -0
  685. package/lib/rendezvous/transports/index.d.ts +2 -0
  686. package/lib/rendezvous/transports/index.d.ts.map +1 -0
  687. package/lib/rendezvous/transports/index.js +18 -0
  688. package/lib/rendezvous/transports/index.js.map +1 -0
  689. package/lib/room-hierarchy.d.ts +35 -0
  690. package/lib/room-hierarchy.d.ts.map +1 -0
  691. package/lib/room-hierarchy.js +136 -0
  692. package/lib/room-hierarchy.js.map +1 -0
  693. package/lib/rust-crypto/CrossSigningIdentity.d.ts +33 -0
  694. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +1 -0
  695. package/lib/rust-crypto/CrossSigningIdentity.js +157 -0
  696. package/lib/rust-crypto/CrossSigningIdentity.js.map +1 -0
  697. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +98 -0
  698. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +1 -0
  699. package/lib/rust-crypto/DehydratedDeviceManager.js +285 -0
  700. package/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -0
  701. package/lib/rust-crypto/KeyClaimManager.d.ts +33 -0
  702. package/lib/rust-crypto/KeyClaimManager.d.ts.map +1 -0
  703. package/lib/rust-crypto/KeyClaimManager.js +82 -0
  704. package/lib/rust-crypto/KeyClaimManager.js.map +1 -0
  705. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +43 -0
  706. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -0
  707. package/lib/rust-crypto/OutgoingRequestProcessor.js +195 -0
  708. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -0
  709. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +47 -0
  710. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +1 -0
  711. package/lib/rust-crypto/OutgoingRequestsManager.js +148 -0
  712. package/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -0
  713. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +120 -0
  714. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +1 -0
  715. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +467 -0
  716. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -0
  717. package/lib/rust-crypto/RoomEncryptor.d.ts +98 -0
  718. package/lib/rust-crypto/RoomEncryptor.d.ts.map +1 -0
  719. package/lib/rust-crypto/RoomEncryptor.js +299 -0
  720. package/lib/rust-crypto/RoomEncryptor.js.map +1 -0
  721. package/lib/rust-crypto/backup.d.ts +254 -0
  722. package/lib/rust-crypto/backup.d.ts.map +1 -0
  723. package/lib/rust-crypto/backup.js +837 -0
  724. package/lib/rust-crypto/backup.js.map +1 -0
  725. package/lib/rust-crypto/constants.d.ts +3 -0
  726. package/lib/rust-crypto/constants.d.ts.map +1 -0
  727. package/lib/rust-crypto/constants.js +19 -0
  728. package/lib/rust-crypto/constants.js.map +1 -0
  729. package/lib/rust-crypto/device-converter.d.ts +28 -0
  730. package/lib/rust-crypto/device-converter.d.ts.map +1 -0
  731. package/lib/rust-crypto/device-converter.js +123 -0
  732. package/lib/rust-crypto/device-converter.js.map +1 -0
  733. package/lib/rust-crypto/index.d.ts +61 -0
  734. package/lib/rust-crypto/index.d.ts.map +1 -0
  735. package/lib/rust-crypto/index.js +152 -0
  736. package/lib/rust-crypto/index.js.map +1 -0
  737. package/lib/rust-crypto/libolm_migration.d.ts +81 -0
  738. package/lib/rust-crypto/libolm_migration.d.ts.map +1 -0
  739. package/lib/rust-crypto/libolm_migration.js +459 -0
  740. package/lib/rust-crypto/libolm_migration.js.map +1 -0
  741. package/lib/rust-crypto/rust-crypto.d.ts +556 -0
  742. package/lib/rust-crypto/rust-crypto.d.ts.map +1 -0
  743. package/lib/rust-crypto/rust-crypto.js +2016 -0
  744. package/lib/rust-crypto/rust-crypto.js.map +1 -0
  745. package/lib/rust-crypto/secret-storage.d.ts +22 -0
  746. package/lib/rust-crypto/secret-storage.d.ts.map +1 -0
  747. package/lib/rust-crypto/secret-storage.js +63 -0
  748. package/lib/rust-crypto/secret-storage.js.map +1 -0
  749. package/lib/rust-crypto/verification.d.ts +319 -0
  750. package/lib/rust-crypto/verification.d.ts.map +1 -0
  751. package/lib/rust-crypto/verification.js +816 -0
  752. package/lib/rust-crypto/verification.js.map +1 -0
  753. package/lib/scheduler.d.ts +132 -0
  754. package/lib/scheduler.d.ts.map +1 -0
  755. package/lib/scheduler.js +259 -0
  756. package/lib/scheduler.js.map +1 -0
  757. package/lib/secret-storage.d.ts +370 -0
  758. package/lib/secret-storage.d.ts.map +1 -0
  759. package/lib/secret-storage.js +466 -0
  760. package/lib/secret-storage.js.map +1 -0
  761. package/lib/serverCapabilities.d.ts +72 -0
  762. package/lib/serverCapabilities.d.ts.map +1 -0
  763. package/lib/serverCapabilities.js +105 -0
  764. package/lib/serverCapabilities.js.map +1 -0
  765. package/lib/service-types.d.ts +5 -0
  766. package/lib/service-types.d.ts.map +1 -0
  767. package/lib/service-types.js +22 -0
  768. package/lib/service-types.js.map +1 -0
  769. package/lib/sliding-sync-sdk.d.ts +107 -0
  770. package/lib/sliding-sync-sdk.d.ts.map +1 -0
  771. package/lib/sliding-sync-sdk.js +903 -0
  772. package/lib/sliding-sync-sdk.js.map +1 -0
  773. package/lib/sliding-sync.d.ts +343 -0
  774. package/lib/sliding-sync.d.ts.map +1 -0
  775. package/lib/sliding-sync.js +817 -0
  776. package/lib/sliding-sync.js.map +1 -0
  777. package/lib/store/index.d.ts +201 -0
  778. package/lib/store/index.d.ts.map +1 -0
  779. package/lib/store/index.js +1 -0
  780. package/lib/store/index.js.map +1 -0
  781. package/lib/store/indexeddb-backend.d.ts +24 -0
  782. package/lib/store/indexeddb-backend.d.ts.map +1 -0
  783. package/lib/store/indexeddb-backend.js +1 -0
  784. package/lib/store/indexeddb-backend.js.map +1 -0
  785. package/lib/store/indexeddb-local-backend.d.ts +129 -0
  786. package/lib/store/indexeddb-local-backend.d.ts.map +1 -0
  787. package/lib/store/indexeddb-local-backend.js +597 -0
  788. package/lib/store/indexeddb-local-backend.js.map +1 -0
  789. package/lib/store/indexeddb-remote-backend.d.ts +79 -0
  790. package/lib/store/indexeddb-remote-backend.d.ts.map +1 -0
  791. package/lib/store/indexeddb-remote-backend.js +210 -0
  792. package/lib/store/indexeddb-remote-backend.js.map +1 -0
  793. package/lib/store/indexeddb-store-worker.d.ts +35 -0
  794. package/lib/store/indexeddb-store-worker.d.ts.map +1 -0
  795. package/lib/store/indexeddb-store-worker.js +146 -0
  796. package/lib/store/indexeddb-store-worker.js.map +1 -0
  797. package/lib/store/indexeddb.d.ts +142 -0
  798. package/lib/store/indexeddb.d.ts.map +1 -0
  799. package/lib/store/indexeddb.js +347 -0
  800. package/lib/store/indexeddb.js.map +1 -0
  801. package/lib/store/local-storage-events-emitter.d.ts +30 -0
  802. package/lib/store/local-storage-events-emitter.d.ts.map +1 -0
  803. package/lib/store/local-storage-events-emitter.js +37 -0
  804. package/lib/store/local-storage-events-emitter.js.map +1 -0
  805. package/lib/store/memory.d.ts +209 -0
  806. package/lib/store/memory.d.ts.map +1 -0
  807. package/lib/store/memory.js +432 -0
  808. package/lib/store/memory.js.map +1 -0
  809. package/lib/store/stub.d.ts +161 -0
  810. package/lib/store/stub.d.ts.map +1 -0
  811. package/lib/store/stub.js +268 -0
  812. package/lib/store/stub.js.map +1 -0
  813. package/lib/sync-accumulator.d.ts +172 -0
  814. package/lib/sync-accumulator.d.ts.map +1 -0
  815. package/lib/sync-accumulator.js +532 -0
  816. package/lib/sync-accumulator.js.map +1 -0
  817. package/lib/sync.d.ts +260 -0
  818. package/lib/sync.d.ts.map +1 -0
  819. package/lib/sync.js +1686 -0
  820. package/lib/sync.js.map +1 -0
  821. package/lib/testing.d.ts +81 -0
  822. package/lib/testing.d.ts.map +1 -0
  823. package/lib/testing.js +162 -0
  824. package/lib/testing.js.map +1 -0
  825. package/lib/thread-utils.d.ts +10 -0
  826. package/lib/thread-utils.d.ts.map +1 -0
  827. package/lib/thread-utils.js +31 -0
  828. package/lib/thread-utils.js.map +1 -0
  829. package/lib/timeline-window.d.ts +168 -0
  830. package/lib/timeline-window.d.ts.map +1 -0
  831. package/lib/timeline-window.js +494 -0
  832. package/lib/timeline-window.js.map +1 -0
  833. package/lib/types.d.ts +33 -0
  834. package/lib/types.d.ts.map +1 -0
  835. package/lib/types.js +33 -0
  836. package/lib/types.js.map +1 -0
  837. package/lib/utils/decryptAESSecretStorageItem.d.ts +12 -0
  838. package/lib/utils/decryptAESSecretStorageItem.d.ts.map +1 -0
  839. package/lib/utils/decryptAESSecretStorageItem.js +50 -0
  840. package/lib/utils/decryptAESSecretStorageItem.js.map +1 -0
  841. package/lib/utils/encryptAESSecretStorageItem.d.ts +16 -0
  842. package/lib/utils/encryptAESSecretStorageItem.d.ts.map +1 -0
  843. package/lib/utils/encryptAESSecretStorageItem.js +68 -0
  844. package/lib/utils/encryptAESSecretStorageItem.js.map +1 -0
  845. package/lib/utils/internal/deriveKeys.d.ts +10 -0
  846. package/lib/utils/internal/deriveKeys.d.ts.map +1 -0
  847. package/lib/utils/internal/deriveKeys.js +60 -0
  848. package/lib/utils/internal/deriveKeys.js.map +1 -0
  849. package/lib/utils.d.ts +267 -0
  850. package/lib/utils.d.ts.map +1 -0
  851. package/lib/utils.js +749 -0
  852. package/lib/utils.js.map +1 -0
  853. package/lib/version-support.d.ts +19 -0
  854. package/lib/version-support.d.ts.map +1 -0
  855. package/lib/version-support.js +37 -0
  856. package/lib/version-support.js.map +1 -0
  857. package/lib/webrtc/audioContext.d.ts +15 -0
  858. package/lib/webrtc/audioContext.d.ts.map +1 -0
  859. package/lib/webrtc/audioContext.js +46 -0
  860. package/lib/webrtc/audioContext.js.map +1 -0
  861. package/lib/webrtc/call.d.ts +560 -0
  862. package/lib/webrtc/call.d.ts.map +1 -0
  863. package/lib/webrtc/call.js +2541 -0
  864. package/lib/webrtc/call.js.map +1 -0
  865. package/lib/webrtc/callEventHandler.d.ts +37 -0
  866. package/lib/webrtc/callEventHandler.d.ts.map +1 -0
  867. package/lib/webrtc/callEventHandler.js +344 -0
  868. package/lib/webrtc/callEventHandler.js.map +1 -0
  869. package/lib/webrtc/callEventTypes.d.ts +73 -0
  870. package/lib/webrtc/callEventTypes.d.ts.map +1 -0
  871. package/lib/webrtc/callEventTypes.js +13 -0
  872. package/lib/webrtc/callEventTypes.js.map +1 -0
  873. package/lib/webrtc/callFeed.d.ts +128 -0
  874. package/lib/webrtc/callFeed.d.ts.map +1 -0
  875. package/lib/webrtc/callFeed.js +289 -0
  876. package/lib/webrtc/callFeed.js.map +1 -0
  877. package/lib/webrtc/groupCall.d.ts +323 -0
  878. package/lib/webrtc/groupCall.d.ts.map +1 -0
  879. package/lib/webrtc/groupCall.js +1337 -0
  880. package/lib/webrtc/groupCall.js.map +1 -0
  881. package/lib/webrtc/groupCallEventHandler.d.ts +31 -0
  882. package/lib/webrtc/groupCallEventHandler.d.ts.map +1 -0
  883. package/lib/webrtc/groupCallEventHandler.js +178 -0
  884. package/lib/webrtc/groupCallEventHandler.js.map +1 -0
  885. package/lib/webrtc/mediaHandler.d.ts +89 -0
  886. package/lib/webrtc/mediaHandler.d.ts.map +1 -0
  887. package/lib/webrtc/mediaHandler.js +437 -0
  888. package/lib/webrtc/mediaHandler.js.map +1 -0
  889. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +8 -0
  890. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +1 -0
  891. package/lib/webrtc/stats/callFeedStatsReporter.js +82 -0
  892. package/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -0
  893. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +25 -0
  894. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +1 -0
  895. package/lib/webrtc/stats/callStatsReportGatherer.js +199 -0
  896. package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -0
  897. package/lib/webrtc/stats/callStatsReportSummary.d.ts +17 -0
  898. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +1 -0
  899. package/lib/webrtc/stats/callStatsReportSummary.js +1 -0
  900. package/lib/webrtc/stats/callStatsReportSummary.js.map +1 -0
  901. package/lib/webrtc/stats/connectionStats.d.ts +28 -0
  902. package/lib/webrtc/stats/connectionStats.d.ts.map +1 -0
  903. package/lib/webrtc/stats/connectionStats.js +26 -0
  904. package/lib/webrtc/stats/connectionStats.js.map +1 -0
  905. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +5 -0
  906. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +1 -0
  907. package/lib/webrtc/stats/connectionStatsBuilder.js +27 -0
  908. package/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -0
  909. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +7 -0
  910. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +1 -0
  911. package/lib/webrtc/stats/connectionStatsReportBuilder.js +121 -0
  912. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -0
  913. package/lib/webrtc/stats/groupCallStats.d.ts +22 -0
  914. package/lib/webrtc/stats/groupCallStats.d.ts.map +1 -0
  915. package/lib/webrtc/stats/groupCallStats.js +78 -0
  916. package/lib/webrtc/stats/groupCallStats.js.map +1 -0
  917. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +10 -0
  918. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +1 -0
  919. package/lib/webrtc/stats/media/mediaSsrcHandler.js +57 -0
  920. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -0
  921. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +12 -0
  922. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +1 -0
  923. package/lib/webrtc/stats/media/mediaTrackHandler.js +62 -0
  924. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -0
  925. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +86 -0
  926. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +1 -0
  927. package/lib/webrtc/stats/media/mediaTrackStats.js +142 -0
  928. package/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -0
  929. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +22 -0
  930. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +1 -0
  931. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +76 -0
  932. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -0
  933. package/lib/webrtc/stats/statsReport.d.ts +99 -0
  934. package/lib/webrtc/stats/statsReport.d.ts.map +1 -0
  935. package/lib/webrtc/stats/statsReport.js +32 -0
  936. package/lib/webrtc/stats/statsReport.js.map +1 -0
  937. package/lib/webrtc/stats/statsReportEmitter.d.ts +15 -0
  938. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +1 -0
  939. package/lib/webrtc/stats/statsReportEmitter.js +33 -0
  940. package/lib/webrtc/stats/statsReportEmitter.js.map +1 -0
  941. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +16 -0
  942. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +1 -0
  943. package/lib/webrtc/stats/summaryStatsReportGatherer.js +116 -0
  944. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +1 -0
  945. package/lib/webrtc/stats/trackStatsBuilder.d.ts +19 -0
  946. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +1 -0
  947. package/lib/webrtc/stats/trackStatsBuilder.js +168 -0
  948. package/lib/webrtc/stats/trackStatsBuilder.js.map +1 -0
  949. package/lib/webrtc/stats/transportStats.d.ts +11 -0
  950. package/lib/webrtc/stats/transportStats.d.ts.map +1 -0
  951. package/lib/webrtc/stats/transportStats.js +1 -0
  952. package/lib/webrtc/stats/transportStats.js.map +1 -0
  953. package/lib/webrtc/stats/transportStatsBuilder.d.ts +5 -0
  954. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +1 -0
  955. package/lib/webrtc/stats/transportStatsBuilder.js +34 -0
  956. package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -0
  957. package/lib/webrtc/stats/valueFormatter.d.ts +4 -0
  958. package/lib/webrtc/stats/valueFormatter.d.ts.map +1 -0
  959. package/lib/webrtc/stats/valueFormatter.js +25 -0
  960. package/lib/webrtc/stats/valueFormatter.js.map +1 -0
  961. package/package.json +134 -0
  962. package/src/@types/AESEncryptedSecretStoragePayload.ts +29 -0
  963. package/src/@types/IIdentityServerProvider.ts +24 -0
  964. package/src/@types/PushRules.ts +209 -0
  965. package/src/@types/another-json.d.ts +19 -0
  966. package/src/@types/auth.ts +252 -0
  967. package/src/@types/beacon.ts +140 -0
  968. package/src/@types/common.ts +22 -0
  969. package/src/@types/crypto.ts +73 -0
  970. package/src/@types/event.ts +370 -0
  971. package/src/@types/events.ts +119 -0
  972. package/src/@types/extensible_events.ts +150 -0
  973. package/src/@types/global.d.ts +70 -0
  974. package/src/@types/local_notifications.ts +19 -0
  975. package/src/@types/location.ts +92 -0
  976. package/src/@types/matrix-sdk-crypto-wasm.d.ts +44 -0
  977. package/src/@types/media.ts +245 -0
  978. package/src/@types/membership.ts +57 -0
  979. package/src/@types/oidc-client-ts.d.ts +24 -0
  980. package/src/@types/partials.ts +67 -0
  981. package/src/@types/polls.ts +119 -0
  982. package/src/@types/read_receipts.ts +61 -0
  983. package/src/@types/registration.ts +102 -0
  984. package/src/@types/requests.ts +314 -0
  985. package/src/@types/search.ts +119 -0
  986. package/src/@types/signed.ts +25 -0
  987. package/src/@types/spaces.ts +37 -0
  988. package/src/@types/state_events.ts +147 -0
  989. package/src/@types/synapse.ts +40 -0
  990. package/src/@types/sync.ts +27 -0
  991. package/src/@types/threepids.ts +29 -0
  992. package/src/@types/topic.ts +63 -0
  993. package/src/@types/uia.ts +29 -0
  994. package/src/NamespacedValue.ts +123 -0
  995. package/src/ReEmitter.ts +93 -0
  996. package/src/ToDeviceMessageQueue.ts +153 -0
  997. package/src/autodiscovery.ts +505 -0
  998. package/src/base64.ts +88 -0
  999. package/src/browser-index.ts +44 -0
  1000. package/src/client.ts +10474 -0
  1001. package/src/common-crypto/CryptoBackend.ts +302 -0
  1002. package/src/common-crypto/README.md +4 -0
  1003. package/src/common-crypto/key-passphrase.ts +43 -0
  1004. package/src/content-helpers.ts +288 -0
  1005. package/src/content-repo.ts +117 -0
  1006. package/src/crypto/CrossSigning.ts +773 -0
  1007. package/src/crypto/DeviceList.ts +989 -0
  1008. package/src/crypto/EncryptionSetup.ts +351 -0
  1009. package/src/crypto/OlmDevice.ts +1500 -0
  1010. package/src/crypto/OutgoingRoomKeyRequestManager.ts +485 -0
  1011. package/src/crypto/RoomList.ts +70 -0
  1012. package/src/crypto/SecretSharing.ts +240 -0
  1013. package/src/crypto/SecretStorage.ts +136 -0
  1014. package/src/crypto/aes.ts +23 -0
  1015. package/src/crypto/algorithms/base.ts +236 -0
  1016. package/src/crypto/algorithms/index.ts +20 -0
  1017. package/src/crypto/algorithms/megolm.ts +2216 -0
  1018. package/src/crypto/algorithms/olm.ts +381 -0
  1019. package/src/crypto/api.ts +70 -0
  1020. package/src/crypto/backup.ts +922 -0
  1021. package/src/crypto/crypto.ts +18 -0
  1022. package/src/crypto/dehydration.ts +272 -0
  1023. package/src/crypto/device-converter.ts +45 -0
  1024. package/src/crypto/deviceinfo.ts +158 -0
  1025. package/src/crypto/index.ts +4414 -0
  1026. package/src/crypto/key_passphrase.ts +42 -0
  1027. package/src/crypto/keybackup.ts +47 -0
  1028. package/src/crypto/olmlib.ts +539 -0
  1029. package/src/crypto/recoverykey.ts +18 -0
  1030. package/src/crypto/store/base.ts +348 -0
  1031. package/src/crypto/store/indexeddb-crypto-store-backend.ts +1250 -0
  1032. package/src/crypto/store/indexeddb-crypto-store.ts +845 -0
  1033. package/src/crypto/store/localStorage-crypto-store.ts +579 -0
  1034. package/src/crypto/store/memory-crypto-store.ts +680 -0
  1035. package/src/crypto/verification/Base.ts +409 -0
  1036. package/src/crypto/verification/Error.ts +76 -0
  1037. package/src/crypto/verification/IllegalMethod.ts +50 -0
  1038. package/src/crypto/verification/QRCode.ts +310 -0
  1039. package/src/crypto/verification/SAS.ts +494 -0
  1040. package/src/crypto/verification/SASDecimal.ts +37 -0
  1041. package/src/crypto/verification/request/Channel.ts +34 -0
  1042. package/src/crypto/verification/request/InRoomChannel.ts +371 -0
  1043. package/src/crypto/verification/request/ToDeviceChannel.ts +354 -0
  1044. package/src/crypto/verification/request/VerificationRequest.ts +976 -0
  1045. package/src/crypto-api/CryptoEvent.ts +93 -0
  1046. package/src/crypto-api/CryptoEventHandlerMap.ts +32 -0
  1047. package/src/crypto-api/index.ts +1175 -0
  1048. package/src/crypto-api/key-passphrase.ts +58 -0
  1049. package/src/crypto-api/keybackup.ts +115 -0
  1050. package/src/crypto-api/recovery-key.ts +69 -0
  1051. package/src/crypto-api/verification.ts +408 -0
  1052. package/src/digest.ts +34 -0
  1053. package/src/embedded.ts +631 -0
  1054. package/src/errors.ts +54 -0
  1055. package/src/event-mapper.ts +97 -0
  1056. package/src/extensible_events_v1/ExtensibleEvent.ts +58 -0
  1057. package/src/extensible_events_v1/InvalidEventError.ts +24 -0
  1058. package/src/extensible_events_v1/MessageEvent.ts +145 -0
  1059. package/src/extensible_events_v1/PollEndEvent.ts +97 -0
  1060. package/src/extensible_events_v1/PollResponseEvent.ts +148 -0
  1061. package/src/extensible_events_v1/PollStartEvent.ts +207 -0
  1062. package/src/extensible_events_v1/utilities.ts +35 -0
  1063. package/src/feature.ts +87 -0
  1064. package/src/filter-component.ts +207 -0
  1065. package/src/filter.ts +245 -0
  1066. package/src/http-api/errors.ts +199 -0
  1067. package/src/http-api/fetch.ts +383 -0
  1068. package/src/http-api/index.ts +191 -0
  1069. package/src/http-api/interface.ts +178 -0
  1070. package/src/http-api/method.ts +25 -0
  1071. package/src/http-api/prefix.ts +48 -0
  1072. package/src/http-api/utils.ts +200 -0
  1073. package/src/index.ts +25 -0
  1074. package/src/indexeddb-helpers.ts +50 -0
  1075. package/src/indexeddb-worker.ts +24 -0
  1076. package/src/interactive-auth.ts +694 -0
  1077. package/src/logger.ts +185 -0
  1078. package/src/matrix.ts +177 -0
  1079. package/src/matrixrtc/CallMembership.ts +247 -0
  1080. package/src/matrixrtc/LivekitFocus.ts +39 -0
  1081. package/src/matrixrtc/MatrixRTCSession.ts +1319 -0
  1082. package/src/matrixrtc/MatrixRTCSessionManager.ts +166 -0
  1083. package/src/matrixrtc/focus.ts +25 -0
  1084. package/src/matrixrtc/index.ts +22 -0
  1085. package/src/matrixrtc/types.ts +36 -0
  1086. package/src/models/MSC3089Branch.ts +272 -0
  1087. package/src/models/MSC3089TreeSpace.ts +565 -0
  1088. package/src/models/ToDeviceMessage.ts +38 -0
  1089. package/src/models/beacon.ts +214 -0
  1090. package/src/models/compare-event-ordering.ts +139 -0
  1091. package/src/models/device.ts +85 -0
  1092. package/src/models/event-context.ts +110 -0
  1093. package/src/models/event-status.ts +39 -0
  1094. package/src/models/event-timeline-set.ts +979 -0
  1095. package/src/models/event-timeline.ts +476 -0
  1096. package/src/models/event.ts +1751 -0
  1097. package/src/models/invites-ignorer.ts +376 -0
  1098. package/src/models/poll.ts +285 -0
  1099. package/src/models/profile-keys.ts +7 -0
  1100. package/src/models/read-receipt.ts +422 -0
  1101. package/src/models/related-relations.ts +39 -0
  1102. package/src/models/relations-container.ts +149 -0
  1103. package/src/models/relations.ts +368 -0
  1104. package/src/models/room-member.ts +457 -0
  1105. package/src/models/room-receipts.ts +439 -0
  1106. package/src/models/room-state.ts +1130 -0
  1107. package/src/models/room-summary.ts +47 -0
  1108. package/src/models/room.ts +3822 -0
  1109. package/src/models/search-result.ts +57 -0
  1110. package/src/models/thread.ts +923 -0
  1111. package/src/models/typed-event-emitter.ts +246 -0
  1112. package/src/models/user.ts +302 -0
  1113. package/src/oidc/authorize.ts +274 -0
  1114. package/src/oidc/discovery.ts +60 -0
  1115. package/src/oidc/error.ts +33 -0
  1116. package/src/oidc/index.ts +34 -0
  1117. package/src/oidc/register.ts +123 -0
  1118. package/src/oidc/tokenRefresher.ts +149 -0
  1119. package/src/oidc/validate.ts +282 -0
  1120. package/src/pushprocessor.ts +837 -0
  1121. package/src/randomstring.ts +51 -0
  1122. package/src/realtime-callbacks.ts +191 -0
  1123. package/src/receipt-accumulator.ts +189 -0
  1124. package/src/rendezvous/MSC4108SignInWithQR.ts +444 -0
  1125. package/src/rendezvous/RendezvousChannel.ts +48 -0
  1126. package/src/rendezvous/RendezvousCode.ts +25 -0
  1127. package/src/rendezvous/RendezvousError.ts +26 -0
  1128. package/src/rendezvous/RendezvousFailureReason.ts +49 -0
  1129. package/src/rendezvous/RendezvousIntent.ts +20 -0
  1130. package/src/rendezvous/RendezvousTransport.ts +58 -0
  1131. package/src/rendezvous/channels/MSC4108SecureChannel.ts +270 -0
  1132. package/src/rendezvous/channels/index.ts +17 -0
  1133. package/src/rendezvous/index.ts +25 -0
  1134. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +270 -0
  1135. package/src/rendezvous/transports/index.ts +17 -0
  1136. package/src/room-hierarchy.ts +152 -0
  1137. package/src/rust-crypto/CrossSigningIdentity.ts +183 -0
  1138. package/src/rust-crypto/DehydratedDeviceManager.ts +306 -0
  1139. package/src/rust-crypto/KeyClaimManager.ts +86 -0
  1140. package/src/rust-crypto/OutgoingRequestProcessor.ts +236 -0
  1141. package/src/rust-crypto/OutgoingRequestsManager.ts +143 -0
  1142. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +501 -0
  1143. package/src/rust-crypto/RoomEncryptor.ts +352 -0
  1144. package/src/rust-crypto/backup.ts +881 -0
  1145. package/src/rust-crypto/constants.ts +18 -0
  1146. package/src/rust-crypto/device-converter.ts +128 -0
  1147. package/src/rust-crypto/index.ts +237 -0
  1148. package/src/rust-crypto/libolm_migration.ts +530 -0
  1149. package/src/rust-crypto/rust-crypto.ts +2205 -0
  1150. package/src/rust-crypto/secret-storage.ts +60 -0
  1151. package/src/rust-crypto/verification.ts +830 -0
  1152. package/src/scheduler.ts +309 -0
  1153. package/src/secret-storage.ts +693 -0
  1154. package/src/serverCapabilities.ts +139 -0
  1155. package/src/service-types.ts +20 -0
  1156. package/src/sliding-sync-sdk.ts +1026 -0
  1157. package/src/sliding-sync.ts +965 -0
  1158. package/src/store/index.ts +261 -0
  1159. package/src/store/indexeddb-backend.ts +41 -0
  1160. package/src/store/indexeddb-local-backend.ts +610 -0
  1161. package/src/store/indexeddb-remote-backend.ts +213 -0
  1162. package/src/store/indexeddb-store-worker.ts +157 -0
  1163. package/src/store/indexeddb.ts +397 -0
  1164. package/src/store/local-storage-events-emitter.ts +46 -0
  1165. package/src/store/memory.ts +448 -0
  1166. package/src/store/stub.ts +280 -0
  1167. package/src/sync-accumulator.ts +689 -0
  1168. package/src/sync.ts +1920 -0
  1169. package/src/testing.ts +191 -0
  1170. package/src/thread-utils.ts +31 -0
  1171. package/src/timeline-window.ts +536 -0
  1172. package/src/types.ts +59 -0
  1173. package/src/utils/decryptAESSecretStorageItem.ts +54 -0
  1174. package/src/utils/encryptAESSecretStorageItem.ts +73 -0
  1175. package/src/utils/internal/deriveKeys.ts +63 -0
  1176. package/src/utils.ts +763 -0
  1177. package/src/version-support.ts +36 -0
  1178. package/src/webrtc/audioContext.ts +44 -0
  1179. package/src/webrtc/call.ts +3074 -0
  1180. package/src/webrtc/callEventHandler.ts +425 -0
  1181. package/src/webrtc/callEventTypes.ts +93 -0
  1182. package/src/webrtc/callFeed.ts +364 -0
  1183. package/src/webrtc/groupCall.ts +1735 -0
  1184. package/src/webrtc/groupCallEventHandler.ts +234 -0
  1185. package/src/webrtc/mediaHandler.ts +484 -0
  1186. package/src/webrtc/stats/callFeedStatsReporter.ts +94 -0
  1187. package/src/webrtc/stats/callStatsReportGatherer.ts +219 -0
  1188. package/src/webrtc/stats/callStatsReportSummary.ts +30 -0
  1189. package/src/webrtc/stats/connectionStats.ts +47 -0
  1190. package/src/webrtc/stats/connectionStatsBuilder.ts +28 -0
  1191. package/src/webrtc/stats/connectionStatsReportBuilder.ts +140 -0
  1192. package/src/webrtc/stats/groupCallStats.ts +93 -0
  1193. package/src/webrtc/stats/media/mediaSsrcHandler.ts +57 -0
  1194. package/src/webrtc/stats/media/mediaTrackHandler.ts +76 -0
  1195. package/src/webrtc/stats/media/mediaTrackStats.ts +176 -0
  1196. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +90 -0
  1197. package/src/webrtc/stats/statsReport.ts +133 -0
  1198. package/src/webrtc/stats/statsReportEmitter.ts +49 -0
  1199. package/src/webrtc/stats/summaryStatsReportGatherer.ts +148 -0
  1200. package/src/webrtc/stats/trackStatsBuilder.ts +207 -0
  1201. package/src/webrtc/stats/transportStats.ts +26 -0
  1202. package/src/webrtc/stats/transportStatsBuilder.ts +48 -0
  1203. package/src/webrtc/stats/valueFormatter.ts +27 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"megolm.js","names":["v4","uuidv4","logger","olmlib","DecryptionAlgorithm","EncryptionAlgorithm","registerAlgorithm","UnknownDeviceError","WITHHELD_MESSAGES","EventType","MsgType","ToDeviceMessageId","RoomKeyRequestState","immediate","MapWithDefault","KnownMembership","DecryptionFailureCode","DecryptionError","isRoomSharedHistory","room","_room$currentState","_visibilityEvent$getC","visibilityEvent","currentState","getStateEvents","visibility","getContent","history_visibility","includes","hasCiphertext","content","ciphertext","length","Object","keys","OutboundSessionInfo","constructor","sessionId","sharedHistory","arguments","undefined","_defineProperty","Map","creationTime","Date","getTime","needsRotation","rotationPeriodMsgs","rotationPeriodMs","sessionLifetime","useCount","log","markSharedWithDevice","userId","deviceId","deviceKey","chainIndex","sharedWithDevices","getOrCreate","set","messageIndex","markNotifiedBlockedDevice","blockedDevicesNotified","sharedWithTooManyDevices","devicesInRoom","devices","has","_devicesInRoom$get","get","MegolmEncryption","params","_params$config$rotati","_params$config","_params$config$rotati2","_params$config2","Promise","resolve","roomId","prefixedLogger","getChild","concat","sessionRotationPeriodMsgs","config","rotation_period_msgs","sessionRotationPeriodMs","rotation_period_ms","ensureOutboundSession","blocked","_arguments","_this","_asyncToGenerator","singleOlmCreationPhase","setup","_ref","oldSession","session","prepareSession","shareSession","_x","apply","fallible","setupPromise","then","catch","e","error","_this2","_session","_session2","debug","prepareNewSession","outboundSessions","_this3","shareMap","userDevices","deviceInfo","_session$sharedWithDe","key","getIdentityKey","olmDevice","deviceCurve25519Key","push","getOutboundGroupSessionKey","payload","type","MEGOLM_ALGORITHM","chain_index","devicesWithoutSession","olmSessions","getExistingOlmSessions","baseApis","all","olmSessionList","Array","from","entries","map","_ref3","sessionsByUser","_ref4","flat","shareKeyWithOlmSessions","deviceList","_ref6","devicesByUser","device","errorDevices","start","now","failedServers","shareKeyWithDevices","retryDevices","failedServerMap","Set","server","add","failedDevices","userHS","slice","indexOf","retryDeviceList","_ref8","notifyFailedOlmDevices","size","_ref10","blockedByUser","_ref11","_deviceInfo","blockedMap","blockedCount","userBlockedDevices","_session$blockedDevic","_ref12","_ref13","notifyBlockedDevices","_this4","createOutboundGroupSession","addInboundGroupSession","ed25519","deviceEd25519Key","crypto","backupManager","backupGroupSession","getDevicesWithoutSessions","deviceMap","noOlmDevices","devicesToShareWith","sessionResults","sessionResult","delete","splitDevices","maxDevicesPerRequest","currentSlice","mapSlices","values","pop","encryptAndSendKeysToDevices","encryptAndSendToDevices","sendBlockedNotificationsToDevices","userDeviceMap","_this5","contentMap","val","blockedInfo","message","_objectSpread","code","reason","room_id","session_id","sendToDevice","reshareKeyWithDevice","senderKey","_this6","_obSessionInfo$shared","obSessionInfo","sessionSharedData","warn","getInboundGroupSessionKey","ensureOlmSessionsForDevices","sender_claimed_ed25519_key","forwarding_curve25519_key_chain","shared_history","encryptedContent","algorithm","OLM_ALGORITHM","sender_key","encryptMessageForDevice","otkTimeout","_this7","devicemap","_this8","userDeviceMaps","i","taskDetail","d","_this9","unnotifiedFailedDevices","filterOutNotifiedErrorDevices","_this10","prepareToEncrypt","_this11","Error","encryptionPreparation","elapsedTime","startTime","cancel","cancelled","isCancelled","promise","getDevicesResult","getDevicesInRoom","globalErrorOnUnknownDevices","removeUnknownDevices","encryptMessage","eventType","_this12","_unused","forceDistributeToUnverified","isVerificationEvent","checkForUnknownDevices","payloadJson","encryptGroupMessage","JSON","stringify","device_id","KeyVerificationCancel","KeyVerificationDone","KeyVerificationMac","KeyVerificationStart","KeyVerificationKey","KeyVerificationReady","KeyVerificationAccept","RoomMessage","KeyVerificationRequest","forceDiscardSession","unknownDevices","isUnverified","isKnown","_arguments2","_this13","members","getEncryptionTargetMembers","shouldEncryptForInvitedMembers","u","membership","roomMembers","isBlacklisting","globalBlacklistUnverifiedDevices","isRoomBlacklisting","getBlacklistUnverifiedDevices","downloadKeys","userDevice","deviceTrust","checkDeviceTrust","isBlocked","isVerified","blockedDevices","MegolmDecryption","decryptEvent","event","_this14","getWireContent","MEGOLM_MISSING_FIELDS","addEventToPendingList","res","decryptGroupMessage","getRoomId","getId","getTs","name","errorCode","OLM_DECRYPT_GROUP_MESSAGE_ERROR","requestKeysForEvent","OLM_UNKNOWN_MESSAGE_INDEX","queryKeyBackupRateLimited","problem","sessionMayHaveProblems","info","getSender","problemDescription","PROBLEM_DESCRIPTIONS","unknown","fixed","MEGOLM_UNKNOWN_INBOUND_SESSION_ID","untrusted","removeEventFromPendingList","parse","result","MEGOLM_BAD_ROOM","clearEvent","senderCurve25519Key","claimedEd25519Key","keysClaimed","forwardingCurve25519KeyChain","wireContent","recipients","getKeyRequestRecipients","requestRoomKey","_senderPendingEvents$","pendingEvents","senderPendingEvents","roomKeyFromEvent","getSenderKey","extraSessionData","session_key","isOlmEncrypted","roomKey","sessionKey","exportFormat","forwardingKeyChain","getKeysClaimed","forwardedRoomKeyFromEvent","senderKeyUser","getUserByIdentityKey","claimedCurve25519Key","isArray","shouldAcceptForwardedKey","_this15","_this15$crypto$device","sendingDevice","getDeviceByIdentityKey","checkDeviceInfoTrust","fromUs","getUserId","keyFromOurVerifiedDevice","weRequested","wasRoomKeyRequested","fromInviter","wasRoomKeyForwardedByInviter","sharedAsHistory","wasRoomKeyForwardedAsHistory","_this16","outgoingRequests","cryptoStore","getOutgoingRoomKeyRequestsByTarget","Sent","some","req","requestBody","_room$getMember","_memberEvent$getUnsig","_memberEvent$getPrevC","getRoom","memberEvent","getMember","events","member","getUnsigned","prev_sender","getPrevContent","Invite","shouldParkForwardedKey","parkForwardedKey","_this17","parkedData","senderId","doTxn","txn","addParkedSharedHistory","addRoomKey","_this18","retryDecryption","cancelRoomKeyRequest","onForwardedRoomKey","_this19","onRoomKeyEvent","_this20","getType","onRoomKeyWithheldEvent","_this21","onNoOlmWithheldEvent","addInboundGroupSessionWithheld","retryDecryptionFromSender","_this22","sender","getSessionIdForDevice","recordSessionProblem","hasKeysForKeyRequest","keyRequest","body","hasInboundSessionKeys","shareKeysWithDevice","getStoredDevice","_devicemap$get","olmSessionResult","buildKeyForwardingMessage","_this23","importRoomKey","source","sender_claimed_keys","forceRedecryptIfUntrusted","_this24","_this24$pendingEvents","pending","pendingList","_ref15","ev","attemptDecryption","isRetry","_unused2","_x2","_this25","_ref17","_ref16","_sessionId","_ref18","_unused3","_x4","_x3","sendSharedHistoryInboundSessions","_this26","sharedHistorySessions","getSharedHistoryInboundGroupSessions","_ref19","promises","deviceMessages","no_olm"],"sources":["../../../src/crypto/algorithms/megolm.ts"],"sourcesContent":["/*\nCopyright 2015 - 2021, 2023 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\n/**\n * Defines m.olm encryption/decryption\n */\n\nimport { v4 as uuidv4 } from \"uuid\";\n\nimport type { IEventDecryptionResult, IMegolmSessionData } from \"../../@types/crypto.ts\";\nimport { logger, Logger } from \"../../logger.ts\";\nimport * as olmlib from \"../olmlib.ts\";\nimport {\n DecryptionAlgorithm,\n DecryptionClassParams,\n EncryptionAlgorithm,\n IParams,\n registerAlgorithm,\n UnknownDeviceError,\n} from \"./base.ts\";\nimport { IDecryptedGroupMessage, WITHHELD_MESSAGES } from \"../OlmDevice.ts\";\nimport { Room } from \"../../models/room.ts\";\nimport { DeviceInfo } from \"../deviceinfo.ts\";\nimport { IOlmSessionResult } from \"../olmlib.ts\";\nimport { DeviceInfoMap } from \"../DeviceList.ts\";\nimport { IContent, MatrixEvent } from \"../../models/event.ts\";\nimport { EventType, MsgType, ToDeviceMessageId } from \"../../@types/event.ts\";\nimport { IMegolmEncryptedContent, IncomingRoomKeyRequest, IEncryptedContent } from \"../index.ts\";\nimport { RoomKeyRequestState } from \"../OutgoingRoomKeyRequestManager.ts\";\nimport { OlmGroupSessionExtraData } from \"../../@types/crypto.ts\";\nimport { MatrixError } from \"../../http-api/index.ts\";\nimport { immediate, MapWithDefault } from \"../../utils.ts\";\nimport { KnownMembership } from \"../../@types/membership.ts\";\nimport { DecryptionFailureCode } from \"../../crypto-api/index.ts\";\nimport { DecryptionError } from \"../../common-crypto/CryptoBackend.ts\";\n\n// determine whether the key can be shared with invitees\nexport function isRoomSharedHistory(room: Room): boolean {\n const visibilityEvent = room?.currentState?.getStateEvents(\"m.room.history_visibility\", \"\");\n // NOTE: if the room visibility is unset, it would normally default to\n // \"world_readable\".\n // (https://spec.matrix.org/unstable/client-server-api/#server-behaviour-5)\n // But we will be paranoid here, and treat it as a situation where the room\n // is not shared-history\n const visibility = visibilityEvent?.getContent()?.history_visibility;\n return [\"world_readable\", \"shared\"].includes(visibility);\n}\n\ninterface IBlockedDevice {\n code: string;\n reason: string;\n deviceInfo: DeviceInfo;\n}\n\n// map user Id → device Id → IBlockedDevice\ntype BlockedMap = Map<string, Map<string, IBlockedDevice>>;\n\nexport interface IOlmDevice<T = DeviceInfo> {\n userId: string;\n deviceInfo: T;\n}\n\n/**\n * Tests whether an encrypted content has a ciphertext.\n * Ciphertext can be a string or object depending on the content type {@link IEncryptedContent}.\n *\n * @param content - Encrypted content\n * @returns true: has ciphertext, else false\n */\nconst hasCiphertext = (content: IEncryptedContent): boolean => {\n return typeof content.ciphertext === \"string\"\n ? !!content.ciphertext.length\n : !!Object.keys(content.ciphertext).length;\n};\n\n/** The result of parsing the an `m.room_key` or `m.forwarded_room_key` to-device event */\ninterface RoomKey {\n /**\n * The Curve25519 key of the megolm session creator.\n *\n * For `m.room_key`, this is also the sender of the `m.room_key` to-device event.\n * For `m.forwarded_room_key`, the two are different (and the key of the sender of the\n * `m.forwarded_room_key` event is included in `forwardingKeyChain`)\n */\n senderKey: string;\n sessionId: string;\n sessionKey: string;\n exportFormat: boolean;\n roomId: string;\n algorithm: string;\n /**\n * A list of the curve25519 keys of the users involved in forwarding this key, most recent last.\n * For `m.room_key` events, this is empty.\n */\n forwardingKeyChain: string[];\n keysClaimed: Partial<Record<\"ed25519\", string>>;\n extraSessionData: OlmGroupSessionExtraData;\n}\n\nexport interface IOutboundGroupSessionKey {\n chain_index: number;\n key: string;\n}\n\ninterface IMessage {\n type: string;\n content: {\n \"algorithm\": string;\n \"room_id\": string;\n \"sender_key\"?: string;\n \"sender_claimed_ed25519_key\"?: string;\n \"session_id\": string;\n \"session_key\": string;\n \"chain_index\": number;\n \"forwarding_curve25519_key_chain\"?: string[];\n \"org.matrix.msc3061.shared_history\": boolean;\n };\n}\n\ninterface IKeyForwardingMessage extends IMessage {\n type: \"m.forwarded_room_key\";\n}\n\ninterface IPayload extends Partial<IMessage> {\n code?: string;\n reason?: string;\n room_id?: string;\n session_id?: string;\n algorithm?: string;\n sender_key?: string;\n}\n\ninterface SharedWithData {\n // The identity key of the device we shared with\n deviceKey: string;\n // The message index of the ratchet we shared with that device\n messageIndex: number;\n}\n\n/**\n * @internal\n */\nclass OutboundSessionInfo {\n /** number of times this session has been used */\n public useCount = 0;\n /** when the session was created (ms since the epoch) */\n public creationTime: number;\n /** devices with which we have shared the session key `userId -> {deviceId -> SharedWithData}` */\n public sharedWithDevices: MapWithDefault<string, Map<string, SharedWithData>> = new MapWithDefault(() => new Map());\n public blockedDevicesNotified: MapWithDefault<string, Map<string, boolean>> = new MapWithDefault(() => new Map());\n\n /**\n * @param sharedHistory - whether the session can be freely shared with\n * other group members, according to the room history visibility settings\n */\n public constructor(\n public readonly sessionId: string,\n public readonly sharedHistory = false,\n ) {\n this.creationTime = new Date().getTime();\n }\n\n /**\n * Check if it's time to rotate the session\n */\n public needsRotation(rotationPeriodMsgs: number, rotationPeriodMs: number): boolean {\n const sessionLifetime = new Date().getTime() - this.creationTime;\n\n if (this.useCount >= rotationPeriodMsgs || sessionLifetime >= rotationPeriodMs) {\n logger.log(\"Rotating megolm session after \" + this.useCount + \" messages, \" + sessionLifetime + \"ms\");\n return true;\n }\n\n return false;\n }\n\n public markSharedWithDevice(userId: string, deviceId: string, deviceKey: string, chainIndex: number): void {\n this.sharedWithDevices.getOrCreate(userId).set(deviceId, { deviceKey, messageIndex: chainIndex });\n }\n\n public markNotifiedBlockedDevice(userId: string, deviceId: string): void {\n this.blockedDevicesNotified.getOrCreate(userId).set(deviceId, true);\n }\n\n /**\n * Determine if this session has been shared with devices which it shouldn't\n * have been.\n *\n * @param devicesInRoom - `userId -> {deviceId -> object}`\n * devices we should shared the session with.\n *\n * @returns true if we have shared the session with devices which aren't\n * in devicesInRoom.\n */\n public sharedWithTooManyDevices(devicesInRoom: DeviceInfoMap): boolean {\n for (const [userId, devices] of this.sharedWithDevices) {\n if (!devicesInRoom.has(userId)) {\n logger.log(\"Starting new megolm session because we shared with \" + userId);\n return true;\n }\n\n for (const [deviceId] of devices) {\n if (!devicesInRoom.get(userId)?.get(deviceId)) {\n logger.log(\"Starting new megolm session because we shared with \" + userId + \":\" + deviceId);\n return true;\n }\n }\n }\n\n return false;\n }\n}\n\n/**\n * Megolm encryption implementation\n *\n * @param params - parameters, as per {@link EncryptionAlgorithm}\n */\nexport class MegolmEncryption extends EncryptionAlgorithm {\n // the most recent attempt to set up a session. This is used to serialise\n // the session setups, so that we have a race-free view of which session we\n // are using, and which devices we have shared the keys with. It resolves\n // with an OutboundSessionInfo (or undefined, for the first message in the\n // room).\n private setupPromise = Promise.resolve<OutboundSessionInfo | null>(null);\n\n // Map of outbound sessions by sessions ID. Used if we need a particular\n // session (the session we're currently using to send is always obtained\n // using setupPromise).\n private outboundSessions: Record<string, OutboundSessionInfo> = {};\n\n private readonly sessionRotationPeriodMsgs: number;\n private readonly sessionRotationPeriodMs: number;\n private encryptionPreparation?: {\n promise: Promise<void>;\n startTime: number;\n cancel: () => void;\n };\n\n protected readonly roomId: string;\n private readonly prefixedLogger: Logger;\n\n public constructor(params: IParams & Required<Pick<IParams, \"roomId\">>) {\n super(params);\n this.roomId = params.roomId;\n this.prefixedLogger = logger.getChild(`[${this.roomId} encryption]`);\n\n this.sessionRotationPeriodMsgs = params.config?.rotation_period_msgs ?? 100;\n this.sessionRotationPeriodMs = params.config?.rotation_period_ms ?? 7 * 24 * 3600 * 1000;\n }\n\n /**\n * @internal\n *\n * @param devicesInRoom - The devices in this room, indexed by user ID\n * @param blocked - The devices that are blocked, indexed by user ID\n * @param singleOlmCreationPhase - Only perform one round of olm\n * session creation\n *\n * This method updates the setupPromise field of the class by chaining a new\n * call on top of the existing promise, and then catching and discarding any\n * errors that might happen while setting up the outbound group session. This\n * is done to ensure that `setupPromise` always resolves to `null` or the\n * `OutboundSessionInfo`.\n *\n * Using `>>=` to represent the promise chaining operation, it does the\n * following:\n *\n * ```\n * setupPromise = previousSetupPromise >>= setup >>= discardErrors\n * ```\n *\n * The initial value for the `setupPromise` is a promise that resolves to\n * `null`. The forceDiscardSession() resets setupPromise to this initial\n * promise.\n *\n * @returns Promise which resolves to the\n * OutboundSessionInfo when setup is complete.\n */\n private async ensureOutboundSession(\n room: Room,\n devicesInRoom: DeviceInfoMap,\n blocked: BlockedMap,\n singleOlmCreationPhase = false,\n ): Promise<OutboundSessionInfo> {\n // takes the previous OutboundSessionInfo, and considers whether to create\n // a new one. Also shares the key with any (new) devices in the room.\n //\n // returns a promise which resolves once the keyshare is successful.\n const setup = async (oldSession: OutboundSessionInfo | null): Promise<OutboundSessionInfo> => {\n const sharedHistory = isRoomSharedHistory(room);\n const session = await this.prepareSession(devicesInRoom, sharedHistory, oldSession);\n\n await this.shareSession(devicesInRoom, sharedHistory, singleOlmCreationPhase, blocked, session);\n\n return session;\n };\n\n // first wait for the previous share to complete\n const fallible = this.setupPromise.then(setup);\n\n // Ensure any failures are logged for debugging and make sure that the\n // promise chain remains unbroken\n //\n // setupPromise resolves to `null` or the `OutboundSessionInfo` whether\n // or not the share succeeds\n this.setupPromise = fallible.catch((e) => {\n this.prefixedLogger.error(`Failed to setup outbound session`, e);\n return null;\n });\n\n // but we return a promise which only resolves if the share was successful.\n return fallible;\n }\n\n private async prepareSession(\n devicesInRoom: DeviceInfoMap,\n sharedHistory: boolean,\n session: OutboundSessionInfo | null,\n ): Promise<OutboundSessionInfo> {\n // history visibility changed\n if (session && sharedHistory !== session.sharedHistory) {\n session = null;\n }\n\n // need to make a brand new session?\n if (session?.needsRotation(this.sessionRotationPeriodMsgs, this.sessionRotationPeriodMs)) {\n this.prefixedLogger.debug(\"Starting new megolm session because we need to rotate.\");\n session = null;\n }\n\n // determine if we have shared with anyone we shouldn't have\n if (session?.sharedWithTooManyDevices(devicesInRoom)) {\n session = null;\n }\n\n if (!session) {\n this.prefixedLogger.debug(\"Starting new megolm session\");\n session = await this.prepareNewSession(sharedHistory);\n this.prefixedLogger.debug(`Started new megolm session ${session.sessionId}`);\n this.outboundSessions[session.sessionId] = session;\n }\n\n return session;\n }\n\n private async shareSession(\n devicesInRoom: DeviceInfoMap,\n sharedHistory: boolean,\n singleOlmCreationPhase: boolean,\n blocked: BlockedMap,\n session: OutboundSessionInfo,\n ): Promise<void> {\n // now check if we need to share with any devices\n const shareMap: Record<string, DeviceInfo[]> = {};\n\n for (const [userId, userDevices] of devicesInRoom) {\n for (const [deviceId, deviceInfo] of userDevices) {\n const key = deviceInfo.getIdentityKey();\n if (key == this.olmDevice.deviceCurve25519Key) {\n // don't bother sending to ourself\n continue;\n }\n\n if (!session.sharedWithDevices.get(userId)?.get(deviceId)) {\n shareMap[userId] = shareMap[userId] || [];\n shareMap[userId].push(deviceInfo);\n }\n }\n }\n\n const key = this.olmDevice.getOutboundGroupSessionKey(session.sessionId);\n const payload: IPayload = {\n type: \"m.room_key\",\n content: {\n \"algorithm\": olmlib.MEGOLM_ALGORITHM,\n \"room_id\": this.roomId,\n \"session_id\": session.sessionId,\n \"session_key\": key.key,\n \"chain_index\": key.chain_index,\n \"org.matrix.msc3061.shared_history\": sharedHistory,\n },\n };\n const [devicesWithoutSession, olmSessions] = await olmlib.getExistingOlmSessions(\n this.olmDevice,\n this.baseApis,\n shareMap,\n );\n\n await Promise.all([\n (async (): Promise<void> => {\n // share keys with devices that we already have a session for\n const olmSessionList = Array.from(olmSessions.entries())\n .map(([userId, sessionsByUser]) =>\n Array.from(sessionsByUser.entries()).map(\n ([deviceId, session]) => `${userId}/${deviceId}: ${session.sessionId}`,\n ),\n )\n .flat(1);\n this.prefixedLogger.debug(\"Sharing keys with devices with existing Olm sessions:\", olmSessionList);\n await this.shareKeyWithOlmSessions(session, key, payload, olmSessions);\n this.prefixedLogger.debug(\"Shared keys with existing Olm sessions\");\n })(),\n (async (): Promise<void> => {\n const deviceList = Array.from(devicesWithoutSession.entries())\n .map(([userId, devicesByUser]) => devicesByUser.map((device) => `${userId}/${device.deviceId}`))\n .flat(1);\n this.prefixedLogger.debug(\n \"Sharing keys (start phase 1) with devices without existing Olm sessions:\",\n deviceList,\n );\n const errorDevices: IOlmDevice[] = [];\n\n // meanwhile, establish olm sessions for devices that we don't\n // already have a session for, and share keys with them. If\n // we're doing two phases of olm session creation, use a\n // shorter timeout when fetching one-time keys for the first\n // phase.\n const start = Date.now();\n const failedServers: string[] = [];\n await this.shareKeyWithDevices(\n session,\n key,\n payload,\n devicesWithoutSession,\n errorDevices,\n singleOlmCreationPhase ? 10000 : 2000,\n failedServers,\n );\n this.prefixedLogger.debug(\"Shared keys (end phase 1) with devices without existing Olm sessions\");\n\n if (!singleOlmCreationPhase && Date.now() - start < 10000) {\n // perform the second phase of olm session creation if requested,\n // and if the first phase didn't take too long\n (async (): Promise<void> => {\n // Retry sending keys to devices that we were unable to establish\n // an olm session for. This time, we use a longer timeout, but we\n // do this in the background and don't block anything else while we\n // do this. We only need to retry users from servers that didn't\n // respond the first time.\n const retryDevices: MapWithDefault<string, DeviceInfo[]> = new MapWithDefault(() => []);\n const failedServerMap = new Set();\n for (const server of failedServers) {\n failedServerMap.add(server);\n }\n const failedDevices: IOlmDevice[] = [];\n for (const { userId, deviceInfo } of errorDevices) {\n const userHS = userId.slice(userId.indexOf(\":\") + 1);\n if (failedServerMap.has(userHS)) {\n retryDevices.getOrCreate(userId).push(deviceInfo);\n } else {\n // if we aren't going to retry, then handle it\n // as a failed device\n failedDevices.push({ userId, deviceInfo });\n }\n }\n\n const retryDeviceList = Array.from(retryDevices.entries())\n .map(([userId, devicesByUser]) =>\n devicesByUser.map((device) => `${userId}/${device.deviceId}`),\n )\n .flat(1);\n\n if (retryDeviceList.length > 0) {\n this.prefixedLogger.debug(\n \"Sharing keys (start phase 2) with devices without existing Olm sessions:\",\n retryDeviceList,\n );\n await this.shareKeyWithDevices(session, key, payload, retryDevices, failedDevices, 30000);\n this.prefixedLogger.debug(\n \"Shared keys (end phase 2) with devices without existing Olm sessions\",\n );\n }\n\n await this.notifyFailedOlmDevices(session, key, failedDevices);\n })();\n } else {\n await this.notifyFailedOlmDevices(session, key, errorDevices);\n }\n })(),\n (async (): Promise<void> => {\n this.prefixedLogger.debug(\n `There are ${blocked.size} blocked devices:`,\n Array.from(blocked.entries())\n .map(([userId, blockedByUser]) =>\n Array.from(blockedByUser.entries()).map(\n ([deviceId, _deviceInfo]) => `${userId}/${deviceId}`,\n ),\n )\n .flat(1),\n );\n\n // also, notify newly blocked devices that they're blocked\n const blockedMap: MapWithDefault<string, Map<string, { device: IBlockedDevice }>> = new MapWithDefault(\n () => new Map(),\n );\n let blockedCount = 0;\n for (const [userId, userBlockedDevices] of blocked) {\n for (const [deviceId, device] of userBlockedDevices) {\n if (session.blockedDevicesNotified.get(userId)?.get(deviceId) === undefined) {\n blockedMap.getOrCreate(userId).set(deviceId, { device });\n blockedCount++;\n }\n }\n }\n\n if (blockedCount) {\n this.prefixedLogger.debug(\n `Notifying ${blockedCount} newly blocked devices:`,\n Array.from(blockedMap.entries())\n .map(([userId, blockedByUser]) =>\n Object.entries(blockedByUser).map(([deviceId, _deviceInfo]) => `${userId}/${deviceId}`),\n )\n .flat(1),\n );\n await this.notifyBlockedDevices(session, blockedMap);\n this.prefixedLogger.debug(`Notified ${blockedCount} newly blocked devices`);\n }\n })(),\n ]);\n }\n\n /**\n * @internal\n *\n *\n * @returns session\n */\n private async prepareNewSession(sharedHistory: boolean): Promise<OutboundSessionInfo> {\n const sessionId = this.olmDevice.createOutboundGroupSession();\n const key = this.olmDevice.getOutboundGroupSessionKey(sessionId);\n\n await this.olmDevice.addInboundGroupSession(\n this.roomId,\n this.olmDevice.deviceCurve25519Key!,\n [],\n sessionId,\n key.key,\n { ed25519: this.olmDevice.deviceEd25519Key! },\n false,\n { sharedHistory },\n );\n\n // don't wait for it to complete\n this.crypto.backupManager.backupGroupSession(this.olmDevice.deviceCurve25519Key!, sessionId);\n\n return new OutboundSessionInfo(sessionId, sharedHistory);\n }\n\n /**\n * Determines what devices in devicesByUser don't have an olm session as given\n * in devicemap.\n *\n * @internal\n *\n * @param deviceMap - the devices that have olm sessions, as returned by\n * olmlib.ensureOlmSessionsForDevices.\n * @param devicesByUser - a map of user IDs to array of deviceInfo\n * @param noOlmDevices - an array to fill with devices that don't have\n * olm sessions\n *\n * @returns an array of devices that don't have olm sessions. If\n * noOlmDevices is specified, then noOlmDevices will be returned.\n */\n private getDevicesWithoutSessions(\n deviceMap: Map<string, Map<string, IOlmSessionResult>>,\n devicesByUser: Map<string, DeviceInfo[]>,\n noOlmDevices: IOlmDevice[] = [],\n ): IOlmDevice[] {\n for (const [userId, devicesToShareWith] of devicesByUser) {\n const sessionResults = deviceMap.get(userId);\n\n for (const deviceInfo of devicesToShareWith) {\n const deviceId = deviceInfo.deviceId;\n\n const sessionResult = sessionResults?.get(deviceId);\n if (!sessionResult?.sessionId) {\n // no session with this device, probably because there\n // were no one-time keys.\n\n noOlmDevices.push({ userId, deviceInfo });\n sessionResults?.delete(deviceId);\n\n // ensureOlmSessionsForUsers has already done the logging,\n // so just skip it.\n continue;\n }\n }\n }\n\n return noOlmDevices;\n }\n\n /**\n * Splits the user device map into multiple chunks to reduce the number of\n * devices we encrypt to per API call.\n *\n * @internal\n *\n * @param devicesByUser - map from userid to list of devices\n *\n * @returns the blocked devices, split into chunks\n */\n private splitDevices<T extends DeviceInfo | IBlockedDevice>(\n devicesByUser: Map<string, Map<string, { device: T }>>,\n ): IOlmDevice<T>[][] {\n const maxDevicesPerRequest = 20;\n\n // use an array where the slices of a content map gets stored\n let currentSlice: IOlmDevice<T>[] = [];\n const mapSlices = [currentSlice];\n\n for (const [userId, userDevices] of devicesByUser) {\n for (const deviceInfo of userDevices.values()) {\n currentSlice.push({\n userId: userId,\n deviceInfo: deviceInfo.device,\n });\n }\n\n // We do this in the per-user loop as we prefer that all messages to the\n // same user end up in the same API call to make it easier for the\n // server (e.g. only have to send one EDU if a remote user, etc). This\n // does mean that if a user has many devices we may go over the desired\n // limit, but its not a hard limit so that is fine.\n if (currentSlice.length > maxDevicesPerRequest) {\n // the current slice is filled up. Start inserting into the next slice\n currentSlice = [];\n mapSlices.push(currentSlice);\n }\n }\n if (currentSlice.length === 0) {\n mapSlices.pop();\n }\n return mapSlices;\n }\n\n /**\n * @internal\n *\n *\n * @param chainIndex - current chain index\n *\n * @param userDeviceMap - mapping from userId to deviceInfo\n *\n * @param payload - fields to include in the encrypted payload\n *\n * @returns Promise which resolves once the key sharing\n * for the given userDeviceMap is generated and has been sent.\n */\n private encryptAndSendKeysToDevices(\n session: OutboundSessionInfo,\n chainIndex: number,\n devices: IOlmDevice[],\n payload: IPayload,\n ): Promise<void> {\n return this.crypto\n .encryptAndSendToDevices(devices, payload)\n .then(() => {\n // store that we successfully uploaded the keys of the current slice\n for (const device of devices) {\n session.markSharedWithDevice(\n device.userId,\n device.deviceInfo.deviceId,\n device.deviceInfo.getIdentityKey(),\n chainIndex,\n );\n }\n })\n .catch((error) => {\n this.prefixedLogger.error(\"failed to encryptAndSendToDevices\", error);\n throw error;\n });\n }\n\n /**\n * @internal\n *\n *\n * @param userDeviceMap - list of blocked devices to notify\n *\n * @param payload - fields to include in the notification payload\n *\n * @returns Promise which resolves once the notifications\n * for the given userDeviceMap is generated and has been sent.\n */\n private async sendBlockedNotificationsToDevices(\n session: OutboundSessionInfo,\n userDeviceMap: IOlmDevice<IBlockedDevice>[],\n payload: IPayload,\n ): Promise<void> {\n const contentMap: MapWithDefault<string, Map<string, IPayload>> = new MapWithDefault(() => new Map());\n\n for (const val of userDeviceMap) {\n const userId = val.userId;\n const blockedInfo = val.deviceInfo;\n const deviceInfo = blockedInfo.deviceInfo;\n const deviceId = deviceInfo.deviceId;\n\n const message = {\n ...payload,\n code: blockedInfo.code,\n reason: blockedInfo.reason,\n [ToDeviceMessageId]: uuidv4(),\n };\n\n if (message.code === \"m.no_olm\") {\n delete message.room_id;\n delete message.session_id;\n }\n\n contentMap.getOrCreate(userId).set(deviceId, message);\n }\n\n await this.baseApis.sendToDevice(\"m.room_key.withheld\", contentMap);\n\n // record the fact that we notified these blocked devices\n for (const [userId, userDeviceMap] of contentMap) {\n for (const deviceId of userDeviceMap.keys()) {\n session.markNotifiedBlockedDevice(userId, deviceId);\n }\n }\n }\n\n /**\n * Re-shares a megolm session key with devices if the key has already been\n * sent to them.\n *\n * @param senderKey - The key of the originating device for the session\n * @param sessionId - ID of the outbound session to share\n * @param userId - ID of the user who owns the target device\n * @param device - The target device\n */\n public async reshareKeyWithDevice(\n senderKey: string,\n sessionId: string,\n userId: string,\n device: DeviceInfo,\n ): Promise<void> {\n const obSessionInfo = this.outboundSessions[sessionId];\n if (!obSessionInfo) {\n this.prefixedLogger.debug(`megolm session ${senderKey}|${sessionId} not found: not re-sharing keys`);\n return;\n }\n\n // The chain index of the key we previously sent this device\n if (!obSessionInfo.sharedWithDevices.has(userId)) {\n this.prefixedLogger.debug(`megolm session ${senderKey}|${sessionId} never shared with user ${userId}`);\n return;\n }\n const sessionSharedData = obSessionInfo.sharedWithDevices.get(userId)?.get(device.deviceId);\n if (sessionSharedData === undefined) {\n this.prefixedLogger.debug(\n `megolm session ${senderKey}|${sessionId} never shared with device ${userId}:${device.deviceId}`,\n );\n return;\n }\n\n if (sessionSharedData.deviceKey !== device.getIdentityKey()) {\n this.prefixedLogger.warn(\n `Megolm session ${senderKey}|${sessionId} has been shared with device ${device.deviceId} but ` +\n `with identity key ${sessionSharedData.deviceKey}. Key is now ${device.getIdentityKey()}!`,\n );\n return;\n }\n\n // get the key from the inbound session: the outbound one will already\n // have been ratcheted to the next chain index.\n const key = await this.olmDevice.getInboundGroupSessionKey(\n this.roomId,\n senderKey,\n sessionId,\n sessionSharedData.messageIndex,\n );\n\n if (!key) {\n this.prefixedLogger.warn(\n `No inbound session key found for megolm session ${senderKey}|${sessionId}: not re-sharing keys`,\n );\n return;\n }\n\n await olmlib.ensureOlmSessionsForDevices(this.olmDevice, this.baseApis, new Map([[userId, [device]]]));\n\n const payload = {\n type: \"m.forwarded_room_key\",\n content: {\n \"algorithm\": olmlib.MEGOLM_ALGORITHM,\n \"room_id\": this.roomId,\n \"session_id\": sessionId,\n \"session_key\": key.key,\n \"chain_index\": key.chain_index,\n \"sender_key\": senderKey,\n \"sender_claimed_ed25519_key\": key.sender_claimed_ed25519_key,\n \"forwarding_curve25519_key_chain\": key.forwarding_curve25519_key_chain,\n \"org.matrix.msc3061.shared_history\": key.shared_history || false,\n },\n };\n\n const encryptedContent: IEncryptedContent = {\n algorithm: olmlib.OLM_ALGORITHM,\n sender_key: this.olmDevice.deviceCurve25519Key!,\n ciphertext: {},\n [ToDeviceMessageId]: uuidv4(),\n };\n await olmlib.encryptMessageForDevice(\n encryptedContent.ciphertext,\n this.userId,\n this.deviceId,\n this.olmDevice,\n userId,\n device,\n payload,\n );\n\n await this.baseApis.sendToDevice(\n \"m.room.encrypted\",\n new Map([[userId, new Map([[device.deviceId, encryptedContent]])]]),\n );\n this.prefixedLogger.debug(\n `Re-shared key for megolm session ${senderKey}|${sessionId} with ${userId}:${device.deviceId}`,\n );\n }\n\n /**\n * @internal\n *\n *\n * @param key - the session key as returned by\n * OlmDevice.getOutboundGroupSessionKey\n *\n * @param payload - the base to-device message payload for sharing keys\n *\n * @param devicesByUser - map from userid to list of devices\n *\n * @param errorDevices - array that will be populated with the devices that we can't get an\n * olm session for\n *\n * @param otkTimeout - The timeout in milliseconds when requesting\n * one-time keys for establishing new olm sessions.\n *\n * @param failedServers - An array to fill with remote servers that\n * failed to respond to one-time-key requests.\n */\n private async shareKeyWithDevices(\n session: OutboundSessionInfo,\n key: IOutboundGroupSessionKey,\n payload: IPayload,\n devicesByUser: Map<string, DeviceInfo[]>,\n errorDevices: IOlmDevice[],\n otkTimeout: number,\n failedServers?: string[],\n ): Promise<void> {\n const devicemap = await olmlib.ensureOlmSessionsForDevices(\n this.olmDevice,\n this.baseApis,\n devicesByUser,\n false,\n otkTimeout,\n failedServers,\n this.prefixedLogger,\n );\n this.getDevicesWithoutSessions(devicemap, devicesByUser, errorDevices);\n await this.shareKeyWithOlmSessions(session, key, payload, devicemap);\n }\n\n private async shareKeyWithOlmSessions(\n session: OutboundSessionInfo,\n key: IOutboundGroupSessionKey,\n payload: IPayload,\n deviceMap: Map<string, Map<string, IOlmSessionResult>>,\n ): Promise<void> {\n const userDeviceMaps = this.splitDevices(deviceMap);\n\n for (let i = 0; i < userDeviceMaps.length; i++) {\n const taskDetail = `megolm keys for ${session.sessionId} (slice ${i + 1}/${userDeviceMaps.length})`;\n try {\n this.prefixedLogger.debug(\n `Sharing ${taskDetail}`,\n userDeviceMaps[i].map((d) => `${d.userId}/${d.deviceInfo.deviceId}`),\n );\n await this.encryptAndSendKeysToDevices(session, key.chain_index, userDeviceMaps[i], payload);\n this.prefixedLogger.debug(`Shared ${taskDetail}`);\n } catch (e) {\n this.prefixedLogger.error(`Failed to share ${taskDetail}`);\n throw e;\n }\n }\n }\n\n /**\n * Notify devices that we weren't able to create olm sessions.\n *\n *\n *\n * @param failedDevices - the devices that we were unable to\n * create olm sessions for, as returned by shareKeyWithDevices\n */\n private async notifyFailedOlmDevices(\n session: OutboundSessionInfo,\n key: IOutboundGroupSessionKey,\n failedDevices: IOlmDevice[],\n ): Promise<void> {\n this.prefixedLogger.debug(`Notifying ${failedDevices.length} devices we failed to create Olm sessions`);\n\n // mark the devices that failed as \"handled\" because we don't want to try\n // to claim a one-time-key for dead devices on every message.\n for (const { userId, deviceInfo } of failedDevices) {\n const deviceId = deviceInfo.deviceId;\n\n session.markSharedWithDevice(userId, deviceId, deviceInfo.getIdentityKey(), key.chain_index);\n }\n\n const unnotifiedFailedDevices = await this.olmDevice.filterOutNotifiedErrorDevices(failedDevices);\n this.prefixedLogger.debug(\n `Need to notify ${unnotifiedFailedDevices.length} failed devices which haven't been notified before`,\n );\n const blockedMap: MapWithDefault<string, Map<string, { device: IBlockedDevice }>> = new MapWithDefault(\n () => new Map(),\n );\n for (const { userId, deviceInfo } of unnotifiedFailedDevices) {\n // we use a similar format to what\n // olmlib.ensureOlmSessionsForDevices returns, so that\n // we can use the same function to split\n blockedMap.getOrCreate(userId).set(deviceInfo.deviceId, {\n device: {\n code: \"m.no_olm\",\n reason: WITHHELD_MESSAGES[\"m.no_olm\"],\n deviceInfo,\n },\n });\n }\n\n // send the notifications\n await this.notifyBlockedDevices(session, blockedMap);\n this.prefixedLogger.debug(\n `Notified ${unnotifiedFailedDevices.length} devices we failed to create Olm sessions`,\n );\n }\n\n /**\n * Notify blocked devices that they have been blocked.\n *\n *\n * @param devicesByUser - map from userid to device ID to blocked data\n */\n private async notifyBlockedDevices(\n session: OutboundSessionInfo,\n devicesByUser: Map<string, Map<string, { device: IBlockedDevice }>>,\n ): Promise<void> {\n const payload: IPayload = {\n room_id: this.roomId,\n session_id: session.sessionId,\n algorithm: olmlib.MEGOLM_ALGORITHM,\n sender_key: this.olmDevice.deviceCurve25519Key!,\n };\n\n const userDeviceMaps = this.splitDevices(devicesByUser);\n\n for (let i = 0; i < userDeviceMaps.length; i++) {\n try {\n await this.sendBlockedNotificationsToDevices(session, userDeviceMaps[i], payload);\n this.prefixedLogger.debug(\n `Completed blacklist notification for ${session.sessionId} ` +\n `(slice ${i + 1}/${userDeviceMaps.length})`,\n );\n } catch (e) {\n this.prefixedLogger.debug(\n `blacklist notification for ${session.sessionId} ` +\n `(slice ${i + 1}/${userDeviceMaps.length}) failed`,\n );\n\n throw e;\n }\n }\n }\n\n /**\n * Perform any background tasks that can be done before a message is ready to\n * send, in order to speed up sending of the message.\n *\n * @param room - the room the event is in\n * @returns A function that, when called, will stop the preparation\n */\n public prepareToEncrypt(room: Room): () => void {\n if (room.roomId !== this.roomId) {\n throw new Error(\"MegolmEncryption.prepareToEncrypt called on unexpected room\");\n }\n\n if (this.encryptionPreparation != null) {\n // We're already preparing something, so don't do anything else.\n const elapsedTime = Date.now() - this.encryptionPreparation.startTime;\n this.prefixedLogger.debug(\n `Already started preparing to encrypt for this room ${elapsedTime}ms ago, skipping`,\n );\n return this.encryptionPreparation.cancel;\n }\n\n this.prefixedLogger.debug(\"Preparing to encrypt events\");\n\n let cancelled = false;\n const isCancelled = (): boolean => cancelled;\n\n this.encryptionPreparation = {\n startTime: Date.now(),\n promise: (async (): Promise<void> => {\n try {\n // Attempt to enumerate the devices in room, and gracefully\n // handle cancellation if it occurs.\n const getDevicesResult = await this.getDevicesInRoom(room, false, isCancelled);\n if (getDevicesResult === null) return;\n const [devicesInRoom, blocked] = getDevicesResult;\n\n if (this.crypto.globalErrorOnUnknownDevices) {\n // Drop unknown devices for now. When the message gets sent, we'll\n // throw an error, but we'll still be prepared to send to the known\n // devices.\n this.removeUnknownDevices(devicesInRoom);\n }\n\n this.prefixedLogger.debug(\"Ensuring outbound megolm session\");\n await this.ensureOutboundSession(room, devicesInRoom, blocked, true);\n\n this.prefixedLogger.debug(\"Ready to encrypt events\");\n } catch (e) {\n this.prefixedLogger.error(\"Failed to prepare to encrypt events\", e);\n } finally {\n delete this.encryptionPreparation;\n }\n })(),\n\n cancel: (): void => {\n // The caller has indicated that the process should be cancelled,\n // so tell the promise that we'd like to halt, and reset the preparation state.\n cancelled = true;\n delete this.encryptionPreparation;\n },\n };\n\n return this.encryptionPreparation.cancel;\n }\n\n /**\n * @param content - plaintext event content\n *\n * @returns Promise which resolves to the new event body\n */\n public async encryptMessage(room: Room, eventType: string, content: IContent): Promise<IMegolmEncryptedContent> {\n this.prefixedLogger.debug(\"Starting to encrypt event\");\n\n if (this.encryptionPreparation != null) {\n // If we started sending keys, wait for it to be done.\n // FIXME: check if we need to cancel\n // (https://github.com/matrix-org/matrix-js-sdk/issues/1255)\n try {\n await this.encryptionPreparation.promise;\n } catch {\n // ignore any errors -- if the preparation failed, we'll just\n // restart everything here\n }\n }\n\n /**\n * When using in-room messages and the room has encryption enabled,\n * clients should ensure that encryption does not hinder the verification.\n */\n const forceDistributeToUnverified = this.isVerificationEvent(eventType, content);\n const [devicesInRoom, blocked] = await this.getDevicesInRoom(room, forceDistributeToUnverified);\n\n // check if any of these devices are not yet known to the user.\n // if so, warn the user so they can verify or ignore.\n if (this.crypto.globalErrorOnUnknownDevices) {\n this.checkForUnknownDevices(devicesInRoom);\n }\n\n const session = await this.ensureOutboundSession(room, devicesInRoom, blocked);\n const payloadJson = {\n room_id: this.roomId,\n type: eventType,\n content: content,\n };\n\n const ciphertext = this.olmDevice.encryptGroupMessage(session.sessionId, JSON.stringify(payloadJson));\n const encryptedContent: IEncryptedContent = {\n algorithm: olmlib.MEGOLM_ALGORITHM,\n sender_key: this.olmDevice.deviceCurve25519Key!,\n ciphertext: ciphertext,\n session_id: session.sessionId,\n // Include our device ID so that recipients can send us a\n // m.new_device message if they don't have our session key.\n // XXX: Do we still need this now that m.new_device messages\n // no longer exist since #483?\n device_id: this.deviceId,\n };\n\n session.useCount++;\n return encryptedContent;\n }\n\n private isVerificationEvent(eventType: string, content: IContent): boolean {\n switch (eventType) {\n case EventType.KeyVerificationCancel:\n case EventType.KeyVerificationDone:\n case EventType.KeyVerificationMac:\n case EventType.KeyVerificationStart:\n case EventType.KeyVerificationKey:\n case EventType.KeyVerificationReady:\n case EventType.KeyVerificationAccept: {\n return true;\n }\n case EventType.RoomMessage: {\n return content[\"msgtype\"] === MsgType.KeyVerificationRequest;\n }\n default: {\n return false;\n }\n }\n }\n\n /**\n * Forces the current outbound group session to be discarded such\n * that another one will be created next time an event is sent.\n *\n * This should not normally be necessary.\n */\n public forceDiscardSession(): void {\n this.setupPromise = this.setupPromise.then(() => null);\n }\n\n /**\n * Checks the devices we're about to send to and see if any are entirely\n * unknown to the user. If so, warn the user, and mark them as known to\n * give the user a chance to go verify them before re-sending this message.\n *\n * @param devicesInRoom - `userId -> {deviceId -> object}`\n * devices we should shared the session with.\n */\n private checkForUnknownDevices(devicesInRoom: DeviceInfoMap): void {\n const unknownDevices: MapWithDefault<string, Map<string, DeviceInfo>> = new MapWithDefault(() => new Map());\n\n for (const [userId, userDevices] of devicesInRoom) {\n for (const [deviceId, device] of userDevices) {\n if (device.isUnverified() && !device.isKnown()) {\n unknownDevices.getOrCreate(userId).set(deviceId, device);\n }\n }\n }\n\n if (unknownDevices.size) {\n // it'd be kind to pass unknownDevices up to the user in this error\n throw new UnknownDeviceError(\n \"This room contains unknown devices which have not been verified. \" +\n \"We strongly recommend you verify them before continuing.\",\n unknownDevices,\n );\n }\n }\n\n /**\n * Remove unknown devices from a set of devices. The devicesInRoom parameter\n * will be modified.\n *\n * @param devicesInRoom - `userId -> {deviceId -> object}`\n * devices we should shared the session with.\n */\n private removeUnknownDevices(devicesInRoom: DeviceInfoMap): void {\n for (const [userId, userDevices] of devicesInRoom) {\n for (const [deviceId, device] of userDevices) {\n if (device.isUnverified() && !device.isKnown()) {\n userDevices.delete(deviceId);\n }\n }\n\n if (userDevices.size === 0) {\n devicesInRoom.delete(userId);\n }\n }\n }\n\n /**\n * Get the list of unblocked devices for all users in the room\n *\n * @param forceDistributeToUnverified - if set to true will include the unverified devices\n * even if setting is set to block them (useful for verification)\n * @param isCancelled - will cause the procedure to abort early if and when it starts\n * returning `true`. If omitted, cancellation won't happen.\n *\n * @returns Promise which resolves to `null`, or an array whose\n * first element is a {@link DeviceInfoMap} indicating\n * the devices that messages should be encrypted to, and whose second\n * element is a map from userId to deviceId to data indicating the devices\n * that are in the room but that have been blocked.\n * If `isCancelled` is provided and returns `true` while processing, `null`\n * will be returned.\n * If `isCancelled` is not provided, the Promise will never resolve to `null`.\n */\n private async getDevicesInRoom(\n room: Room,\n forceDistributeToUnverified?: boolean,\n ): Promise<[DeviceInfoMap, BlockedMap]>;\n private async getDevicesInRoom(\n room: Room,\n forceDistributeToUnverified?: boolean,\n isCancelled?: () => boolean,\n ): Promise<null | [DeviceInfoMap, BlockedMap]>;\n private async getDevicesInRoom(\n room: Room,\n forceDistributeToUnverified = false,\n isCancelled?: () => boolean,\n ): Promise<null | [DeviceInfoMap, BlockedMap]> {\n const members = await room.getEncryptionTargetMembers();\n this.prefixedLogger.debug(\n `Encrypting for users (shouldEncryptForInvitedMembers: ${room.shouldEncryptForInvitedMembers()}):`,\n members.map((u) => `${u.userId} (${u.membership})`),\n );\n\n const roomMembers = members.map(function (u) {\n return u.userId;\n });\n\n // The global value is treated as a default for when rooms don't specify a value.\n let isBlacklisting = this.crypto.globalBlacklistUnverifiedDevices;\n const isRoomBlacklisting = room.getBlacklistUnverifiedDevices();\n if (typeof isRoomBlacklisting === \"boolean\") {\n isBlacklisting = isRoomBlacklisting;\n }\n\n // We are happy to use a cached version here: we assume that if we already\n // have a list of the user's devices, then we already share an e2e room\n // with them, which means that they will have announced any new devices via\n // device_lists in their /sync response. This cache should then be maintained\n // using all the device_lists changes and left fields.\n // See https://github.com/vector-im/element-web/issues/2305 for details.\n const devices = await this.crypto.downloadKeys(roomMembers, false);\n\n if (isCancelled?.() === true) {\n return null;\n }\n\n const blocked = new MapWithDefault<string, Map<string, IBlockedDevice>>(() => new Map());\n // remove any blocked devices\n for (const [userId, userDevices] of devices) {\n for (const [deviceId, userDevice] of userDevices) {\n // Yield prior to checking each device so that we don't block\n // updating/rendering for too long.\n // See https://github.com/vector-im/element-web/issues/21612\n if (isCancelled !== undefined) await immediate();\n if (isCancelled?.() === true) return null;\n const deviceTrust = this.crypto.checkDeviceTrust(userId, deviceId);\n\n if (\n userDevice.isBlocked() ||\n (!deviceTrust.isVerified() && isBlacklisting && !forceDistributeToUnverified)\n ) {\n const blockedDevices = blocked.getOrCreate(userId);\n const isBlocked = userDevice.isBlocked();\n blockedDevices.set(deviceId, {\n code: isBlocked ? \"m.blacklisted\" : \"m.unverified\",\n reason: WITHHELD_MESSAGES[isBlocked ? \"m.blacklisted\" : \"m.unverified\"],\n deviceInfo: userDevice,\n });\n userDevices.delete(deviceId);\n }\n }\n }\n\n return [devices, blocked];\n }\n}\n\n/**\n * Megolm decryption implementation\n *\n * @param params - parameters, as per {@link DecryptionAlgorithm}\n */\nexport class MegolmDecryption extends DecryptionAlgorithm {\n // events which we couldn't decrypt due to unknown sessions /\n // indexes, or which we could only decrypt with untrusted keys:\n // map from senderKey|sessionId to Set of MatrixEvents\n private pendingEvents = new Map<string, Map<string, Set<MatrixEvent>>>();\n\n // this gets stubbed out by the unit tests.\n private olmlib = olmlib;\n\n protected readonly roomId: string;\n private readonly prefixedLogger: Logger;\n\n public constructor(params: DecryptionClassParams<IParams & Required<Pick<IParams, \"roomId\">>>) {\n super(params);\n this.roomId = params.roomId;\n this.prefixedLogger = logger.getChild(`[${this.roomId} decryption]`);\n }\n\n /**\n * returns a promise which resolves to a\n * {@link EventDecryptionResult} once we have finished\n * decrypting, or rejects with an `algorithms.DecryptionError` if there is a\n * problem decrypting the event.\n */\n public async decryptEvent(event: MatrixEvent): Promise<IEventDecryptionResult> {\n const content = event.getWireContent();\n\n if (!content.sender_key || !content.session_id || !content.ciphertext) {\n throw new DecryptionError(DecryptionFailureCode.MEGOLM_MISSING_FIELDS, \"Missing fields in input\");\n }\n\n // we add the event to the pending list *before* we start decryption.\n //\n // then, if the key turns up while decryption is in progress (and\n // decryption fails), we will schedule a retry.\n // (fixes https://github.com/vector-im/element-web/issues/5001)\n this.addEventToPendingList(event);\n\n let res: IDecryptedGroupMessage | null;\n try {\n res = await this.olmDevice.decryptGroupMessage(\n event.getRoomId()!,\n content.sender_key,\n content.session_id,\n content.ciphertext,\n event.getId()!,\n event.getTs(),\n );\n } catch (e) {\n if ((<Error>e).name === \"DecryptionError\") {\n // re-throw decryption errors as-is\n throw e;\n }\n\n let errorCode = DecryptionFailureCode.OLM_DECRYPT_GROUP_MESSAGE_ERROR;\n\n if ((<MatrixError>e)?.message === \"OLM.UNKNOWN_MESSAGE_INDEX\") {\n this.requestKeysForEvent(event);\n\n errorCode = DecryptionFailureCode.OLM_UNKNOWN_MESSAGE_INDEX;\n }\n\n throw new DecryptionError(errorCode, e instanceof Error ? e.message : \"Unknown Error: Error is undefined\", {\n session: content.sender_key + \"|\" + content.session_id,\n });\n }\n\n if (res === null) {\n // We've got a message for a session we don't have.\n // try and get the missing key from the backup first\n this.crypto.backupManager.queryKeyBackupRateLimited(event.getRoomId(), content.session_id).catch(() => {});\n\n // (XXX: We might actually have received this key since we started\n // decrypting, in which case we'll have scheduled a retry, and this\n // request will be redundant. We could probably check to see if the\n // event is still in the pending list; if not, a retry will have been\n // scheduled, so we needn't send out the request here.)\n this.requestKeysForEvent(event);\n\n // See if there was a problem with the olm session at the time the\n // event was sent. Use a fuzz factor of 2 minutes.\n const problem = await this.olmDevice.sessionMayHaveProblems(content.sender_key, event.getTs() - 120000);\n if (problem) {\n this.prefixedLogger.info(\n `When handling UISI from ${event.getSender()} (sender key ${content.sender_key}): ` +\n `recent session problem with that sender:`,\n problem,\n );\n let problemDescription = PROBLEM_DESCRIPTIONS[problem.type as \"no_olm\"] || PROBLEM_DESCRIPTIONS.unknown;\n if (problem.fixed) {\n problemDescription += \" Trying to create a new secure channel and re-requesting the keys.\";\n }\n throw new DecryptionError(DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID, problemDescription, {\n session: content.sender_key + \"|\" + content.session_id,\n });\n }\n\n throw new DecryptionError(\n DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID,\n \"The sender's device has not sent us the keys for this message.\",\n {\n session: content.sender_key + \"|\" + content.session_id,\n },\n );\n }\n\n // Success. We can remove the event from the pending list, if\n // that hasn't already happened. However, if the event was\n // decrypted with an untrusted key, leave it on the pending\n // list so it will be retried if we find a trusted key later.\n if (!res.untrusted) {\n this.removeEventFromPendingList(event);\n }\n\n const payload = JSON.parse(res.result);\n\n // belt-and-braces check that the room id matches that indicated by the HS\n // (this is somewhat redundant, since the megolm session is scoped to the\n // room, so neither the sender nor a MITM can lie about the room_id).\n if (payload.room_id !== event.getRoomId()) {\n throw new DecryptionError(\n DecryptionFailureCode.MEGOLM_BAD_ROOM,\n \"Message intended for room \" + payload.room_id,\n );\n }\n\n return {\n clearEvent: payload,\n senderCurve25519Key: res.senderKey,\n claimedEd25519Key: res.keysClaimed.ed25519,\n forwardingCurve25519KeyChain: res.forwardingCurve25519KeyChain,\n untrusted: res.untrusted,\n };\n }\n\n private requestKeysForEvent(event: MatrixEvent): void {\n const wireContent = event.getWireContent();\n\n const recipients = event.getKeyRequestRecipients(this.userId);\n\n this.crypto.requestRoomKey(\n {\n room_id: event.getRoomId()!,\n algorithm: wireContent.algorithm,\n sender_key: wireContent.sender_key,\n session_id: wireContent.session_id,\n },\n recipients,\n );\n }\n\n /**\n * Add an event to the list of those awaiting their session keys.\n *\n * @internal\n *\n */\n private addEventToPendingList(event: MatrixEvent): void {\n const content = event.getWireContent();\n const senderKey = content.sender_key;\n const sessionId = content.session_id;\n if (!this.pendingEvents.has(senderKey)) {\n this.pendingEvents.set(senderKey, new Map<string, Set<MatrixEvent>>());\n }\n const senderPendingEvents = this.pendingEvents.get(senderKey)!;\n if (!senderPendingEvents.has(sessionId)) {\n senderPendingEvents.set(sessionId, new Set());\n }\n senderPendingEvents.get(sessionId)?.add(event);\n }\n\n /**\n * Remove an event from the list of those awaiting their session keys.\n *\n * @internal\n *\n */\n private removeEventFromPendingList(event: MatrixEvent): void {\n const content = event.getWireContent();\n const senderKey = content.sender_key;\n const sessionId = content.session_id;\n const senderPendingEvents = this.pendingEvents.get(senderKey);\n const pendingEvents = senderPendingEvents?.get(sessionId);\n if (!pendingEvents) {\n return;\n }\n\n pendingEvents.delete(event);\n if (pendingEvents.size === 0) {\n senderPendingEvents!.delete(sessionId);\n }\n if (senderPendingEvents!.size === 0) {\n this.pendingEvents.delete(senderKey);\n }\n }\n\n /**\n * Parse a RoomKey out of an `m.room_key` event.\n *\n * @param event - the event containing the room key.\n *\n * @returns The `RoomKey` if it could be successfully parsed out of the\n * event.\n *\n * @internal\n *\n */\n private roomKeyFromEvent(event: MatrixEvent): RoomKey | undefined {\n const senderKey = event.getSenderKey()!;\n const content = event.getContent<Partial<IMessage[\"content\"]>>();\n const extraSessionData: OlmGroupSessionExtraData = {};\n\n if (!content.room_id || !content.session_key || !content.session_id || !content.algorithm) {\n this.prefixedLogger.error(\"key event is missing fields\");\n return;\n }\n\n if (!olmlib.isOlmEncrypted(event)) {\n this.prefixedLogger.error(\"key event not properly encrypted\");\n return;\n }\n\n if (content[\"org.matrix.msc3061.shared_history\"]) {\n extraSessionData.sharedHistory = true;\n }\n\n const roomKey: RoomKey = {\n senderKey: senderKey,\n sessionId: content.session_id,\n sessionKey: content.session_key,\n extraSessionData,\n exportFormat: false,\n roomId: content.room_id,\n algorithm: content.algorithm,\n forwardingKeyChain: [],\n keysClaimed: event.getKeysClaimed(),\n };\n\n return roomKey;\n }\n\n /**\n * Parse a RoomKey out of an `m.forwarded_room_key` event.\n *\n * @param event - the event containing the forwarded room key.\n *\n * @returns The `RoomKey` if it could be successfully parsed out of the\n * event.\n *\n * @internal\n *\n */\n private forwardedRoomKeyFromEvent(event: MatrixEvent): RoomKey | undefined {\n // the properties in m.forwarded_room_key are a superset of those in m.room_key, so\n // start by parsing the m.room_key fields.\n const roomKey = this.roomKeyFromEvent(event);\n\n if (!roomKey) {\n return;\n }\n\n const senderKey = event.getSenderKey()!;\n const content = event.getContent<Partial<IMessage[\"content\"]>>();\n\n const senderKeyUser = this.baseApis.crypto!.deviceList.getUserByIdentityKey(olmlib.OLM_ALGORITHM, senderKey);\n\n // We received this to-device event from event.getSenderKey(), but the original\n // creator of the room key is claimed in the content.\n const claimedCurve25519Key = content.sender_key;\n const claimedEd25519Key = content.sender_claimed_ed25519_key;\n\n let forwardingKeyChain = Array.isArray(content.forwarding_curve25519_key_chain)\n ? content.forwarding_curve25519_key_chain\n : [];\n\n // copy content before we modify it\n forwardingKeyChain = forwardingKeyChain.slice();\n forwardingKeyChain.push(senderKey);\n\n // Check if we have all the fields we need.\n if (senderKeyUser !== event.getSender()) {\n this.prefixedLogger.error(\"sending device does not belong to the user it claims to be from\");\n return;\n }\n\n if (!claimedCurve25519Key) {\n this.prefixedLogger.error(\"forwarded_room_key event is missing sender_key field\");\n return;\n }\n\n if (!claimedEd25519Key) {\n this.prefixedLogger.error(`forwarded_room_key_event is missing sender_claimed_ed25519_key field`);\n return;\n }\n\n const keysClaimed = {\n ed25519: claimedEd25519Key,\n };\n\n // FIXME: We're reusing the same field to track both:\n //\n // 1. The Olm identity we've received this room key from.\n // 2. The Olm identity deduced (in the trusted case) or claiming (in the\n // untrusted case) to be the original creator of this room key.\n //\n // We now overwrite the value tracking usage 1 with the value tracking usage 2.\n roomKey.senderKey = claimedCurve25519Key;\n // Replace our keysClaimed as well.\n roomKey.keysClaimed = keysClaimed;\n roomKey.exportFormat = true;\n roomKey.forwardingKeyChain = forwardingKeyChain;\n // forwarded keys are always untrusted\n roomKey.extraSessionData.untrusted = true;\n\n return roomKey;\n }\n\n /**\n * Determine if we should accept the forwarded room key that was found in the given\n * event.\n *\n * @param event - An `m.forwarded_room_key` event.\n * @param roomKey - The room key that was found in the event.\n *\n * @returns promise that will resolve to a boolean telling us if it's ok to\n * accept the given forwarded room key.\n *\n * @internal\n *\n */\n private async shouldAcceptForwardedKey(event: MatrixEvent, roomKey: RoomKey): Promise<boolean> {\n const senderKey = event.getSenderKey()!;\n\n const sendingDevice =\n this.crypto.deviceList.getDeviceByIdentityKey(olmlib.OLM_ALGORITHM, senderKey) ?? undefined;\n const deviceTrust = this.crypto.checkDeviceInfoTrust(event.getSender()!, sendingDevice);\n\n // Using the plaintext sender here is fine since we checked that the\n // sender matches to the user id in the device keys when this event was\n // originally decrypted. This can obviously only happen if the device\n // keys have been downloaded, but if they haven't the\n // `deviceTrust.isVerified()` flag would be false as well.\n //\n // It would still be far nicer if the `sendingDevice` had a user ID\n // attached to it that went through signature checks.\n const fromUs = event.getSender() === this.baseApis.getUserId();\n const keyFromOurVerifiedDevice = deviceTrust.isVerified() && fromUs;\n const weRequested = await this.wasRoomKeyRequested(event, roomKey);\n const fromInviter = this.wasRoomKeyForwardedByInviter(event, roomKey);\n const sharedAsHistory = this.wasRoomKeyForwardedAsHistory(roomKey);\n\n return (weRequested && keyFromOurVerifiedDevice) || (fromInviter && sharedAsHistory);\n }\n\n /**\n * Did we ever request the given room key from the event sender and its\n * accompanying device.\n *\n * @param event - An `m.forwarded_room_key` event.\n * @param roomKey - The room key that was found in the event.\n *\n * @internal\n *\n */\n private async wasRoomKeyRequested(event: MatrixEvent, roomKey: RoomKey): Promise<boolean> {\n // We send the `m.room_key_request` out as a wildcard to-device request,\n // otherwise we would have to duplicate the same content for each\n // device. This is why we need to pass in \"*\" as the device id here.\n const outgoingRequests = await this.crypto.cryptoStore.getOutgoingRoomKeyRequestsByTarget(\n event.getSender()!,\n \"*\",\n [RoomKeyRequestState.Sent],\n );\n\n return outgoingRequests.some(\n (req) => req.requestBody.room_id === roomKey.roomId && req.requestBody.session_id === roomKey.sessionId,\n );\n }\n\n private wasRoomKeyForwardedByInviter(event: MatrixEvent, roomKey: RoomKey): boolean {\n // TODO: This is supposed to have a time limit. We should only accept\n // such keys if we happen to receive them for a recently joined room.\n const room = this.baseApis.getRoom(roomKey.roomId);\n const senderKey = event.getSenderKey();\n\n if (!senderKey) {\n return false;\n }\n\n const senderKeyUser = this.crypto.deviceList.getUserByIdentityKey(olmlib.OLM_ALGORITHM, senderKey);\n\n if (!senderKeyUser) {\n return false;\n }\n\n const memberEvent = room?.getMember(this.userId)?.events.member;\n const fromInviter =\n memberEvent?.getSender() === senderKeyUser ||\n (memberEvent?.getUnsigned()?.prev_sender === senderKeyUser &&\n memberEvent?.getPrevContent()?.membership === KnownMembership.Invite);\n\n if (room && fromInviter) {\n return true;\n } else {\n return false;\n }\n }\n\n private wasRoomKeyForwardedAsHistory(roomKey: RoomKey): boolean {\n const room = this.baseApis.getRoom(roomKey.roomId);\n\n // If the key is not for a known room, then something fishy is going on,\n // so we reject the key out of caution. In practice, this is a bit moot\n // because we'll only accept shared_history forwarded by the inviter, and\n // we won't know who was the inviter for an unknown room, so we'll reject\n // it anyway.\n if (room && roomKey.extraSessionData.sharedHistory) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Check if a forwarded room key should be parked.\n *\n * A forwarded room key should be parked if it's a key for a room we're not\n * in. We park the forwarded room key in case *this sender* invites us to\n * that room later.\n */\n private shouldParkForwardedKey(roomKey: RoomKey): boolean {\n const room = this.baseApis.getRoom(roomKey.roomId);\n\n if (!room && roomKey.extraSessionData.sharedHistory) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Park the given room key to our store.\n *\n * @param event - An `m.forwarded_room_key` event.\n * @param roomKey - The room key that was found in the event.\n *\n * @internal\n *\n */\n private async parkForwardedKey(event: MatrixEvent, roomKey: RoomKey): Promise<void> {\n const parkedData = {\n senderId: event.getSender()!,\n senderKey: roomKey.senderKey,\n sessionId: roomKey.sessionId,\n sessionKey: roomKey.sessionKey,\n keysClaimed: roomKey.keysClaimed,\n forwardingCurve25519KeyChain: roomKey.forwardingKeyChain,\n };\n await this.crypto.cryptoStore.doTxn(\n \"readwrite\",\n [\"parked_shared_history\"],\n (txn) => this.crypto.cryptoStore.addParkedSharedHistory(roomKey.roomId, parkedData, txn),\n logger.getChild(\"[addParkedSharedHistory]\"),\n );\n }\n\n /**\n * Add the given room key to our store.\n *\n * @param roomKey - The room key that should be added to the store.\n *\n * @internal\n *\n */\n private async addRoomKey(roomKey: RoomKey): Promise<void> {\n try {\n await this.olmDevice.addInboundGroupSession(\n roomKey.roomId,\n roomKey.senderKey,\n roomKey.forwardingKeyChain,\n roomKey.sessionId,\n roomKey.sessionKey,\n roomKey.keysClaimed,\n roomKey.exportFormat,\n roomKey.extraSessionData,\n );\n\n // have another go at decrypting events sent with this session.\n if (await this.retryDecryption(roomKey.senderKey, roomKey.sessionId, !roomKey.extraSessionData.untrusted)) {\n // cancel any outstanding room key requests for this session.\n // Only do this if we managed to decrypt every message in the\n // session, because if we didn't, we leave the other key\n // requests in the hopes that someone sends us a key that\n // includes an earlier index.\n this.crypto.cancelRoomKeyRequest({\n algorithm: roomKey.algorithm,\n room_id: roomKey.roomId,\n session_id: roomKey.sessionId,\n sender_key: roomKey.senderKey,\n });\n }\n\n // don't wait for the keys to be backed up for the server\n await this.crypto.backupManager.backupGroupSession(roomKey.senderKey, roomKey.sessionId);\n } catch (e) {\n this.prefixedLogger.error(`Error handling m.room_key_event: ${e}`);\n }\n }\n\n /**\n * Handle room keys that have been forwarded to us as an\n * `m.forwarded_room_key` event.\n *\n * Forwarded room keys need special handling since we have no way of knowing\n * who the original creator of the room key was. This naturally means that\n * forwarded room keys are always untrusted and should only be accepted in\n * some cases.\n *\n * @param event - An `m.forwarded_room_key` event.\n *\n * @internal\n *\n */\n private async onForwardedRoomKey(event: MatrixEvent): Promise<void> {\n const roomKey = this.forwardedRoomKeyFromEvent(event);\n\n if (!roomKey) {\n return;\n }\n\n if (await this.shouldAcceptForwardedKey(event, roomKey)) {\n await this.addRoomKey(roomKey);\n } else if (this.shouldParkForwardedKey(roomKey)) {\n await this.parkForwardedKey(event, roomKey);\n }\n }\n\n public async onRoomKeyEvent(event: MatrixEvent): Promise<void> {\n if (event.getType() == \"m.forwarded_room_key\") {\n await this.onForwardedRoomKey(event);\n } else {\n const roomKey = this.roomKeyFromEvent(event);\n\n if (!roomKey) {\n return;\n }\n\n await this.addRoomKey(roomKey);\n }\n }\n\n /**\n * @param event - key event\n */\n public async onRoomKeyWithheldEvent(event: MatrixEvent): Promise<void> {\n const content = event.getContent();\n const senderKey = content.sender_key;\n\n if (content.code === \"m.no_olm\") {\n await this.onNoOlmWithheldEvent(event);\n } else if (content.code === \"m.unavailable\") {\n // this simply means that the other device didn't have the key, which isn't very useful information. Don't\n // record it in the storage\n } else {\n await this.olmDevice.addInboundGroupSessionWithheld(\n content.room_id,\n senderKey,\n content.session_id,\n content.code,\n content.reason,\n );\n }\n\n // Having recorded the problem, retry decryption on any affected messages.\n // It's unlikely we'll be able to decrypt sucessfully now, but this will\n // update the error message.\n //\n if (content.session_id) {\n await this.retryDecryption(senderKey, content.session_id);\n } else {\n // no_olm messages aren't specific to a given megolm session, so\n // we trigger retrying decryption for all the messages from the sender's\n // key, so that we can update the error message to indicate the olm\n // session problem.\n await this.retryDecryptionFromSender(senderKey);\n }\n }\n\n private async onNoOlmWithheldEvent(event: MatrixEvent): Promise<void> {\n const content = event.getContent();\n const senderKey = content.sender_key;\n const sender = event.getSender()!;\n this.prefixedLogger.warn(`${sender}:${senderKey} was unable to establish an olm session with us`);\n // if the sender says that they haven't been able to establish an olm\n // session, let's proactively establish one\n\n if (await this.olmDevice.getSessionIdForDevice(senderKey)) {\n // a session has already been established, so we don't need to\n // create a new one.\n this.prefixedLogger.debug(\"New session already created. Not creating a new one.\");\n await this.olmDevice.recordSessionProblem(senderKey, \"no_olm\", true);\n return;\n }\n let device = this.crypto.deviceList.getDeviceByIdentityKey(content.algorithm, senderKey);\n if (!device) {\n // if we don't know about the device, fetch the user's devices again\n // and retry before giving up\n await this.crypto.downloadKeys([sender], false);\n device = this.crypto.deviceList.getDeviceByIdentityKey(content.algorithm, senderKey);\n if (!device) {\n this.prefixedLogger.info(\n \"Couldn't find device for identity key \" + senderKey + \": not establishing session\",\n );\n await this.olmDevice.recordSessionProblem(senderKey, \"no_olm\", false);\n return;\n }\n }\n\n // XXX: switch this to use encryptAndSendToDevices() rather than duplicating it?\n\n await olmlib.ensureOlmSessionsForDevices(this.olmDevice, this.baseApis, new Map([[sender, [device]]]), false);\n const encryptedContent: IEncryptedContent = {\n algorithm: olmlib.OLM_ALGORITHM,\n sender_key: this.olmDevice.deviceCurve25519Key!,\n ciphertext: {},\n [ToDeviceMessageId]: uuidv4(),\n };\n await olmlib.encryptMessageForDevice(\n encryptedContent.ciphertext,\n this.userId,\n undefined,\n this.olmDevice,\n sender,\n device,\n { type: \"m.dummy\" },\n );\n\n await this.olmDevice.recordSessionProblem(senderKey, \"no_olm\", true);\n\n await this.baseApis.sendToDevice(\n \"m.room.encrypted\",\n new Map([[sender, new Map([[device.deviceId, encryptedContent]])]]),\n );\n }\n\n public hasKeysForKeyRequest(keyRequest: IncomingRoomKeyRequest): Promise<boolean> {\n const body = keyRequest.requestBody;\n\n return this.olmDevice.hasInboundSessionKeys(\n body.room_id,\n body.sender_key,\n body.session_id,\n // TODO: ratchet index\n );\n }\n\n public shareKeysWithDevice(keyRequest: IncomingRoomKeyRequest): void {\n const userId = keyRequest.userId;\n const deviceId = keyRequest.deviceId;\n const deviceInfo = this.crypto.getStoredDevice(userId, deviceId)!;\n const body = keyRequest.requestBody;\n\n // XXX: switch this to use encryptAndSendToDevices()?\n\n this.olmlib\n .ensureOlmSessionsForDevices(this.olmDevice, this.baseApis, new Map([[userId, [deviceInfo]]]))\n .then((devicemap) => {\n const olmSessionResult = devicemap.get(userId)?.get(deviceId);\n if (!olmSessionResult?.sessionId) {\n // no session with this device, probably because there\n // were no one-time keys.\n //\n // ensureOlmSessionsForUsers has already done the logging,\n // so just skip it.\n return null;\n }\n\n this.prefixedLogger.debug(\n \"sharing keys for session \" +\n body.sender_key +\n \"|\" +\n body.session_id +\n \" with device \" +\n userId +\n \":\" +\n deviceId,\n );\n\n return this.buildKeyForwardingMessage(body.room_id, body.sender_key, body.session_id);\n })\n .then((payload) => {\n const encryptedContent: IEncryptedContent = {\n algorithm: olmlib.OLM_ALGORITHM,\n sender_key: this.olmDevice.deviceCurve25519Key!,\n ciphertext: {},\n [ToDeviceMessageId]: uuidv4(),\n };\n\n return this.olmlib\n .encryptMessageForDevice(\n encryptedContent.ciphertext,\n this.userId,\n undefined,\n this.olmDevice,\n userId,\n deviceInfo,\n payload!,\n )\n .then(() => {\n // TODO: retries\n return this.baseApis.sendToDevice(\n \"m.room.encrypted\",\n new Map([[userId, new Map([[deviceId, encryptedContent]])]]),\n );\n });\n });\n }\n\n private async buildKeyForwardingMessage(\n roomId: string,\n senderKey: string,\n sessionId: string,\n ): Promise<IKeyForwardingMessage> {\n const key = await this.olmDevice.getInboundGroupSessionKey(roomId, senderKey, sessionId);\n\n return {\n type: \"m.forwarded_room_key\",\n content: {\n \"algorithm\": olmlib.MEGOLM_ALGORITHM,\n \"room_id\": roomId,\n \"sender_key\": senderKey,\n \"sender_claimed_ed25519_key\": key!.sender_claimed_ed25519_key!,\n \"session_id\": sessionId,\n \"session_key\": key!.key,\n \"chain_index\": key!.chain_index,\n \"forwarding_curve25519_key_chain\": key!.forwarding_curve25519_key_chain,\n \"org.matrix.msc3061.shared_history\": key!.shared_history || false,\n },\n };\n }\n\n /**\n * @param untrusted - whether the key should be considered as untrusted\n * @param source - where the key came from\n */\n public importRoomKey(\n session: IMegolmSessionData,\n { untrusted, source }: { untrusted?: boolean; source?: string } = {},\n ): Promise<void> {\n const extraSessionData: OlmGroupSessionExtraData = {};\n if (untrusted || session.untrusted) {\n extraSessionData.untrusted = true;\n }\n if (session[\"org.matrix.msc3061.shared_history\"]) {\n extraSessionData.sharedHistory = true;\n }\n return this.olmDevice\n .addInboundGroupSession(\n session.room_id,\n session.sender_key,\n session.forwarding_curve25519_key_chain,\n session.session_id,\n session.session_key,\n session.sender_claimed_keys,\n true,\n extraSessionData,\n )\n .then(() => {\n if (source !== \"backup\") {\n // don't wait for it to complete\n this.crypto.backupManager.backupGroupSession(session.sender_key, session.session_id).catch((e) => {\n // This throws if the upload failed, but this is fine\n // since it will have written it to the db and will retry.\n this.prefixedLogger.debug(\"Failed to back up megolm session\", e);\n });\n }\n // have another go at decrypting events sent with this session.\n this.retryDecryption(session.sender_key, session.session_id, !extraSessionData.untrusted);\n });\n }\n\n /**\n * Have another go at decrypting events after we receive a key. Resolves once\n * decryption has been re-attempted on all events.\n *\n * @internal\n * @param forceRedecryptIfUntrusted - whether messages that were already\n * successfully decrypted using untrusted keys should be re-decrypted\n *\n * @returns whether all messages were successfully\n * decrypted with trusted keys\n */\n private async retryDecryption(\n senderKey: string,\n sessionId: string,\n forceRedecryptIfUntrusted?: boolean,\n ): Promise<boolean> {\n const senderPendingEvents = this.pendingEvents.get(senderKey);\n if (!senderPendingEvents) {\n return true;\n }\n\n const pending = senderPendingEvents.get(sessionId);\n if (!pending) {\n return true;\n }\n\n const pendingList = [...pending];\n this.prefixedLogger.debug(\n \"Retrying decryption on events:\",\n pendingList.map((e) => `${e.getId()}`),\n );\n\n await Promise.all(\n pendingList.map(async (ev) => {\n try {\n await ev.attemptDecryption(this.crypto, { isRetry: true, forceRedecryptIfUntrusted });\n } catch {\n // don't die if something goes wrong\n }\n }),\n );\n\n // If decrypted successfully with trusted keys, they'll have\n // been removed from pendingEvents\n return !this.pendingEvents.get(senderKey)?.has(sessionId);\n }\n\n public async retryDecryptionFromSender(senderKey: string): Promise<boolean> {\n const senderPendingEvents = this.pendingEvents.get(senderKey);\n if (!senderPendingEvents) {\n return true;\n }\n\n this.pendingEvents.delete(senderKey);\n\n await Promise.all(\n [...senderPendingEvents].map(async ([_sessionId, pending]) => {\n await Promise.all(\n [...pending].map(async (ev) => {\n try {\n await ev.attemptDecryption(this.crypto);\n } catch {\n // don't die if something goes wrong\n }\n }),\n );\n }),\n );\n\n return !this.pendingEvents.has(senderKey);\n }\n\n public async sendSharedHistoryInboundSessions(devicesByUser: Map<string, DeviceInfo[]>): Promise<void> {\n await olmlib.ensureOlmSessionsForDevices(this.olmDevice, this.baseApis, devicesByUser);\n\n const sharedHistorySessions = await this.olmDevice.getSharedHistoryInboundGroupSessions(this.roomId);\n this.prefixedLogger.debug(\n `Sharing history in with users ${Array.from(devicesByUser.keys())}`,\n sharedHistorySessions.map(([senderKey, sessionId]) => `${senderKey}|${sessionId}`),\n );\n for (const [senderKey, sessionId] of sharedHistorySessions) {\n const payload = await this.buildKeyForwardingMessage(this.roomId, senderKey, sessionId);\n\n // FIXME: use encryptAndSendToDevices() rather than duplicating it here.\n const promises: Promise<unknown>[] = [];\n const contentMap: Map<string, Map<string, IEncryptedContent>> = new Map();\n for (const [userId, devices] of devicesByUser) {\n const deviceMessages = new Map();\n contentMap.set(userId, deviceMessages);\n for (const deviceInfo of devices) {\n const encryptedContent: IEncryptedContent = {\n algorithm: olmlib.OLM_ALGORITHM,\n sender_key: this.olmDevice.deviceCurve25519Key!,\n ciphertext: {},\n [ToDeviceMessageId]: uuidv4(),\n };\n deviceMessages.set(deviceInfo.deviceId, encryptedContent);\n promises.push(\n olmlib.encryptMessageForDevice(\n encryptedContent.ciphertext,\n this.userId,\n undefined,\n this.olmDevice,\n userId,\n deviceInfo,\n payload,\n ),\n );\n }\n }\n await Promise.all(promises);\n\n // prune out any devices that encryptMessageForDevice could not encrypt for,\n // in which case it will have just not added anything to the ciphertext object.\n // There's no point sending messages to devices if we couldn't encrypt to them,\n // since that's effectively a blank message.\n for (const [userId, deviceMessages] of contentMap) {\n for (const [deviceId, content] of deviceMessages) {\n if (!hasCiphertext(content)) {\n this.prefixedLogger.debug(\"No ciphertext for device \" + userId + \":\" + deviceId + \": pruning\");\n deviceMessages.delete(deviceId);\n }\n }\n // No devices left for that user? Strip that too.\n if (deviceMessages.size === 0) {\n this.prefixedLogger.debug(\"Pruned all devices for user \" + userId);\n contentMap.delete(userId);\n }\n }\n\n // Is there anything left?\n if (contentMap.size === 0) {\n this.prefixedLogger.debug(\"No users left to send to: aborting\");\n return;\n }\n\n await this.baseApis.sendToDevice(\"m.room.encrypted\", contentMap);\n }\n }\n}\n\nconst PROBLEM_DESCRIPTIONS = {\n no_olm: \"The sender was unable to establish a secure channel.\",\n unknown: \"The secure channel with the sender was corrupted.\",\n};\n\nregisterAlgorithm(olmlib.MEGOLM_ALGORITHM, MegolmEncryption, MegolmDecryption);\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAASA,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAGnC,SAASC,MAAM,QAAgB,iBAAiB;AAChD,OAAO,KAAKC,MAAM,MAAM,cAAc;AACtC,SACIC,mBAAmB,EAEnBC,mBAAmB,EAEnBC,iBAAiB,EACjBC,kBAAkB,QACf,WAAW;AAClB,SAAiCC,iBAAiB,QAAQ,iBAAiB;AAM3E,SAASC,SAAS,EAAEC,OAAO,EAAEC,iBAAiB,QAAQ,uBAAuB;AAE7E,SAASC,mBAAmB,QAAQ,qCAAqC;AAGzE,SAASC,SAAS,EAAEC,cAAc,QAAQ,gBAAgB;AAC1D,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,qBAAqB,QAAQ,2BAA2B;AACjE,SAASC,eAAe,QAAQ,sCAAsC;;AAEtE;AACA,OAAO,SAASC,mBAAmBA,CAACC,IAA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AAC;UAC/D;QACJ;QAEA,MAAMsV,OAAI,CAACjU,QAAQ,CAACgF,YAAY,CAAC,kBAAkB,EAAET,UAAU,CAAC;MACpE;IAAC;EACL;AACJ;AAEA,IAAMwH,oBAAoB,GAAG;EACzBwI,MAAM,EAAE,sDAAsD;EAC9DvI,OAAO,EAAE;AACb,CAAC;AAED5T,iBAAiB,CAACH,MAAM,CAAC0H,gBAAgB,EAAExD,gBAAgB,EAAEqO,gBAAgB,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export interface IMessage {
2
+ type: number;
3
+ body: string;
4
+ }
5
+ //# sourceMappingURL=olm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"olm.d.ts","sourceRoot":"","sources":["../../../src/crypto/algorithms/olm.ts"],"names":[],"mappings":"AAkCA,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB"}