@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":"memory-crypto-store.js","names":["logger","deepCompare","promiseTry","safeSet","MigrationState","SESSION_BATCH_SIZE","encodeSessionKey","senderCurve25519Key","sessionId","encodeURIComponent","decodeSessionKey","key","keyParts","split","senderKey","decodeURIComponent","MemoryCryptoStore","constructor","_defineProperty","NOT_STARTED","Map","containsData","_this","_asyncToGenerator","account","startup","_this2","deleteAllData","Promise","resolve","getMigrationState","_this3","migrationState","setMigrationState","_this4","getOrAddOutgoingRoomKeyRequest","request","requestBody","existing","_getOutgoingRoomKeyRequest","log","concat","room_id","session_id","outgoingRoomKeyRequests","push","getOutgoingRoomKeyRequest","getOutgoingRoomKeyRequestByState","wantedStates","req","state","getAllOutgoingRoomKeyRequestsByState","wantedState","filter","r","getOutgoingRoomKeyRequestsByTarget","userId","deviceId","results","recipients","some","recipient","updateOutgoingRoomKeyRequest","requestId","expectedState","updates","warn","Object","assign","deleteOutgoingRoomKeyRequest","i","length","splice","getAccount","txn","func","storeAccount","accountPickle","getCrossSigningKeys","crossSigningKeys","getSecretStorePrivateKey","type","result","privateKeys","storeCrossSigningKeys","keys","storeSecretStorePrivateKey","countEndToEndSessions","count","deviceSessions","values","sessions","getEndToEndSession","deviceKey","getEndToEndSessions","getAllEndToEndSessions","entries","forEach","_ref","_ref2","session","_objectSpread","storeEndToEndSession","sessionInfo","undefined","storeEndToEndSessionProblem","fixed","_this5","problems","sessionProblems","time","Date","now","sort","a","b","getEndToEndSessionProblem","timestamp","_this6","lastProblem","problem","filterOutNotifiedErrorDevices","devices","_this7","notifiedErrorDevices","ret","device","deviceInfo","getEndToEndSessionsBatch","_this8","deleteEndToEndSessionsBatch","_this9","getEndToEndInboundGroupSession","k","inboundGroupSessions","inboundGroupSessionsWithheld","getAllEndToEndInboundGroupSessions","sessionData","addEndToEndInboundGroupSession","storeEndToEndInboundGroupSession","storeEndToEndInboundGroupSessionWithheld","countEndToEndInboundGroupSessions","_this10","getEndToEndInboundGroupSessionsBatch","_this11","needsBackup","sessionsNeedingBackup","deleteEndToEndInboundGroupSessionsBatch","_this12","getEndToEndDeviceData","deviceData","storeEndToEndDeviceData","storeEndToEndRoom","roomId","roomInfo","rooms","getEndToEndRooms","getSessionsNeedingBackup","limit","countSessionsNeedingBackup","unmarkSessionsNeedingBackup","sessionKey","markSessionsNeedingBackup","addSharedHistoryInboundGroupSession","sharedHistoryInboundGroupSessions","getSharedHistoryInboundGroupSessions","addParkedSharedHistory","parkedData","_this$parkedSharedHis","parked","parkedSharedHistory","get","set","takeParkedSharedHistory","_this$parkedSharedHis2","delete","doTxn","mode","stores"],"sources":["../../../src/crypto/store/memory-crypto-store.ts"],"sourcesContent":["/*\nCopyright 2017 - 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 { deepCompare, promiseTry, safeSet } from \"../../utils.ts\";\nimport {\n CryptoStore,\n IDeviceData,\n IProblem,\n ISession,\n SessionExtended,\n ISessionInfo,\n IWithheld,\n MigrationState,\n Mode,\n OutgoingRoomKeyRequest,\n ParkedSharedHistory,\n SecretStorePrivateKeys,\n SESSION_BATCH_SIZE,\n} from \"./base.ts\";\nimport { IRoomKeyRequestBody } from \"../index.ts\";\nimport { IOlmDevice } from \"../algorithms/megolm.ts\";\nimport { IRoomEncryption } from \"../RoomList.ts\";\nimport { InboundGroupSessionData } from \"../OlmDevice.ts\";\nimport { CrossSigningKeyInfo } from \"../../crypto-api/index.ts\";\n\nfunction encodeSessionKey(senderCurve25519Key: string, sessionId: string): string {\n return encodeURIComponent(senderCurve25519Key) + \"/\" + encodeURIComponent(sessionId);\n}\n\nfunction decodeSessionKey(key: string): { senderKey: string; sessionId: string } {\n const keyParts = key.split(\"/\");\n const senderKey = decodeURIComponent(keyParts[0]);\n const sessionId = decodeURIComponent(keyParts[1]);\n return { senderKey, sessionId };\n}\n\n/**\n * Internal module. in-memory storage for e2e.\n */\n\nexport class MemoryCryptoStore implements CryptoStore {\n private migrationState: MigrationState = MigrationState.NOT_STARTED;\n private outgoingRoomKeyRequests: OutgoingRoomKeyRequest[] = [];\n private account: string | null = null;\n private crossSigningKeys: Record<string, CrossSigningKeyInfo> | null = null;\n private privateKeys: Partial<SecretStorePrivateKeys> = {};\n\n private sessions: { [deviceKey: string]: { [sessionId: string]: ISessionInfo } } = {};\n private sessionProblems: { [deviceKey: string]: IProblem[] } = {};\n private notifiedErrorDevices: { [userId: string]: { [deviceId: string]: boolean } } = {};\n private inboundGroupSessions: { [sessionKey: string]: InboundGroupSessionData } = {};\n private inboundGroupSessionsWithheld: Record<string, IWithheld> = {};\n // Opaque device data object\n private deviceData: IDeviceData | null = null;\n private rooms: { [roomId: string]: IRoomEncryption } = {};\n private sessionsNeedingBackup: { [sessionKey: string]: boolean } = {};\n private sharedHistoryInboundGroupSessions: { [roomId: string]: [senderKey: string, sessionId: string][] } = {};\n private parkedSharedHistory = new Map<string, ParkedSharedHistory[]>(); // keyed by room ID\n\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Implementation of {@link CryptoStore.containsData}.\n *\n * @internal\n */\n public async containsData(): Promise<boolean> {\n // If it contains anything, it should contain an account.\n return this.account !== null;\n }\n\n /**\n * Ensure the database exists and is up-to-date.\n *\n * This must be called before the store can be used.\n *\n * @returns resolves to the store.\n */\n public async startup(): Promise<CryptoStore> {\n // No startup work to do for the memory store.\n return this;\n }\n\n /**\n * Delete all data from this store.\n *\n * @returns Promise which resolves when the store has been cleared.\n */\n public deleteAllData(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n *\n * @internal\n */\n public async getMigrationState(): Promise<MigrationState> {\n return this.migrationState;\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n *\n * @internal\n */\n public async setMigrationState(migrationState: MigrationState): Promise<void> {\n this.migrationState = migrationState;\n }\n\n /**\n * Look for an existing outgoing room key request, and if none is found,\n * add a new one\n *\n *\n * @returns resolves to\n * {@link OutgoingRoomKeyRequest}: either the\n * same instance as passed in, or the existing one.\n */\n public getOrAddOutgoingRoomKeyRequest(request: OutgoingRoomKeyRequest): Promise<OutgoingRoomKeyRequest> {\n const requestBody = request.requestBody;\n\n return promiseTry(() => {\n // first see if we already have an entry for this request.\n const existing = this._getOutgoingRoomKeyRequest(requestBody);\n\n if (existing) {\n // this entry matches the request - return it.\n logger.log(\n `already have key request outstanding for ` +\n `${requestBody.room_id} / ${requestBody.session_id}: ` +\n `not sending another`,\n );\n return existing;\n }\n\n // we got to the end of the list without finding a match\n // - add the new request.\n logger.log(`enqueueing key request for ${requestBody.room_id} / ` + requestBody.session_id);\n this.outgoingRoomKeyRequests.push(request);\n return request;\n });\n }\n\n /**\n * Look for an existing room key request\n *\n * @param requestBody - existing request to look for\n *\n * @returns resolves to the matching\n * {@link OutgoingRoomKeyRequest}, or null if\n * not found\n */\n public getOutgoingRoomKeyRequest(requestBody: IRoomKeyRequestBody): Promise<OutgoingRoomKeyRequest | null> {\n return Promise.resolve(this._getOutgoingRoomKeyRequest(requestBody));\n }\n\n /**\n * Looks for existing room key request, and returns the result synchronously.\n *\n * @internal\n *\n * @param requestBody - existing request to look for\n *\n * @returns\n * the matching request, or null if not found\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private _getOutgoingRoomKeyRequest(requestBody: IRoomKeyRequestBody): OutgoingRoomKeyRequest | null {\n for (const existing of this.outgoingRoomKeyRequests) {\n if (deepCompare(existing.requestBody, requestBody)) {\n return existing;\n }\n }\n return null;\n }\n\n /**\n * Look for room key requests by state\n *\n * @param wantedStates - list of acceptable states\n *\n * @returns resolves to the a\n * {@link OutgoingRoomKeyRequest}, or null if\n * there are no pending requests in those states\n */\n public getOutgoingRoomKeyRequestByState(wantedStates: number[]): Promise<OutgoingRoomKeyRequest | null> {\n for (const req of this.outgoingRoomKeyRequests) {\n for (const state of wantedStates) {\n if (req.state === state) {\n return Promise.resolve(req);\n }\n }\n }\n return Promise.resolve(null);\n }\n\n /**\n *\n * @returns All OutgoingRoomKeyRequests in state\n */\n public getAllOutgoingRoomKeyRequestsByState(wantedState: number): Promise<OutgoingRoomKeyRequest[]> {\n return Promise.resolve(this.outgoingRoomKeyRequests.filter((r) => r.state == wantedState));\n }\n\n public getOutgoingRoomKeyRequestsByTarget(\n userId: string,\n deviceId: string,\n wantedStates: number[],\n ): Promise<OutgoingRoomKeyRequest[]> {\n const results: OutgoingRoomKeyRequest[] = [];\n\n for (const req of this.outgoingRoomKeyRequests) {\n for (const state of wantedStates) {\n if (\n req.state === state &&\n req.recipients.some((recipient) => recipient.userId === userId && recipient.deviceId === deviceId)\n ) {\n results.push(req);\n }\n }\n }\n return Promise.resolve(results);\n }\n\n /**\n * Look for an existing room key request by id and state, and update it if\n * found\n *\n * @param requestId - ID of request to update\n * @param expectedState - state we expect to find the request in\n * @param updates - name/value map of updates to apply\n *\n * @returns resolves to\n * {@link OutgoingRoomKeyRequest}\n * updated request, or null if no matching row was found\n */\n public updateOutgoingRoomKeyRequest(\n requestId: string,\n expectedState: number,\n updates: Partial<OutgoingRoomKeyRequest>,\n ): Promise<OutgoingRoomKeyRequest | null> {\n for (const req of this.outgoingRoomKeyRequests) {\n if (req.requestId !== requestId) {\n continue;\n }\n\n if (req.state !== expectedState) {\n logger.warn(\n `Cannot update room key request from ${expectedState} ` +\n `as it was already updated to ${req.state}`,\n );\n return Promise.resolve(null);\n }\n Object.assign(req, updates);\n return Promise.resolve(req);\n }\n\n return Promise.resolve(null);\n }\n\n /**\n * Look for an existing room key request by id and state, and delete it if\n * found\n *\n * @param requestId - ID of request to update\n * @param expectedState - state we expect to find the request in\n *\n * @returns resolves once the operation is completed\n */\n public deleteOutgoingRoomKeyRequest(\n requestId: string,\n expectedState: number,\n ): Promise<OutgoingRoomKeyRequest | null> {\n for (let i = 0; i < this.outgoingRoomKeyRequests.length; i++) {\n const req = this.outgoingRoomKeyRequests[i];\n\n if (req.requestId !== requestId) {\n continue;\n }\n\n if (req.state != expectedState) {\n logger.warn(`Cannot delete room key request in state ${req.state} ` + `(expected ${expectedState})`);\n return Promise.resolve(null);\n }\n\n this.outgoingRoomKeyRequests.splice(i, 1);\n return Promise.resolve(req);\n }\n\n return Promise.resolve(null);\n }\n\n // Olm Account\n\n public getAccount(txn: unknown, func: (accountPickle: string | null) => void): void {\n func(this.account);\n }\n\n public storeAccount(txn: unknown, accountPickle: string): void {\n this.account = accountPickle;\n }\n\n public getCrossSigningKeys(txn: unknown, func: (keys: Record<string, CrossSigningKeyInfo> | null) => void): void {\n func(this.crossSigningKeys);\n }\n\n public getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void {\n const result = this.privateKeys[type] as SecretStorePrivateKeys[K] | undefined;\n func(result || null);\n }\n\n public storeCrossSigningKeys(txn: unknown, keys: Record<string, CrossSigningKeyInfo>): void {\n this.crossSigningKeys = keys;\n }\n\n public storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void {\n this.privateKeys[type] = key;\n }\n\n // Olm Sessions\n\n public countEndToEndSessions(txn: unknown, func: (count: number) => void): void {\n let count = 0;\n for (const deviceSessions of Object.values(this.sessions)) {\n count += Object.keys(deviceSessions).length;\n }\n func(count);\n }\n\n public getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (session: ISessionInfo) => void,\n ): void {\n const deviceSessions = this.sessions[deviceKey] || {};\n func(deviceSessions[sessionId] || null);\n }\n\n public getEndToEndSessions(\n deviceKey: string,\n txn: unknown,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void {\n func(this.sessions[deviceKey] || {});\n }\n\n public getAllEndToEndSessions(txn: unknown, func: (session: ISessionInfo) => void): void {\n Object.entries(this.sessions).forEach(([deviceKey, deviceSessions]) => {\n Object.entries(deviceSessions).forEach(([sessionId, session]) => {\n func({\n ...session,\n deviceKey,\n sessionId,\n });\n });\n });\n }\n\n public storeEndToEndSession(deviceKey: string, sessionId: string, sessionInfo: ISessionInfo, txn: unknown): void {\n let deviceSessions = this.sessions[deviceKey];\n if (deviceSessions === undefined) {\n deviceSessions = {};\n this.sessions[deviceKey] = deviceSessions;\n }\n safeSet(deviceSessions, sessionId, sessionInfo);\n }\n\n public async storeEndToEndSessionProblem(deviceKey: string, type: string, fixed: boolean): Promise<void> {\n const problems = (this.sessionProblems[deviceKey] = this.sessionProblems[deviceKey] || []);\n problems.push({ type, fixed, time: Date.now() });\n problems.sort((a, b) => {\n return a.time - b.time;\n });\n }\n\n public async getEndToEndSessionProblem(deviceKey: string, timestamp: number): Promise<IProblem | null> {\n const problems = this.sessionProblems[deviceKey] || [];\n if (!problems.length) {\n return null;\n }\n const lastProblem = problems[problems.length - 1];\n for (const problem of problems) {\n if (problem.time > timestamp) {\n return Object.assign({}, problem, { fixed: lastProblem.fixed });\n }\n }\n if (lastProblem.fixed) {\n return null;\n } else {\n return lastProblem;\n }\n }\n\n public async filterOutNotifiedErrorDevices(devices: IOlmDevice[]): Promise<IOlmDevice[]> {\n const notifiedErrorDevices = this.notifiedErrorDevices;\n const ret: IOlmDevice[] = [];\n\n for (const device of devices) {\n const { userId, deviceInfo } = device;\n if (userId in notifiedErrorDevices) {\n if (!(deviceInfo.deviceId in notifiedErrorDevices[userId])) {\n ret.push(device);\n safeSet(notifiedErrorDevices[userId], deviceInfo.deviceId, true);\n }\n } else {\n ret.push(device);\n safeSet(notifiedErrorDevices, userId, { [deviceInfo.deviceId]: true });\n }\n }\n\n return ret;\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async getEndToEndSessionsBatch(): Promise<null | ISessionInfo[]> {\n const result: ISessionInfo[] = [];\n for (const deviceSessions of Object.values(this.sessions)) {\n for (const session of Object.values(deviceSessions)) {\n result.push(session);\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndSessionsBatch(sessions: { deviceKey: string; sessionId: string }[]): Promise<void> {\n for (const { deviceKey, sessionId } of sessions) {\n const deviceSessions = this.sessions[deviceKey] || {};\n delete deviceSessions[sessionId];\n if (Object.keys(deviceSessions).length === 0) {\n // No more sessions for this device.\n delete this.sessions[deviceKey];\n }\n }\n }\n\n // Inbound Group Sessions\n\n public getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: unknown,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void {\n const k = encodeSessionKey(senderCurve25519Key, sessionId);\n func(this.inboundGroupSessions[k] || null, this.inboundGroupSessionsWithheld[k] || null);\n }\n\n public getAllEndToEndInboundGroupSessions(txn: unknown, func: (session: ISession | null) => void): void {\n for (const key of Object.keys(this.inboundGroupSessions)) {\n func({\n ...decodeSessionKey(key),\n sessionData: this.inboundGroupSessions[key],\n });\n }\n func(null);\n }\n\n public addEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void {\n const k = encodeSessionKey(senderCurve25519Key, sessionId);\n if (this.inboundGroupSessions[k] === undefined) {\n this.inboundGroupSessions[k] = sessionData;\n }\n }\n\n public storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void {\n const k = encodeSessionKey(senderCurve25519Key, sessionId);\n this.inboundGroupSessions[k] = sessionData;\n }\n\n public storeEndToEndInboundGroupSessionWithheld(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: IWithheld,\n txn: unknown,\n ): void {\n const k = encodeSessionKey(senderCurve25519Key, sessionId);\n this.inboundGroupSessionsWithheld[k] = sessionData;\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n public async countEndToEndInboundGroupSessions(): Promise<number> {\n return Object.keys(this.inboundGroupSessions).length;\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async getEndToEndInboundGroupSessionsBatch(): Promise<null | SessionExtended[]> {\n const result: SessionExtended[] = [];\n for (const [key, session] of Object.entries(this.inboundGroupSessions)) {\n result.push({\n ...decodeSessionKey(key),\n sessionData: session,\n needsBackup: key in this.sessionsNeedingBackup,\n });\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n public async deleteEndToEndInboundGroupSessionsBatch(\n sessions: { senderKey: string; sessionId: string }[],\n ): Promise<void> {\n for (const { senderKey, sessionId } of sessions) {\n const k = encodeSessionKey(senderKey, sessionId);\n delete this.inboundGroupSessions[k];\n }\n }\n\n // Device Data\n\n public getEndToEndDeviceData(txn: unknown, func: (deviceData: IDeviceData | null) => void): void {\n func(this.deviceData);\n }\n\n public storeEndToEndDeviceData(deviceData: IDeviceData, txn: unknown): void {\n this.deviceData = deviceData;\n }\n\n // E2E rooms\n\n public storeEndToEndRoom(roomId: string, roomInfo: IRoomEncryption, txn: unknown): void {\n this.rooms[roomId] = roomInfo;\n }\n\n public getEndToEndRooms(txn: unknown, func: (rooms: Record<string, IRoomEncryption>) => void): void {\n func(this.rooms);\n }\n\n public getSessionsNeedingBackup(limit: number): Promise<ISession[]> {\n const sessions: ISession[] = [];\n for (const session in this.sessionsNeedingBackup) {\n if (this.inboundGroupSessions[session]) {\n sessions.push({\n ...decodeSessionKey(session),\n sessionData: this.inboundGroupSessions[session],\n });\n if (limit && session.length >= limit) {\n break;\n }\n }\n }\n return Promise.resolve(sessions);\n }\n\n public countSessionsNeedingBackup(): Promise<number> {\n return Promise.resolve(Object.keys(this.sessionsNeedingBackup).length);\n }\n\n public unmarkSessionsNeedingBackup(sessions: ISession[]): Promise<void> {\n for (const session of sessions) {\n const sessionKey = encodeSessionKey(session.senderKey, session.sessionId);\n delete this.sessionsNeedingBackup[sessionKey];\n }\n return Promise.resolve();\n }\n\n public markSessionsNeedingBackup(sessions: ISession[]): Promise<void> {\n for (const session of sessions) {\n const sessionKey = encodeSessionKey(session.senderKey, session.sessionId);\n this.sessionsNeedingBackup[sessionKey] = true;\n }\n return Promise.resolve();\n }\n\n public addSharedHistoryInboundGroupSession(roomId: string, senderKey: string, sessionId: string): void {\n const sessions = this.sharedHistoryInboundGroupSessions[roomId] || [];\n sessions.push([senderKey, sessionId]);\n this.sharedHistoryInboundGroupSessions[roomId] = sessions;\n }\n\n public getSharedHistoryInboundGroupSessions(roomId: string): Promise<[senderKey: string, sessionId: string][]> {\n return Promise.resolve(this.sharedHistoryInboundGroupSessions[roomId] || []);\n }\n\n public addParkedSharedHistory(roomId: string, parkedData: ParkedSharedHistory): void {\n const parked = this.parkedSharedHistory.get(roomId) ?? [];\n parked.push(parkedData);\n this.parkedSharedHistory.set(roomId, parked);\n }\n\n public takeParkedSharedHistory(roomId: string): Promise<ParkedSharedHistory[]> {\n const parked = this.parkedSharedHistory.get(roomId) ?? [];\n this.parkedSharedHistory.delete(roomId);\n return Promise.resolve(parked);\n }\n\n // Session key backups\n\n public doTxn<T>(mode: Mode, stores: Iterable<string>, func: (txn?: unknown) => T): Promise<T> {\n return Promise.resolve(func(null));\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,iBAAiB;AACxC,SAASC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB;AACjE,SAQIC,cAAc,EAKdC,kBAAkB,QACf,WAAW;AAOlB,SAASC,gBAAgBA,CAACC,mBAA2B,EAAEC,SAAiB,EAAU;EAC9E,OAAOC,kBAAkB,CAACF,mBAAmB,CAAC,GAAG,GAAG,GAAGE,kBAAkB,CAACD,SAAS,CAAC;AACxF;AAEA,SAASE,gBAAgBA,CAACC,GAAW,EAA4C;EAC7E,IAAMC,QAAQ,GAAGD,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC;EAC/B,IAAMC,SAAS,GAAGC,kBAAkB,CAACH,QAAQ,CAAC,CAAC,CAAC,CAAC;EACjD,IAAMJ,SAAS,GAAGO,kBAAkB,CAACH,QAAQ,CAAC,CAAC,CAAC,CAAC;EACjD,OAAO;IAAEE,SAAS;IAAEN;EAAU,CAAC;AACnC;;AAEA;AACA;AACA;;AAEA,OAAO,MAAMQ,iBAAiB,CAAwB;EAAAC,YAAA;IAAAC,eAAA,yBACTd,cAAc,CAACe,WAAW;IAAAD,eAAA,kCACP,EAAE;IAAAA,eAAA,kBAC7B,IAAI;IAAAA,eAAA,2BACkC,IAAI;IAAAA,eAAA,sBACpB,CAAC,CAAC;IAAAA,eAAA,mBAE0B,CAAC,CAAC;IAAAA,eAAA,0BACtB,CAAC,CAAC;IAAAA,eAAA,+BACqB,CAAC,CAAC;IAAAA,eAAA,+BACN,CAAC,CAAC;IAAAA,eAAA,uCAClB,CAAC,CAAC;IACpE;IAAAA,eAAA,qBACyC,IAAI;IAAAA,eAA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IAAAK,sBAAA,GAAG,IAAI,CAACJ,mBAAmB,CAACC,GAAG,CAAClB,MAAM,CAAC,cAAAqB,sBAAA,cAAAA,sBAAA,GAAI,EAAE;IACzD,IAAI,CAACJ,mBAAmB,CAACK,MAAM,CAACtB,MAAM,CAAC;IACvC,OAAO7H,OAAO,CAACC,OAAO,CAAC4I,MAAM,CAAC;EAClC;;EAEA;;EAEOO,KAAKA,CAAIC,IAAU,EAAEC,MAAwB,EAAEvG,IAA0B,EAAc;IAC1F,OAAO/C,OAAO,CAACC,OAAO,CAAC8C,IAAI,CAAC,IAAI,CAAC,CAAC;EACtC;AACJ","ignoreList":[]}
@@ -1,105 +0,0 @@
1
- /**
2
- * Base class for verification methods.
3
- */
4
- import { MatrixEvent } from "../../models/event.ts";
5
- import { DeviceInfo } from "../deviceinfo.ts";
6
- import { KeysDuringVerification } from "../CrossSigning.ts";
7
- import { IVerificationChannel } from "./request/Channel.ts";
8
- import { MatrixClient } from "../../client.ts";
9
- import { VerificationRequest } from "./request/VerificationRequest.ts";
10
- import { TypedEventEmitter } from "../../models/typed-event-emitter.ts";
11
- import { ShowQrCodeCallbacks, ShowSasCallbacks, Verifier, VerifierEvent, VerifierEventHandlerMap } from "../../crypto-api/verification.ts";
12
- export declare class SwitchStartEventError extends Error {
13
- readonly startEvent: MatrixEvent | null;
14
- constructor(startEvent: MatrixEvent | null);
15
- }
16
- export type KeyVerifier = (keyId: string, device: DeviceInfo, keyInfo: string) => void;
17
- /** @deprecated use VerifierEvent */
18
- export type VerificationEvent = VerifierEvent;
19
- /** @deprecated use VerifierEvent */
20
- export declare const VerificationEvent: typeof VerifierEvent;
21
- /** @deprecated use VerifierEventHandlerMap */
22
- export type VerificationEventHandlerMap = {
23
- [VerificationEvent.Cancel]: (e: Error | MatrixEvent) => void;
24
- };
25
- /** @deprecated Avoid referencing this class directly; instead use {@link Crypto.Verifier}. */
26
- export declare class VerificationBase<Events extends string = VerifierEvent, Arguments = VerifierEventHandlerMap> extends TypedEventEmitter<VerifierEvent, VerifierEventHandlerMap> implements Verifier {
27
- readonly channel: IVerificationChannel;
28
- readonly baseApis: MatrixClient;
29
- readonly userId: string;
30
- readonly deviceId: string;
31
- startEvent: MatrixEvent | null;
32
- readonly request: VerificationRequest;
33
- private cancelled;
34
- private _done;
35
- private promise;
36
- private transactionTimeoutTimer;
37
- protected expectedEvent?: string;
38
- private resolve?;
39
- private reject?;
40
- private resolveEvent?;
41
- private rejectEvent?;
42
- private started?;
43
- /**
44
- * Base class for verification methods.
45
- *
46
- * <p>Once a verifier object is created, the verification can be started by
47
- * calling the verify() method, which will return a promise that will
48
- * resolve when the verification is completed, or reject if it could not
49
- * complete.</p>
50
- *
51
- * <p>Subclasses must have a NAME class property.</p>
52
- *
53
- * @param channel - the verification channel to send verification messages over.
54
- * TODO: Channel types
55
- *
56
- * @param baseApis - base matrix api interface
57
- *
58
- * @param userId - the user ID that is being verified
59
- *
60
- * @param deviceId - the device ID that is being verified
61
- *
62
- * @param startEvent - the m.key.verification.start event that
63
- * initiated this verification, if any
64
- *
65
- * @param request - the key verification request object related to
66
- * this verification, if any
67
- */
68
- constructor(channel: IVerificationChannel, baseApis: MatrixClient, userId: string, deviceId: string, startEvent: MatrixEvent | null, request: VerificationRequest);
69
- get initiatedByMe(): boolean;
70
- get hasBeenCancelled(): boolean;
71
- private resetTimer;
72
- private endTimer;
73
- protected send(type: string, uncompletedContent: Record<string, any>): Promise<void>;
74
- protected waitForEvent(type: string): Promise<MatrixEvent>;
75
- canSwitchStartEvent(event: MatrixEvent): boolean;
76
- switchStartEvent(event: MatrixEvent): void;
77
- handleEvent(e: MatrixEvent): void;
78
- done(): Promise<KeysDuringVerification | void>;
79
- cancel(e: Error | MatrixEvent): void;
80
- /**
81
- * Begin the key verification
82
- *
83
- * @returns Promise which resolves when the verification has
84
- * completed.
85
- */
86
- verify(): Promise<void>;
87
- protected doVerification?: () => Promise<void>;
88
- protected verifyKeys(userId: string, keys: Record<string, string>, verifier: KeyVerifier): Promise<void>;
89
- get events(): string[] | undefined;
90
- /**
91
- * Get the details for an SAS verification, if one is in progress
92
- *
93
- * Returns `null`, unless this verifier is for a SAS-based verification and we are waiting for the user to confirm
94
- * the SAS matches.
95
- */
96
- getShowSasCallbacks(): ShowSasCallbacks | null;
97
- /**
98
- * Get the details for reciprocating QR code verification, if one is in progress
99
- *
100
- * Returns `null`, unless this verifier is for reciprocating a QR-code-based verification (ie, the other user has
101
- * already scanned our QR code), and we are waiting for the user to confirm.
102
- */
103
- getReciprocateQrCodeCallbacks(): ShowQrCodeCallbacks | null;
104
- }
105
- //# sourceMappingURL=Base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../../src/crypto/verification/Base.ts"],"names":[],"mappings":"AAiBA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAiC,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EACH,mBAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,uBAAuB,EAC1B,MAAM,kCAAkC,CAAC;AAI1C,qBAAa,qBAAsB,SAAQ,KAAK;aACT,UAAU,EAAE,WAAW,GAAG,IAAI;gBAA9B,UAAU,EAAE,WAAW,GAAG,IAAI;CAGpE;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvF,oCAAoC;AACpC,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AErC;IAED,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,QAAQ;IAOhB,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpF,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAgBnD,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIhD,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAa1C,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IAuC3B,IAAI,IAAI,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IASpD,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,IAAI;IAgD3C;;;;;OAKG;IACI,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B9B,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;cAE/B,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAwD9G,IAAW,MAAM,IAAI,MAAM,EAAE,GAAG,SAAS,CAExC;IAED;;;;;OAKG;IACI,mBAAmB,IAAI,gBAAgB,GAAG,IAAI;IAIrD;;;;;OAKG;IACI,6BAA6B,IAAI,mBAAmB,GAAG,IAAI;CAGrE"}
@@ -1,372 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- /*
4
- Copyright 2018 New Vector Ltd
5
- Copyright 2020 The Matrix.org Foundation C.I.C.
6
-
7
- Licensed under the Apache License, Version 2.0 (the "License");
8
- you may not use this file except in compliance with the License.
9
- You may obtain a copy of the License at
10
-
11
- http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- Unless required by applicable law or agreed to in writing, software
14
- distributed under the License is distributed on an "AS IS" BASIS,
15
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- See the License for the specific language governing permissions and
17
- limitations under the License.
18
- */
19
-
20
- /**
21
- * Base class for verification methods.
22
- */
23
-
24
- import { MatrixEvent } from "../../models/event.js";
25
- import { EventType } from "../../@types/event.js";
26
- import { logger } from "../../logger.js";
27
- import { DeviceInfo } from "../deviceinfo.js";
28
- import { newTimeoutError } from "./Error.js";
29
- import { requestKeysDuringVerification } from "../CrossSigning.js";
30
- import { TypedEventEmitter } from "../../models/typed-event-emitter.js";
31
- import { VerifierEvent } from "../../crypto-api/verification.js";
32
- var timeoutException = new Error("Verification timed out");
33
- export class SwitchStartEventError extends Error {
34
- constructor(startEvent) {
35
- super();
36
- this.startEvent = startEvent;
37
- }
38
- }
39
-
40
- /** @deprecated use VerifierEvent */
41
-
42
- /** @deprecated use VerifierEvent */
43
- export var VerificationEvent = VerifierEvent;
44
-
45
- /** @deprecated use VerifierEventHandlerMap */
46
-
47
- /** @deprecated Avoid referencing this class directly; instead use {@link Crypto.Verifier}. */
48
- // The type parameters of VerificationBase are no longer used, but we need some placeholders to maintain
49
- // backwards compatibility with applications that reference the class.
50
- export class VerificationBase extends TypedEventEmitter {
51
- /**
52
- * Base class for verification methods.
53
- *
54
- * <p>Once a verifier object is created, the verification can be started by
55
- * calling the verify() method, which will return a promise that will
56
- * resolve when the verification is completed, or reject if it could not
57
- * complete.</p>
58
- *
59
- * <p>Subclasses must have a NAME class property.</p>
60
- *
61
- * @param channel - the verification channel to send verification messages over.
62
- * TODO: Channel types
63
- *
64
- * @param baseApis - base matrix api interface
65
- *
66
- * @param userId - the user ID that is being verified
67
- *
68
- * @param deviceId - the device ID that is being verified
69
- *
70
- * @param startEvent - the m.key.verification.start event that
71
- * initiated this verification, if any
72
- *
73
- * @param request - the key verification request object related to
74
- * this verification, if any
75
- */
76
- constructor(channel, baseApis, userId, deviceId, startEvent, request) {
77
- super();
78
- this.channel = channel;
79
- this.baseApis = baseApis;
80
- this.userId = userId;
81
- this.deviceId = deviceId;
82
- this.startEvent = startEvent;
83
- this.request = request;
84
- _defineProperty(this, "cancelled", false);
85
- _defineProperty(this, "_done", false);
86
- _defineProperty(this, "promise", null);
87
- _defineProperty(this, "transactionTimeoutTimer", null);
88
- _defineProperty(this, "expectedEvent", void 0);
89
- _defineProperty(this, "resolve", void 0);
90
- _defineProperty(this, "reject", void 0);
91
- _defineProperty(this, "resolveEvent", void 0);
92
- _defineProperty(this, "rejectEvent", void 0);
93
- _defineProperty(this, "started", void 0);
94
- _defineProperty(this, "doVerification", void 0);
95
- }
96
- get initiatedByMe() {
97
- // if there is no start event yet,
98
- // we probably want to send it,
99
- // which happens if we initiate
100
- if (!this.startEvent) {
101
- return true;
102
- }
103
- var sender = this.startEvent.getSender();
104
- var content = this.startEvent.getContent();
105
- return sender === this.baseApis.getUserId() && content.from_device === this.baseApis.getDeviceId();
106
- }
107
- get hasBeenCancelled() {
108
- return this.cancelled;
109
- }
110
- resetTimer() {
111
- logger.info("Refreshing/starting the verification transaction timeout timer");
112
- if (this.transactionTimeoutTimer !== null) {
113
- clearTimeout(this.transactionTimeoutTimer);
114
- }
115
- this.transactionTimeoutTimer = setTimeout(() => {
116
- if (!this._done && !this.cancelled) {
117
- logger.info("Triggering verification timeout");
118
- this.cancel(timeoutException);
119
- }
120
- }, 10 * 60 * 1000); // 10 minutes
121
- }
122
- endTimer() {
123
- if (this.transactionTimeoutTimer !== null) {
124
- clearTimeout(this.transactionTimeoutTimer);
125
- this.transactionTimeoutTimer = null;
126
- }
127
- }
128
- send(type, uncompletedContent) {
129
- return this.channel.send(type, uncompletedContent);
130
- }
131
- waitForEvent(type) {
132
- if (this._done) {
133
- return Promise.reject(new Error("Verification is already done"));
134
- }
135
- var existingEvent = this.request.getEventFromOtherParty(type);
136
- if (existingEvent) {
137
- return Promise.resolve(existingEvent);
138
- }
139
- this.expectedEvent = type;
140
- return new Promise((resolve, reject) => {
141
- this.resolveEvent = resolve;
142
- this.rejectEvent = reject;
143
- });
144
- }
145
- canSwitchStartEvent(event) {
146
- return false;
147
- }
148
- switchStartEvent(event) {
149
- if (this.canSwitchStartEvent(event)) {
150
- logger.log("Verification Base: switching verification start event", {
151
- restartingFlow: !!this.rejectEvent
152
- });
153
- if (this.rejectEvent) {
154
- var reject = this.rejectEvent;
155
- this.rejectEvent = undefined;
156
- reject(new SwitchStartEventError(event));
157
- } else {
158
- this.startEvent = event;
159
- }
160
- }
161
- }
162
- handleEvent(e) {
163
- if (this._done) {
164
- return;
165
- } else if (e.getType() === this.expectedEvent) {
166
- // if we receive an expected m.key.verification.done, then just
167
- // ignore it, since we don't need to do anything about it
168
- if (this.expectedEvent !== EventType.KeyVerificationDone) {
169
- var _this$resolveEvent;
170
- this.expectedEvent = undefined;
171
- this.rejectEvent = undefined;
172
- this.resetTimer();
173
- (_this$resolveEvent = this.resolveEvent) === null || _this$resolveEvent === void 0 || _this$resolveEvent.call(this, e);
174
- }
175
- } else if (e.getType() === EventType.KeyVerificationCancel) {
176
- var reject = this.reject;
177
- this.reject = undefined;
178
- // there is only promise to reject if verify has been called
179
- if (reject) {
180
- var content = e.getContent();
181
- var {
182
- reason,
183
- code
184
- } = content;
185
- reject(new Error("Other side cancelled verification " + "because ".concat(reason, " (").concat(code, ")")));
186
- }
187
- } else if (this.expectedEvent) {
188
- // only cancel if there is an event expected.
189
- // if there is no event expected, it means verify() wasn't called
190
- // and we're just replaying the timeline events when syncing
191
- // after a refresh when the events haven't been stored in the cache yet.
192
- var exception = new Error("Unexpected message: expecting " + this.expectedEvent + " but got " + e.getType());
193
- this.expectedEvent = undefined;
194
- if (this.rejectEvent) {
195
- var _reject = this.rejectEvent;
196
- this.rejectEvent = undefined;
197
- _reject(exception);
198
- }
199
- this.cancel(exception);
200
- }
201
- }
202
- done() {
203
- var _this = this;
204
- return _asyncToGenerator(function* () {
205
- _this.endTimer(); // always kill the activity timer
206
- if (!_this._done) {
207
- var _this$resolve;
208
- _this.request.onVerifierFinished();
209
- (_this$resolve = _this.resolve) === null || _this$resolve === void 0 || _this$resolve.call(_this);
210
- return requestKeysDuringVerification(_this.baseApis, _this.userId, _this.deviceId);
211
- }
212
- })();
213
- }
214
- cancel(e) {
215
- this.endTimer(); // always kill the activity timer
216
- if (!this._done) {
217
- this.cancelled = true;
218
- this.request.onVerifierCancelled();
219
- if (this.userId && this.deviceId) {
220
- // send a cancellation to the other user (if it wasn't
221
- // cancelled by the other user)
222
- if (e === timeoutException) {
223
- var timeoutEvent = newTimeoutError();
224
- this.send(timeoutEvent.getType(), timeoutEvent.getContent());
225
- } else if (e instanceof MatrixEvent) {
226
- var sender = e.getSender();
227
- if (sender !== this.userId) {
228
- var content = e.getContent();
229
- if (e.getType() === EventType.KeyVerificationCancel) {
230
- content.code = content.code || "m.unknown";
231
- content.reason = content.reason || content.body || "Unknown reason";
232
- this.send(EventType.KeyVerificationCancel, content);
233
- } else {
234
- this.send(EventType.KeyVerificationCancel, {
235
- code: "m.unknown",
236
- reason: content.body || "Unknown reason"
237
- });
238
- }
239
- }
240
- } else {
241
- this.send(EventType.KeyVerificationCancel, {
242
- code: "m.unknown",
243
- reason: e.toString()
244
- });
245
- }
246
- }
247
- if (this.promise !== null) {
248
- // when we cancel without a promise, we end up with a promise
249
- // but no reject function. If cancel is called again, we'd error.
250
- if (this.reject) this.reject(e);
251
- } else {
252
- // FIXME: this causes an "Uncaught promise" console message
253
- // if nothing ends up chaining this promise.
254
- this.promise = Promise.reject(e);
255
- }
256
- // Also emit a 'cancel' event that the app can listen for to detect cancellation
257
- // before calling verify()
258
- this.emit(VerificationEvent.Cancel, e);
259
- }
260
- }
261
-
262
- /**
263
- * Begin the key verification
264
- *
265
- * @returns Promise which resolves when the verification has
266
- * completed.
267
- */
268
- verify() {
269
- var _this2 = this;
270
- if (this.promise) return this.promise;
271
- this.promise = new Promise((resolve, reject) => {
272
- this.resolve = function () {
273
- _this2._done = true;
274
- _this2.endTimer();
275
- resolve(...arguments);
276
- };
277
- this.reject = e => {
278
- this._done = true;
279
- this.endTimer();
280
- reject(e);
281
- };
282
- });
283
- if (this.doVerification && !this.started) {
284
- this.started = true;
285
- this.resetTimer(); // restart the timeout
286
- new Promise((resolve, reject) => {
287
- var _deviceList$getStored;
288
- var crossSignId = (_deviceList$getStored = this.baseApis.crypto.deviceList.getStoredCrossSigningForUser(this.userId)) === null || _deviceList$getStored === void 0 ? void 0 : _deviceList$getStored.getId();
289
- if (crossSignId === this.deviceId) {
290
- reject(new Error("Device ID is the same as the cross-signing ID"));
291
- }
292
- resolve();
293
- }).then(() => this.doVerification()).then(this.done.bind(this), this.cancel.bind(this));
294
- }
295
- return this.promise;
296
- }
297
- verifyKeys(userId, keys, verifier) {
298
- var _this3 = this;
299
- return _asyncToGenerator(function* () {
300
- // we try to verify all the keys that we're told about, but we might
301
- // not know about all of them, so keep track of the keys that we know
302
- // about, and ignore the rest
303
- var verifiedDevices = [];
304
- for (var [_keyId, _keyInfo] of Object.entries(keys)) {
305
- var _deviceId = _keyId.split(":", 2)[1];
306
- var _device = _this3.baseApis.getStoredDevice(userId, _deviceId);
307
- if (_device) {
308
- verifier(_keyId, _device, _keyInfo);
309
- verifiedDevices.push([_deviceId, _keyId, _device.keys[_keyId]]);
310
- } else {
311
- var crossSigningInfo = _this3.baseApis.crypto.deviceList.getStoredCrossSigningForUser(userId);
312
- if (crossSigningInfo && crossSigningInfo.getId() === _deviceId) {
313
- verifier(_keyId, DeviceInfo.fromStorage({
314
- keys: {
315
- [_keyId]: _deviceId
316
- }
317
- }, _deviceId), _keyInfo);
318
- verifiedDevices.push([_deviceId, _keyId, _deviceId]);
319
- } else {
320
- logger.warn("verification: Could not find device ".concat(_deviceId, " to verify"));
321
- }
322
- }
323
- }
324
-
325
- // if none of the keys could be verified, then error because the app
326
- // should be informed about that
327
- if (!verifiedDevices.length) {
328
- throw new Error("No devices could be verified");
329
- }
330
- logger.info("Verification completed! Marking devices verified: ", verifiedDevices);
331
- // TODO: There should probably be a batch version of this, otherwise it's going
332
- // to upload each signature in a separate API call which is silly because the
333
- // API supports as many signatures as you like.
334
- for (var [_deviceId2, _keyId2, key] of verifiedDevices) {
335
- yield _this3.baseApis.crypto.setDeviceVerification(userId, _deviceId2, true, null, null, {
336
- [_keyId2]: key
337
- });
338
- }
339
-
340
- // if one of the user's own devices is being marked as verified / unverified,
341
- // check the key backup status, since whether or not we use this depends on
342
- // whether it has a signature from a verified device
343
- if (userId == _this3.baseApis.credentials.userId) {
344
- yield _this3.baseApis.checkKeyBackup();
345
- }
346
- })();
347
- }
348
- get events() {
349
- return undefined;
350
- }
351
-
352
- /**
353
- * Get the details for an SAS verification, if one is in progress
354
- *
355
- * Returns `null`, unless this verifier is for a SAS-based verification and we are waiting for the user to confirm
356
- * the SAS matches.
357
- */
358
- getShowSasCallbacks() {
359
- return null;
360
- }
361
-
362
- /**
363
- * Get the details for reciprocating QR code verification, if one is in progress
364
- *
365
- * Returns `null`, unless this verifier is for reciprocating a QR-code-based verification (ie, the other user has
366
- * already scanned our QR code), and we are waiting for the user to confirm.
367
- */
368
- getReciprocateQrCodeCallbacks() {
369
- return null;
370
- }
371
- }
372
- //# sourceMappingURL=Base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.js","names":["MatrixEvent","EventType","logger","DeviceInfo","newTimeoutError","requestKeysDuringVerification","TypedEventEmitter","VerifierEvent","timeoutException","Error","SwitchStartEventError","constructor","startEvent","VerificationEvent","VerificationBase","channel","baseApis","userId","deviceId","request","_defineProperty","initiatedByMe","sender","getSender","content","getContent","getUserId","from_device","getDeviceId","hasBeenCancelled","cancelled","resetTimer","info","transactionTimeoutTimer","clearTimeout","setTimeout","_done","cancel","endTimer","send","type","uncompletedContent","waitForEvent","Promise","reject","existingEvent","getEventFromOtherParty","resolve","expectedEvent","resolveEvent","rejectEvent","canSwitchStartEvent","event","switchStartEvent","log","restartingFlow","undefined","handleEvent","e","getType","KeyVerificationDone","_this$resolveEvent","call","KeyVerificationCancel","reason","code","concat","exception","done","_this","_asyncToGenerator","_this$resolve","onVerifierFinished","onVerifierCancelled","timeoutEvent","body","toString","promise","emit","Cancel","verify","_this2","arguments","doVerification","started","_deviceList$getStored","crossSignId","crypto","deviceList","getStoredCrossSigningForUser","getId","then","bind","verifyKeys","keys","verifier","_this3","verifiedDevices","keyId","keyInfo","Object","entries","split","device","getStoredDevice","push","crossSigningInfo","fromStorage","warn","length","key","setDeviceVerification","credentials","checkKeyBackup","events","getShowSasCallbacks","getReciprocateQrCodeCallbacks"],"sources":["../../../src/crypto/verification/Base.ts"],"sourcesContent":["/*\nCopyright 2018 New Vector Ltd\nCopyright 2020 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Base class for verification methods.\n */\n\nimport { MatrixEvent } from \"../../models/event.ts\";\nimport { EventType } from \"../../@types/event.ts\";\nimport { logger } from \"../../logger.ts\";\nimport { DeviceInfo } from \"../deviceinfo.ts\";\nimport { newTimeoutError } from \"./Error.ts\";\nimport { KeysDuringVerification, requestKeysDuringVerification } from \"../CrossSigning.ts\";\nimport { IVerificationChannel } from \"./request/Channel.ts\";\nimport { MatrixClient } from \"../../client.ts\";\nimport { VerificationRequest } from \"./request/VerificationRequest.ts\";\nimport { TypedEventEmitter } from \"../../models/typed-event-emitter.ts\";\nimport {\n ShowQrCodeCallbacks,\n ShowSasCallbacks,\n Verifier,\n VerifierEvent,\n VerifierEventHandlerMap,\n} from \"../../crypto-api/verification.ts\";\n\nconst timeoutException = new Error(\"Verification timed out\");\n\nexport class SwitchStartEventError extends Error {\n public constructor(public readonly startEvent: MatrixEvent | null) {\n super();\n }\n}\n\nexport type KeyVerifier = (keyId: string, device: DeviceInfo, keyInfo: string) => void;\n\n/** @deprecated use VerifierEvent */\nexport type VerificationEvent = VerifierEvent;\n/** @deprecated use VerifierEvent */\nexport const VerificationEvent = VerifierEvent;\n\n/** @deprecated use VerifierEventHandlerMap */\nexport type VerificationEventHandlerMap = {\n [VerificationEvent.Cancel]: (e: Error | MatrixEvent) => void;\n};\n\n/** @deprecated Avoid referencing this class directly; instead use {@link Crypto.Verifier}. */\n// The type parameters of VerificationBase are no longer used, but we need some placeholders to maintain\n// backwards compatibility with applications that reference the class.\nexport class VerificationBase<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Events extends string = VerifierEvent,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Arguments = VerifierEventHandlerMap,\n >\n extends TypedEventEmitter<VerifierEvent, VerifierEventHandlerMap>\n implements Verifier\n{\n private cancelled = false;\n private _done = false;\n private promise: Promise<void> | null = null;\n private transactionTimeoutTimer: ReturnType<typeof setTimeout> | null = null;\n protected expectedEvent?: string;\n private resolve?: () => void;\n private reject?: (e: Error | MatrixEvent) => void;\n private resolveEvent?: (e: MatrixEvent) => void;\n private rejectEvent?: (e: Error) => void;\n private started?: boolean;\n\n /**\n * Base class for verification methods.\n *\n * <p>Once a verifier object is created, the verification can be started by\n * calling the verify() method, which will return a promise that will\n * resolve when the verification is completed, or reject if it could not\n * complete.</p>\n *\n * <p>Subclasses must have a NAME class property.</p>\n *\n * @param channel - the verification channel to send verification messages over.\n * TODO: Channel types\n *\n * @param baseApis - base matrix api interface\n *\n * @param userId - the user ID that is being verified\n *\n * @param deviceId - the device ID that is being verified\n *\n * @param startEvent - the m.key.verification.start event that\n * initiated this verification, if any\n *\n * @param request - the key verification request object related to\n * this verification, if any\n */\n public constructor(\n public readonly channel: IVerificationChannel,\n public readonly baseApis: MatrixClient,\n public readonly userId: string,\n public readonly deviceId: string,\n public startEvent: MatrixEvent | null,\n public readonly request: VerificationRequest,\n ) {\n super();\n }\n\n public get initiatedByMe(): boolean {\n // if there is no start event yet,\n // we probably want to send it,\n // which happens if we initiate\n if (!this.startEvent) {\n return true;\n }\n const sender = this.startEvent.getSender();\n const content = this.startEvent.getContent();\n return sender === this.baseApis.getUserId() && content.from_device === this.baseApis.getDeviceId();\n }\n\n public get hasBeenCancelled(): boolean {\n return this.cancelled;\n }\n\n private resetTimer(): void {\n logger.info(\"Refreshing/starting the verification transaction timeout timer\");\n if (this.transactionTimeoutTimer !== null) {\n clearTimeout(this.transactionTimeoutTimer);\n }\n this.transactionTimeoutTimer = setTimeout(\n () => {\n if (!this._done && !this.cancelled) {\n logger.info(\"Triggering verification timeout\");\n this.cancel(timeoutException);\n }\n },\n 10 * 60 * 1000,\n ); // 10 minutes\n }\n\n private endTimer(): void {\n if (this.transactionTimeoutTimer !== null) {\n clearTimeout(this.transactionTimeoutTimer);\n this.transactionTimeoutTimer = null;\n }\n }\n\n protected send(type: string, uncompletedContent: Record<string, any>): Promise<void> {\n return this.channel.send(type, uncompletedContent);\n }\n\n protected waitForEvent(type: string): Promise<MatrixEvent> {\n if (this._done) {\n return Promise.reject(new Error(\"Verification is already done\"));\n }\n const existingEvent = this.request.getEventFromOtherParty(type);\n if (existingEvent) {\n return Promise.resolve(existingEvent);\n }\n\n this.expectedEvent = type;\n return new Promise((resolve, reject) => {\n this.resolveEvent = resolve;\n this.rejectEvent = reject;\n });\n }\n\n public canSwitchStartEvent(event: MatrixEvent): boolean {\n return false;\n }\n\n public switchStartEvent(event: MatrixEvent): void {\n if (this.canSwitchStartEvent(event)) {\n logger.log(\"Verification Base: switching verification start event\", { restartingFlow: !!this.rejectEvent });\n if (this.rejectEvent) {\n const reject = this.rejectEvent;\n this.rejectEvent = undefined;\n reject(new SwitchStartEventError(event));\n } else {\n this.startEvent = event;\n }\n }\n }\n\n public handleEvent(e: MatrixEvent): void {\n if (this._done) {\n return;\n } else if (e.getType() === this.expectedEvent) {\n // if we receive an expected m.key.verification.done, then just\n // ignore it, since we don't need to do anything about it\n if (this.expectedEvent !== EventType.KeyVerificationDone) {\n this.expectedEvent = undefined;\n this.rejectEvent = undefined;\n this.resetTimer();\n this.resolveEvent?.(e);\n }\n } else if (e.getType() === EventType.KeyVerificationCancel) {\n const reject = this.reject;\n this.reject = undefined;\n // there is only promise to reject if verify has been called\n if (reject) {\n const content = e.getContent();\n const { reason, code } = content;\n reject(new Error(`Other side cancelled verification ` + `because ${reason} (${code})`));\n }\n } else if (this.expectedEvent) {\n // only cancel if there is an event expected.\n // if there is no event expected, it means verify() wasn't called\n // and we're just replaying the timeline events when syncing\n // after a refresh when the events haven't been stored in the cache yet.\n const exception = new Error(\n \"Unexpected message: expecting \" + this.expectedEvent + \" but got \" + e.getType(),\n );\n this.expectedEvent = undefined;\n if (this.rejectEvent) {\n const reject = this.rejectEvent;\n this.rejectEvent = undefined;\n reject(exception);\n }\n this.cancel(exception);\n }\n }\n\n public async done(): Promise<KeysDuringVerification | void> {\n this.endTimer(); // always kill the activity timer\n if (!this._done) {\n this.request.onVerifierFinished();\n this.resolve?.();\n return requestKeysDuringVerification(this.baseApis, this.userId, this.deviceId);\n }\n }\n\n public cancel(e: Error | MatrixEvent): void {\n this.endTimer(); // always kill the activity timer\n if (!this._done) {\n this.cancelled = true;\n this.request.onVerifierCancelled();\n if (this.userId && this.deviceId) {\n // send a cancellation to the other user (if it wasn't\n // cancelled by the other user)\n if (e === timeoutException) {\n const timeoutEvent = newTimeoutError();\n this.send(timeoutEvent.getType(), timeoutEvent.getContent());\n } else if (e instanceof MatrixEvent) {\n const sender = e.getSender();\n if (sender !== this.userId) {\n const content = e.getContent();\n if (e.getType() === EventType.KeyVerificationCancel) {\n content.code = content.code || \"m.unknown\";\n content.reason = content.reason || content.body || \"Unknown reason\";\n this.send(EventType.KeyVerificationCancel, content);\n } else {\n this.send(EventType.KeyVerificationCancel, {\n code: \"m.unknown\",\n reason: content.body || \"Unknown reason\",\n });\n }\n }\n } else {\n this.send(EventType.KeyVerificationCancel, {\n code: \"m.unknown\",\n reason: e.toString(),\n });\n }\n }\n if (this.promise !== null) {\n // when we cancel without a promise, we end up with a promise\n // but no reject function. If cancel is called again, we'd error.\n if (this.reject) this.reject(e);\n } else {\n // FIXME: this causes an \"Uncaught promise\" console message\n // if nothing ends up chaining this promise.\n this.promise = Promise.reject(e);\n }\n // Also emit a 'cancel' event that the app can listen for to detect cancellation\n // before calling verify()\n this.emit(VerificationEvent.Cancel, e);\n }\n }\n\n /**\n * Begin the key verification\n *\n * @returns Promise which resolves when the verification has\n * completed.\n */\n public verify(): Promise<void> {\n if (this.promise) return this.promise;\n\n this.promise = new Promise((resolve, reject) => {\n this.resolve = (...args): void => {\n this._done = true;\n this.endTimer();\n resolve(...args);\n };\n this.reject = (e: Error | MatrixEvent): void => {\n this._done = true;\n this.endTimer();\n reject(e);\n };\n });\n if (this.doVerification && !this.started) {\n this.started = true;\n this.resetTimer(); // restart the timeout\n new Promise<void>((resolve, reject) => {\n const crossSignId = this.baseApis.crypto!.deviceList.getStoredCrossSigningForUser(this.userId)?.getId();\n if (crossSignId === this.deviceId) {\n reject(new Error(\"Device ID is the same as the cross-signing ID\"));\n }\n resolve();\n })\n .then(() => this.doVerification!())\n .then(this.done.bind(this), this.cancel.bind(this));\n }\n return this.promise;\n }\n\n protected doVerification?: () => Promise<void>;\n\n protected async verifyKeys(userId: string, keys: Record<string, string>, verifier: KeyVerifier): Promise<void> {\n // we try to verify all the keys that we're told about, but we might\n // not know about all of them, so keep track of the keys that we know\n // about, and ignore the rest\n const verifiedDevices: [string, string, string][] = [];\n\n for (const [keyId, keyInfo] of Object.entries(keys)) {\n const deviceId = keyId.split(\":\", 2)[1];\n const device = this.baseApis.getStoredDevice(userId, deviceId);\n if (device) {\n verifier(keyId, device, keyInfo);\n verifiedDevices.push([deviceId, keyId, device.keys[keyId]]);\n } else {\n const crossSigningInfo = this.baseApis.crypto!.deviceList.getStoredCrossSigningForUser(userId);\n if (crossSigningInfo && crossSigningInfo.getId() === deviceId) {\n verifier(\n keyId,\n DeviceInfo.fromStorage(\n {\n keys: {\n [keyId]: deviceId,\n },\n },\n deviceId,\n ),\n keyInfo,\n );\n verifiedDevices.push([deviceId, keyId, deviceId]);\n } else {\n logger.warn(`verification: Could not find device ${deviceId} to verify`);\n }\n }\n }\n\n // if none of the keys could be verified, then error because the app\n // should be informed about that\n if (!verifiedDevices.length) {\n throw new Error(\"No devices could be verified\");\n }\n\n logger.info(\"Verification completed! Marking devices verified: \", verifiedDevices);\n // TODO: There should probably be a batch version of this, otherwise it's going\n // to upload each signature in a separate API call which is silly because the\n // API supports as many signatures as you like.\n for (const [deviceId, keyId, key] of verifiedDevices) {\n await this.baseApis.crypto!.setDeviceVerification(userId, deviceId, true, null, null, { [keyId]: key });\n }\n\n // if one of the user's own devices is being marked as verified / unverified,\n // check the key backup status, since whether or not we use this depends on\n // whether it has a signature from a verified device\n if (userId == this.baseApis.credentials.userId) {\n await this.baseApis.checkKeyBackup();\n }\n }\n\n public get events(): string[] | undefined {\n return undefined;\n }\n\n /**\n * Get the details for an SAS verification, if one is in progress\n *\n * Returns `null`, unless this verifier is for a SAS-based verification and we are waiting for the user to confirm\n * the SAS matches.\n */\n public getShowSasCallbacks(): ShowSasCallbacks | null {\n return null;\n }\n\n /**\n * Get the details for reciprocating QR code verification, if one is in progress\n *\n * Returns `null`, unless this verifier is for reciprocating a QR-code-based verification (ie, the other user has\n * already scanned our QR code), and we are waiting for the user to confirm.\n */\n public getReciprocateQrCodeCallbacks(): ShowQrCodeCallbacks | null {\n return null;\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,uBAAuB;AACnD,SAASC,SAAS,QAAQ,u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