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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (467) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/global.d.js +0 -2
  3. package/lib/@types/global.d.js.map +1 -1
  4. package/lib/browser-index.d.ts.map +1 -1
  5. package/lib/browser-index.js +0 -11
  6. package/lib/browser-index.js.map +1 -1
  7. package/lib/client.d.ts +2 -1176
  8. package/lib/client.d.ts.map +1 -1
  9. package/lib/client.js +346 -2717
  10. package/lib/client.js.map +1 -1
  11. package/lib/embedded.d.ts +0 -22
  12. package/lib/embedded.d.ts.map +1 -1
  13. package/lib/embedded.js +24 -166
  14. package/lib/embedded.js.map +1 -1
  15. package/lib/event-mapper.d.ts.map +1 -1
  16. package/lib/event-mapper.js +0 -4
  17. package/lib/event-mapper.js.map +1 -1
  18. package/lib/matrix.d.ts +0 -19
  19. package/lib/matrix.d.ts.map +1 -1
  20. package/lib/matrix.js +1 -26
  21. package/lib/matrix.js.map +1 -1
  22. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  23. package/lib/models/MSC3089Branch.js +0 -3
  24. package/lib/models/MSC3089Branch.js.map +1 -1
  25. package/lib/models/event.d.ts +0 -94
  26. package/lib/models/event.d.ts.map +1 -1
  27. package/lib/models/event.js +0 -274
  28. package/lib/models/event.js.map +1 -1
  29. package/lib/models/poll.d.ts.map +1 -1
  30. package/lib/models/poll.js +1 -5
  31. package/lib/models/poll.js.map +1 -1
  32. package/lib/models/relations-container.d.ts.map +1 -1
  33. package/lib/models/relations-container.js +1 -7
  34. package/lib/models/relations-container.js.map +1 -1
  35. package/lib/models/relations.d.ts +0 -1
  36. package/lib/models/relations.d.ts.map +1 -1
  37. package/lib/models/relations.js +0 -8
  38. package/lib/models/relations.js.map +1 -1
  39. package/lib/models/room-state.d.ts.map +1 -1
  40. package/lib/models/room-state.js +10 -26
  41. package/lib/models/room-state.js.map +1 -1
  42. package/lib/models/room.d.ts +0 -18
  43. package/lib/models/room.d.ts.map +1 -1
  44. package/lib/models/room.js +94 -148
  45. package/lib/models/room.js.map +1 -1
  46. package/lib/models/thread.d.ts.map +1 -1
  47. package/lib/models/thread.js +0 -1
  48. package/lib/models/thread.js.map +1 -1
  49. package/lib/sliding-sync-sdk.d.ts +2 -3
  50. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  51. package/lib/sliding-sync-sdk.js +41 -90
  52. package/lib/sliding-sync-sdk.js.map +1 -1
  53. package/lib/sync.d.ts +0 -12
  54. package/lib/sync.d.ts.map +1 -1
  55. package/lib/sync.js +1 -73
  56. package/lib/sync.js.map +1 -1
  57. package/lib/testing.d.ts +0 -48
  58. package/lib/testing.d.ts.map +1 -1
  59. package/lib/testing.js +0 -105
  60. package/lib/testing.js.map +1 -1
  61. package/package.json +1 -3
  62. package/src/@types/global.d.ts +0 -3
  63. package/src/browser-index.ts +0 -11
  64. package/src/client.ts +57 -2732
  65. package/src/embedded.ts +3 -130
  66. package/src/event-mapper.ts +0 -4
  67. package/src/matrix.ts +0 -28
  68. package/src/models/MSC3089Branch.ts +0 -3
  69. package/src/models/event.ts +0 -289
  70. package/src/models/poll.ts +0 -6
  71. package/src/models/relations-container.ts +1 -8
  72. package/src/models/relations.ts +0 -8
  73. package/src/models/room-state.ts +2 -8
  74. package/src/models/room.ts +0 -62
  75. package/src/models/thread.ts +0 -1
  76. package/src/sliding-sync-sdk.ts +2 -72
  77. package/src/sync.ts +1 -98
  78. package/src/testing.ts +0 -108
  79. package/lib/@types/crypto.d.ts +0 -47
  80. package/lib/@types/crypto.d.ts.map +0 -1
  81. package/lib/@types/crypto.js +0 -1
  82. package/lib/@types/crypto.js.map +0 -1
  83. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  84. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  85. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  86. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  87. package/lib/common-crypto/CryptoBackend.js +0 -73
  88. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  89. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  90. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  91. package/lib/common-crypto/key-passphrase.js +0 -33
  92. package/lib/common-crypto/key-passphrase.js.map +0 -1
  93. package/lib/crypto/CrossSigning.d.ts +0 -184
  94. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  95. package/lib/crypto/CrossSigning.js +0 -718
  96. package/lib/crypto/CrossSigning.js.map +0 -1
  97. package/lib/crypto/DeviceList.d.ts +0 -216
  98. package/lib/crypto/DeviceList.d.ts.map +0 -1
  99. package/lib/crypto/DeviceList.js +0 -892
  100. package/lib/crypto/DeviceList.js.map +0 -1
  101. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  102. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  103. package/lib/crypto/EncryptionSetup.js +0 -356
  104. package/lib/crypto/EncryptionSetup.js.map +0 -1
  105. package/lib/crypto/OlmDevice.d.ts +0 -457
  106. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  107. package/lib/crypto/OlmDevice.js +0 -1241
  108. package/lib/crypto/OlmDevice.js.map +0 -1
  109. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  110. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  111. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  112. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  113. package/lib/crypto/RoomList.d.ts +0 -26
  114. package/lib/crypto/RoomList.d.ts.map +0 -1
  115. package/lib/crypto/RoomList.js +0 -71
  116. package/lib/crypto/RoomList.js.map +0 -1
  117. package/lib/crypto/SecretSharing.d.ts +0 -24
  118. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  119. package/lib/crypto/SecretSharing.js +0 -194
  120. package/lib/crypto/SecretSharing.js.map +0 -1
  121. package/lib/crypto/SecretStorage.d.ts +0 -55
  122. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  123. package/lib/crypto/SecretStorage.js +0 -118
  124. package/lib/crypto/SecretStorage.js.map +0 -1
  125. package/lib/crypto/aes.d.ts +0 -6
  126. package/lib/crypto/aes.d.ts.map +0 -1
  127. package/lib/crypto/aes.js +0 -24
  128. package/lib/crypto/aes.js.map +0 -1
  129. package/lib/crypto/algorithms/base.d.ts +0 -156
  130. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  131. package/lib/crypto/algorithms/base.js +0 -187
  132. package/lib/crypto/algorithms/base.js.map +0 -1
  133. package/lib/crypto/algorithms/index.d.ts +0 -4
  134. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  135. package/lib/crypto/algorithms/index.js +0 -20
  136. package/lib/crypto/algorithms/index.js.map +0 -1
  137. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  138. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  139. package/lib/crypto/algorithms/megolm.js +0 -1822
  140. package/lib/crypto/algorithms/megolm.js.map +0 -1
  141. package/lib/crypto/algorithms/olm.d.ts +0 -5
  142. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  143. package/lib/crypto/algorithms/olm.js +0 -299
  144. package/lib/crypto/algorithms/olm.js.map +0 -1
  145. package/lib/crypto/api.d.ts +0 -32
  146. package/lib/crypto/api.d.ts.map +0 -1
  147. package/lib/crypto/api.js +0 -22
  148. package/lib/crypto/api.js.map +0 -1
  149. package/lib/crypto/backup.d.ts +0 -227
  150. package/lib/crypto/backup.d.ts.map +0 -1
  151. package/lib/crypto/backup.js +0 -824
  152. package/lib/crypto/backup.js.map +0 -1
  153. package/lib/crypto/crypto.d.ts +0 -3
  154. package/lib/crypto/crypto.d.ts.map +0 -1
  155. package/lib/crypto/crypto.js +0 -19
  156. package/lib/crypto/crypto.js.map +0 -1
  157. package/lib/crypto/dehydration.d.ts +0 -34
  158. package/lib/crypto/dehydration.d.ts.map +0 -1
  159. package/lib/crypto/dehydration.js +0 -252
  160. package/lib/crypto/dehydration.js.map +0 -1
  161. package/lib/crypto/device-converter.d.ts +0 -9
  162. package/lib/crypto/device-converter.d.ts.map +0 -1
  163. package/lib/crypto/device-converter.js +0 -42
  164. package/lib/crypto/device-converter.js.map +0 -1
  165. package/lib/crypto/deviceinfo.d.ts +0 -99
  166. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  167. package/lib/crypto/deviceinfo.js +0 -148
  168. package/lib/crypto/deviceinfo.js.map +0 -1
  169. package/lib/crypto/index.d.ts +0 -1209
  170. package/lib/crypto/index.d.ts.map +0 -1
  171. package/lib/crypto/index.js +0 -4097
  172. package/lib/crypto/index.js.map +0 -1
  173. package/lib/crypto/key_passphrase.d.ts +0 -14
  174. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  175. package/lib/crypto/key_passphrase.js +0 -44
  176. package/lib/crypto/key_passphrase.js.map +0 -1
  177. package/lib/crypto/keybackup.d.ts +0 -18
  178. package/lib/crypto/keybackup.d.ts.map +0 -1
  179. package/lib/crypto/keybackup.js +0 -1
  180. package/lib/crypto/keybackup.js.map +0 -1
  181. package/lib/crypto/olmlib.d.ts +0 -129
  182. package/lib/crypto/olmlib.d.ts.map +0 -1
  183. package/lib/crypto/olmlib.js +0 -492
  184. package/lib/crypto/olmlib.js.map +0 -1
  185. package/lib/crypto/recoverykey.d.ts +0 -2
  186. package/lib/crypto/recoverykey.d.ts.map +0 -1
  187. package/lib/crypto/recoverykey.js +0 -19
  188. package/lib/crypto/recoverykey.js.map +0 -1
  189. package/lib/crypto/store/base.d.ts +0 -252
  190. package/lib/crypto/store/base.d.ts.map +0 -1
  191. package/lib/crypto/store/base.js +0 -64
  192. package/lib/crypto/store/base.js.map +0 -1
  193. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  194. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  195. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  196. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  197. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  198. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  199. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  200. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  201. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  202. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  203. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  204. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  205. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  206. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  207. package/lib/crypto/store/memory-crypto-store.js +0 -622
  208. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  209. package/lib/crypto/verification/Base.d.ts +0 -105
  210. package/lib/crypto/verification/Base.d.ts.map +0 -1
  211. package/lib/crypto/verification/Base.js +0 -372
  212. package/lib/crypto/verification/Base.js.map +0 -1
  213. package/lib/crypto/verification/Error.d.ts +0 -35
  214. package/lib/crypto/verification/Error.d.ts.map +0 -1
  215. package/lib/crypto/verification/Error.js +0 -86
  216. package/lib/crypto/verification/Error.js.map +0 -1
  217. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  218. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  219. package/lib/crypto/verification/IllegalMethod.js +0 -43
  220. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  221. package/lib/crypto/verification/QRCode.d.ts +0 -51
  222. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  223. package/lib/crypto/verification/QRCode.js +0 -277
  224. package/lib/crypto/verification/QRCode.js.map +0 -1
  225. package/lib/crypto/verification/SAS.d.ts +0 -27
  226. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  227. package/lib/crypto/verification/SAS.js +0 -485
  228. package/lib/crypto/verification/SAS.js.map +0 -1
  229. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  230. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  231. package/lib/crypto/verification/SASDecimal.js +0 -34
  232. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  233. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  234. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  235. package/lib/crypto/verification/request/Channel.js +0 -1
  236. package/lib/crypto/verification/request/Channel.js.map +0 -1
  237. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  238. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  239. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  240. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  241. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  242. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  243. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  244. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  245. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  246. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  247. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  248. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  249. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  250. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  251. package/lib/crypto-api/CryptoEvent.js +0 -33
  252. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  253. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  254. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  255. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  256. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  257. package/lib/crypto-api/index.d.ts +0 -978
  258. package/lib/crypto-api/index.d.ts.map +0 -1
  259. package/lib/crypto-api/index.js +0 -304
  260. package/lib/crypto-api/index.js.map +0 -1
  261. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  262. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  263. package/lib/crypto-api/key-passphrase.js +0 -51
  264. package/lib/crypto-api/key-passphrase.js.map +0 -1
  265. package/lib/crypto-api/keybackup.d.ts +0 -88
  266. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  267. package/lib/crypto-api/keybackup.js +0 -1
  268. package/lib/crypto-api/keybackup.js.map +0 -1
  269. package/lib/crypto-api/recovery-key.d.ts +0 -11
  270. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  271. package/lib/crypto-api/recovery-key.js +0 -65
  272. package/lib/crypto-api/recovery-key.js.map +0 -1
  273. package/lib/crypto-api/verification.d.ts +0 -344
  274. package/lib/crypto-api/verification.d.ts.map +0 -1
  275. package/lib/crypto-api/verification.js +0 -91
  276. package/lib/crypto-api/verification.js.map +0 -1
  277. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  278. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  279. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  280. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  281. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  282. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  283. package/lib/rendezvous/RendezvousChannel.js +0 -1
  284. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  285. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  286. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  287. package/lib/rendezvous/RendezvousCode.js +0 -1
  288. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  289. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  290. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  291. package/lib/rendezvous/RendezvousError.js +0 -23
  292. package/lib/rendezvous/RendezvousError.js.map +0 -1
  293. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  294. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  295. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  296. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  297. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  298. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  299. package/lib/rendezvous/RendezvousIntent.js +0 -22
  300. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  301. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  302. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  303. package/lib/rendezvous/RendezvousTransport.js +0 -1
  304. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  305. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  306. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  307. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  308. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  309. package/lib/rendezvous/channels/index.d.ts +0 -2
  310. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  311. package/lib/rendezvous/channels/index.js +0 -18
  312. package/lib/rendezvous/channels/index.js.map +0 -1
  313. package/lib/rendezvous/index.d.ts +0 -10
  314. package/lib/rendezvous/index.d.ts.map +0 -1
  315. package/lib/rendezvous/index.js +0 -23
  316. package/lib/rendezvous/index.js.map +0 -1
  317. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  318. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  319. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  320. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  321. package/lib/rendezvous/transports/index.d.ts +0 -2
  322. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  323. package/lib/rendezvous/transports/index.js +0 -18
  324. package/lib/rendezvous/transports/index.js.map +0 -1
  325. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  326. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  327. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  328. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  329. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  330. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  331. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  332. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  333. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  334. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  335. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  336. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  337. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  338. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  339. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  340. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  341. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  342. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  343. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  344. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  345. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  346. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  347. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  348. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  349. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  350. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  351. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  352. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  353. package/lib/rust-crypto/backup.d.ts +0 -254
  354. package/lib/rust-crypto/backup.d.ts.map +0 -1
  355. package/lib/rust-crypto/backup.js +0 -837
  356. package/lib/rust-crypto/backup.js.map +0 -1
  357. package/lib/rust-crypto/constants.d.ts +0 -3
  358. package/lib/rust-crypto/constants.d.ts.map +0 -1
  359. package/lib/rust-crypto/constants.js +0 -19
  360. package/lib/rust-crypto/constants.js.map +0 -1
  361. package/lib/rust-crypto/device-converter.d.ts +0 -28
  362. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  363. package/lib/rust-crypto/device-converter.js +0 -123
  364. package/lib/rust-crypto/device-converter.js.map +0 -1
  365. package/lib/rust-crypto/index.d.ts +0 -61
  366. package/lib/rust-crypto/index.d.ts.map +0 -1
  367. package/lib/rust-crypto/index.js +0 -152
  368. package/lib/rust-crypto/index.js.map +0 -1
  369. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  370. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  371. package/lib/rust-crypto/libolm_migration.js +0 -459
  372. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  373. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  374. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  375. package/lib/rust-crypto/rust-crypto.js +0 -2016
  376. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  377. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  378. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  379. package/lib/rust-crypto/secret-storage.js +0 -63
  380. package/lib/rust-crypto/secret-storage.js.map +0 -1
  381. package/lib/rust-crypto/verification.d.ts +0 -319
  382. package/lib/rust-crypto/verification.d.ts.map +0 -1
  383. package/lib/rust-crypto/verification.js +0 -816
  384. package/lib/rust-crypto/verification.js.map +0 -1
  385. package/lib/secret-storage.d.ts +0 -370
  386. package/lib/secret-storage.d.ts.map +0 -1
  387. package/lib/secret-storage.js +0 -466
  388. package/lib/secret-storage.js.map +0 -1
  389. package/src/@types/crypto.ts +0 -73
  390. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  391. package/src/common-crypto/CryptoBackend.ts +0 -302
  392. package/src/common-crypto/README.md +0 -4
  393. package/src/common-crypto/key-passphrase.ts +0 -43
  394. package/src/crypto/CrossSigning.ts +0 -773
  395. package/src/crypto/DeviceList.ts +0 -989
  396. package/src/crypto/EncryptionSetup.ts +0 -351
  397. package/src/crypto/OlmDevice.ts +0 -1500
  398. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  399. package/src/crypto/RoomList.ts +0 -70
  400. package/src/crypto/SecretSharing.ts +0 -240
  401. package/src/crypto/SecretStorage.ts +0 -136
  402. package/src/crypto/aes.ts +0 -23
  403. package/src/crypto/algorithms/base.ts +0 -236
  404. package/src/crypto/algorithms/index.ts +0 -20
  405. package/src/crypto/algorithms/megolm.ts +0 -2216
  406. package/src/crypto/algorithms/olm.ts +0 -381
  407. package/src/crypto/api.ts +0 -70
  408. package/src/crypto/backup.ts +0 -922
  409. package/src/crypto/crypto.ts +0 -18
  410. package/src/crypto/dehydration.ts +0 -272
  411. package/src/crypto/device-converter.ts +0 -45
  412. package/src/crypto/deviceinfo.ts +0 -158
  413. package/src/crypto/index.ts +0 -4414
  414. package/src/crypto/key_passphrase.ts +0 -42
  415. package/src/crypto/keybackup.ts +0 -47
  416. package/src/crypto/olmlib.ts +0 -539
  417. package/src/crypto/recoverykey.ts +0 -18
  418. package/src/crypto/store/base.ts +0 -348
  419. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  420. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  421. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  422. package/src/crypto/store/memory-crypto-store.ts +0 -680
  423. package/src/crypto/verification/Base.ts +0 -409
  424. package/src/crypto/verification/Error.ts +0 -76
  425. package/src/crypto/verification/IllegalMethod.ts +0 -50
  426. package/src/crypto/verification/QRCode.ts +0 -310
  427. package/src/crypto/verification/SAS.ts +0 -494
  428. package/src/crypto/verification/SASDecimal.ts +0 -37
  429. package/src/crypto/verification/request/Channel.ts +0 -34
  430. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  431. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  432. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  433. package/src/crypto-api/CryptoEvent.ts +0 -93
  434. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  435. package/src/crypto-api/index.ts +0 -1175
  436. package/src/crypto-api/key-passphrase.ts +0 -58
  437. package/src/crypto-api/keybackup.ts +0 -115
  438. package/src/crypto-api/recovery-key.ts +0 -69
  439. package/src/crypto-api/verification.ts +0 -408
  440. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  441. package/src/rendezvous/RendezvousChannel.ts +0 -48
  442. package/src/rendezvous/RendezvousCode.ts +0 -25
  443. package/src/rendezvous/RendezvousError.ts +0 -26
  444. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  445. package/src/rendezvous/RendezvousIntent.ts +0 -20
  446. package/src/rendezvous/RendezvousTransport.ts +0 -58
  447. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  448. package/src/rendezvous/channels/index.ts +0 -17
  449. package/src/rendezvous/index.ts +0 -25
  450. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  451. package/src/rendezvous/transports/index.ts +0 -17
  452. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  453. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  454. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  455. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  456. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  457. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  458. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  459. package/src/rust-crypto/backup.ts +0 -881
  460. package/src/rust-crypto/constants.ts +0 -18
  461. package/src/rust-crypto/device-converter.ts +0 -128
  462. package/src/rust-crypto/index.ts +0 -237
  463. package/src/rust-crypto/libolm_migration.ts +0 -530
  464. package/src/rust-crypto/rust-crypto.ts +0 -2205
  465. package/src/rust-crypto/secret-storage.ts +0 -60
  466. package/src/rust-crypto/verification.ts +0 -830
  467. package/src/secret-storage.ts +0 -693
@@ -1,467 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- /*
4
- Copyright 2023 - 2024 The Matrix.org Foundation C.I.C.
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- */
18
-
19
- import { CryptoEvent } from "../crypto-api/index.js";
20
- import { ClientPrefix, MatrixError, Method } from "../http-api/index.js";
21
- import { encodeUri, sleep } from "../utils.js";
22
- // The minimum time to wait between two retries in case of errors. To avoid hammering the server.
23
- var KEY_BACKUP_BACKOFF = 5000; // ms
24
-
25
- /**
26
- * Enumerates the different kind of errors that can occurs when downloading and importing a key from backup.
27
- */
28
- var KeyDownloadErrorCode = /*#__PURE__*/function (KeyDownloadErrorCode) {
29
- KeyDownloadErrorCode["MISSING_DECRYPTION_KEY"] = "MISSING_DECRYPTION_KEY";
30
- KeyDownloadErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
31
- KeyDownloadErrorCode["STOPPED"] = "STOPPED";
32
- return KeyDownloadErrorCode;
33
- }(KeyDownloadErrorCode || {});
34
- class KeyDownloadError extends Error {
35
- constructor(code) {
36
- super("Failed to get key from backup: ".concat(code));
37
- this.code = code;
38
- this.name = "KeyDownloadError";
39
- }
40
- }
41
- class KeyDownloadRateLimitError extends Error {
42
- constructor(retryMillis) {
43
- super("Failed to get key from backup: rate limited");
44
- this.retryMillis = retryMillis;
45
- this.name = "KeyDownloadRateLimitError";
46
- }
47
- }
48
-
49
- /** Details of a megolm session whose key we are trying to fetch. */
50
-
51
- /** Holds the current backup decryptor and version that should be used.
52
- *
53
- * This is intended to be used as an immutable object (a new instance should be created if the configuration changes),
54
- * and some of the logic relies on that, so the properties are marked as `readonly`.
55
- */
56
-
57
- /**
58
- * Used when an 'unable to decrypt' error occurs. It attempts to download the key from the backup.
59
- *
60
- * The current backup API lacks pagination, which can lead to lengthy key retrieval times for large histories (several 10s of minutes).
61
- * To mitigate this, keys are downloaded on demand as decryption errors occurs.
62
- * While this approach may result in numerous requests, it improves user experience by reducing wait times for message decryption.
63
- *
64
- * The PerSessionKeyBackupDownloader is resistant to backup configuration changes: it will automatically resume querying when
65
- * the backup is configured correctly.
66
- */
67
- export class PerSessionKeyBackupDownloader {
68
- /**
69
- * Creates a new instance of PerSessionKeyBackupDownloader.
70
- *
71
- * @param backupManager - The backup manager to use.
72
- * @param olmMachine - The olm machine to use.
73
- * @param http - The http instance to use.
74
- * @param logger - The logger to use.
75
- */
76
- constructor(logger, olmMachine, http, backupManager) {
77
- this.olmMachine = olmMachine;
78
- this.http = http;
79
- this.backupManager = backupManager;
80
- _defineProperty(this, "stopped", false);
81
- /**
82
- * The version and decryption key to use with current backup if all set up correctly.
83
- *
84
- * Will not be set unless `hasConfigurationProblem` is `false`.
85
- */
86
- _defineProperty(this, "configuration", null);
87
- /** We remember when a session was requested and not found in backup to avoid query again too soon.
88
- * Map of session_id to timestamp */
89
- _defineProperty(this, "sessionLastCheckAttemptedTime", new Map());
90
- /** The logger to use */
91
- _defineProperty(this, "logger", void 0);
92
- /** Whether the download loop is running. */
93
- _defineProperty(this, "downloadLoopRunning", false);
94
- /** The list of requests that are queued. */
95
- _defineProperty(this, "queuedRequests", []);
96
- /** Remembers if we have a configuration problem. */
97
- _defineProperty(this, "hasConfigurationProblem", false);
98
- /** The current server backup version check promise. To avoid doing a server call if one is in flight. */
99
- _defineProperty(this, "currentBackupVersionCheck", null);
100
- /**
101
- * Called when the backup status changes (CryptoEvents)
102
- * This will trigger a check of the backup configuration.
103
- */
104
- _defineProperty(this, "onBackupStatusChanged", () => {
105
- // we want to force check configuration, so we clear the current one.
106
- this.hasConfigurationProblem = false;
107
- this.configuration = null;
108
- this.getOrCreateBackupConfiguration().then(configuration => {
109
- if (configuration) {
110
- // restart the download loop if it was stopped
111
- this.downloadKeysLoop();
112
- }
113
- });
114
- });
115
- this.logger = logger.getChild("[PerSessionKeyBackupDownloader]");
116
- backupManager.on(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);
117
- backupManager.on(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);
118
- backupManager.on(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);
119
- }
120
-
121
- /**
122
- * Check if key download is successfully configured and active.
123
- *
124
- * @return `true` if key download is correctly configured and active; otherwise `false`.
125
- */
126
- isKeyBackupDownloadConfigured() {
127
- return this.configuration !== null;
128
- }
129
-
130
- /**
131
- * Return the details of the latest backup on the server, when we last checked.
132
- *
133
- * This is just a convenience method to expose {@link RustBackupManager.getServerBackupInfo}.
134
- */
135
- getServerBackupInfo() {
136
- var _this = this;
137
- return _asyncToGenerator(function* () {
138
- return yield _this.backupManager.getServerBackupInfo();
139
- })();
140
- }
141
-
142
- /**
143
- * Called when a MissingRoomKey or UnknownMessageIndex decryption error is encountered.
144
- *
145
- * This will try to download the key from the backup if there is a trusted active backup.
146
- * In case of success the key will be imported and the onRoomKeysUpdated callback will be called
147
- * internally by the rust-sdk and decryption will be retried.
148
- *
149
- * @param roomId - The room ID of the room where the error occurred.
150
- * @param megolmSessionId - The megolm session ID that is missing.
151
- */
152
- onDecryptionKeyMissingError(roomId, megolmSessionId) {
153
- // Several messages encrypted with the same session may be decrypted at the same time,
154
- // so we need to be resistant and not query several time the same session.
155
- if (this.isAlreadyInQueue(roomId, megolmSessionId)) {
156
- // There is already a request queued for this session, no need to queue another one.
157
- this.logger.trace("Not checking key backup for session ".concat(megolmSessionId, " as it is already queued"));
158
- return;
159
- }
160
- if (this.wasRequestedRecently(megolmSessionId)) {
161
- // We already tried to download this session recently and it was not in backup, no need to try again.
162
- this.logger.trace("Not checking key backup for session ".concat(megolmSessionId, " as it was already requested recently"));
163
- return;
164
- }
165
-
166
- // We always add the request to the queue, even if we have a configuration problem (can't access backup).
167
- // This is to make sure that if the configuration problem is resolved, we will try to download the key.
168
- // This will happen after an initial sync, at this point the backup will not yet be trusted and the decryption
169
- // key will not be available, but it will be just after the verification.
170
- // We don't need to persist it because currently on refresh the sdk will retry to decrypt the messages in error.
171
- this.queuedRequests.push({
172
- roomId,
173
- megolmSessionId
174
- });
175
-
176
- // Start the download loop if it's not already running.
177
- this.downloadKeysLoop();
178
- }
179
- stop() {
180
- this.stopped = true;
181
- this.backupManager.off(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);
182
- this.backupManager.off(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);
183
- this.backupManager.off(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);
184
- }
185
- /** Returns true if the megolm session is already queued for download. */
186
- isAlreadyInQueue(roomId, megolmSessionId) {
187
- return this.queuedRequests.some(info => {
188
- return info.roomId == roomId && info.megolmSessionId == megolmSessionId;
189
- });
190
- }
191
-
192
- /**
193
- * Marks the session as not found in backup, to avoid retrying to soon for a key not in backup
194
- *
195
- * @param megolmSessionId - The megolm session ID that is missing.
196
- */
197
- markAsNotFoundInBackup(megolmSessionId) {
198
- var now = Date.now();
199
- this.sessionLastCheckAttemptedTime.set(megolmSessionId, now);
200
- // if too big make some cleaning to keep under control
201
- if (this.sessionLastCheckAttemptedTime.size > 100) {
202
- this.sessionLastCheckAttemptedTime = new Map(Array.from(this.sessionLastCheckAttemptedTime).filter((sid, ts) => {
203
- return Math.max(now - ts, 0) < KEY_BACKUP_BACKOFF;
204
- }));
205
- }
206
- }
207
-
208
- /** Returns true if the session was requested recently. */
209
- wasRequestedRecently(megolmSessionId) {
210
- var lastCheck = this.sessionLastCheckAttemptedTime.get(megolmSessionId);
211
- if (!lastCheck) return false;
212
- return Math.max(Date.now() - lastCheck, 0) < KEY_BACKUP_BACKOFF;
213
- }
214
- getBackupDecryptionKey() {
215
- var _this2 = this;
216
- return _asyncToGenerator(function* () {
217
- try {
218
- return yield _this2.olmMachine.getBackupKeys();
219
- } catch (_unused) {
220
- return null;
221
- }
222
- })();
223
- }
224
-
225
- /**
226
- * Requests a key from the server side backup.
227
- *
228
- * @param version - The backup version to use.
229
- * @param roomId - The room ID of the room where the error occurred.
230
- * @param sessionId - The megolm session ID that is missing.
231
- */
232
- requestRoomKeyFromBackup(version, roomId, sessionId) {
233
- var _this3 = this;
234
- return _asyncToGenerator(function* () {
235
- var path = encodeUri("/room_keys/keys/$roomId/$sessionId", {
236
- $roomId: roomId,
237
- $sessionId: sessionId
238
- });
239
- return yield _this3.http.authedRequest(Method.Get, path, {
240
- version
241
- }, undefined, {
242
- prefix: ClientPrefix.V3
243
- });
244
- })();
245
- }
246
- downloadKeysLoop() {
247
- var _this4 = this;
248
- return _asyncToGenerator(function* () {
249
- if (_this4.downloadLoopRunning) return;
250
-
251
- // If we have a configuration problem, we don't want to try to download.
252
- // If any configuration change is detected, we will retry and restart the loop.
253
- if (_this4.hasConfigurationProblem) return;
254
- _this4.downloadLoopRunning = true;
255
- try {
256
- while (_this4.queuedRequests.length > 0) {
257
- // we just peek the first one without removing it, so if a new request for same key comes in while we're
258
- // processing this one, it won't queue another request.
259
- var request = _this4.queuedRequests[0];
260
- try {
261
- // The backup could have changed between the time we queued the request and now, so we need to check
262
- var configuration = yield _this4.getOrCreateBackupConfiguration();
263
- if (!configuration) {
264
- // Backup is not configured correctly, so stop the loop.
265
- _this4.downloadLoopRunning = false;
266
- return;
267
- }
268
- var result = yield _this4.queryKeyBackup(request.roomId, request.megolmSessionId, configuration);
269
- if (_this4.stopped) {
270
- return;
271
- }
272
- // We got the encrypted key from backup, let's try to decrypt and import it.
273
- try {
274
- yield _this4.decryptAndImport(request, result, configuration);
275
- } catch (e) {
276
- _this4.logger.error("Error while decrypting and importing key backup for session ".concat(request.megolmSessionId), e);
277
- }
278
- // now remove the request from the queue as we've processed it.
279
- _this4.queuedRequests.shift();
280
- } catch (err) {
281
- if (err instanceof KeyDownloadError) {
282
- switch (err.code) {
283
- case KeyDownloadErrorCode.MISSING_DECRYPTION_KEY:
284
- _this4.markAsNotFoundInBackup(request.megolmSessionId);
285
- // continue for next one
286
- _this4.queuedRequests.shift();
287
- break;
288
- case KeyDownloadErrorCode.NETWORK_ERROR:
289
- // We don't want to hammer if there is a problem, so wait a bit.
290
- yield sleep(KEY_BACKUP_BACKOFF);
291
- break;
292
- case KeyDownloadErrorCode.STOPPED:
293
- // If the downloader was stopped, we don't want to retry.
294
- _this4.downloadLoopRunning = false;
295
- return;
296
- }
297
- } else if (err instanceof KeyDownloadRateLimitError) {
298
- // we want to retry after the backoff time
299
- yield sleep(err.retryMillis);
300
- }
301
- }
302
- }
303
- } finally {
304
- // all pending request have been processed, we can stop the loop.
305
- _this4.downloadLoopRunning = false;
306
- }
307
- })();
308
- }
309
-
310
- /**
311
- * Query the backup for a key.
312
- *
313
- * @param targetRoomId - ID of the room that the session is used in.
314
- * @param targetSessionId - ID of the session for which to check backup.
315
- * @param configuration - The backup configuration to use.
316
- */
317
- queryKeyBackup(targetRoomId, targetSessionId, configuration) {
318
- var _this5 = this;
319
- return _asyncToGenerator(function* () {
320
- _this5.logger.debug("Checking key backup for session ".concat(targetSessionId));
321
- if (_this5.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);
322
- try {
323
- var res = yield _this5.requestRoomKeyFromBackup(configuration.backupVersion, targetRoomId, targetSessionId);
324
- _this5.logger.debug("Got key from backup for sessionId:".concat(targetSessionId));
325
- return res;
326
- } catch (e) {
327
- if (_this5.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);
328
- _this5.logger.info("No luck requesting key backup for session ".concat(targetSessionId, ": ").concat(e));
329
- if (e instanceof MatrixError) {
330
- var errCode = e.data.errcode;
331
- if (errCode == "M_NOT_FOUND") {
332
- // Unfortunately the spec doesn't give us a way to differentiate between a missing key and a wrong version.
333
- // Synapse will return:
334
- // - "error": "Unknown backup version" if the version is wrong.
335
- // - "error": "No room_keys found" if the key is missing.
336
- // It's useful to know if the key is missing or if the version is wrong.
337
- // As it's not spec'ed, we fall back on considering the key is not in backup.
338
- // Notice that this request will be lost if instead the backup got out of sync (updated from other session).
339
- throw new KeyDownloadError(KeyDownloadErrorCode.MISSING_DECRYPTION_KEY);
340
- }
341
- if (e.isRateLimitError()) {
342
- var _waitTime;
343
- var waitTime;
344
- try {
345
- var _e$getRetryAfterMs;
346
- waitTime = (_e$getRetryAfterMs = e.getRetryAfterMs()) !== null && _e$getRetryAfterMs !== void 0 ? _e$getRetryAfterMs : undefined;
347
- } catch (error) {
348
- _this5.logger.warn("Error while retrieving a rate-limit retry delay", error);
349
- }
350
- if (waitTime && waitTime > 0) {
351
- _this5.logger.info("Rate limited by server, waiting ".concat(waitTime, "ms"));
352
- }
353
- throw new KeyDownloadRateLimitError((_waitTime = waitTime) !== null && _waitTime !== void 0 ? _waitTime : KEY_BACKUP_BACKOFF);
354
- }
355
- }
356
- throw new KeyDownloadError(KeyDownloadErrorCode.NETWORK_ERROR);
357
- }
358
- })();
359
- }
360
- decryptAndImport(sessionInfo, data, configuration) {
361
- var _this6 = this;
362
- return _asyncToGenerator(function* () {
363
- var sessionsToImport = {
364
- [sessionInfo.megolmSessionId]: data
365
- };
366
- var keys = yield configuration.decryptor.decryptSessions(sessionsToImport);
367
- for (var k of keys) {
368
- k.room_id = sessionInfo.roomId;
369
- }
370
- yield _this6.backupManager.importBackedUpRoomKeys(keys, configuration.backupVersion);
371
- })();
372
- }
373
-
374
- /**
375
- * Gets the current backup configuration or create one if it doesn't exist.
376
- *
377
- * When a valid configuration is found it is cached and returned for subsequent calls.
378
- * Otherwise, if a check is forced or a check has not yet been done, a new check is done.
379
- *
380
- * @returns The backup configuration to use or null if there is a configuration problem.
381
- */
382
- getOrCreateBackupConfiguration() {
383
- var _this7 = this;
384
- return _asyncToGenerator(function* () {
385
- if (_this7.configuration) {
386
- return _this7.configuration;
387
- }
388
-
389
- // We already tried to check the configuration and it failed.
390
- // We don't want to try again immediately, we will retry if a configuration change is detected.
391
- if (_this7.hasConfigurationProblem) {
392
- return null;
393
- }
394
-
395
- // This method can be called rapidly by several emitted CryptoEvent, so we need to make sure that we don't
396
- // query the server several times.
397
- if (_this7.currentBackupVersionCheck != null) {
398
- _this7.logger.debug("Already checking server version, use current promise");
399
- return yield _this7.currentBackupVersionCheck;
400
- }
401
- _this7.currentBackupVersionCheck = _this7.internalCheckFromServer();
402
- try {
403
- return yield _this7.currentBackupVersionCheck;
404
- } finally {
405
- _this7.currentBackupVersionCheck = null;
406
- }
407
- })();
408
- }
409
- internalCheckFromServer() {
410
- var _this8 = this;
411
- return _asyncToGenerator(function* () {
412
- var _currentServerVersion, _currentServerVersion2, _currentServerVersion4;
413
- var currentServerVersion = null;
414
- try {
415
- currentServerVersion = yield _this8.backupManager.getServerBackupInfo();
416
- } catch (e) {
417
- _this8.logger.debug("Backup: error while checking server version: ".concat(e));
418
- _this8.hasConfigurationProblem = true;
419
- return null;
420
- }
421
- _this8.logger.debug("Got current backup version from server: ".concat((_currentServerVersion = currentServerVersion) === null || _currentServerVersion === void 0 ? void 0 : _currentServerVersion.version));
422
- if (((_currentServerVersion2 = currentServerVersion) === null || _currentServerVersion2 === void 0 ? void 0 : _currentServerVersion2.algorithm) != "m.megolm_backup.v1.curve25519-aes-sha2") {
423
- var _currentServerVersion3;
424
- _this8.logger.info("Unsupported algorithm ".concat((_currentServerVersion3 = currentServerVersion) === null || _currentServerVersion3 === void 0 ? void 0 : _currentServerVersion3.algorithm));
425
- _this8.hasConfigurationProblem = true;
426
- return null;
427
- }
428
- if (!((_currentServerVersion4 = currentServerVersion) !== null && _currentServerVersion4 !== void 0 && _currentServerVersion4.version)) {
429
- _this8.logger.info("No current key backup");
430
- _this8.hasConfigurationProblem = true;
431
- return null;
432
- }
433
- var activeVersion = yield _this8.backupManager.getActiveBackupVersion();
434
- if (activeVersion == null || currentServerVersion.version != activeVersion) {
435
- // Either the current backup version on server side is not trusted, or it is out of sync with the active version on the client side.
436
- _this8.logger.info("The current backup version on the server (".concat(currentServerVersion.version, ") is not trusted. Version we are currently backing up to: ").concat(activeVersion));
437
- _this8.hasConfigurationProblem = true;
438
- return null;
439
- }
440
- var backupKeys = yield _this8.getBackupDecryptionKey();
441
- if (!(backupKeys !== null && backupKeys !== void 0 && backupKeys.decryptionKey)) {
442
- _this8.logger.debug("Not checking key backup for session (no decryption key)");
443
- _this8.hasConfigurationProblem = true;
444
- return null;
445
- }
446
- if (activeVersion != backupKeys.backupVersion) {
447
- _this8.logger.debug("Version for which we have a decryption key (".concat(backupKeys.backupVersion, ") doesn't match the version we are backing up to (").concat(activeVersion, ")"));
448
- _this8.hasConfigurationProblem = true;
449
- return null;
450
- }
451
- var authData = currentServerVersion.auth_data;
452
- if (authData.public_key != backupKeys.decryptionKey.megolmV1PublicKey.publicKeyBase64) {
453
- _this8.logger.debug("Key backup on server does not match our decryption key");
454
- _this8.hasConfigurationProblem = true;
455
- return null;
456
- }
457
- var backupDecryptor = _this8.backupManager.createBackupDecryptor(backupKeys.decryptionKey);
458
- _this8.hasConfigurationProblem = false;
459
- _this8.configuration = {
460
- decryptor: backupDecryptor,
461
- backupVersion: activeVersion
462
- };
463
- return _this8.configuration;
464
- })();
465
- }
466
- }
467
- //# sourceMappingURL=PerSessionKeyBackupDownloader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PerSessionKeyBackupDownloader.js","names":["CryptoEvent","ClientPrefix","MatrixError","Method","encodeUri","sleep","KEY_BACKUP_BACKOFF","KeyDownloadErrorCode","KeyDownloadError","Error","constructor","code","concat","name","KeyDownloadRateLimitError","retryMillis","PerSessionKeyBackupDownloader","logger","olmMachine","http","backupManager","_defineProperty","Map","hasConfigurationProblem","configuration","getOrCreateBackupConfiguration","then","downloadKeysLoop","getChild","on","KeyBackupStatus","onBackupStatusChanged","KeyBackupFailed","KeyBackupDecryptionKeyCached","isKeyBackupDownloadConfigured","getServerBackupInfo","_this","_asyncToGenerator","onDecryptionKeyMissingError","roomId","megolmSessionId","isAlreadyInQueue","trace","wasRequestedRecently","queuedRequests","push","stop","stopped","off","some","info","markAsNotFoundInBackup","now","Date","sessionLastCheckAttemptedTime","set","size","Array","from","filter","sid","ts","Math","max","lastCheck","get","getBackupDecryptionKey","_this2","getBackupKeys","_unused","requestRoomKeyFromBackup","version","sessionId","_this3","path","$roomId","$sessionId","authedRequest","Get","undefined","prefix","V3","_this4","downloadLoopRunning","length","request","result","queryKeyBackup","decryptAndImport","e","error","shift","err","MISSING_DECRYPTION_KEY","NETWORK_ERROR","STOPPED","targetRoomId","targetSessionId","_this5","debug","res","backupVersion","errCode","data","errcode","isRateLimitError","_waitTime","waitTime","_e$getRetryAfterMs","getRetryAfterMs","warn","sessionInfo","_this6","sessionsToImport","keys","decryptor","decryptSessions","k","room_id","importBackedUpRoomKeys","_this7","currentBackupVersionCheck","internalCheckFromServer","_this8","_currentServerVersion","_currentServerVersion2","_currentServerVersion4","currentServerVersion","algorithm","_currentServerVersion3","activeVersion","getActiveBackupVersion","backupKeys","decryptionKey","authData","auth_data","public_key","megolmV1PublicKey","publicKeyBase64","backupDecryptor","createBackupDecryptor"],"sources":["../../src/rust-crypto/PerSessionKeyBackupDownloader.ts"],"sourcesContent":["/*\nCopyright 2023 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { OlmMachine } from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport { Curve25519AuthData, KeyBackupInfo, KeyBackupSession } from \"../crypto-api/keybackup.ts\";\nimport { CryptoEvent } from \"../crypto-api/index.ts\";\nimport { Logger } from \"../logger.ts\";\nimport { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from \"../http-api/index.ts\";\nimport { RustBackupManager } from \"./backup.ts\";\nimport { encodeUri, sleep } from \"../utils.ts\";\nimport { BackupDecryptor } from \"../common-crypto/CryptoBackend.ts\";\n\n// The minimum time to wait between two retries in case of errors. To avoid hammering the server.\nconst KEY_BACKUP_BACKOFF = 5000; // ms\n\n/**\n * Enumerates the different kind of errors that can occurs when downloading and importing a key from backup.\n */\nenum KeyDownloadErrorCode {\n /** The requested key is not in the backup. */\n MISSING_DECRYPTION_KEY = \"MISSING_DECRYPTION_KEY\",\n /** A network error occurred while trying to download the key from backup. */\n NETWORK_ERROR = \"NETWORK_ERROR\",\n /** The loop has been stopped. */\n STOPPED = \"STOPPED\",\n}\n\nclass KeyDownloadError extends Error {\n public constructor(public readonly code: KeyDownloadErrorCode) {\n super(`Failed to get key from backup: ${code}`);\n this.name = \"KeyDownloadError\";\n }\n}\n\nclass KeyDownloadRateLimitError extends Error {\n public constructor(public readonly retryMillis: number) {\n super(`Failed to get key from backup: rate limited`);\n this.name = \"KeyDownloadRateLimitError\";\n }\n}\n\n/** Details of a megolm session whose key we are trying to fetch. */\ntype SessionInfo = { roomId: string; megolmSessionId: string };\n\n/** Holds the current backup decryptor and version that should be used.\n *\n * This is intended to be used as an immutable object (a new instance should be created if the configuration changes),\n * and some of the logic relies on that, so the properties are marked as `readonly`.\n */\ntype Configuration = {\n readonly backupVersion: string;\n readonly decryptor: BackupDecryptor;\n};\n\n/**\n * Used when an 'unable to decrypt' error occurs. It attempts to download the key from the backup.\n *\n * The current backup API lacks pagination, which can lead to lengthy key retrieval times for large histories (several 10s of minutes).\n * To mitigate this, keys are downloaded on demand as decryption errors occurs.\n * While this approach may result in numerous requests, it improves user experience by reducing wait times for message decryption.\n *\n * The PerSessionKeyBackupDownloader is resistant to backup configuration changes: it will automatically resume querying when\n * the backup is configured correctly.\n */\nexport class PerSessionKeyBackupDownloader {\n private stopped = false;\n\n /**\n * The version and decryption key to use with current backup if all set up correctly.\n *\n * Will not be set unless `hasConfigurationProblem` is `false`.\n */\n private configuration: Configuration | null = null;\n\n /** We remember when a session was requested and not found in backup to avoid query again too soon.\n * Map of session_id to timestamp */\n private sessionLastCheckAttemptedTime: Map<string, number> = new Map();\n\n /** The logger to use */\n private readonly logger: Logger;\n\n /** Whether the download loop is running. */\n private downloadLoopRunning = false;\n\n /** The list of requests that are queued. */\n private queuedRequests: SessionInfo[] = [];\n\n /** Remembers if we have a configuration problem. */\n private hasConfigurationProblem = false;\n\n /** The current server backup version check promise. To avoid doing a server call if one is in flight. */\n private currentBackupVersionCheck: Promise<Configuration | null> | null = null;\n\n /**\n * Creates a new instance of PerSessionKeyBackupDownloader.\n *\n * @param backupManager - The backup manager to use.\n * @param olmMachine - The olm machine to use.\n * @param http - The http instance to use.\n * @param logger - The logger to use.\n */\n public constructor(\n logger: Logger,\n private readonly olmMachine: OlmMachine,\n private readonly http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n private readonly backupManager: RustBackupManager,\n ) {\n this.logger = logger.getChild(\"[PerSessionKeyBackupDownloader]\");\n\n backupManager.on(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n backupManager.on(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n backupManager.on(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n }\n\n /**\n * Check if key download is successfully configured and active.\n *\n * @return `true` if key download is correctly configured and active; otherwise `false`.\n */\n public isKeyBackupDownloadConfigured(): boolean {\n return this.configuration !== null;\n }\n\n /**\n * Return the details of the latest backup on the server, when we last checked.\n *\n * This is just a convenience method to expose {@link RustBackupManager.getServerBackupInfo}.\n */\n public async getServerBackupInfo(): Promise<KeyBackupInfo | null | undefined> {\n return await this.backupManager.getServerBackupInfo();\n }\n\n /**\n * Called when a MissingRoomKey or UnknownMessageIndex decryption error is encountered.\n *\n * This will try to download the key from the backup if there is a trusted active backup.\n * In case of success the key will be imported and the onRoomKeysUpdated callback will be called\n * internally by the rust-sdk and decryption will be retried.\n *\n * @param roomId - The room ID of the room where the error occurred.\n * @param megolmSessionId - The megolm session ID that is missing.\n */\n public onDecryptionKeyMissingError(roomId: string, megolmSessionId: string): void {\n // Several messages encrypted with the same session may be decrypted at the same time,\n // so we need to be resistant and not query several time the same session.\n if (this.isAlreadyInQueue(roomId, megolmSessionId)) {\n // There is already a request queued for this session, no need to queue another one.\n this.logger.trace(`Not checking key backup for session ${megolmSessionId} as it is already queued`);\n return;\n }\n\n if (this.wasRequestedRecently(megolmSessionId)) {\n // We already tried to download this session recently and it was not in backup, no need to try again.\n this.logger.trace(\n `Not checking key backup for session ${megolmSessionId} as it was already requested recently`,\n );\n return;\n }\n\n // We always add the request to the queue, even if we have a configuration problem (can't access backup).\n // This is to make sure that if the configuration problem is resolved, we will try to download the key.\n // This will happen after an initial sync, at this point the backup will not yet be trusted and the decryption\n // key will not be available, but it will be just after the verification.\n // We don't need to persist it because currently on refresh the sdk will retry to decrypt the messages in error.\n this.queuedRequests.push({ roomId, megolmSessionId });\n\n // Start the download loop if it's not already running.\n this.downloadKeysLoop();\n }\n\n public stop(): void {\n this.stopped = true;\n this.backupManager.off(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n this.backupManager.off(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n this.backupManager.off(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n }\n\n /**\n * Called when the backup status changes (CryptoEvents)\n * This will trigger a check of the backup configuration.\n */\n private onBackupStatusChanged = (): void => {\n // we want to force check configuration, so we clear the current one.\n this.hasConfigurationProblem = false;\n this.configuration = null;\n this.getOrCreateBackupConfiguration().then((configuration) => {\n if (configuration) {\n // restart the download loop if it was stopped\n this.downloadKeysLoop();\n }\n });\n };\n\n /** Returns true if the megolm session is already queued for download. */\n private isAlreadyInQueue(roomId: string, megolmSessionId: string): boolean {\n return this.queuedRequests.some((info) => {\n return info.roomId == roomId && info.megolmSessionId == megolmSessionId;\n });\n }\n\n /**\n * Marks the session as not found in backup, to avoid retrying to soon for a key not in backup\n *\n * @param megolmSessionId - The megolm session ID that is missing.\n */\n private markAsNotFoundInBackup(megolmSessionId: string): void {\n const now = Date.now();\n this.sessionLastCheckAttemptedTime.set(megolmSessionId, now);\n // if too big make some cleaning to keep under control\n if (this.sessionLastCheckAttemptedTime.size > 100) {\n this.sessionLastCheckAttemptedTime = new Map(\n Array.from(this.sessionLastCheckAttemptedTime).filter((sid, ts) => {\n return Math.max(now - ts, 0) < KEY_BACKUP_BACKOFF;\n }),\n );\n }\n }\n\n /** Returns true if the session was requested recently. */\n private wasRequestedRecently(megolmSessionId: string): boolean {\n const lastCheck = this.sessionLastCheckAttemptedTime.get(megolmSessionId);\n if (!lastCheck) return false;\n return Math.max(Date.now() - lastCheck, 0) < KEY_BACKUP_BACKOFF;\n }\n\n private async getBackupDecryptionKey(): Promise<RustSdkCryptoJs.BackupKeys | null> {\n try {\n return await this.olmMachine.getBackupKeys();\n } catch {\n return null;\n }\n }\n\n /**\n * Requests a key from the server side backup.\n *\n * @param version - The backup version to use.\n * @param roomId - The room ID of the room where the error occurred.\n * @param sessionId - The megolm session ID that is missing.\n */\n private async requestRoomKeyFromBackup(\n version: string,\n roomId: string,\n sessionId: string,\n ): Promise<KeyBackupSession> {\n const path = encodeUri(\"/room_keys/keys/$roomId/$sessionId\", {\n $roomId: roomId,\n $sessionId: sessionId,\n });\n\n return await this.http.authedRequest<KeyBackupSession>(Method.Get, path, { version }, undefined, {\n prefix: ClientPrefix.V3,\n });\n }\n\n private async downloadKeysLoop(): Promise<void> {\n if (this.downloadLoopRunning) return;\n\n // If we have a configuration problem, we don't want to try to download.\n // If any configuration change is detected, we will retry and restart the loop.\n if (this.hasConfigurationProblem) return;\n\n this.downloadLoopRunning = true;\n\n try {\n while (this.queuedRequests.length > 0) {\n // we just peek the first one without removing it, so if a new request for same key comes in while we're\n // processing this one, it won't queue another request.\n const request = this.queuedRequests[0];\n try {\n // The backup could have changed between the time we queued the request and now, so we need to check\n const configuration = await this.getOrCreateBackupConfiguration();\n if (!configuration) {\n // Backup is not configured correctly, so stop the loop.\n this.downloadLoopRunning = false;\n return;\n }\n\n const result = await this.queryKeyBackup(request.roomId, request.megolmSessionId, configuration);\n\n if (this.stopped) {\n return;\n }\n // We got the encrypted key from backup, let's try to decrypt and import it.\n try {\n await this.decryptAndImport(request, result, configuration);\n } catch (e) {\n this.logger.error(\n `Error while decrypting and importing key backup for session ${request.megolmSessionId}`,\n e,\n );\n }\n // now remove the request from the queue as we've processed it.\n this.queuedRequests.shift();\n } catch (err) {\n if (err instanceof KeyDownloadError) {\n switch (err.code) {\n case KeyDownloadErrorCode.MISSING_DECRYPTION_KEY:\n this.markAsNotFoundInBackup(request.megolmSessionId);\n // continue for next one\n this.queuedRequests.shift();\n break;\n case KeyDownloadErrorCode.NETWORK_ERROR:\n // We don't want to hammer if there is a problem, so wait a bit.\n await sleep(KEY_BACKUP_BACKOFF);\n break;\n case KeyDownloadErrorCode.STOPPED:\n // If the downloader was stopped, we don't want to retry.\n this.downloadLoopRunning = false;\n return;\n }\n } else if (err instanceof KeyDownloadRateLimitError) {\n // we want to retry after the backoff time\n await sleep(err.retryMillis);\n }\n }\n }\n } finally {\n // all pending request have been processed, we can stop the loop.\n this.downloadLoopRunning = false;\n }\n }\n\n /**\n * Query the backup for a key.\n *\n * @param targetRoomId - ID of the room that the session is used in.\n * @param targetSessionId - ID of the session for which to check backup.\n * @param configuration - The backup configuration to use.\n */\n private async queryKeyBackup(\n targetRoomId: string,\n targetSessionId: string,\n configuration: Configuration,\n ): Promise<KeyBackupSession> {\n this.logger.debug(`Checking key backup for session ${targetSessionId}`);\n if (this.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n try {\n const res = await this.requestRoomKeyFromBackup(configuration.backupVersion, targetRoomId, targetSessionId);\n this.logger.debug(`Got key from backup for sessionId:${targetSessionId}`);\n return res;\n } catch (e) {\n if (this.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n\n this.logger.info(`No luck requesting key backup for session ${targetSessionId}: ${e}`);\n if (e instanceof MatrixError) {\n const errCode = e.data.errcode;\n if (errCode == \"M_NOT_FOUND\") {\n // Unfortunately the spec doesn't give us a way to differentiate between a missing key and a wrong version.\n // Synapse will return:\n // - \"error\": \"Unknown backup version\" if the version is wrong.\n // - \"error\": \"No room_keys found\" if the key is missing.\n // It's useful to know if the key is missing or if the version is wrong.\n // As it's not spec'ed, we fall back on considering the key is not in backup.\n // Notice that this request will be lost if instead the backup got out of sync (updated from other session).\n throw new KeyDownloadError(KeyDownloadErrorCode.MISSING_DECRYPTION_KEY);\n }\n if (e.isRateLimitError()) {\n let waitTime: number | undefined;\n try {\n waitTime = e.getRetryAfterMs() ?? undefined;\n } catch (error) {\n this.logger.warn(\"Error while retrieving a rate-limit retry delay\", error);\n }\n if (waitTime && waitTime > 0) {\n this.logger.info(`Rate limited by server, waiting ${waitTime}ms`);\n }\n throw new KeyDownloadRateLimitError(waitTime ?? KEY_BACKUP_BACKOFF);\n }\n }\n throw new KeyDownloadError(KeyDownloadErrorCode.NETWORK_ERROR);\n }\n }\n\n private async decryptAndImport(\n sessionInfo: SessionInfo,\n data: KeyBackupSession,\n configuration: Configuration,\n ): Promise<void> {\n const sessionsToImport: Record<string, KeyBackupSession> = { [sessionInfo.megolmSessionId]: data };\n\n const keys = await configuration!.decryptor.decryptSessions(sessionsToImport);\n for (const k of keys) {\n k.room_id = sessionInfo.roomId;\n }\n await this.backupManager.importBackedUpRoomKeys(keys, configuration.backupVersion);\n }\n\n /**\n * Gets the current backup configuration or create one if it doesn't exist.\n *\n * When a valid configuration is found it is cached and returned for subsequent calls.\n * Otherwise, if a check is forced or a check has not yet been done, a new check is done.\n *\n * @returns The backup configuration to use or null if there is a configuration problem.\n */\n private async getOrCreateBackupConfiguration(): Promise<Configuration | null> {\n if (this.configuration) {\n return this.configuration;\n }\n\n // We already tried to check the configuration and it failed.\n // We don't want to try again immediately, we will retry if a configuration change is detected.\n if (this.hasConfigurationProblem) {\n return null;\n }\n\n // This method can be called rapidly by several emitted CryptoEvent, so we need to make sure that we don't\n // query the server several times.\n if (this.currentBackupVersionCheck != null) {\n this.logger.debug(`Already checking server version, use current promise`);\n return await this.currentBackupVersionCheck;\n }\n\n this.currentBackupVersionCheck = this.internalCheckFromServer();\n try {\n return await this.currentBackupVersionCheck;\n } finally {\n this.currentBackupVersionCheck = null;\n }\n }\n\n private async internalCheckFromServer(): Promise<Configuration | null> {\n let currentServerVersion = null;\n try {\n currentServerVersion = await this.backupManager.getServerBackupInfo();\n } catch (e) {\n this.logger.debug(`Backup: error while checking server version: ${e}`);\n this.hasConfigurationProblem = true;\n return null;\n }\n this.logger.debug(`Got current backup version from server: ${currentServerVersion?.version}`);\n\n if (currentServerVersion?.algorithm != \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n this.logger.info(`Unsupported algorithm ${currentServerVersion?.algorithm}`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n if (!currentServerVersion?.version) {\n this.logger.info(`No current key backup`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const activeVersion = await this.backupManager.getActiveBackupVersion();\n if (activeVersion == null || currentServerVersion.version != activeVersion) {\n // Either the current backup version on server side is not trusted, or it is out of sync with the active version on the client side.\n this.logger.info(\n `The current backup version on the server (${currentServerVersion.version}) is not trusted. Version we are currently backing up to: ${activeVersion}`,\n );\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const backupKeys = await this.getBackupDecryptionKey();\n if (!backupKeys?.decryptionKey) {\n this.logger.debug(`Not checking key backup for session (no decryption key)`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n if (activeVersion != backupKeys.backupVersion) {\n this.logger.debug(\n `Version for which we have a decryption key (${backupKeys.backupVersion}) doesn't match the version we are backing up to (${activeVersion})`,\n );\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const authData = currentServerVersion.auth_data as Curve25519AuthData;\n if (authData.public_key != backupKeys.decryptionKey.megolmV1PublicKey.publicKeyBase64) {\n this.logger.debug(`Key backup on server does not match our decryption key`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const backupDecryptor = this.backupManager.createBackupDecryptor(backupKeys.decryptionKey);\n this.hasConfigurationProblem = false;\n this.configuration = {\n decryptor: backupDecryptor,\n backupVersion: activeVersion,\n };\n return this.configuration;\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,WAAW,QAAQ,wBAAwB;AAEpD,SAASC,YAAY,EAAaC,WAAW,EAAiBC,MAAM,QAAQ,sBAAsB;AAElG,SAASC,SAAS,EAAEC,KAAK,QAAQ,aAAa;AAG9C;AACA,IAAMC,kBAAkB,GAAG,IAAI,CAAC,CAAC;;AAEjC;AACA;AACA;AAFA,IAGKC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA,EAApBA,oBAAoB;AASzB,MAAMC,gBAAgB,SAASC,KAAK,CAAC;EAC1BC,WAAWA,CAAiBC,IAA0B,EAAE;IAC3D,KAAK,mCAAAC,MAAA,CAAmCD,IAAI,CAAE,CAAC;IAAC,KADjBA,IAA0B,GAA1BA,IAA0B;IAEzD,IAAI,CAACE,IAAI,GAAG,kBAAkB;EAClC;AACJ;AAEA,MAAMC,yBAAyB,SAASL,KAAK,CAAC;EACnCC,W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,yDAAyD,CAAC;QAC3EwB,MAAI,CAACpG,uBAAuB,GAAG,IAAI;QACnC,OAAO,IAAI;MACf;MAEA,IAAMoH,eAAe,GAAGhB,MAAI,CAACvG,aAAa,CAACwH,qBAAqB,CAACR,UAAU,CAACC,aAAa,CAAC;MAC1FV,MAAI,CAACpG,uBAAuB,GAAG,KAAK;MACpCoG,MAAI,CAACnG,aAAa,GAAG;QACjB2F,SAAS,EAAEwB,eAAe;QAC1BtC,aAAa,EAAE6B;MACnB,CAAC;MACD,OAAOP,MAAI,CAACnG,aAAa;IAAC;EAC9B;AACJ","ignoreList":[]}
@@ -1,98 +0,0 @@
1
- import { HistoryVisibility as RustHistoryVisibility, OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm";
2
- import { IContent, MatrixEvent } from "../models/event.ts";
3
- import { Room } from "../models/room.ts";
4
- import { KeyClaimManager } from "./KeyClaimManager.ts";
5
- import { RoomMember } from "../models/room-member.ts";
6
- import { HistoryVisibility } from "../@types/partials.ts";
7
- import { OutgoingRequestsManager } from "./OutgoingRequestsManager.ts";
8
- import { DeviceIsolationMode } from "../crypto-api/index.ts";
9
- /**
10
- * RoomEncryptor: responsible for encrypting messages to a given room
11
- *
12
- * @internal
13
- */
14
- export declare class RoomEncryptor {
15
- private readonly olmMachine;
16
- private readonly keyClaimManager;
17
- private readonly outgoingRequestManager;
18
- private readonly room;
19
- private encryptionSettings;
20
- private readonly prefixedLogger;
21
- /** whether the room members have been loaded and tracked for the first time */
22
- private lazyLoadedMembersResolved;
23
- /**
24
- * Ensures that there is only one encryption operation at a time for that room.
25
- *
26
- * An encryption operation is either a {@link prepareForEncryption} or an {@link encryptEvent} call.
27
- */
28
- private currentEncryptionPromise;
29
- /**
30
- * @param olmMachine - The rust-sdk's OlmMachine
31
- * @param keyClaimManager - Our KeyClaimManager, which manages the queue of one-time-key claim requests
32
- * @param outgoingRequestManager - The OutgoingRequestManager, which manages the queue of outgoing requests.
33
- * @param room - The room we want to encrypt for
34
- * @param encryptionSettings - body of the m.room.encryption event currently in force in this room
35
- */
36
- constructor(olmMachine: OlmMachine, keyClaimManager: KeyClaimManager, outgoingRequestManager: OutgoingRequestsManager, room: Room, encryptionSettings: IContent);
37
- /**
38
- * Handle a new `m.room.encryption` event in this room
39
- *
40
- * @param config - The content of the encryption event
41
- */
42
- onCryptoEvent(config: IContent): void;
43
- /**
44
- * Handle a new `m.room.member` event in this room
45
- *
46
- * @param member - new membership state
47
- */
48
- onRoomMembership(member: RoomMember): void;
49
- /**
50
- * Prepare to encrypt events in this room.
51
- *
52
- * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices
53
- * in the room.
54
- * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,
55
- * will not send encrypted messages to unverified devices.
56
- * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.
57
- * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.
58
- */
59
- prepareForEncryption(globalBlacklistUnverifiedDevices: boolean, deviceIsolationMode: DeviceIsolationMode): Promise<void>;
60
- /**
61
- * Encrypt an event for this room, or prepare for encryption.
62
- *
63
- * This will ensure that we have a megolm session for this room, share it with the devices in the room, and
64
- * then, if an event is provided, encrypt it using the session.
65
- *
66
- * @param event - Event to be encrypted, or null if only preparing for encryption (in which case we will pre-share the room key).
67
- * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,
68
- * will not send encrypted messages to unverified devices.
69
- * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.
70
- * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.
71
- */
72
- encryptEvent(event: MatrixEvent | null, globalBlacklistUnverifiedDevices: boolean, deviceIsolationMode: DeviceIsolationMode): Promise<void>;
73
- /**
74
- * Prepare to encrypt events in this room.
75
- *
76
- * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices
77
- * in the room.
78
- *
79
- * @param logger - a place to write diagnostics to
80
- * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,
81
- * will not send encrypted messages to unverified devices.
82
- * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.
83
- * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.
84
- */
85
- private ensureEncryptionSession;
86
- /**
87
- * Discard any existing group session for this room
88
- */
89
- forceDiscardSession(): Promise<void>;
90
- private encryptEventInner;
91
- }
92
- /**
93
- * Convert a HistoryVisibility to a RustHistoryVisibility
94
- * @param visibility - HistoryVisibility enum
95
- * @returns a RustHistoryVisibility enum
96
- */
97
- export declare function toRustHistoryVisibility(visibility: HistoryVisibility): RustHistoryVisibility;
98
- //# sourceMappingURL=RoomEncryptor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RoomEncryptor.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/RoomEncryptor.ts"],"names":[],"mappings":"AAiBA,OAAO,EAIH,iBAAiB,IAAI,qBAAqB,EAC1C,UAAU,EAIb,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAA2B,MAAM,wBAAwB,CAAC;AAEtF;;;;GAIG;AACH,qBAAa,aAAa;IAqBlB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,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