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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (492) 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 -1221
  8. package/lib/client.d.ts.map +1 -1
  9. package/lib/client.js +331 -2821
  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/lib/types.d.ts +0 -1
  62. package/lib/types.d.ts.map +1 -1
  63. package/lib/types.js.map +1 -1
  64. package/package.json +1 -3
  65. package/src/@types/global.d.ts +0 -3
  66. package/src/browser-index.ts +0 -11
  67. package/src/client.ts +60 -2882
  68. package/src/embedded.ts +3 -130
  69. package/src/event-mapper.ts +0 -4
  70. package/src/matrix.ts +0 -28
  71. package/src/models/MSC3089Branch.ts +0 -3
  72. package/src/models/event.ts +0 -289
  73. package/src/models/poll.ts +0 -6
  74. package/src/models/relations-container.ts +1 -8
  75. package/src/models/relations.ts +0 -8
  76. package/src/models/room-state.ts +2 -8
  77. package/src/models/room.ts +0 -62
  78. package/src/models/thread.ts +0 -1
  79. package/src/sliding-sync-sdk.ts +2 -72
  80. package/src/sync.ts +1 -98
  81. package/src/testing.ts +0 -108
  82. package/src/types.ts +0 -1
  83. package/CHANGELOG.md +0 -5910
  84. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +0 -14
  85. package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +0 -1
  86. package/lib/@types/AESEncryptedSecretStoragePayload.js +0 -1
  87. package/lib/@types/AESEncryptedSecretStoragePayload.js.map +0 -1
  88. package/lib/@types/crypto.d.ts +0 -47
  89. package/lib/@types/crypto.d.ts.map +0 -1
  90. package/lib/@types/crypto.js +0 -1
  91. package/lib/@types/crypto.js.map +0 -1
  92. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  93. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  94. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  95. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  96. package/lib/common-crypto/CryptoBackend.js +0 -73
  97. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  98. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  99. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  100. package/lib/common-crypto/key-passphrase.js +0 -33
  101. package/lib/common-crypto/key-passphrase.js.map +0 -1
  102. package/lib/crypto/CrossSigning.d.ts +0 -184
  103. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  104. package/lib/crypto/CrossSigning.js +0 -718
  105. package/lib/crypto/CrossSigning.js.map +0 -1
  106. package/lib/crypto/DeviceList.d.ts +0 -216
  107. package/lib/crypto/DeviceList.d.ts.map +0 -1
  108. package/lib/crypto/DeviceList.js +0 -892
  109. package/lib/crypto/DeviceList.js.map +0 -1
  110. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  111. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  112. package/lib/crypto/EncryptionSetup.js +0 -356
  113. package/lib/crypto/EncryptionSetup.js.map +0 -1
  114. package/lib/crypto/OlmDevice.d.ts +0 -457
  115. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  116. package/lib/crypto/OlmDevice.js +0 -1241
  117. package/lib/crypto/OlmDevice.js.map +0 -1
  118. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  119. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  120. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  121. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  122. package/lib/crypto/RoomList.d.ts +0 -26
  123. package/lib/crypto/RoomList.d.ts.map +0 -1
  124. package/lib/crypto/RoomList.js +0 -71
  125. package/lib/crypto/RoomList.js.map +0 -1
  126. package/lib/crypto/SecretSharing.d.ts +0 -24
  127. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  128. package/lib/crypto/SecretSharing.js +0 -194
  129. package/lib/crypto/SecretSharing.js.map +0 -1
  130. package/lib/crypto/SecretStorage.d.ts +0 -55
  131. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  132. package/lib/crypto/SecretStorage.js +0 -118
  133. package/lib/crypto/SecretStorage.js.map +0 -1
  134. package/lib/crypto/aes.d.ts +0 -6
  135. package/lib/crypto/aes.d.ts.map +0 -1
  136. package/lib/crypto/aes.js +0 -24
  137. package/lib/crypto/aes.js.map +0 -1
  138. package/lib/crypto/algorithms/base.d.ts +0 -156
  139. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  140. package/lib/crypto/algorithms/base.js +0 -187
  141. package/lib/crypto/algorithms/base.js.map +0 -1
  142. package/lib/crypto/algorithms/index.d.ts +0 -4
  143. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  144. package/lib/crypto/algorithms/index.js +0 -20
  145. package/lib/crypto/algorithms/index.js.map +0 -1
  146. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  147. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  148. package/lib/crypto/algorithms/megolm.js +0 -1822
  149. package/lib/crypto/algorithms/megolm.js.map +0 -1
  150. package/lib/crypto/algorithms/olm.d.ts +0 -5
  151. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  152. package/lib/crypto/algorithms/olm.js +0 -299
  153. package/lib/crypto/algorithms/olm.js.map +0 -1
  154. package/lib/crypto/api.d.ts +0 -32
  155. package/lib/crypto/api.d.ts.map +0 -1
  156. package/lib/crypto/api.js +0 -22
  157. package/lib/crypto/api.js.map +0 -1
  158. package/lib/crypto/backup.d.ts +0 -227
  159. package/lib/crypto/backup.d.ts.map +0 -1
  160. package/lib/crypto/backup.js +0 -824
  161. package/lib/crypto/backup.js.map +0 -1
  162. package/lib/crypto/crypto.d.ts +0 -3
  163. package/lib/crypto/crypto.d.ts.map +0 -1
  164. package/lib/crypto/crypto.js +0 -19
  165. package/lib/crypto/crypto.js.map +0 -1
  166. package/lib/crypto/dehydration.d.ts +0 -34
  167. package/lib/crypto/dehydration.d.ts.map +0 -1
  168. package/lib/crypto/dehydration.js +0 -252
  169. package/lib/crypto/dehydration.js.map +0 -1
  170. package/lib/crypto/device-converter.d.ts +0 -9
  171. package/lib/crypto/device-converter.d.ts.map +0 -1
  172. package/lib/crypto/device-converter.js +0 -42
  173. package/lib/crypto/device-converter.js.map +0 -1
  174. package/lib/crypto/deviceinfo.d.ts +0 -99
  175. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  176. package/lib/crypto/deviceinfo.js +0 -148
  177. package/lib/crypto/deviceinfo.js.map +0 -1
  178. package/lib/crypto/index.d.ts +0 -1209
  179. package/lib/crypto/index.d.ts.map +0 -1
  180. package/lib/crypto/index.js +0 -4097
  181. package/lib/crypto/index.js.map +0 -1
  182. package/lib/crypto/key_passphrase.d.ts +0 -14
  183. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  184. package/lib/crypto/key_passphrase.js +0 -44
  185. package/lib/crypto/key_passphrase.js.map +0 -1
  186. package/lib/crypto/keybackup.d.ts +0 -18
  187. package/lib/crypto/keybackup.d.ts.map +0 -1
  188. package/lib/crypto/keybackup.js +0 -1
  189. package/lib/crypto/keybackup.js.map +0 -1
  190. package/lib/crypto/olmlib.d.ts +0 -129
  191. package/lib/crypto/olmlib.d.ts.map +0 -1
  192. package/lib/crypto/olmlib.js +0 -492
  193. package/lib/crypto/olmlib.js.map +0 -1
  194. package/lib/crypto/recoverykey.d.ts +0 -2
  195. package/lib/crypto/recoverykey.d.ts.map +0 -1
  196. package/lib/crypto/recoverykey.js +0 -19
  197. package/lib/crypto/recoverykey.js.map +0 -1
  198. package/lib/crypto/store/base.d.ts +0 -252
  199. package/lib/crypto/store/base.d.ts.map +0 -1
  200. package/lib/crypto/store/base.js +0 -64
  201. package/lib/crypto/store/base.js.map +0 -1
  202. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  203. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  204. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  205. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  206. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  207. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  208. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  209. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  210. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  211. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  212. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  213. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  214. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  215. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  216. package/lib/crypto/store/memory-crypto-store.js +0 -622
  217. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  218. package/lib/crypto/verification/Base.d.ts +0 -105
  219. package/lib/crypto/verification/Base.d.ts.map +0 -1
  220. package/lib/crypto/verification/Base.js +0 -372
  221. package/lib/crypto/verification/Base.js.map +0 -1
  222. package/lib/crypto/verification/Error.d.ts +0 -35
  223. package/lib/crypto/verification/Error.d.ts.map +0 -1
  224. package/lib/crypto/verification/Error.js +0 -86
  225. package/lib/crypto/verification/Error.js.map +0 -1
  226. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  227. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  228. package/lib/crypto/verification/IllegalMethod.js +0 -43
  229. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  230. package/lib/crypto/verification/QRCode.d.ts +0 -51
  231. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  232. package/lib/crypto/verification/QRCode.js +0 -277
  233. package/lib/crypto/verification/QRCode.js.map +0 -1
  234. package/lib/crypto/verification/SAS.d.ts +0 -27
  235. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  236. package/lib/crypto/verification/SAS.js +0 -485
  237. package/lib/crypto/verification/SAS.js.map +0 -1
  238. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  239. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  240. package/lib/crypto/verification/SASDecimal.js +0 -34
  241. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  242. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  243. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  244. package/lib/crypto/verification/request/Channel.js +0 -1
  245. package/lib/crypto/verification/request/Channel.js.map +0 -1
  246. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  247. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  248. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  249. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  250. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  251. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  252. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  253. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  254. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  255. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  256. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  257. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  258. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  259. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  260. package/lib/crypto-api/CryptoEvent.js +0 -33
  261. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  262. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  263. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  264. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  265. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  266. package/lib/crypto-api/index.d.ts +0 -978
  267. package/lib/crypto-api/index.d.ts.map +0 -1
  268. package/lib/crypto-api/index.js +0 -304
  269. package/lib/crypto-api/index.js.map +0 -1
  270. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  271. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  272. package/lib/crypto-api/key-passphrase.js +0 -51
  273. package/lib/crypto-api/key-passphrase.js.map +0 -1
  274. package/lib/crypto-api/keybackup.d.ts +0 -88
  275. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  276. package/lib/crypto-api/keybackup.js +0 -1
  277. package/lib/crypto-api/keybackup.js.map +0 -1
  278. package/lib/crypto-api/recovery-key.d.ts +0 -11
  279. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  280. package/lib/crypto-api/recovery-key.js +0 -65
  281. package/lib/crypto-api/recovery-key.js.map +0 -1
  282. package/lib/crypto-api/verification.d.ts +0 -344
  283. package/lib/crypto-api/verification.d.ts.map +0 -1
  284. package/lib/crypto-api/verification.js +0 -91
  285. package/lib/crypto-api/verification.js.map +0 -1
  286. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  287. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  288. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  289. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  290. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  291. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  292. package/lib/rendezvous/RendezvousChannel.js +0 -1
  293. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  294. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  295. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  296. package/lib/rendezvous/RendezvousCode.js +0 -1
  297. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  298. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  299. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  300. package/lib/rendezvous/RendezvousError.js +0 -23
  301. package/lib/rendezvous/RendezvousError.js.map +0 -1
  302. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  303. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  304. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  305. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  306. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  307. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  308. package/lib/rendezvous/RendezvousIntent.js +0 -22
  309. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  310. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  311. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  312. package/lib/rendezvous/RendezvousTransport.js +0 -1
  313. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  314. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  315. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  316. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  317. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  318. package/lib/rendezvous/channels/index.d.ts +0 -2
  319. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  320. package/lib/rendezvous/channels/index.js +0 -18
  321. package/lib/rendezvous/channels/index.js.map +0 -1
  322. package/lib/rendezvous/index.d.ts +0 -10
  323. package/lib/rendezvous/index.d.ts.map +0 -1
  324. package/lib/rendezvous/index.js +0 -23
  325. package/lib/rendezvous/index.js.map +0 -1
  326. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  327. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  328. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  329. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  330. package/lib/rendezvous/transports/index.d.ts +0 -2
  331. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  332. package/lib/rendezvous/transports/index.js +0 -18
  333. package/lib/rendezvous/transports/index.js.map +0 -1
  334. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  335. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  336. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  337. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  338. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  339. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  340. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  341. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  342. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  343. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  344. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  345. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  346. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  347. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  348. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  349. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  350. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  351. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  352. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  353. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  354. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  355. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  356. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  357. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  358. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  359. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  360. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  361. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  362. package/lib/rust-crypto/backup.d.ts +0 -254
  363. package/lib/rust-crypto/backup.d.ts.map +0 -1
  364. package/lib/rust-crypto/backup.js +0 -837
  365. package/lib/rust-crypto/backup.js.map +0 -1
  366. package/lib/rust-crypto/constants.d.ts +0 -3
  367. package/lib/rust-crypto/constants.d.ts.map +0 -1
  368. package/lib/rust-crypto/constants.js +0 -19
  369. package/lib/rust-crypto/constants.js.map +0 -1
  370. package/lib/rust-crypto/device-converter.d.ts +0 -28
  371. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  372. package/lib/rust-crypto/device-converter.js +0 -123
  373. package/lib/rust-crypto/device-converter.js.map +0 -1
  374. package/lib/rust-crypto/index.d.ts +0 -61
  375. package/lib/rust-crypto/index.d.ts.map +0 -1
  376. package/lib/rust-crypto/index.js +0 -152
  377. package/lib/rust-crypto/index.js.map +0 -1
  378. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  379. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  380. package/lib/rust-crypto/libolm_migration.js +0 -459
  381. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  382. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  383. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  384. package/lib/rust-crypto/rust-crypto.js +0 -2016
  385. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  386. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  387. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  388. package/lib/rust-crypto/secret-storage.js +0 -63
  389. package/lib/rust-crypto/secret-storage.js.map +0 -1
  390. package/lib/rust-crypto/verification.d.ts +0 -319
  391. package/lib/rust-crypto/verification.d.ts.map +0 -1
  392. package/lib/rust-crypto/verification.js +0 -816
  393. package/lib/rust-crypto/verification.js.map +0 -1
  394. package/lib/secret-storage.d.ts +0 -370
  395. package/lib/secret-storage.d.ts.map +0 -1
  396. package/lib/secret-storage.js +0 -466
  397. package/lib/secret-storage.js.map +0 -1
  398. package/lib/utils/decryptAESSecretStorageItem.d.ts +0 -12
  399. package/lib/utils/decryptAESSecretStorageItem.d.ts.map +0 -1
  400. package/lib/utils/decryptAESSecretStorageItem.js +0 -50
  401. package/lib/utils/decryptAESSecretStorageItem.js.map +0 -1
  402. package/lib/utils/encryptAESSecretStorageItem.d.ts +0 -16
  403. package/lib/utils/encryptAESSecretStorageItem.d.ts.map +0 -1
  404. package/lib/utils/encryptAESSecretStorageItem.js +0 -68
  405. package/lib/utils/encryptAESSecretStorageItem.js.map +0 -1
  406. package/lib/utils/internal/deriveKeys.d.ts +0 -10
  407. package/lib/utils/internal/deriveKeys.d.ts.map +0 -1
  408. package/lib/utils/internal/deriveKeys.js +0 -60
  409. package/lib/utils/internal/deriveKeys.js.map +0 -1
  410. package/src/@types/AESEncryptedSecretStoragePayload.ts +0 -29
  411. package/src/@types/crypto.ts +0 -73
  412. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  413. package/src/common-crypto/CryptoBackend.ts +0 -302
  414. package/src/common-crypto/README.md +0 -4
  415. package/src/common-crypto/key-passphrase.ts +0 -43
  416. package/src/crypto/CrossSigning.ts +0 -773
  417. package/src/crypto/DeviceList.ts +0 -989
  418. package/src/crypto/EncryptionSetup.ts +0 -351
  419. package/src/crypto/OlmDevice.ts +0 -1500
  420. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  421. package/src/crypto/RoomList.ts +0 -70
  422. package/src/crypto/SecretSharing.ts +0 -240
  423. package/src/crypto/SecretStorage.ts +0 -136
  424. package/src/crypto/aes.ts +0 -23
  425. package/src/crypto/algorithms/base.ts +0 -236
  426. package/src/crypto/algorithms/index.ts +0 -20
  427. package/src/crypto/algorithms/megolm.ts +0 -2216
  428. package/src/crypto/algorithms/olm.ts +0 -381
  429. package/src/crypto/api.ts +0 -70
  430. package/src/crypto/backup.ts +0 -922
  431. package/src/crypto/crypto.ts +0 -18
  432. package/src/crypto/dehydration.ts +0 -272
  433. package/src/crypto/device-converter.ts +0 -45
  434. package/src/crypto/deviceinfo.ts +0 -158
  435. package/src/crypto/index.ts +0 -4414
  436. package/src/crypto/key_passphrase.ts +0 -42
  437. package/src/crypto/keybackup.ts +0 -47
  438. package/src/crypto/olmlib.ts +0 -539
  439. package/src/crypto/recoverykey.ts +0 -18
  440. package/src/crypto/store/base.ts +0 -348
  441. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  442. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  443. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  444. package/src/crypto/store/memory-crypto-store.ts +0 -680
  445. package/src/crypto/verification/Base.ts +0 -409
  446. package/src/crypto/verification/Error.ts +0 -76
  447. package/src/crypto/verification/IllegalMethod.ts +0 -50
  448. package/src/crypto/verification/QRCode.ts +0 -310
  449. package/src/crypto/verification/SAS.ts +0 -494
  450. package/src/crypto/verification/SASDecimal.ts +0 -37
  451. package/src/crypto/verification/request/Channel.ts +0 -34
  452. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  453. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  454. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  455. package/src/crypto-api/CryptoEvent.ts +0 -93
  456. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  457. package/src/crypto-api/index.ts +0 -1175
  458. package/src/crypto-api/key-passphrase.ts +0 -58
  459. package/src/crypto-api/keybackup.ts +0 -115
  460. package/src/crypto-api/recovery-key.ts +0 -69
  461. package/src/crypto-api/verification.ts +0 -408
  462. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  463. package/src/rendezvous/RendezvousChannel.ts +0 -48
  464. package/src/rendezvous/RendezvousCode.ts +0 -25
  465. package/src/rendezvous/RendezvousError.ts +0 -26
  466. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  467. package/src/rendezvous/RendezvousIntent.ts +0 -20
  468. package/src/rendezvous/RendezvousTransport.ts +0 -58
  469. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  470. package/src/rendezvous/channels/index.ts +0 -17
  471. package/src/rendezvous/index.ts +0 -25
  472. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  473. package/src/rendezvous/transports/index.ts +0 -17
  474. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  475. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  476. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  477. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  478. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  479. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  480. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  481. package/src/rust-crypto/backup.ts +0 -881
  482. package/src/rust-crypto/constants.ts +0 -18
  483. package/src/rust-crypto/device-converter.ts +0 -128
  484. package/src/rust-crypto/index.ts +0 -237
  485. package/src/rust-crypto/libolm_migration.ts +0 -530
  486. package/src/rust-crypto/rust-crypto.ts +0 -2205
  487. package/src/rust-crypto/secret-storage.ts +0 -60
  488. package/src/rust-crypto/verification.ts +0 -830
  489. package/src/secret-storage.ts +0 -693
  490. package/src/utils/decryptAESSecretStorageItem.ts +0 -54
  491. package/src/utils/encryptAESSecretStorageItem.ts +0 -73
  492. package/src/utils/internal/deriveKeys.ts +0 -63
@@ -1,299 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- /*
4
- Copyright 2023 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 * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
20
- import { CollectStrategy, EncryptionAlgorithm, EncryptionSettings, HistoryVisibility as RustHistoryVisibility, RoomId, UserId } from "@matrix-org/matrix-sdk-crypto-wasm";
21
- import { EventType } from "../@types/event.js";
22
- import { logger, LogSpan } from "../logger.js";
23
- import { HistoryVisibility } from "../@types/partials.js";
24
- import { logDuration } from "../utils.js";
25
- import { KnownMembership } from "../@types/membership.js";
26
- import { DeviceIsolationModeKind } from "../crypto-api/index.js";
27
-
28
- /**
29
- * RoomEncryptor: responsible for encrypting messages to a given room
30
- *
31
- * @internal
32
- */
33
- export class RoomEncryptor {
34
- /**
35
- * @param olmMachine - The rust-sdk's OlmMachine
36
- * @param keyClaimManager - Our KeyClaimManager, which manages the queue of one-time-key claim requests
37
- * @param outgoingRequestManager - The OutgoingRequestManager, which manages the queue of outgoing requests.
38
- * @param room - The room we want to encrypt for
39
- * @param encryptionSettings - body of the m.room.encryption event currently in force in this room
40
- */
41
- constructor(olmMachine, keyClaimManager, outgoingRequestManager, room, encryptionSettings) {
42
- this.olmMachine = olmMachine;
43
- this.keyClaimManager = keyClaimManager;
44
- this.outgoingRequestManager = outgoingRequestManager;
45
- this.room = room;
46
- this.encryptionSettings = encryptionSettings;
47
- _defineProperty(this, "prefixedLogger", void 0);
48
- /** whether the room members have been loaded and tracked for the first time */
49
- _defineProperty(this, "lazyLoadedMembersResolved", false);
50
- /**
51
- * Ensures that there is only one encryption operation at a time for that room.
52
- *
53
- * An encryption operation is either a {@link prepareForEncryption} or an {@link encryptEvent} call.
54
- */
55
- _defineProperty(this, "currentEncryptionPromise", Promise.resolve());
56
- this.prefixedLogger = logger.getChild("[".concat(room.roomId, " encryption]"));
57
-
58
- // start tracking devices for any users already known to be in this room.
59
- // Do not load members here, would defeat lazy loading.
60
- var members = room.getJoinedMembers();
61
-
62
- // At this point just mark the known members as tracked, it might not be the full list of members
63
- // because of lazy loading. This is fine, because we will get a member list update when sending a message for
64
- // the first time, see `RoomEncryptor#ensureEncryptionSession`
65
- this.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId))).catch(e => this.prefixedLogger.error("Error initializing tracked users", e));
66
- }
67
-
68
- /**
69
- * Handle a new `m.room.encryption` event in this room
70
- *
71
- * @param config - The content of the encryption event
72
- */
73
- onCryptoEvent(config) {
74
- if (JSON.stringify(this.encryptionSettings) != JSON.stringify(config)) {
75
- // This should currently be unreachable, since the Rust SDK will reject any attempts to change config.
76
- throw new Error("Cannot reconfigure an active RoomEncryptor");
77
- }
78
- }
79
-
80
- /**
81
- * Handle a new `m.room.member` event in this room
82
- *
83
- * @param member - new membership state
84
- */
85
- onRoomMembership(member) {
86
- if (member.membership == KnownMembership.Join || member.membership == KnownMembership.Invite && this.room.shouldEncryptForInvitedMembers()) {
87
- // make sure we are tracking the deviceList for this user
88
- this.olmMachine.updateTrackedUsers([new UserId(member.userId)]).catch(e => {
89
- this.prefixedLogger.error("Unable to update tracked users", e);
90
- });
91
- }
92
-
93
- // TODO: handle leaves (including our own)
94
- }
95
-
96
- /**
97
- * Prepare to encrypt events in this room.
98
- *
99
- * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices
100
- * in the room.
101
- * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,
102
- * will not send encrypted messages to unverified devices.
103
- * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.
104
- * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.
105
- */
106
- prepareForEncryption(globalBlacklistUnverifiedDevices, deviceIsolationMode) {
107
- var _this = this;
108
- return _asyncToGenerator(function* () {
109
- // We consider a prepareForEncryption as an encryption promise as it will potentially share keys
110
- // even if it doesn't send an event.
111
- // Usually this is called when the user starts typing, so we want to make sure we have keys ready when the
112
- // message is finally sent.
113
- // If `encryptEvent` is invoked before `prepareForEncryption` has completed, the `encryptEvent` call will wait for
114
- // `prepareForEncryption` to complete before executing.
115
- // The part where `encryptEvent` shares the room key will then usually be a no-op as it was already performed by `prepareForEncryption`.
116
- yield _this.encryptEvent(null, globalBlacklistUnverifiedDevices, deviceIsolationMode);
117
- })();
118
- }
119
-
120
- /**
121
- * Encrypt an event for this room, or prepare for encryption.
122
- *
123
- * This will ensure that we have a megolm session for this room, share it with the devices in the room, and
124
- * then, if an event is provided, encrypt it using the session.
125
- *
126
- * @param event - Event to be encrypted, or null if only preparing for encryption (in which case we will pre-share the room key).
127
- * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,
128
- * will not send encrypted messages to unverified devices.
129
- * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.
130
- * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.
131
- */
132
- encryptEvent(event, globalBlacklistUnverifiedDevices, deviceIsolationMode) {
133
- var _event$getTxnId,
134
- _this2 = this;
135
- var logger = new LogSpan(this.prefixedLogger, event ? (_event$getTxnId = event.getTxnId()) !== null && _event$getTxnId !== void 0 ? _event$getTxnId : "" : "prepareForEncryption");
136
- // Ensure order of encryption to avoid message ordering issues, as the scheduler only ensures
137
- // events order after they have been encrypted.
138
- var prom = this.currentEncryptionPromise.catch(() => {
139
- // Any errors in the previous call will have been reported already, so there is nothing to do here.
140
- // we just throw away the error and start anew.
141
- }).then(/*#__PURE__*/_asyncToGenerator(function* () {
142
- yield logDuration(logger, "ensureEncryptionSession", /*#__PURE__*/_asyncToGenerator(function* () {
143
- yield _this2.ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode);
144
- }));
145
- if (event) {
146
- yield logDuration(logger, "encryptEventInner", /*#__PURE__*/_asyncToGenerator(function* () {
147
- yield _this2.encryptEventInner(logger, event);
148
- }));
149
- }
150
- }));
151
- this.currentEncryptionPromise = prom;
152
- return prom;
153
- }
154
-
155
- /**
156
- * Prepare to encrypt events in this room.
157
- *
158
- * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices
159
- * in the room.
160
- *
161
- * @param logger - a place to write diagnostics to
162
- * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,
163
- * will not send encrypted messages to unverified devices.
164
- * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.
165
- * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.
166
- */
167
- ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode) {
168
- var _this3 = this;
169
- return _asyncToGenerator(function* () {
170
- if (_this3.encryptionSettings.algorithm !== "m.megolm.v1.aes-sha2") {
171
- throw new Error("Cannot encrypt in ".concat(_this3.room.roomId, " for unsupported algorithm '").concat(_this3.encryptionSettings.algorithm, "'"));
172
- }
173
- logger.debug("Starting encryption");
174
- var members = yield _this3.room.getEncryptionTargetMembers();
175
-
176
- // If this is the first time we are sending a message to the room, we may not yet have seen all the members
177
- // (so the Crypto SDK might not have a device list for them). So, if this is the first time we are encrypting
178
- // for this room, give the SDK the full list of members, to be on the safe side.
179
- //
180
- // This could end up being racy (if two calls to ensureEncryptionSession happen at the same time), but that's
181
- // not a particular problem, since `OlmMachine.updateTrackedUsers` just adds any users that weren't already tracked.
182
- if (!_this3.lazyLoadedMembersResolved) {
183
- yield logDuration(_this3.prefixedLogger, "loadMembersIfNeeded: updateTrackedUsers", /*#__PURE__*/_asyncToGenerator(function* () {
184
- yield _this3.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId)));
185
- }));
186
- logger.debug("Updated tracked users");
187
- _this3.lazyLoadedMembersResolved = true;
188
-
189
- // Query keys in case we don't have them for newly tracked members.
190
- // It's important after loading members for the first time, as likely most of them won't be
191
- // known yet and will be unable to decrypt messages despite being in the room for long.
192
- // This must be done before ensuring sessions. If not the devices of these users are not
193
- // known yet and will not get the room key.
194
- // We don't have API to only get the keys queries related to this member list, so we just
195
- // process the pending requests from the olmMachine. (usually these are processed
196
- // at the end of the sync, but we can't wait for that).
197
- // XXX future improvement process only KeysQueryRequests for the users that have never been queried.
198
- logger.debug("Processing outgoing requests");
199
- yield logDuration(_this3.prefixedLogger, "doProcessOutgoingRequests", /*#__PURE__*/_asyncToGenerator(function* () {
200
- yield _this3.outgoingRequestManager.doProcessOutgoingRequests();
201
- }));
202
- } else {
203
- // If members are already loaded it's less critical to await on key queries.
204
- // We might still want to trigger a processOutgoingRequests here.
205
- // The call to `ensureSessionsForUsers` below will wait a bit on in-flight key queries we are
206
- // interested in. If a sync handling happens in the meantime, and some new members are added to the room
207
- // or have new devices it would give us a chance to query them before sending.
208
- // It's less critical due to the racy nature of this process.
209
- logger.debug("Processing outgoing requests in background");
210
- _this3.outgoingRequestManager.doProcessOutgoingRequests();
211
- }
212
- logger.debug("Encrypting for users (shouldEncryptForInvitedMembers: ".concat(_this3.room.shouldEncryptForInvitedMembers(), "):"), members.map(u => "".concat(u.userId, " (").concat(u.membership, ")")));
213
- var userList = members.map(u => new UserId(u.userId));
214
- yield logDuration(_this3.prefixedLogger, "ensureSessionsForUsers", /*#__PURE__*/_asyncToGenerator(function* () {
215
- yield _this3.keyClaimManager.ensureSessionsForUsers(logger, userList);
216
- }));
217
- var rustEncryptionSettings = new EncryptionSettings();
218
- rustEncryptionSettings.historyVisibility = toRustHistoryVisibility(_this3.room.getHistoryVisibility());
219
-
220
- // We only support megolm
221
- rustEncryptionSettings.algorithm = EncryptionAlgorithm.MegolmV1AesSha2;
222
-
223
- // We need to convert the rotation period from milliseconds to microseconds
224
- // See https://spec.matrix.org/v1.8/client-server-api/#mroomencryption and
225
- // https://matrix-org.github.io/matrix-rust-sdk-crypto-wasm/classes/EncryptionSettings.html#rotationPeriod
226
- if (typeof _this3.encryptionSettings.rotation_period_ms === "number") {
227
- rustEncryptionSettings.rotationPeriod = BigInt(_this3.encryptionSettings.rotation_period_ms * 1000);
228
- }
229
- if (typeof _this3.encryptionSettings.rotation_period_msgs === "number") {
230
- rustEncryptionSettings.rotationPeriodMessages = BigInt(_this3.encryptionSettings.rotation_period_msgs);
231
- }
232
- switch (deviceIsolationMode.kind) {
233
- case DeviceIsolationModeKind.AllDevicesIsolationMode:
234
- {
235
- var _this3$room$getBlackl;
236
- // When this.room.getBlacklistUnverifiedDevices() === null, the global settings should be used
237
- // See Room#getBlacklistUnverifiedDevices
238
- var onlyAllowTrustedDevices = (_this3$room$getBlackl = _this3.room.getBlacklistUnverifiedDevices()) !== null && _this3$room$getBlackl !== void 0 ? _this3$room$getBlackl : globalBlacklistUnverifiedDevices;
239
- rustEncryptionSettings.sharingStrategy = CollectStrategy.deviceBasedStrategy(onlyAllowTrustedDevices, deviceIsolationMode.errorOnVerifiedUserProblems);
240
- }
241
- break;
242
- case DeviceIsolationModeKind.OnlySignedDevicesIsolationMode:
243
- rustEncryptionSettings.sharingStrategy = CollectStrategy.identityBasedStrategy();
244
- break;
245
- }
246
- yield logDuration(_this3.prefixedLogger, "shareRoomKey", /*#__PURE__*/_asyncToGenerator(function* () {
247
- var shareMessages = yield _this3.olmMachine.shareRoomKey(new RoomId(_this3.room.roomId),
248
- // safe to pass without cloning, as it's not reused here (before or after)
249
- userList, rustEncryptionSettings);
250
- if (shareMessages) {
251
- for (var m of shareMessages) {
252
- yield _this3.outgoingRequestManager.outgoingRequestProcessor.makeOutgoingRequest(m);
253
- }
254
- }
255
- }));
256
- })();
257
- }
258
-
259
- /**
260
- * Discard any existing group session for this room
261
- */
262
- forceDiscardSession() {
263
- var _this4 = this;
264
- return _asyncToGenerator(function* () {
265
- var r = yield _this4.olmMachine.invalidateGroupSession(new RoomId(_this4.room.roomId));
266
- if (r) {
267
- _this4.prefixedLogger.info("Discarded existing group session");
268
- }
269
- })();
270
- }
271
- encryptEventInner(logger, event) {
272
- var _this5 = this;
273
- return _asyncToGenerator(function* () {
274
- logger.debug("Encrypting actual message content");
275
- var encryptedContent = yield _this5.olmMachine.encryptRoomEvent(new RoomId(_this5.room.roomId), event.getType(), JSON.stringify(event.getContent()));
276
- event.makeEncrypted(EventType.RoomMessageEncrypted, JSON.parse(encryptedContent), _this5.olmMachine.identityKeys.curve25519.toBase64(), _this5.olmMachine.identityKeys.ed25519.toBase64());
277
- logger.debug("Encrypted event successfully");
278
- })();
279
- }
280
- }
281
-
282
- /**
283
- * Convert a HistoryVisibility to a RustHistoryVisibility
284
- * @param visibility - HistoryVisibility enum
285
- * @returns a RustHistoryVisibility enum
286
- */
287
- export function toRustHistoryVisibility(visibility) {
288
- switch (visibility) {
289
- case HistoryVisibility.Invited:
290
- return RustHistoryVisibility.Invited;
291
- case HistoryVisibility.Joined:
292
- return RustHistoryVisibility.Joined;
293
- case HistoryVisibility.Shared:
294
- return RustHistoryVisibility.Shared;
295
- case HistoryVisibility.WorldReadable:
296
- return RustHistoryVisibility.WorldReadable;
297
- }
298
- }
299
- //# sourceMappingURL=RoomEncryptor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RoomEncryptor.js","names":["RustSdkCryptoJs","CollectStrategy","EncryptionAlgorithm","EncryptionSettings","HistoryVisibility","RustHistoryVisibility","RoomId","UserId","EventType","logger","LogSpan","logDuration","KnownMembership","DeviceIsolationModeKind","RoomEncryptor","constructor","olmMachine","keyClaimManager","outgoingRequestManager","room","encryptionSettings","_defineProperty","Promise","resolve","prefixedLogger","getChild","concat","roomId","members","getJoinedMembers","updateTrackedUsers","map","u","userId","catch","e","error","onCryptoEvent","config","JSON","stringify","Error","onRoomMembership","member","membership","Join","Invite","shouldEncryptForInvitedMembers","prepareForEncryption","globalBlacklistUnverifiedDevices","deviceIsolationMode","_this","_asyncToGenerator","encryptEvent","event","_event$getTxnId","_this2","getTxnId","prom","currentEncryptionPromise","then","ensureEncryptionSession","encryptEventInner","_this3","algorithm","debug","getEncryptionTargetMembers","lazyLoadedMembersResolved","doProcessOutgoingRequests","userList","ensureSessionsForUsers","rustEncryptionSettings","historyVisibility","toRustHistoryVisibility","getHistoryVisibility","MegolmV1AesSha2","rotation_period_ms","rotationPeriod","BigInt","rotation_period_msgs","rotationPeriodMessages","kind","AllDevicesIsolationMode","_this3$room$getBlackl","onlyAllowTrustedDevices","getBlacklistUnverifiedDevices","sharingStrategy","deviceBasedStrategy","errorOnVerifiedUserProblems","OnlySignedDevicesIsolationMode","identityBasedStrategy","shareMessages","shareRoomKey","m","outgoingRequestProcessor","makeOutgoingRequest","forceDiscardSession","_this4","r","invalidateGroupSession","info","_this5","encryptedContent","encryptRoomEvent","getType","getContent","makeEncrypted","RoomMessageEncrypted","parse","identityKeys","curve25519","toBase64","ed25519","visibility","Invited","Joined","Shared","WorldReadable"],"sources":["../../src/rust-crypto/RoomEncryptor.ts"],"sourcesContent":["/*\nCopyright 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\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport {\n CollectStrategy,\n EncryptionAlgorithm,\n EncryptionSettings,\n HistoryVisibility as RustHistoryVisibility,\n OlmMachine,\n RoomId,\n ToDeviceRequest,\n UserId,\n} from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport { EventType } from \"../@types/event.ts\";\nimport { IContent, MatrixEvent } from \"../models/event.ts\";\nimport { Room } from \"../models/room.ts\";\nimport { Logger, logger, LogSpan } from \"../logger.ts\";\nimport { KeyClaimManager } from \"./KeyClaimManager.ts\";\nimport { RoomMember } from \"../models/room-member.ts\";\nimport { HistoryVisibility } from \"../@types/partials.ts\";\nimport { OutgoingRequestsManager } from \"./OutgoingRequestsManager.ts\";\nimport { logDuration } from \"../utils.ts\";\nimport { KnownMembership } from \"../@types/membership.ts\";\nimport { DeviceIsolationMode, DeviceIsolationModeKind } from \"../crypto-api/index.ts\";\n\n/**\n * RoomEncryptor: responsible for encrypting messages to a given room\n *\n * @internal\n */\nexport class RoomEncryptor {\n private readonly prefixedLogger: Logger;\n\n /** whether the room members have been loaded and tracked for the first time */\n private lazyLoadedMembersResolved = false;\n\n /**\n * Ensures that there is only one encryption operation at a time for that room.\n *\n * An encryption operation is either a {@link prepareForEncryption} or an {@link encryptEvent} call.\n */\n private currentEncryptionPromise: Promise<void> = Promise.resolve();\n\n /**\n * @param olmMachine - The rust-sdk's OlmMachine\n * @param keyClaimManager - Our KeyClaimManager, which manages the queue of one-time-key claim requests\n * @param outgoingRequestManager - The OutgoingRequestManager, which manages the queue of outgoing requests.\n * @param room - The room we want to encrypt for\n * @param encryptionSettings - body of the m.room.encryption event currently in force in this room\n */\n public constructor(\n private readonly olmMachine: OlmMachine,\n private readonly keyClaimManager: KeyClaimManager,\n private readonly outgoingRequestManager: OutgoingRequestsManager,\n private readonly room: Room,\n private encryptionSettings: IContent,\n ) {\n this.prefixedLogger = logger.getChild(`[${room.roomId} encryption]`);\n\n // start tracking devices for any users already known to be in this room.\n // Do not load members here, would defeat lazy loading.\n const members = room.getJoinedMembers();\n\n // At this point just mark the known members as tracked, it might not be the full list of members\n // because of lazy loading. This is fine, because we will get a member list update when sending a message for\n // the first time, see `RoomEncryptor#ensureEncryptionSession`\n this.olmMachine\n .updateTrackedUsers(members.map((u) => new RustSdkCryptoJs.UserId(u.userId)))\n .catch((e) => this.prefixedLogger.error(\"Error initializing tracked users\", e));\n }\n\n /**\n * Handle a new `m.room.encryption` event in this room\n *\n * @param config - The content of the encryption event\n */\n public onCryptoEvent(config: IContent): void {\n if (JSON.stringify(this.encryptionSettings) != JSON.stringify(config)) {\n // This should currently be unreachable, since the Rust SDK will reject any attempts to change config.\n throw new Error(\"Cannot reconfigure an active RoomEncryptor\");\n }\n }\n\n /**\n * Handle a new `m.room.member` event in this room\n *\n * @param member - new membership state\n */\n public onRoomMembership(member: RoomMember): void {\n if (\n member.membership == KnownMembership.Join ||\n (member.membership == KnownMembership.Invite && this.room.shouldEncryptForInvitedMembers())\n ) {\n // make sure we are tracking the deviceList for this user\n this.olmMachine.updateTrackedUsers([new UserId(member.userId)]).catch((e) => {\n this.prefixedLogger.error(\"Unable to update tracked users\", e);\n });\n }\n\n // TODO: handle leaves (including our own)\n }\n\n /**\n * Prepare to encrypt events in this room.\n *\n * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n * in the room.\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n public async prepareForEncryption(\n globalBlacklistUnverifiedDevices: boolean,\n deviceIsolationMode: DeviceIsolationMode,\n ): Promise<void> {\n // We consider a prepareForEncryption as an encryption promise as it will potentially share keys\n // even if it doesn't send an event.\n // Usually this is called when the user starts typing, so we want to make sure we have keys ready when the\n // message is finally sent.\n // If `encryptEvent` is invoked before `prepareForEncryption` has completed, the `encryptEvent` call will wait for\n // `prepareForEncryption` to complete before executing.\n // The part where `encryptEvent` shares the room key will then usually be a no-op as it was already performed by `prepareForEncryption`.\n await this.encryptEvent(null, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n }\n\n /**\n * Encrypt an event for this room, or prepare for encryption.\n *\n * This will ensure that we have a megolm session for this room, share it with the devices in the room, and\n * then, if an event is provided, encrypt it using the session.\n *\n * @param event - Event to be encrypted, or null if only preparing for encryption (in which case we will pre-share the room key).\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n public encryptEvent(\n event: MatrixEvent | null,\n globalBlacklistUnverifiedDevices: boolean,\n deviceIsolationMode: DeviceIsolationMode,\n ): Promise<void> {\n const logger = new LogSpan(this.prefixedLogger, event ? (event.getTxnId() ?? \"\") : \"prepareForEncryption\");\n // Ensure order of encryption to avoid message ordering issues, as the scheduler only ensures\n // events order after they have been encrypted.\n const prom = this.currentEncryptionPromise\n .catch(() => {\n // Any errors in the previous call will have been reported already, so there is nothing to do here.\n // we just throw away the error and start anew.\n })\n .then(async () => {\n await logDuration(logger, \"ensureEncryptionSession\", async () => {\n await this.ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n });\n if (event) {\n await logDuration(logger, \"encryptEventInner\", async () => {\n await this.encryptEventInner(logger, event);\n });\n }\n });\n\n this.currentEncryptionPromise = prom;\n return prom;\n }\n\n /**\n * Prepare to encrypt events in this room.\n *\n * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n * in the room.\n *\n * @param logger - a place to write diagnostics to\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n private async ensureEncryptionSession(\n logger: LogSpan,\n globalBlacklistUnverifiedDevices: boolean,\n deviceIsolationMode: DeviceIsolationMode,\n ): Promise<void> {\n if (this.encryptionSettings.algorithm !== \"m.megolm.v1.aes-sha2\") {\n throw new Error(\n `Cannot encrypt in ${this.room.roomId} for unsupported algorithm '${this.encryptionSettings.algorithm}'`,\n );\n }\n logger.debug(\"Starting encryption\");\n\n const members = await this.room.getEncryptionTargetMembers();\n\n // If this is the first time we are sending a message to the room, we may not yet have seen all the members\n // (so the Crypto SDK might not have a device list for them). So, if this is the first time we are encrypting\n // for this room, give the SDK the full list of members, to be on the safe side.\n //\n // This could end up being racy (if two calls to ensureEncryptionSession happen at the same time), but that's\n // not a particular problem, since `OlmMachine.updateTrackedUsers` just adds any users that weren't already tracked.\n if (!this.lazyLoadedMembersResolved) {\n await logDuration(this.prefixedLogger, \"loadMembersIfNeeded: updateTrackedUsers\", async () => {\n await this.olmMachine.updateTrackedUsers(members.map((u) => new RustSdkCryptoJs.UserId(u.userId)));\n });\n logger.debug(`Updated tracked users`);\n this.lazyLoadedMembersResolved = true;\n\n // Query keys in case we don't have them for newly tracked members.\n // It's important after loading members for the first time, as likely most of them won't be\n // known yet and will be unable to decrypt messages despite being in the room for long.\n // This must be done before ensuring sessions. If not the devices of these users are not\n // known yet and will not get the room key.\n // We don't have API to only get the keys queries related to this member list, so we just\n // process the pending requests from the olmMachine. (usually these are processed\n // at the end of the sync, but we can't wait for that).\n // XXX future improvement process only KeysQueryRequests for the users that have never been queried.\n logger.debug(`Processing outgoing requests`);\n\n await logDuration(this.prefixedLogger, \"doProcessOutgoingRequests\", async () => {\n await this.outgoingRequestManager.doProcessOutgoingRequests();\n });\n } else {\n // If members are already loaded it's less critical to await on key queries.\n // We might still want to trigger a processOutgoingRequests here.\n // The call to `ensureSessionsForUsers` below will wait a bit on in-flight key queries we are\n // interested in. If a sync handling happens in the meantime, and some new members are added to the room\n // or have new devices it would give us a chance to query them before sending.\n // It's less critical due to the racy nature of this process.\n logger.debug(`Processing outgoing requests in background`);\n this.outgoingRequestManager.doProcessOutgoingRequests();\n }\n\n logger.debug(\n `Encrypting for users (shouldEncryptForInvitedMembers: ${this.room.shouldEncryptForInvitedMembers()}):`,\n members.map((u) => `${u.userId} (${u.membership})`),\n );\n\n const userList = members.map((u) => new UserId(u.userId));\n\n await logDuration(this.prefixedLogger, \"ensureSessionsForUsers\", async () => {\n await this.keyClaimManager.ensureSessionsForUsers(logger, userList);\n });\n\n const rustEncryptionSettings = new EncryptionSettings();\n rustEncryptionSettings.historyVisibility = toRustHistoryVisibility(this.room.getHistoryVisibility());\n\n // We only support megolm\n rustEncryptionSettings.algorithm = EncryptionAlgorithm.MegolmV1AesSha2;\n\n // We need to convert the rotation period from milliseconds to microseconds\n // See https://spec.matrix.org/v1.8/client-server-api/#mroomencryption and\n // https://matrix-org.github.io/matrix-rust-sdk-crypto-wasm/classes/EncryptionSettings.html#rotationPeriod\n if (typeof this.encryptionSettings.rotation_period_ms === \"number\") {\n rustEncryptionSettings.rotationPeriod = BigInt(this.encryptionSettings.rotation_period_ms * 1000);\n }\n\n if (typeof this.encryptionSettings.rotation_period_msgs === \"number\") {\n rustEncryptionSettings.rotationPeriodMessages = BigInt(this.encryptionSettings.rotation_period_msgs);\n }\n\n switch (deviceIsolationMode.kind) {\n case DeviceIsolationModeKind.AllDevicesIsolationMode:\n {\n // When this.room.getBlacklistUnverifiedDevices() === null, the global settings should be used\n // See Room#getBlacklistUnverifiedDevices\n const onlyAllowTrustedDevices =\n this.room.getBlacklistUnverifiedDevices() ?? globalBlacklistUnverifiedDevices;\n rustEncryptionSettings.sharingStrategy = CollectStrategy.deviceBasedStrategy(\n onlyAllowTrustedDevices,\n deviceIsolationMode.errorOnVerifiedUserProblems,\n );\n }\n break;\n case DeviceIsolationModeKind.OnlySignedDevicesIsolationMode:\n rustEncryptionSettings.sharingStrategy = CollectStrategy.identityBasedStrategy();\n break;\n }\n\n await logDuration(this.prefixedLogger, \"shareRoomKey\", async () => {\n const shareMessages: ToDeviceRequest[] = await this.olmMachine.shareRoomKey(\n new RoomId(this.room.roomId),\n // safe to pass without cloning, as it's not reused here (before or after)\n userList,\n rustEncryptionSettings,\n );\n if (shareMessages) {\n for (const m of shareMessages) {\n await this.outgoingRequestManager.outgoingRequestProcessor.makeOutgoingRequest(m);\n }\n }\n });\n }\n\n /**\n * Discard any existing group session for this room\n */\n public async forceDiscardSession(): Promise<void> {\n const r = await this.olmMachine.invalidateGroupSession(new RoomId(this.room.roomId));\n if (r) {\n this.prefixedLogger.info(\"Discarded existing group session\");\n }\n }\n\n private async encryptEventInner(logger: LogSpan, event: MatrixEvent): Promise<void> {\n logger.debug(\"Encrypting actual message content\");\n const encryptedContent = await this.olmMachine.encryptRoomEvent(\n new RoomId(this.room.roomId),\n event.getType(),\n JSON.stringify(event.getContent()),\n );\n\n event.makeEncrypted(\n EventType.RoomMessageEncrypted,\n JSON.parse(encryptedContent),\n this.olmMachine.identityKeys.curve25519.toBase64(),\n this.olmMachine.identityKeys.ed25519.toBase64(),\n );\n\n logger.debug(\"Encrypted event successfully\");\n }\n}\n\n/**\n * Convert a HistoryVisibility to a RustHistoryVisibility\n * @param visibility - HistoryVisibility enum\n * @returns a RustHistoryVisibility enum\n */\nexport function toRustHistoryVisibility(visibility: HistoryVisibility): RustHistoryVisibility {\n switch (visibility) {\n case HistoryVisibility.Invited:\n return RustHistoryVisibility.Invited;\n case HistoryVisibility.Joined:\n return RustHistoryVisibility.Joined;\n case HistoryVisibility.Shared:\n return RustHistoryVisibility.Shared;\n case HistoryVisibility.WorldReadable:\n return RustHistoryVisibility.WorldReadable;\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,eAAe,MAAM,oCAAoC;AACrE,SACIC,eAAe,EACfC,mBAAmB,EACnBC,kBAAkB,EAClBC,iBAAiB,IAAIC,qBAAqB,EAE1CC,MAAM,EAENC,MAAM,QACH,oCAAoC;AAE3C,SAASC,SAAS,QAAQ,oBAAoB;AAG9C,SAAiBC,MAAM,EAAEC,OAAO,QAAQ,cAAc;AAGtD,SAASN,iBAAiB,QAAQ,uBAAu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I,CAACrF,UAAU,CAAC6F,YAAY,CAACG,OAAO,CAACD,QAAQ,CAAC,CAClD,CAAC;MAEDtG,MAAM,CAACwD,KAAK,CAAC,8BAA8B,CAAC;IAAC;EACjD;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,uBAAuBA,CAACwC,UAA6B,EAAyB;EAC1F,QAAQA,UAAU;IACd,KAAK7G,iBAAiB,CAAC8G,OAAO;MAC1B,OAAO7G,qBAAqB,CAAC6G,OAAO;IACxC,KAAK9G,iBAAiB,CAAC+G,MAAM;MACzB,OAAO9G,qBAAqB,CAAC8G,MAAM;IACvC,KAAK/G,iBAAiB,CAACgH,MAAM;MACzB,OAAO/G,qBAAqB,CAAC+G,MAAM;IACvC,KAAKhH,iBAAiB,CAACiH,aAAa;MAChC,OAAOhH,qBAAqB,CAACgH,aAAa;EAClD;AACJ","ignoreList":[]}
@@ -1,254 +0,0 @@
1
- import { OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm";
2
- import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
3
- import { BackupTrustInfo, KeyBackupCheck, KeyBackupInfo, KeyBackupSession, Curve25519SessionData, KeyBackupRestoreOpts, KeyBackupRestoreResult, KeyBackupRoomSessions } from "../crypto-api/keybackup.ts";
4
- import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts";
5
- import { IMegolmSessionData } from "../crypto/index.ts";
6
- import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
7
- import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
8
- import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts";
9
- import { ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts";
10
- import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts";
11
- /** Authentification of the backup info, depends on algorithm */
12
- type AuthData = KeyBackupInfo["auth_data"];
13
- /**
14
- * Holds information of a created keybackup.
15
- * Useful to get the generated private key material and save it securely somewhere.
16
- */
17
- interface KeyBackupCreationInfo {
18
- version: string;
19
- algorithm: string;
20
- authData: AuthData;
21
- decryptionKey: RustSdkCryptoJs.BackupDecryptionKey;
22
- }
23
- /**
24
- * @internal
25
- */
26
- export declare class RustBackupManager extends TypedEventEmitter<RustBackupCryptoEvents, RustBackupCryptoEventMap> {
27
- private readonly olmMachine;
28
- private readonly http;
29
- private readonly outgoingRequestProcessor;
30
- /** Have we checked if there is a backup on the server which we can use */
31
- private checkedForBackup;
32
- /**
33
- * The latest backup version on the server, when we last checked.
34
- *
35
- * If there was no backup on the server, `null`. If our attempt to check resulted in an error, `undefined`.
36
- *
37
- * Note that the backup was not necessarily verified.
38
- */
39
- private serverBackupInfo;
40
- private activeBackupVersion;
41
- private stopped;
42
- /** whether {@link backupKeysLoop} is currently running */
43
- private backupKeysLoopRunning;
44
- constructor(olmMachine: OlmMachine, http: MatrixHttpApi<IHttpOpts & {
45
- onlyData: true;
46
- }>, outgoingRequestProcessor: OutgoingRequestProcessor);
47
- /**
48
- * Tells the RustBackupManager to stop.
49
- * The RustBackupManager is scheduling background uploads of keys to the backup, this
50
- * call allows to cancel the process when the client is stoppped.
51
- */
52
- stop(): void;
53
- /**
54
- * Get the backup version we are currently backing up to, if any
55
- */
56
- getActiveBackupVersion(): Promise<string | null>;
57
- /**
58
- * Return the details of the latest backup on the server, when we last checked.
59
- *
60
- * This normally returns a cached value, but if we haven't yet made a request to the server, it will fire one off.
61
- * It will always return the details of the active backup if key backup is enabled.
62
- *
63
- * If there was no backup on the server, `null`. If our attempt to check resulted in an error, `undefined`.
64
- */
65
- getServerBackupInfo(): Promise<KeyBackupInfo | null | undefined>;
66
- /**
67
- * Determine if a key backup can be trusted.
68
- *
69
- * @param info - key backup info dict from {@link MatrixClient#getKeyBackupVersion}.
70
- */
71
- isKeyBackupTrusted(info: KeyBackupInfo): Promise<BackupTrustInfo>;
72
- /**
73
- * Re-check the key backup and enable/disable it as appropriate.
74
- *
75
- * @param force - whether we should force a re-check even if one has already happened.
76
- */
77
- checkKeyBackupAndEnable(force: boolean): Promise<KeyBackupCheck | null>;
78
- /**
79
- * Handles a backup secret received event and store it if it matches the current backup version.
80
- *
81
- * @param secret - The secret as received from a `m.secret.send` event for secret `m.megolm_backup.v1`.
82
- * @returns true if the secret is valid and has been stored, false otherwise.
83
- */
84
- handleBackupSecretReceived(secret: string): Promise<boolean>;
85
- saveBackupDecryptionKey(backupDecryptionKey: RustSdkCryptoJs.BackupDecryptionKey, version: string): Promise<void>;
86
- /**
87
- * Import a list of room keys previously exported by exportRoomKeys
88
- *
89
- * @param keys - a list of session export objects
90
- * @param opts - options object
91
- * @returns a promise which resolves once the keys have been imported
92
- */
93
- importRoomKeys(keys: IMegolmSessionData[], opts?: ImportRoomKeysOpts): Promise<void>;
94
- /**
95
- * Import a list of room keys previously exported by exportRoomKeysAsJson
96
- *
97
- * @param jsonKeys - a JSON string encoding a list of session export objects,
98
- * each of which is an IMegolmSessionData
99
- * @param opts - options object
100
- * @returns a promise which resolves once the keys have been imported
101
- */
102
- importRoomKeysAsJson(jsonKeys: string, opts?: ImportRoomKeysOpts): Promise<void>;
103
- /**
104
- * Implementation of {@link CryptoBackend#importBackedUpRoomKeys}.
105
- */
106
- importBackedUpRoomKeys(keys: IMegolmSessionData[], backupVersion: string, opts?: ImportRoomKeysOpts): Promise<void>;
107
- private keyBackupCheckInProgress;
108
- /** Helper for `checkKeyBackup` */
109
- private doCheckKeyBackup;
110
- private enableKeyBackup;
111
- /**
112
- * Restart the backup key loop if there is an active trusted backup.
113
- * Doesn't try to check the backup server side. To be called when a new
114
- * megolm key is known locally.
115
- */
116
- maybeUploadKey(): Promise<void>;
117
- private disableKeyBackup;
118
- private backupKeysLoop;
119
- /**
120
- * Utility method to count the number of keys in a backup request, in order to update the remaining keys count.
121
- * This should be the chunk size of the backup request for all requests but the last, but we don't have access to it
122
- * (it's static in the Rust SDK).
123
- * @param batch - The backup request to count the keys from.
124
- *
125
- * @returns The number of keys in the backup request.
126
- */
127
- private keysCountInBatch;
128
- /**
129
- * Get information about a key backup from the server
130
- * - If version is provided, get information about that backup version.
131
- * - If no version is provided, get information about the latest backup.
132
- *
133
- * @param version - The version of the backup to get information about.
134
- * @returns Information object from API or null if there is no active backup.
135
- */
136
- requestKeyBackupVersion(version?: string): Promise<KeyBackupInfo | null>;
137
- /**
138
- * Creates a new key backup by generating a new random private key.
139
- *
140
- * If there is an existing backup server side it will be deleted and replaced
141
- * by the new one.
142
- *
143
- * @param signObject - Method that should sign the backup with existing device and
144
- * existing identity.
145
- * @returns a KeyBackupCreationInfo - All information related to the backup.
146
- */
147
- setupKeyBackup(signObject: (authData: AuthData) => Promise<void>): Promise<KeyBackupCreationInfo>;
148
- /**
149
- * Deletes all key backups.
150
- *
151
- * Will call the API to delete active backup until there is no more present.
152
- */
153
- deleteAllKeyBackupVersions(): Promise<void>;
154
- /**
155
- * Deletes the given key backup.
156
- *
157
- * @param version - The backup version to delete.
158
- */
159
- deleteKeyBackupVersion(version: string): Promise<void>;
160
- /**
161
- * Creates a new backup decryptor for the given private key.
162
- * @param decryptionKey - The private key to use for decryption.
163
- */
164
- createBackupDecryptor(decryptionKey: RustSdkCryptoJs.BackupDecryptionKey): BackupDecryptor;
165
- /**
166
- * Restore a key backup.
167
- *
168
- * @param backupVersion - The version of the backup to restore.
169
- * @param backupDecryptor - The backup decryptor to use to decrypt the keys.
170
- * @param opts - Options for the restore.
171
- * @returns The total number of keys and the total imported.
172
- */
173
- restoreKeyBackup(backupVersion: string, backupDecryptor: BackupDecryptor, opts?: KeyBackupRestoreOpts): Promise<KeyBackupRestoreResult>;
174
- /**
175
- * Call `/room_keys/keys` to download the key backup (room keys) for the given backup version.
176
- * https://spec.matrix.org/v1.12/client-server-api/#get_matrixclientv3room_keyskeys
177
- *
178
- * @param backupVersion
179
- * @returns The key backup response.
180
- */
181
- private downloadKeyBackup;
182
- /**
183
- * Import the room keys from a `/room_keys/keys` call.
184
- * Calls `opts.progressCallback` with the progress of the import.
185
- *
186
- * @param keyBackup - The response from the server containing the keys to import.
187
- * @param backupVersion - The version of the backup info.
188
- * @param backupDecryptor - The backup decryptor to use to decrypt the keys.
189
- * @param opts - Options for the import.
190
- *
191
- * @returns The total number of keys and the total imported.
192
- *
193
- * @private
194
- */
195
- private importKeyBackup;
196
- }
197
- /**
198
- * Implementation of {@link BackupDecryptor} for the rust crypto backend.
199
- */
200
- export declare class RustBackupDecryptor implements BackupDecryptor {
201
- private decryptionKey;
202
- sourceTrusted: boolean;
203
- constructor(decryptionKey: RustSdkCryptoJs.BackupDecryptionKey);
204
- /**
205
- * Implements {@link BackupDecryptor#decryptSessions}
206
- */
207
- decryptSessions(ciphertexts: Record<string, KeyBackupSession<Curve25519SessionData | AESEncryptedSecretStoragePayload>>): Promise<IMegolmSessionData[]>;
208
- /**
209
- * Implements {@link BackupDecryptor#free}
210
- */
211
- free(): void;
212
- }
213
- /**
214
- * Fetch a key backup info from the server.
215
- *
216
- * If `version` is provided, calls `GET /room_keys/version/$version` and gets the backup info for that version.
217
- * See https://spec.matrix.org/v1.12/client-server-api/#get_matrixclientv3room_keysversionversion.
218
- *
219
- * If not, calls `GET /room_keys/version` and gets the latest backup info.
220
- * See https://spec.matrix.org/v1.12/client-server-api/#get_matrixclientv3room_keysversion
221
- *
222
- * @param http
223
- * @param version - the specific version of the backup info to fetch
224
- * @returns The key backup info or null if there is no backup.
225
- */
226
- export declare function requestKeyBackupVersion(http: MatrixHttpApi<IHttpOpts & {
227
- onlyData: true;
228
- }>, version?: string): Promise<KeyBackupInfo | null>;
229
- /**
230
- * Checks if the provided decryption key matches the public key of the key backup info.
231
- *
232
- * @param decryptionKey - The decryption key to check.
233
- * @param keyBackupInfo - The key backup info to check against.
234
- * @returns `true` if the decryption key matches the key backup info, `false` otherwise.
235
- */
236
- export declare function decryptionKeyMatchesKeyBackupInfo(decryptionKey: RustSdkCryptoJs.BackupDecryptionKey, keyBackupInfo: KeyBackupInfo): boolean;
237
- export type RustBackupCryptoEvents = CryptoEvent.KeyBackupStatus | CryptoEvent.KeyBackupSessionsRemaining | CryptoEvent.KeyBackupFailed | CryptoEvent.KeyBackupDecryptionKeyCached;
238
- export type RustBackupCryptoEventMap = {
239
- [CryptoEvent.KeyBackupStatus]: (enabled: boolean) => void;
240
- [CryptoEvent.KeyBackupSessionsRemaining]: (remaining: number) => void;
241
- [CryptoEvent.KeyBackupFailed]: (errCode: string) => void;
242
- [CryptoEvent.KeyBackupDecryptionKeyCached]: (version: string) => void;
243
- };
244
- /**
245
- * Response from GET `/room_keys/keys` endpoint.
246
- * See https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3room_keyskeys
247
- */
248
- export interface KeyBackup {
249
- rooms: Record<string, {
250
- sessions: KeyBackupRoomSessions;
251
- }>;
252
- }
253
- export {};
254
- //# sourceMappingURL=backup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/backup.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAyB,MAAM,oCAAoC,CAAC;AACvF,OAAO,KAAK,eAAe,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EACH,eAAe,EAEf,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAgB,SAAS,EAAe,aAAa,EAAU,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAA6B,kBAAkB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAE,gCAAgC,EAAE,MA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