@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 +0,0 @@
1
- {"version":3,"file":"VerificationRequest.js","names":["logger","errorFactory","errorFromEvent","newUnexpectedMessageError","newUnknownMethodError","QRCodeData","SCAN_QR_CODE_METHOD","EventType","TypedEventEmitter","canAcceptVerificationRequest","VerificationPhase","Phase","VerificationRequestEvent","TIMEOUT_FROM_EVENT_TS","TIMEOUT_FROM_EVENT_RECEIPT","VERIFICATION_REQUEST_MARGIN","EVENT_PREFIX","REQUEST_TYPE","START_TYPE","CANCEL_TYPE","DONE_TYPE","READY_TYPE","PHASE_UNSENT","Unsent","PHASE_REQUESTED","Requested","PHASE_READY","Ready","PHASE_STARTED","Started","PHASE_CANCELLED","Cancelled","PHASE_DONE","Done","VerificationRequest","constructor","channel","verificationMethods","client","_this","this","_defineProperty","Map","_asyncToGenerator","initiatedByMe","cancel","reason","code","err","error","request","setPhase","validateEvent","type","event","content","getContent","startsWith","log","Array","isArray","methods","from_device","length","transactionId","roomId","invalid","phase","requested","cancelled","ready","started","done","commonMethods","chosenMethod","_chosenMethod","calculateEventTimeout","effectiveExpiresAt","getTimestamp","requestReceivedAt","expiresAtByReceipt","Math","min","max","Date","now","timeout","requestEvent","getEventByEither","_phase","verifier","_verifier","canAccept","accepting","_accepting","declining","_declining","pending","observeOnly","qrCodeData","_qrCodeData","getQRCodeBytes","_this$_qrCodeData","getBuffer","generateQRCode","_this2","otherPartySupportsMethod","method","force","arguments","undefined","theirMethodEvent","eventsByThem","get","myStartEvent","eventsByUs","myStartMethod","includes","noEventsYet","size","hasMyRequest","has","hasTheirRequest","hasMyStart","hasTheirStart","requestingUserId","getUserId","otherUserId","receivingUserId","userId","otherDeviceId","deviceId","isSelfVerification","cancellingUserId","myCancel","theirCancel","getId","getSender","cancellationCode","ev","_observeOnly","targetDevice","theirFirstEvent","theirFirstContent","fromDevice","beginKeyVerification","validStartPhase","canCreateRequest","createVerifier","startVerification","_this3","verify","scanQRCode","Error","sendRequest","_this4","keys","send","_arguments","_this5","emit","Change","_cancellingUserId","accept","_this6","waitFor","fn","Promise","resolve","reject","check","handled","off","on","notify","getEventBy","byThem","calculatePhaseTransitions","transitions","hasRequestByThem","push","readyEvent","startEvent","theirStartEvent","ourStartEvent","fromRequestPhase","fromUnsentPhase","ourDoneEvent","verifierHasFinished","cancelEvent","_cancelled","transitionToPhase","transition","wasSentByOwnDevice","filter","m","receiveStartFromOtherDevices","wasSentByOwnUser","concat","applyPhaseTransitions","existingIdx","findIndex","t","newTransitions","slice","isWinningStartRace","newEvent","getType","oldEvent","oldRaceIdentifier","oldContent","getDeviceId","newRaceIdentifier","newContent","hasEventId","eventId","values","handleEvent","isLiveEvent","isRemoteEcho","isSentByUs","_this7","wasObserveOnly","adjustObserveOnly","cancelOnError","isDuplicateEvent","oldPhase","addEvent","newEventWinsRace","canSwitchStartEvent","switchStartEvent","_this7$_verifier$even","events","some","shouldGenerateQrCode","create","lastTransition","setupTimeout","JSON","stringify","shouldTimeout","timeoutTimer","setTimeout","cancelOnTimeout","shouldClear","clearTimeout","_this8","isUnexpectedRequest","isUnexpectedReady","warn","set","entries","delete","VerifierCtor","onVerifierCancelled","onVerifierFinished","KeyVerificationDone","getEventFromOtherParty"],"sources":["../../../../src/crypto/verification/request/VerificationRequest.ts"],"sourcesContent":["/*\nCopyright 2018 - 2021 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 { logger } from \"../../../logger.ts\";\nimport { errorFactory, errorFromEvent, newUnexpectedMessageError, newUnknownMethodError } from \"../Error.ts\";\nimport { QRCodeData, SCAN_QR_CODE_METHOD } from \"../QRCode.ts\";\nimport { IVerificationChannel } from \"./Channel.ts\";\nimport { MatrixClient } from \"../../../client.ts\";\nimport { MatrixEvent } from \"../../../models/event.ts\";\nimport { EventType } from \"../../../@types/event.ts\";\nimport { VerificationBase } from \"../Base.ts\";\nimport { VerificationMethod } from \"../../index.ts\";\nimport { TypedEventEmitter } from \"../../../models/typed-event-emitter.ts\";\nimport {\n canAcceptVerificationRequest,\n VerificationPhase as Phase,\n VerificationRequest as IVerificationRequest,\n VerificationRequestEvent,\n VerificationRequestEventHandlerMap,\n Verifier,\n} from \"../../../crypto-api/verification.ts\";\n\n// backwards-compatibility exports\nexport { VerificationPhase as Phase, VerificationRequestEvent } from \"../../../crypto-api/verification.ts\";\n\n// How long after the event's timestamp that the request times out\nconst TIMEOUT_FROM_EVENT_TS = 10 * 60 * 1000; // 10 minutes\n\n// How long after we receive the event that the request times out\nconst TIMEOUT_FROM_EVENT_RECEIPT = 2 * 60 * 1000; // 2 minutes\n\n// to avoid almost expired verification notifications\n// from showing a notification and almost immediately\n// disappearing, also ignore verification requests that\n// are this amount of time away from expiring.\nconst VERIFICATION_REQUEST_MARGIN = 3 * 1000; // 3 seconds\n\nexport const EVENT_PREFIX = \"m.key.verification.\";\nexport const REQUEST_TYPE = EVENT_PREFIX + \"request\";\nexport const START_TYPE = EVENT_PREFIX + \"start\";\nexport const CANCEL_TYPE = EVENT_PREFIX + \"cancel\";\nexport const DONE_TYPE = EVENT_PREFIX + \"done\";\nexport const READY_TYPE = EVENT_PREFIX + \"ready\";\n\n// Legacy export fields\nexport const PHASE_UNSENT = Phase.Unsent;\nexport const PHASE_REQUESTED = Phase.Requested;\nexport const PHASE_READY = Phase.Ready;\nexport const PHASE_STARTED = Phase.Started;\nexport const PHASE_CANCELLED = Phase.Cancelled;\nexport const PHASE_DONE = Phase.Done;\n\ninterface ITargetDevice {\n userId?: string;\n deviceId?: string;\n}\n\ninterface ITransition {\n phase: Phase;\n event?: MatrixEvent;\n}\n\n/**\n * State machine for verification requests.\n * Things that differ based on what channel is used to\n * send and receive verification events are put in `InRoomChannel` or `ToDeviceChannel`.\n *\n * @deprecated Avoid direct references: instead prefer {@link Crypto.VerificationRequest}.\n */\nexport class VerificationRequest<C extends IVerificationChannel = IVerificationChannel>\n extends TypedEventEmitter<VerificationRequestEvent, VerificationRequestEventHandlerMap>\n implements IVerificationRequest\n{\n private eventsByUs = new Map<string, MatrixEvent>();\n private eventsByThem = new Map<string, MatrixEvent>();\n private _observeOnly = false;\n private timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n private _accepting = false;\n private _declining = false;\n private verifierHasFinished = false;\n private _cancelled = false;\n private _chosenMethod: VerificationMethod | null = null;\n // we keep a copy of the QR Code data (including other user master key) around\n // for QR reciprocate verification, to protect against\n // cross-signing identity reset between the .ready and .start event\n // and signing the wrong key after .start\n private _qrCodeData: QRCodeData | null = null;\n\n // The timestamp when we received the request event from the other side\n private requestReceivedAt: number | null = null;\n\n private commonMethods: VerificationMethod[] = [];\n private _phase!: Phase;\n public _cancellingUserId?: string; // Used in tests only\n private _verifier?: VerificationBase<any, any>;\n\n public constructor(\n public readonly channel: C,\n private readonly verificationMethods: Map<VerificationMethod, typeof VerificationBase>,\n private readonly client: MatrixClient,\n ) {\n super();\n this.channel.request = this;\n this.setPhase(PHASE_UNSENT, false);\n }\n\n /**\n * Stateless validation logic not specific to the channel.\n * Invoked by the same static method in either channel.\n * @param type - the \"symbolic\" event type, as returned by the `getEventType` function on the channel.\n * @param event - the event to validate. Don't call getType() on it but use the `type` parameter instead.\n * @param client - the client to get the current user and device id from\n * @returns whether the event is valid and should be passed to handleEvent\n */\n public static validateEvent(type: string, event: MatrixEvent, client: MatrixClient): boolean {\n const content = event.getContent();\n\n if (!type || !type.startsWith(EVENT_PREFIX)) {\n return false;\n }\n\n // from here on we're fairly sure that this is supposed to be\n // part of a verification request, so be noisy when rejecting something\n if (!content) {\n logger.log(\"VerificationRequest: validateEvent: no content\");\n return false;\n }\n\n if (type === REQUEST_TYPE || type === READY_TYPE) {\n if (!Array.isArray(content.methods)) {\n logger.log(\"VerificationRequest: validateEvent: \" + \"fail because methods\");\n return false;\n }\n }\n\n if (type === REQUEST_TYPE || type === READY_TYPE || type === START_TYPE) {\n if (typeof content.from_device !== \"string\" || content.from_device.length === 0) {\n logger.log(\"VerificationRequest: validateEvent: \" + \"fail because from_device\");\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Unique ID for this verification request.\n *\n * An ID isn't assigned until the first message is sent, so this may be `undefined` in the early phases.\n */\n public get transactionId(): string | undefined {\n return this.channel.transactionId;\n }\n\n /**\n * For an in-room verification, the ID of the room.\n */\n public get roomId(): string | undefined {\n return this.channel.roomId;\n }\n\n public get invalid(): boolean {\n return this.phase === PHASE_UNSENT;\n }\n\n /** returns whether the phase is PHASE_REQUESTED */\n public get requested(): boolean {\n return this.phase === PHASE_REQUESTED;\n }\n\n /** returns whether the phase is PHASE_CANCELLED */\n public get cancelled(): boolean {\n return this.phase === PHASE_CANCELLED;\n }\n\n /** returns whether the phase is PHASE_READY */\n public get ready(): boolean {\n return this.phase === PHASE_READY;\n }\n\n /** returns whether the phase is PHASE_STARTED */\n public get started(): boolean {\n return this.phase === PHASE_STARTED;\n }\n\n /** returns whether the phase is PHASE_DONE */\n public get done(): boolean {\n return this.phase === PHASE_DONE;\n }\n\n /** once the phase is PHASE_STARTED (and !initiatedByMe) or PHASE_READY: common methods supported by both sides */\n public get methods(): VerificationMethod[] {\n return this.commonMethods;\n }\n\n /** the method picked in the .start event */\n public get chosenMethod(): VerificationMethod | null {\n return this._chosenMethod;\n }\n\n public calculateEventTimeout(event: MatrixEvent): number {\n let effectiveExpiresAt = this.channel.getTimestamp(event) + TIMEOUT_FROM_EVENT_TS;\n\n if (this.requestReceivedAt && !this.initiatedByMe && this.phase <= PHASE_REQUESTED) {\n const expiresAtByReceipt = this.requestReceivedAt + TIMEOUT_FROM_EVENT_RECEIPT;\n effectiveExpiresAt = Math.min(effectiveExpiresAt, expiresAtByReceipt);\n }\n\n return Math.max(0, effectiveExpiresAt - Date.now());\n }\n\n /** The current remaining amount of ms before the request should be automatically cancelled */\n public get timeout(): number {\n const requestEvent = this.getEventByEither(REQUEST_TYPE);\n if (requestEvent) {\n return this.calculateEventTimeout(requestEvent);\n }\n return 0;\n }\n\n /**\n * The key verification request event.\n * @returns The request event, or falsey if not found.\n */\n public get requestEvent(): MatrixEvent | undefined {\n return this.getEventByEither(REQUEST_TYPE);\n }\n\n /** current phase of the request. Some properties might only be defined in a current phase. */\n public get phase(): Phase {\n return this._phase;\n }\n\n /** The verifier to do the actual verification, once the method has been established. Only defined when the `phase` is PHASE_STARTED. */\n public get verifier(): VerificationBase<any, any> | undefined {\n return this._verifier;\n }\n\n public get canAccept(): boolean {\n return canAcceptVerificationRequest(this);\n }\n\n public get accepting(): boolean {\n return this._accepting;\n }\n\n public get declining(): boolean {\n return this._declining;\n }\n\n /** whether this request has sent it's initial event and needs more events to complete */\n public get pending(): boolean {\n return !this.observeOnly && this._phase !== PHASE_DONE && this._phase !== PHASE_CANCELLED;\n }\n\n /** Only set after a .ready if the other party can scan a QR code\n *\n * @deprecated Prefer `generateQRCode`.\n */\n public get qrCodeData(): QRCodeData | null {\n return this._qrCodeData;\n }\n\n /**\n * Get the data for a QR code allowing the other device to verify this one, if it supports it.\n *\n * Only set after a .ready if the other party can scan a QR code, otherwise undefined.\n *\n * @deprecated Prefer `generateQRCode`.\n */\n public getQRCodeBytes(): Buffer | undefined {\n return this._qrCodeData?.getBuffer();\n }\n\n /**\n * Generate the data for a QR code allowing the other device to verify this one, if it supports it.\n *\n * Only returns data once `phase` is `Ready` and the other party can scan a QR code;\n * otherwise returns `undefined`.\n */\n public async generateQRCode(): Promise<Buffer | undefined> {\n return this.getQRCodeBytes();\n }\n\n /** Checks whether the other party supports a given verification method.\n * This is useful when setting up the QR code UI, as it is somewhat asymmetrical:\n * if the other party supports SCAN_QR, we should show a QR code in the UI, and vice versa.\n * For methods that need to be supported by both ends, use the `methods` property.\n * @param method - the method to check\n * @param force - to check even if the phase is not ready or started yet, internal usage\n * @returns whether or not the other party said the supported the method */\n public otherPartySupportsMethod(method: string, force = false): boolean {\n if (!force && !this.ready && !this.started) {\n return false;\n }\n const theirMethodEvent = this.eventsByThem.get(REQUEST_TYPE) || this.eventsByThem.get(READY_TYPE);\n if (!theirMethodEvent) {\n // if we started straight away with .start event,\n // we are assuming that the other side will support the\n // chosen method, so return true for that.\n if (this.started && this.initiatedByMe) {\n const myStartEvent = this.eventsByUs.get(START_TYPE);\n const content = myStartEvent && myStartEvent.getContent();\n const myStartMethod = content && content.method;\n return method == myStartMethod;\n }\n return false;\n }\n const content = theirMethodEvent.getContent();\n if (!content) {\n return false;\n }\n const { methods } = content;\n if (!Array.isArray(methods)) {\n return false;\n }\n\n return methods.includes(method);\n }\n\n /** Whether this request was initiated by the syncing user.\n * For InRoomChannel, this is who sent the .request event.\n * For ToDeviceChannel, this is who sent the .start event\n */\n public get initiatedByMe(): boolean {\n // event created by us but no remote echo has been received yet\n const noEventsYet = this.eventsByUs.size + this.eventsByThem.size === 0;\n if (this._phase === PHASE_UNSENT && noEventsYet) {\n return true;\n }\n const hasMyRequest = this.eventsByUs.has(REQUEST_TYPE);\n const hasTheirRequest = this.eventsByThem.has(REQUEST_TYPE);\n if (hasMyRequest && !hasTheirRequest) {\n return true;\n }\n if (!hasMyRequest && hasTheirRequest) {\n return false;\n }\n const hasMyStart = this.eventsByUs.has(START_TYPE);\n const hasTheirStart = this.eventsByThem.has(START_TYPE);\n if (hasMyStart && !hasTheirStart) {\n return true;\n }\n return false;\n }\n\n /** The id of the user that initiated the request */\n public get requestingUserId(): string {\n if (this.initiatedByMe) {\n return this.client.getUserId()!;\n } else {\n return this.otherUserId;\n }\n }\n\n /** The id of the user that (will) receive(d) the request */\n public get receivingUserId(): string {\n if (this.initiatedByMe) {\n return this.otherUserId;\n } else {\n return this.client.getUserId()!;\n }\n }\n\n /** The user id of the other party in this request */\n public get otherUserId(): string {\n return this.channel.userId!;\n }\n\n /** The device id of the other party in this request, for requests happening over to-device messages only. */\n public get otherDeviceId(): string | undefined {\n return this.channel.deviceId;\n }\n\n public get isSelfVerification(): boolean {\n return this.client.getUserId() === this.otherUserId;\n }\n\n /**\n * The id of the user that cancelled the request,\n * only defined when phase is PHASE_CANCELLED\n */\n public get cancellingUserId(): string | undefined {\n const myCancel = this.eventsByUs.get(CANCEL_TYPE);\n const theirCancel = this.eventsByThem.get(CANCEL_TYPE);\n\n if (myCancel && (!theirCancel || myCancel.getId()! < theirCancel.getId()!)) {\n return myCancel.getSender();\n }\n if (theirCancel) {\n return theirCancel.getSender();\n }\n return undefined;\n }\n\n /**\n * The cancellation code e.g m.user which is responsible for cancelling this verification\n */\n public get cancellationCode(): string {\n const ev = this.getEventByEither(CANCEL_TYPE);\n return ev ? ev.getContent().code : null;\n }\n\n public get observeOnly(): boolean {\n return this._observeOnly;\n }\n\n /**\n * Gets which device the verification should be started with\n * given the events sent so far in the verification. This is the\n * same algorithm used to determine which device to send the\n * verification to when no specific device is specified.\n * @returns The device information\n */\n public get targetDevice(): ITargetDevice {\n const theirFirstEvent =\n this.eventsByThem.get(REQUEST_TYPE) ||\n this.eventsByThem.get(READY_TYPE) ||\n this.eventsByThem.get(START_TYPE);\n const theirFirstContent = theirFirstEvent?.getContent();\n const fromDevice = theirFirstContent?.from_device;\n return {\n userId: this.otherUserId,\n deviceId: fromDevice,\n };\n }\n\n /* Start the key verification, creating a verifier and sending a .start event.\n * If no previous events have been sent, pass in `targetDevice` to set who to direct this request to.\n * @param method - the name of the verification method to use.\n * @param targetDevice.userId the id of the user to direct this request to\n * @param targetDevice.deviceId the id of the device to direct this request to\n * @returns the verifier of the given method\n */\n public beginKeyVerification(\n method: VerificationMethod,\n targetDevice: ITargetDevice | null = null,\n ): VerificationBase<any, any> {\n // need to allow also when unsent in case of to_device\n if (!this.observeOnly && !this._verifier) {\n const validStartPhase =\n this.phase === PHASE_REQUESTED ||\n this.phase === PHASE_READY ||\n (this.phase === PHASE_UNSENT && this.channel.canCreateRequest(START_TYPE));\n if (validStartPhase) {\n // when called on a request that was initiated with .request event\n // check the method is supported by both sides\n if (this.commonMethods.length && !this.commonMethods.includes(method)) {\n throw newUnknownMethodError();\n }\n this._verifier = this.createVerifier(method, null, targetDevice);\n if (!this._verifier) {\n throw newUnknownMethodError();\n }\n this._chosenMethod = method;\n }\n }\n return this._verifier!;\n }\n\n public async startVerification(method: string): Promise<Verifier> {\n const verifier = this.beginKeyVerification(method);\n // kick off the verification in the background, but *don't* wait for to complete: we need to return the `Verifier`.\n verifier.verify();\n return verifier;\n }\n\n public scanQRCode(qrCodeData: Uint8Array): Promise<Verifier> {\n throw new Error(\"QR code scanning not supported by legacy crypto\");\n }\n\n /**\n * sends the initial .request event.\n * @returns resolves when the event has been sent.\n */\n public async sendRequest(): Promise<void> {\n if (!this.observeOnly && this._phase === PHASE_UNSENT) {\n const methods = [...this.verificationMethods.keys()];\n await this.channel.send(REQUEST_TYPE, { methods });\n }\n }\n\n /**\n * Cancels the request, sending a cancellation to the other party\n * @param params\n * @param params.reason - the error reason to send the cancellation with\n * @param params.code - the error code to send the cancellation with\n * @returns resolves when the event has been sent.\n */\n public async cancel({ reason = \"User declined\", code = \"m.user\" } = {}): Promise<void> {\n if (!this.observeOnly && this._phase !== PHASE_CANCELLED) {\n this._declining = true;\n this.emit(VerificationRequestEvent.Change);\n if (this._verifier) {\n return this._verifier.cancel(errorFactory(code, reason)());\n } else {\n this._cancellingUserId = this.client.getUserId()!;\n await this.channel.send(CANCEL_TYPE, { code, reason });\n }\n }\n }\n\n /**\n * Accepts the request, sending a .ready event to the other party\n * @returns resolves when the event has been sent.\n */\n public async accept(): Promise<void> {\n if (!this.observeOnly && this.phase === PHASE_REQUESTED && !this.initiatedByMe) {\n const methods = [...this.verificationMethods.keys()];\n this._accepting = true;\n this.emit(VerificationRequestEvent.Change);\n await this.channel.send(READY_TYPE, { methods });\n }\n }\n\n /**\n * Can be used to listen for state changes until the callback returns true.\n * @param fn - callback to evaluate whether the request is in the desired state.\n * Takes the request as an argument.\n * @returns that resolves once the callback returns true\n * @throws Error when the request is cancelled\n */\n public waitFor(fn: (request: VerificationRequest) => boolean): Promise<VerificationRequest> {\n return new Promise((resolve, reject) => {\n const check = (): boolean => {\n let handled = false;\n if (fn(this)) {\n resolve(this);\n handled = true;\n } else if (this.cancelled) {\n reject(new Error(\"cancelled\"));\n handled = true;\n }\n if (handled) {\n this.off(VerificationRequestEvent.Change, check);\n }\n return handled;\n };\n if (!check()) {\n this.on(VerificationRequestEvent.Change, check);\n }\n });\n }\n\n private setPhase(phase: Phase, notify = true): void {\n this._phase = phase;\n if (notify) {\n this.emit(VerificationRequestEvent.Change);\n }\n }\n\n private getEventByEither(type: string): MatrixEvent | undefined {\n return this.eventsByThem.get(type) || this.eventsByUs.get(type);\n }\n\n private getEventBy(type: string, byThem = false): MatrixEvent | undefined {\n if (byThem) {\n return this.eventsByThem.get(type);\n } else {\n return this.eventsByUs.get(type);\n }\n }\n\n private calculatePhaseTransitions(): ITransition[] {\n const transitions: ITransition[] = [{ phase: PHASE_UNSENT }];\n const phase = (): Phase => transitions[transitions.length - 1].phase;\n\n // always pass by .request first to be sure channel.userId has been set\n const hasRequestByThem = this.eventsByThem.has(REQUEST_TYPE);\n const requestEvent = this.getEventBy(REQUEST_TYPE, hasRequestByThem);\n if (requestEvent) {\n transitions.push({ phase: PHASE_REQUESTED, event: requestEvent });\n }\n\n const readyEvent = requestEvent && this.getEventBy(READY_TYPE, !hasRequestByThem);\n if (readyEvent && phase() === PHASE_REQUESTED) {\n transitions.push({ phase: PHASE_READY, event: readyEvent });\n }\n\n let startEvent: MatrixEvent | undefined;\n if (readyEvent || !requestEvent) {\n const theirStartEvent = this.eventsByThem.get(START_TYPE);\n const ourStartEvent = this.eventsByUs.get(START_TYPE);\n // any party can send .start after a .ready or unsent\n if (theirStartEvent && ourStartEvent) {\n startEvent =\n theirStartEvent.getSender()! < ourStartEvent.getSender()! ? theirStartEvent : ourStartEvent;\n } else {\n startEvent = theirStartEvent ? theirStartEvent : ourStartEvent;\n }\n } else {\n startEvent = this.getEventBy(START_TYPE, !hasRequestByThem);\n }\n if (startEvent) {\n const fromRequestPhase =\n phase() === PHASE_REQUESTED && requestEvent?.getSender() !== startEvent.getSender();\n const fromUnsentPhase = phase() === PHASE_UNSENT && this.channel.canCreateRequest(START_TYPE);\n if (fromRequestPhase || phase() === PHASE_READY || fromUnsentPhase) {\n transitions.push({ phase: PHASE_STARTED, event: startEvent });\n }\n }\n\n const ourDoneEvent = this.eventsByUs.get(DONE_TYPE);\n if (this.verifierHasFinished || (ourDoneEvent && phase() === PHASE_STARTED)) {\n transitions.push({ phase: PHASE_DONE });\n }\n\n const cancelEvent = this.getEventByEither(CANCEL_TYPE);\n if ((this._cancelled || cancelEvent) && phase() !== PHASE_DONE) {\n transitions.push({ phase: PHASE_CANCELLED, event: cancelEvent });\n return transitions;\n }\n\n return transitions;\n }\n\n private transitionToPhase(transition: ITransition): void {\n const { phase, event } = transition;\n // get common methods\n if (phase === PHASE_REQUESTED || phase === PHASE_READY) {\n if (!this.wasSentByOwnDevice(event)) {\n const content = event!.getContent<{\n methods: string[];\n }>();\n this.commonMethods = content.methods.filter((m) => this.verificationMethods.has(m));\n }\n }\n // detect if we're not a party in the request, and we should just observe\n if (!this.observeOnly) {\n // if requested or accepted by one of my other devices\n if (phase === PHASE_REQUESTED || phase === PHASE_STARTED || phase === PHASE_READY) {\n if (\n this.channel.receiveStartFromOtherDevices &&\n this.wasSentByOwnUser(event) &&\n !this.wasSentByOwnDevice(event)\n ) {\n this._observeOnly = true;\n }\n }\n }\n // create verifier\n if (phase === PHASE_STARTED) {\n const { method } = event!.getContent();\n if (!this._verifier && !this.observeOnly) {\n this._verifier = this.createVerifier(method, event);\n if (!this._verifier) {\n this.cancel({\n code: \"m.unknown_method\",\n reason: `Unknown method: ${method}`,\n });\n } else {\n this._chosenMethod = method;\n }\n }\n }\n }\n\n private applyPhaseTransitions(): ITransition[] {\n const transitions = this.calculatePhaseTransitions();\n const existingIdx = transitions.findIndex((t) => t.phase === this.phase);\n // trim off phases we already went through, if any\n const newTransitions = transitions.slice(existingIdx + 1);\n // transition to all new phases\n for (const transition of newTransitions) {\n this.transitionToPhase(transition);\n }\n return newTransitions;\n }\n\n private isWinningStartRace(newEvent: MatrixEvent): boolean {\n if (newEvent.getType() !== START_TYPE) {\n return false;\n }\n const oldEvent = this._verifier!.startEvent;\n\n let oldRaceIdentifier;\n if (this.isSelfVerification) {\n // if the verifier does not have a startEvent,\n // it is because it's still sending and we are on the initator side\n // we know we are sending a .start event because we already\n // have a verifier (checked in calling method)\n if (oldEvent) {\n const oldContent = oldEvent.getContent();\n oldRaceIdentifier = oldContent && oldContent.from_device;\n } else {\n oldRaceIdentifier = this.client.getDeviceId();\n }\n } else {\n if (oldEvent) {\n oldRaceIdentifier = oldEvent.getSender();\n } else {\n oldRaceIdentifier = this.client.getUserId();\n }\n }\n\n let newRaceIdentifier;\n if (this.isSelfVerification) {\n const newContent = newEvent.getContent();\n newRaceIdentifier = newContent && newContent.from_device;\n } else {\n newRaceIdentifier = newEvent.getSender();\n }\n return newRaceIdentifier < oldRaceIdentifier;\n }\n\n public hasEventId(eventId: string): boolean {\n for (const event of this.eventsByUs.values()) {\n if (event.getId() === eventId) {\n return true;\n }\n }\n for (const event of this.eventsByThem.values()) {\n if (event.getId() === eventId) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Changes the state of the request and verifier in response to a key verification event.\n * @param type - the \"symbolic\" event type, as returned by the `getEventType` function on the channel.\n * @param event - the event to handle. Don't call getType() on it but use the `type` parameter instead.\n * @param isLiveEvent - whether this is an even received through sync or not\n * @param isRemoteEcho - whether this is the remote echo of an event sent by the same device\n * @param isSentByUs - whether this event is sent by a party that can accept and/or observe the request like one of our peers.\n * For InRoomChannel this means any device for the syncing user. For ToDeviceChannel, just the syncing device.\n * @returns a promise that resolves when any requests as an answer to the passed-in event are sent.\n */\n public async handleEvent(\n type: string,\n event: MatrixEvent,\n isLiveEvent: boolean,\n isRemoteEcho: boolean,\n isSentByUs: boolean,\n ): Promise<void> {\n // if reached phase cancelled or done, ignore anything else that comes\n if (this.done || this.cancelled) {\n return;\n }\n const wasObserveOnly = this._observeOnly;\n\n this.adjustObserveOnly(event, isLiveEvent);\n\n if (!this.observeOnly && !isRemoteEcho) {\n if (await this.cancelOnError(type, event)) {\n return;\n }\n }\n\n // This assumes verification won't need to send an event with\n // the same type for the same party twice.\n // This is true for QR and SAS verification, and was\n // added here to prevent verification getting cancelled\n // when the server duplicates an event (https://github.com/matrix-org/synapse/issues/3365)\n const isDuplicateEvent = isSentByUs ? this.eventsByUs.has(type) : this.eventsByThem.has(type);\n if (isDuplicateEvent) {\n return;\n }\n\n const oldPhase = this.phase;\n this.addEvent(type, event, isSentByUs);\n\n // this will create if needed the verifier so needs to happen before calling it\n const newTransitions = this.applyPhaseTransitions();\n try {\n // only pass events from the other side to the verifier,\n // no remote echos of our own events\n if (this._verifier && !this.observeOnly) {\n const newEventWinsRace = this.isWinningStartRace(event);\n if (this._verifier.canSwitchStartEvent(event) && newEventWinsRace) {\n this._verifier.switchStartEvent(event);\n } else if (!isRemoteEcho) {\n if (type === CANCEL_TYPE || this._verifier.events?.includes(type)) {\n this._verifier.handleEvent(event);\n }\n }\n }\n\n if (newTransitions.length) {\n // create QRCodeData if the other side can scan\n // important this happens before emitting a phase change,\n // so listeners can rely on it being there already\n // We only do this for live events because it is important that\n // we sign the keys that were in the QR code, and not the keys\n // we happen to have at some later point in time.\n if (isLiveEvent && newTransitions.some((t) => t.phase === PHASE_READY)) {\n const shouldGenerateQrCode = this.otherPartySupportsMethod(SCAN_QR_CODE_METHOD, true);\n if (shouldGenerateQrCode) {\n this._qrCodeData = await QRCodeData.create(this, this.client);\n }\n }\n\n const lastTransition = newTransitions[newTransitions.length - 1];\n const { phase } = lastTransition;\n\n this.setupTimeout(phase);\n // set phase as last thing as this emits the \"change\" event\n this.setPhase(phase);\n } else if (this._observeOnly !== wasObserveOnly) {\n this.emit(VerificationRequestEvent.Change);\n }\n } finally {\n // log events we processed so we can see from rageshakes what events were added to a request\n logger.log(\n `Verification request ${this.channel.transactionId}: ` +\n `${type} event with id:${event.getId()}, ` +\n `content:${JSON.stringify(event.getContent())} ` +\n `deviceId:${this.channel.deviceId}, ` +\n `sender:${event.getSender()}, isSentByUs:${isSentByUs}, ` +\n `isLiveEvent:${isLiveEvent}, isRemoteEcho:${isRemoteEcho}, ` +\n `phase:${oldPhase}=>${this.phase}, ` +\n `observeOnly:${wasObserveOnly}=>${this._observeOnly}`,\n );\n }\n }\n\n private setupTimeout(phase: Phase): void {\n const shouldTimeout = !this.timeoutTimer && !this.observeOnly && phase === PHASE_REQUESTED;\n\n if (shouldTimeout) {\n this.timeoutTimer = setTimeout(this.cancelOnTimeout, this.timeout);\n }\n if (this.timeoutTimer) {\n const shouldClear =\n phase === PHASE_STARTED || phase === PHASE_READY || phase === PHASE_DONE || phase === PHASE_CANCELLED;\n if (shouldClear) {\n clearTimeout(this.timeoutTimer);\n this.timeoutTimer = null;\n }\n }\n }\n\n private cancelOnTimeout = async (): Promise<void> => {\n try {\n if (this.initiatedByMe) {\n await this.cancel({\n reason: \"Other party didn't accept in time\",\n code: \"m.timeout\",\n });\n } else {\n await this.cancel({\n reason: \"User didn't accept in time\",\n code: \"m.timeout\",\n });\n }\n } catch (err) {\n logger.error(\"Error while cancelling verification request\", err);\n }\n };\n\n private async cancelOnError(type: string, event: MatrixEvent): Promise<boolean> {\n if (type === START_TYPE) {\n const method = event.getContent().method;\n if (!this.verificationMethods.has(method)) {\n await this.cancel(errorFromEvent(newUnknownMethodError()));\n return true;\n }\n }\n\n const isUnexpectedRequest = type === REQUEST_TYPE && this.phase !== PHASE_UNSENT;\n const isUnexpectedReady = type === READY_TYPE && this.phase !== PHASE_REQUESTED && this.phase !== PHASE_STARTED;\n // only if phase has passed from PHASE_UNSENT should we cancel, because events\n // are allowed to come in in any order (at least with InRoomChannel). So we only know\n // we're dealing with a valid request we should participate in once we've moved to PHASE_REQUESTED.\n // Before that, we could be looking at somebody else's verification request and we just\n // happen to be in the room\n if (this.phase !== PHASE_UNSENT && (isUnexpectedRequest || isUnexpectedReady)) {\n logger.warn(`Cancelling, unexpected ${type} verification ` + `event from ${event.getSender()}`);\n const reason = `Unexpected ${type} event in phase ${this.phase}`;\n await this.cancel(errorFromEvent(newUnexpectedMessageError({ reason })));\n return true;\n }\n return false;\n }\n\n private adjustObserveOnly(event: MatrixEvent, isLiveEvent = false): void {\n // don't send out events for historical requests\n if (!isLiveEvent) {\n this._observeOnly = true;\n }\n if (this.calculateEventTimeout(event) < VERIFICATION_REQUEST_MARGIN) {\n this._observeOnly = true;\n }\n }\n\n private addEvent(type: string, event: MatrixEvent, isSentByUs = false): void {\n if (isSentByUs) {\n this.eventsByUs.set(type, event);\n } else {\n this.eventsByThem.set(type, event);\n }\n\n // once we know the userId of the other party (from the .request event)\n // see if any event by anyone else crept into this.eventsByThem\n if (type === REQUEST_TYPE) {\n for (const [type, event] of this.eventsByThem.entries()) {\n if (event.getSender() !== this.otherUserId) {\n this.eventsByThem.delete(type);\n }\n }\n // also remember when we received the request event\n this.requestReceivedAt = Date.now();\n }\n }\n\n private createVerifier(\n method: VerificationMethod,\n startEvent: MatrixEvent | null = null,\n targetDevice: ITargetDevice | null = null,\n ): VerificationBase<any, any> | undefined {\n if (!targetDevice) {\n targetDevice = this.targetDevice;\n }\n const { userId, deviceId } = targetDevice;\n\n const VerifierCtor = this.verificationMethods.get(method);\n if (!VerifierCtor) {\n logger.warn(\"could not find verifier constructor for method\", method);\n return;\n }\n return new VerifierCtor(this.channel, this.client, userId!, deviceId!, startEvent, this);\n }\n\n private wasSentByOwnUser(event?: MatrixEvent): boolean {\n return event?.getSender() === this.client.getUserId();\n }\n\n // only for .request, .ready or .start\n private wasSentByOwnDevice(event?: MatrixEvent): boolean {\n if (!this.wasSentByOwnUser(event)) {\n return false;\n }\n const content = event!.getContent();\n if (!content || content.from_device !== this.client.getDeviceId()) {\n return false;\n }\n return true;\n }\n\n public onVerifierCancelled(): void {\n this._cancelled = true;\n // move to cancelled phase\n const newTransitions = this.applyPhaseTransitions();\n if (newTransitions.length) {\n this.setPhase(newTransitions[newTransitions.length - 1].phase);\n }\n }\n\n public onVerifierFinished(): void {\n this.channel.send(EventType.KeyVerificationDone, {});\n this.verifierHasFinished = true;\n // move to .done phase\n const newTransitions = this.applyPhaseTransitions();\n if (newTransitions.length) {\n this.setPhase(newTransitions[newTransitions.length - 1].phase);\n }\n }\n\n public getEventFromOtherParty(type: string): MatrixEvent | undefined {\n return this.eventsByThem.get(type);\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,YAAY,EAAEC,cAAc,EAAEC,yBAAyB,EAAEC,qBAAqB,QAAQ,aAAa;AAC5G,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,cAAc;AAI9D,SAASC,SAAS,QAAQ,0BAA0B;AAGpD,SAASC,iBAAiB,QAAQ,wCAAwC;AAC1E,SACIC,4BAA4B,EAC5BC,iBAAiB,IAAIC,KAAK,EAE1BC,wBAAwB,QAGrB,qCAAqC;;AAE5C;AACA,SAASF,iBAAiB,IAAIC,KAAK,EAAEC,wBAAwB,QAAQ,qCAAqC;;AAE1G;AACA,IAAMC,qBAAqB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;;AAE9C;AACA,IAAMC,0BAA0B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;;AAElD;AACA;AACA;AACA;AACA,IAAMC,2BAA2B,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;;AAE9C,OAAO,IAAMC,YAAY,GAAG,qBAAqB;AACjD,OAAO,IAAMC,YAAY,GAAGD,YAAY,GAAG,SAAS;AACpD,OAAO,IAAME,UAAU,GAAGF,YAAY,GAAG,OAAO;AAChD,OAAO,IAAMG,WAAW,GAAGH,YAAY,GAAG,QAAQ;AAClD,OAAO,IAAMI,SAAS,GAAGJ,YAAY,GAAG,MAAM;AAC9C,OAAO,IAAMK,UAAU,GAAGL,YAAY,GAA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,CAAC,CAACI,KAAK,CAAC;IAClE;EACJ;EAEO8L,sBAAsBA,CAAC5M,IAAY,EAA2B;IACjE,OAAO,IAAI,CAAC2D,YAAY,CAACC,GAAG,CAAC5D,IAAI,CAAC;EACtC;AACJ","ignoreList":[]}
@@ -1,69 +0,0 @@
1
- /**
2
- * Events emitted by the {@link CryptoApi}
3
- */
4
- export declare enum CryptoEvent {
5
- /**
6
- * Fires when the trust status of a user changes.
7
- * The payload is a pair (userId, userTrustLevel). The trust level is one of the values from UserVerificationStatus.
8
- */
9
- UserTrustStatusChanged = "userTrustStatusChanged",
10
- /**
11
- * Fires when the key backup status changes.
12
- * The payload is a boolean indicating whether the key backup is enabled.
13
- */
14
- KeyBackupStatus = "crypto.keyBackupStatus",
15
- /**
16
- * Fires when we failed to back up the keys
17
- * The payload is the error code of the error that occurred.
18
- */
19
- KeyBackupFailed = "crypto.keyBackupFailed",
20
- /**
21
- * Fires when the number of sessions that can be backed up changes.
22
- * The payload is the remaining number of sessions that can be backed up.
23
- */
24
- KeyBackupSessionsRemaining = "crypto.keyBackupSessionsRemaining",
25
- /**
26
- * Fires when a new valid backup decryption key is in cache.
27
- * This will happen when a secret is received from another session, from secret storage,
28
- * or when a new backup is created from this session.
29
- *
30
- * The payload is the version of the backup for which we have the key for.
31
- *
32
- * This event is only fired by the rust crypto backend.
33
- */
34
- KeyBackupDecryptionKeyCached = "crypto.keyBackupDecryptionKeyCached",
35
- /**
36
- * Fires when a key verification request is received.
37
- * The payload is a VerificationRequest object representing the request.
38
- */
39
- VerificationRequestReceived = "crypto.verificationRequestReceived",
40
- /** @deprecated Use {@link DevicesUpdated} instead when using rust crypto */
41
- WillUpdateDevices = "crypto.willUpdateDevices",
42
- /**
43
- * Fires whenever the stored devices for a user have been updated
44
- * The payload is a pair (userIds, initialFetch).
45
- */
46
- DevicesUpdated = "crypto.devicesUpdated",
47
- /**
48
- * Fires when the user's cross-signing keys have changed or cross-signing
49
- * has been enabled/disabled. The client can use getStoredCrossSigningForUser
50
- * with the user ID of the logged in user to check if cross-signing is
51
- * enabled on the account. If enabled, it can test whether the current key
52
- * is trusted using with checkUserTrust with the user ID of the logged
53
- * in user. The checkOwnCrossSigningTrust function may be used to reconcile
54
- * the trust in the account key.
55
- *
56
- * The cross-signing API is currently UNSTABLE and may change without notice.
57
- * @experimental
58
- */
59
- KeysChanged = "crossSigning.keysChanged",
60
- /**
61
- * Fires when data is being migrated from legacy crypto to rust crypto.
62
- *
63
- * The payload is a pair `(progress, total)`, where `progress` is the number of steps completed so far, and
64
- * `total` is the total number of steps. When migration is complete, a final instance of the event is emitted, with
65
- * `progress === total === -1`.
66
- */
67
- LegacyCryptoStoreMigrationProgress = "crypto.legacyCryptoStoreMigrationProgress"
68
- }
69
- //# sourceMappingURL=CryptoEvent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CryptoEvent.d.ts","sourceRoot":"","sources":["../../src/crypto-api/CryptoEvent.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,oBAAY,WAAW;IACnB;;;OAGG;IACH,sBAAsB,2BAA2B;IAEjD;;;OAGG;IACH,eAAe,2BAA2B;IAE1C;;;OAGG;IACH,eAAe,2BAA2B;IAE1C;;;OAGG;IACH,0BAA0B,sCAAsC;IAEhE;;;;;;;;OAQG;IACH,4BAA4B,wCAAwC;IAEpE;;;OAGG;IACH,2BAA2B,uCAAuC;IAElE,4EAA4E;IAC5E,iBAAiB,6BAA6B;IAE9C;;;OAGG;IACH,cAAc,0BAA0B;IAExC;;;;;;;;;;;OAWG;IACH,WAAW,6BAA6B;IAExC;;;;;;OAMG;IACH,kCAAkC,8CAA8C;CACnF"}
@@ -1,33 +0,0 @@
1
- /*
2
- * Copyright 2024 The Matrix.org Foundation C.I.C.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- /**
18
- * Events emitted by the {@link CryptoApi}
19
- */
20
- export var CryptoEvent = /*#__PURE__*/function (CryptoEvent) {
21
- CryptoEvent["UserTrustStatusChanged"] = "userTrustStatusChanged";
22
- CryptoEvent["KeyBackupStatus"] = "crypto.keyBackupStatus";
23
- CryptoEvent["KeyBackupFailed"] = "crypto.keyBackupFailed";
24
- CryptoEvent["KeyBackupSessionsRemaining"] = "crypto.keyBackupSessionsRemaining";
25
- CryptoEvent["KeyBackupDecryptionKeyCached"] = "crypto.keyBackupDecryptionKeyCached";
26
- CryptoEvent["VerificationRequestReceived"] = "crypto.verificationRequestReceived";
27
- CryptoEvent["WillUpdateDevices"] = "crypto.willUpdateDevices";
28
- CryptoEvent["DevicesUpdated"] = "crypto.devicesUpdated";
29
- CryptoEvent["KeysChanged"] = "crossSigning.keysChanged";
30
- CryptoEvent["LegacyCryptoStoreMigrationProgress"] = "crypto.legacyCryptoStoreMigrationProgress";
31
- return CryptoEvent;
32
- }({});
33
- //# sourceMappingURL=CryptoEvent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CryptoEvent.js","names":["CryptoEvent"],"sources":["../../src/crypto-api/CryptoEvent.ts"],"sourcesContent":["/*\n * Copyright 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Events emitted by the {@link CryptoApi}\n */\nexport enum CryptoEvent {\n /**\n * Fires when the trust status of a user changes.\n * The payload is a pair (userId, userTrustLevel). The trust level is one of the values from UserVerificationStatus.\n */\n UserTrustStatusChanged = \"userTrustStatusChanged\",\n\n /**\n * Fires when the key backup status changes.\n * The payload is a boolean indicating whether the key backup is enabled.\n */\n KeyBackupStatus = \"crypto.keyBackupStatus\",\n\n /**\n * Fires when we failed to back up the keys\n * The payload is the error code of the error that occurred.\n */\n KeyBackupFailed = \"crypto.keyBackupFailed\",\n\n /**\n * Fires when the number of sessions that can be backed up changes.\n * The payload is the remaining number of sessions that can be backed up.\n */\n KeyBackupSessionsRemaining = \"crypto.keyBackupSessionsRemaining\",\n\n /**\n * Fires when a new valid backup decryption key is in cache.\n * This will happen when a secret is received from another session, from secret storage,\n * or when a new backup is created from this session.\n *\n * The payload is the version of the backup for which we have the key for.\n *\n * This event is only fired by the rust crypto backend.\n */\n KeyBackupDecryptionKeyCached = \"crypto.keyBackupDecryptionKeyCached\",\n\n /**\n * Fires when a key verification request is received.\n * The payload is a VerificationRequest object representing the request.\n */\n VerificationRequestReceived = \"crypto.verificationRequestReceived\",\n\n /** @deprecated Use {@link DevicesUpdated} instead when using rust crypto */\n WillUpdateDevices = \"crypto.willUpdateDevices\",\n\n /**\n * Fires whenever the stored devices for a user have been updated\n * The payload is a pair (userIds, initialFetch).\n */\n DevicesUpdated = \"crypto.devicesUpdated\",\n\n /**\n * Fires when the user's cross-signing keys have changed or cross-signing\n * has been enabled/disabled. The client can use getStoredCrossSigningForUser\n * with the user ID of the logged in user to check if cross-signing is\n * enabled on the account. If enabled, it can test whether the current key\n * is trusted using with checkUserTrust with the user ID of the logged\n * in user. The checkOwnCrossSigningTrust function may be used to reconcile\n * the trust in the account key.\n *\n * The cross-signing API is currently UNSTABLE and may change without notice.\n * @experimental\n */\n KeysChanged = \"crossSigning.keysChanged\",\n\n /**\n * Fires when data is being migrated from legacy crypto to rust crypto.\n *\n * The payload is a pair `(progress, total)`, where `progress` is the number of steps completed so far, and\n * `total` is the total number of steps. When migration is complete, a final instance of the event is emitted, with\n * `progress === total === -1`.\n */\n LegacyCryptoStoreMigrationProgress = \"crypto.legacyCryptoStoreMigrationProgress\",\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
@@ -1,16 +0,0 @@
1
- import { CryptoEvent } from "./CryptoEvent.ts";
2
- import { VerificationRequest } from "./verification.ts";
3
- import { UserVerificationStatus } from "./index.ts";
4
- import { RustBackupCryptoEventMap } from "../rust-crypto/backup.ts";
5
- /**
6
- * A map of the {@link CryptoEvent} fired by the {@link CryptoApi} and their payloads.
7
- */
8
- export type CryptoEventHandlerMap = {
9
- [CryptoEvent.VerificationRequestReceived]: (request: VerificationRequest) => void;
10
- [CryptoEvent.UserTrustStatusChanged]: (userId: string, userTrustLevel: UserVerificationStatus) => void;
11
- [CryptoEvent.KeyBackupDecryptionKeyCached]: (version: string) => void;
12
- [CryptoEvent.KeysChanged]: (data: {}) => void;
13
- [CryptoEvent.WillUpdateDevices]: (users: string[], initialFetch: boolean) => void;
14
- [CryptoEvent.DevicesUpdated]: (users: string[], initialFetch: boolean) => void;
15
- } & RustBackupCryptoEventMap;
16
- //# sourceMappingURL=CryptoEventHandlerMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CryptoEventHandlerMap.d.ts","sourceRoot":"","sources":["../../src/crypto-api/CryptoEventHandlerMap.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAChC,CAAC,WAAW,CAAC,2BAA2B,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClF,CAAC,WAAW,CAAC,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACvG,CAAC,WAAW,CAAC,4BAA4B,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,IAAI,CAAC;IAC9C,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;IAClF,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;CAClF,GAAG,wBAAwB,CAAC"}
@@ -1,22 +0,0 @@
1
- /*
2
- * Copyright 2024 The Matrix.org Foundation C.I.C.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { CryptoEvent } from "./CryptoEvent.js";
18
-
19
- /**
20
- * A map of the {@link CryptoEvent} fired by the {@link CryptoApi} and their payloads.
21
- */
22
- //# sourceMappingURL=CryptoEventHandlerMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CryptoEventHandlerMap.js","names":["CryptoEvent"],"sources":["../../src/crypto-api/CryptoEventHandlerMap.ts"],"sourcesContent":["/*\n * Copyright 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CryptoEvent } from \"./CryptoEvent.ts\";\nimport { VerificationRequest } from \"./verification.ts\";\nimport { UserVerificationStatus } from \"./index.ts\";\nimport { RustBackupCryptoEventMap } from \"../rust-crypto/backup.ts\";\n\n/**\n * A map of the {@link CryptoEvent} fired by the {@link CryptoApi} and their payloads.\n */\nexport type CryptoEventHandlerMap = {\n [CryptoEvent.VerificationRequestReceived]: (request: VerificationRequest) => void;\n [CryptoEvent.UserTrustStatusChanged]: (userId: string, userTrustLevel: UserVerificationStatus) => void;\n [CryptoEvent.KeyBackupDecryptionKeyCached]: (version: string) => void;\n [CryptoEvent.KeysChanged]: (data: {}) => void;\n [CryptoEvent.WillUpdateDevices]: (users: string[], initialFetch: boolean) => void;\n [CryptoEvent.DevicesUpdated]: (users: string[], initialFetch: boolean) => void;\n} & RustBackupCryptoEventMap;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,kBAAkB;;AAK9C;AACA;AACA","ignoreList":[]}