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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (467) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/global.d.js +0 -2
  3. package/lib/@types/global.d.js.map +1 -1
  4. package/lib/browser-index.d.ts.map +1 -1
  5. package/lib/browser-index.js +0 -11
  6. package/lib/browser-index.js.map +1 -1
  7. package/lib/client.d.ts +2 -1176
  8. package/lib/client.d.ts.map +1 -1
  9. package/lib/client.js +346 -2717
  10. package/lib/client.js.map +1 -1
  11. package/lib/embedded.d.ts +0 -22
  12. package/lib/embedded.d.ts.map +1 -1
  13. package/lib/embedded.js +24 -166
  14. package/lib/embedded.js.map +1 -1
  15. package/lib/event-mapper.d.ts.map +1 -1
  16. package/lib/event-mapper.js +0 -4
  17. package/lib/event-mapper.js.map +1 -1
  18. package/lib/matrix.d.ts +0 -19
  19. package/lib/matrix.d.ts.map +1 -1
  20. package/lib/matrix.js +1 -26
  21. package/lib/matrix.js.map +1 -1
  22. package/lib/models/MSC3089Branch.d.ts.map +1 -1
  23. package/lib/models/MSC3089Branch.js +0 -3
  24. package/lib/models/MSC3089Branch.js.map +1 -1
  25. package/lib/models/event.d.ts +0 -94
  26. package/lib/models/event.d.ts.map +1 -1
  27. package/lib/models/event.js +0 -274
  28. package/lib/models/event.js.map +1 -1
  29. package/lib/models/poll.d.ts.map +1 -1
  30. package/lib/models/poll.js +1 -5
  31. package/lib/models/poll.js.map +1 -1
  32. package/lib/models/relations-container.d.ts.map +1 -1
  33. package/lib/models/relations-container.js +1 -7
  34. package/lib/models/relations-container.js.map +1 -1
  35. package/lib/models/relations.d.ts +0 -1
  36. package/lib/models/relations.d.ts.map +1 -1
  37. package/lib/models/relations.js +0 -8
  38. package/lib/models/relations.js.map +1 -1
  39. package/lib/models/room-state.d.ts.map +1 -1
  40. package/lib/models/room-state.js +10 -26
  41. package/lib/models/room-state.js.map +1 -1
  42. package/lib/models/room.d.ts +0 -18
  43. package/lib/models/room.d.ts.map +1 -1
  44. package/lib/models/room.js +94 -148
  45. package/lib/models/room.js.map +1 -1
  46. package/lib/models/thread.d.ts.map +1 -1
  47. package/lib/models/thread.js +0 -1
  48. package/lib/models/thread.js.map +1 -1
  49. package/lib/sliding-sync-sdk.d.ts +2 -3
  50. package/lib/sliding-sync-sdk.d.ts.map +1 -1
  51. package/lib/sliding-sync-sdk.js +41 -90
  52. package/lib/sliding-sync-sdk.js.map +1 -1
  53. package/lib/sync.d.ts +0 -12
  54. package/lib/sync.d.ts.map +1 -1
  55. package/lib/sync.js +1 -73
  56. package/lib/sync.js.map +1 -1
  57. package/lib/testing.d.ts +0 -48
  58. package/lib/testing.d.ts.map +1 -1
  59. package/lib/testing.js +0 -105
  60. package/lib/testing.js.map +1 -1
  61. package/package.json +1 -3
  62. package/src/@types/global.d.ts +0 -3
  63. package/src/browser-index.ts +0 -11
  64. package/src/client.ts +57 -2732
  65. package/src/embedded.ts +3 -130
  66. package/src/event-mapper.ts +0 -4
  67. package/src/matrix.ts +0 -28
  68. package/src/models/MSC3089Branch.ts +0 -3
  69. package/src/models/event.ts +0 -289
  70. package/src/models/poll.ts +0 -6
  71. package/src/models/relations-container.ts +1 -8
  72. package/src/models/relations.ts +0 -8
  73. package/src/models/room-state.ts +2 -8
  74. package/src/models/room.ts +0 -62
  75. package/src/models/thread.ts +0 -1
  76. package/src/sliding-sync-sdk.ts +2 -72
  77. package/src/sync.ts +1 -98
  78. package/src/testing.ts +0 -108
  79. package/lib/@types/crypto.d.ts +0 -47
  80. package/lib/@types/crypto.d.ts.map +0 -1
  81. package/lib/@types/crypto.js +0 -1
  82. package/lib/@types/crypto.js.map +0 -1
  83. package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
  84. package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
  85. package/lib/common-crypto/CryptoBackend.d.ts +0 -240
  86. package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
  87. package/lib/common-crypto/CryptoBackend.js +0 -73
  88. package/lib/common-crypto/CryptoBackend.js.map +0 -1
  89. package/lib/common-crypto/key-passphrase.d.ts +0 -14
  90. package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
  91. package/lib/common-crypto/key-passphrase.js +0 -33
  92. package/lib/common-crypto/key-passphrase.js.map +0 -1
  93. package/lib/crypto/CrossSigning.d.ts +0 -184
  94. package/lib/crypto/CrossSigning.d.ts.map +0 -1
  95. package/lib/crypto/CrossSigning.js +0 -718
  96. package/lib/crypto/CrossSigning.js.map +0 -1
  97. package/lib/crypto/DeviceList.d.ts +0 -216
  98. package/lib/crypto/DeviceList.d.ts.map +0 -1
  99. package/lib/crypto/DeviceList.js +0 -892
  100. package/lib/crypto/DeviceList.js.map +0 -1
  101. package/lib/crypto/EncryptionSetup.d.ts +0 -152
  102. package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
  103. package/lib/crypto/EncryptionSetup.js +0 -356
  104. package/lib/crypto/EncryptionSetup.js.map +0 -1
  105. package/lib/crypto/OlmDevice.d.ts +0 -457
  106. package/lib/crypto/OlmDevice.d.ts.map +0 -1
  107. package/lib/crypto/OlmDevice.js +0 -1241
  108. package/lib/crypto/OlmDevice.js.map +0 -1
  109. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
  110. package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
  111. package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
  112. package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
  113. package/lib/crypto/RoomList.d.ts +0 -26
  114. package/lib/crypto/RoomList.d.ts.map +0 -1
  115. package/lib/crypto/RoomList.js +0 -71
  116. package/lib/crypto/RoomList.js.map +0 -1
  117. package/lib/crypto/SecretSharing.d.ts +0 -24
  118. package/lib/crypto/SecretSharing.d.ts.map +0 -1
  119. package/lib/crypto/SecretSharing.js +0 -194
  120. package/lib/crypto/SecretSharing.js.map +0 -1
  121. package/lib/crypto/SecretStorage.d.ts +0 -55
  122. package/lib/crypto/SecretStorage.d.ts.map +0 -1
  123. package/lib/crypto/SecretStorage.js +0 -118
  124. package/lib/crypto/SecretStorage.js.map +0 -1
  125. package/lib/crypto/aes.d.ts +0 -6
  126. package/lib/crypto/aes.d.ts.map +0 -1
  127. package/lib/crypto/aes.js +0 -24
  128. package/lib/crypto/aes.js.map +0 -1
  129. package/lib/crypto/algorithms/base.d.ts +0 -156
  130. package/lib/crypto/algorithms/base.d.ts.map +0 -1
  131. package/lib/crypto/algorithms/base.js +0 -187
  132. package/lib/crypto/algorithms/base.js.map +0 -1
  133. package/lib/crypto/algorithms/index.d.ts +0 -4
  134. package/lib/crypto/algorithms/index.d.ts.map +0 -1
  135. package/lib/crypto/algorithms/index.js +0 -20
  136. package/lib/crypto/algorithms/index.js.map +0 -1
  137. package/lib/crypto/algorithms/megolm.d.ts +0 -385
  138. package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
  139. package/lib/crypto/algorithms/megolm.js +0 -1822
  140. package/lib/crypto/algorithms/megolm.js.map +0 -1
  141. package/lib/crypto/algorithms/olm.d.ts +0 -5
  142. package/lib/crypto/algorithms/olm.d.ts.map +0 -1
  143. package/lib/crypto/algorithms/olm.js +0 -299
  144. package/lib/crypto/algorithms/olm.js.map +0 -1
  145. package/lib/crypto/api.d.ts +0 -32
  146. package/lib/crypto/api.d.ts.map +0 -1
  147. package/lib/crypto/api.js +0 -22
  148. package/lib/crypto/api.js.map +0 -1
  149. package/lib/crypto/backup.d.ts +0 -227
  150. package/lib/crypto/backup.d.ts.map +0 -1
  151. package/lib/crypto/backup.js +0 -824
  152. package/lib/crypto/backup.js.map +0 -1
  153. package/lib/crypto/crypto.d.ts +0 -3
  154. package/lib/crypto/crypto.d.ts.map +0 -1
  155. package/lib/crypto/crypto.js +0 -19
  156. package/lib/crypto/crypto.js.map +0 -1
  157. package/lib/crypto/dehydration.d.ts +0 -34
  158. package/lib/crypto/dehydration.d.ts.map +0 -1
  159. package/lib/crypto/dehydration.js +0 -252
  160. package/lib/crypto/dehydration.js.map +0 -1
  161. package/lib/crypto/device-converter.d.ts +0 -9
  162. package/lib/crypto/device-converter.d.ts.map +0 -1
  163. package/lib/crypto/device-converter.js +0 -42
  164. package/lib/crypto/device-converter.js.map +0 -1
  165. package/lib/crypto/deviceinfo.d.ts +0 -99
  166. package/lib/crypto/deviceinfo.d.ts.map +0 -1
  167. package/lib/crypto/deviceinfo.js +0 -148
  168. package/lib/crypto/deviceinfo.js.map +0 -1
  169. package/lib/crypto/index.d.ts +0 -1209
  170. package/lib/crypto/index.d.ts.map +0 -1
  171. package/lib/crypto/index.js +0 -4097
  172. package/lib/crypto/index.js.map +0 -1
  173. package/lib/crypto/key_passphrase.d.ts +0 -14
  174. package/lib/crypto/key_passphrase.d.ts.map +0 -1
  175. package/lib/crypto/key_passphrase.js +0 -44
  176. package/lib/crypto/key_passphrase.js.map +0 -1
  177. package/lib/crypto/keybackup.d.ts +0 -18
  178. package/lib/crypto/keybackup.d.ts.map +0 -1
  179. package/lib/crypto/keybackup.js +0 -1
  180. package/lib/crypto/keybackup.js.map +0 -1
  181. package/lib/crypto/olmlib.d.ts +0 -129
  182. package/lib/crypto/olmlib.d.ts.map +0 -1
  183. package/lib/crypto/olmlib.js +0 -492
  184. package/lib/crypto/olmlib.js.map +0 -1
  185. package/lib/crypto/recoverykey.d.ts +0 -2
  186. package/lib/crypto/recoverykey.d.ts.map +0 -1
  187. package/lib/crypto/recoverykey.js +0 -19
  188. package/lib/crypto/recoverykey.js.map +0 -1
  189. package/lib/crypto/store/base.d.ts +0 -252
  190. package/lib/crypto/store/base.d.ts.map +0 -1
  191. package/lib/crypto/store/base.js +0 -64
  192. package/lib/crypto/store/base.js.map +0 -1
  193. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
  194. package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
  195. package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
  196. package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
  197. package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
  198. package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
  199. package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
  200. package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
  201. package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
  202. package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
  203. package/lib/crypto/store/localStorage-crypto-store.js +0 -531
  204. package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
  205. package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
  206. package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
  207. package/lib/crypto/store/memory-crypto-store.js +0 -622
  208. package/lib/crypto/store/memory-crypto-store.js.map +0 -1
  209. package/lib/crypto/verification/Base.d.ts +0 -105
  210. package/lib/crypto/verification/Base.d.ts.map +0 -1
  211. package/lib/crypto/verification/Base.js +0 -372
  212. package/lib/crypto/verification/Base.js.map +0 -1
  213. package/lib/crypto/verification/Error.d.ts +0 -35
  214. package/lib/crypto/verification/Error.d.ts.map +0 -1
  215. package/lib/crypto/verification/Error.js +0 -86
  216. package/lib/crypto/verification/Error.js.map +0 -1
  217. package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
  218. package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
  219. package/lib/crypto/verification/IllegalMethod.js +0 -43
  220. package/lib/crypto/verification/IllegalMethod.js.map +0 -1
  221. package/lib/crypto/verification/QRCode.d.ts +0 -51
  222. package/lib/crypto/verification/QRCode.d.ts.map +0 -1
  223. package/lib/crypto/verification/QRCode.js +0 -277
  224. package/lib/crypto/verification/QRCode.js.map +0 -1
  225. package/lib/crypto/verification/SAS.d.ts +0 -27
  226. package/lib/crypto/verification/SAS.d.ts.map +0 -1
  227. package/lib/crypto/verification/SAS.js +0 -485
  228. package/lib/crypto/verification/SAS.js.map +0 -1
  229. package/lib/crypto/verification/SASDecimal.d.ts +0 -8
  230. package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
  231. package/lib/crypto/verification/SASDecimal.js +0 -34
  232. package/lib/crypto/verification/SASDecimal.js.map +0 -1
  233. package/lib/crypto/verification/request/Channel.d.ts +0 -18
  234. package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
  235. package/lib/crypto/verification/request/Channel.js +0 -1
  236. package/lib/crypto/verification/request/Channel.js.map +0 -1
  237. package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
  238. package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
  239. package/lib/crypto/verification/request/InRoomChannel.js +0 -351
  240. package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
  241. package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
  242. package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
  243. package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
  244. package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
  245. package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
  246. package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
  247. package/lib/crypto/verification/request/VerificationRequest.js +0 -937
  248. package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
  249. package/lib/crypto-api/CryptoEvent.d.ts +0 -69
  250. package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
  251. package/lib/crypto-api/CryptoEvent.js +0 -33
  252. package/lib/crypto-api/CryptoEvent.js.map +0 -1
  253. package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
  254. package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
  255. package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
  256. package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
  257. package/lib/crypto-api/index.d.ts +0 -978
  258. package/lib/crypto-api/index.d.ts.map +0 -1
  259. package/lib/crypto-api/index.js +0 -304
  260. package/lib/crypto-api/index.js.map +0 -1
  261. package/lib/crypto-api/key-passphrase.d.ts +0 -11
  262. package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
  263. package/lib/crypto-api/key-passphrase.js +0 -51
  264. package/lib/crypto-api/key-passphrase.js.map +0 -1
  265. package/lib/crypto-api/keybackup.d.ts +0 -88
  266. package/lib/crypto-api/keybackup.d.ts.map +0 -1
  267. package/lib/crypto-api/keybackup.js +0 -1
  268. package/lib/crypto-api/keybackup.js.map +0 -1
  269. package/lib/crypto-api/recovery-key.d.ts +0 -11
  270. package/lib/crypto-api/recovery-key.d.ts.map +0 -1
  271. package/lib/crypto-api/recovery-key.js +0 -65
  272. package/lib/crypto-api/recovery-key.js.map +0 -1
  273. package/lib/crypto-api/verification.d.ts +0 -344
  274. package/lib/crypto-api/verification.d.ts.map +0 -1
  275. package/lib/crypto-api/verification.js +0 -91
  276. package/lib/crypto-api/verification.js.map +0 -1
  277. package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
  278. package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
  279. package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
  280. package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
  281. package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
  282. package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
  283. package/lib/rendezvous/RendezvousChannel.js +0 -1
  284. package/lib/rendezvous/RendezvousChannel.js.map +0 -1
  285. package/lib/rendezvous/RendezvousCode.d.ts +0 -9
  286. package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
  287. package/lib/rendezvous/RendezvousCode.js +0 -1
  288. package/lib/rendezvous/RendezvousCode.js.map +0 -1
  289. package/lib/rendezvous/RendezvousError.d.ts +0 -6
  290. package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
  291. package/lib/rendezvous/RendezvousError.js +0 -23
  292. package/lib/rendezvous/RendezvousError.js.map +0 -1
  293. package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
  294. package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
  295. package/lib/rendezvous/RendezvousFailureReason.js +0 -38
  296. package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
  297. package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
  298. package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
  299. package/lib/rendezvous/RendezvousIntent.js +0 -22
  300. package/lib/rendezvous/RendezvousIntent.js.map +0 -1
  301. package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
  302. package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
  303. package/lib/rendezvous/RendezvousTransport.js +0 -1
  304. package/lib/rendezvous/RendezvousTransport.js.map +0 -1
  305. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
  306. package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
  307. package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
  308. package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
  309. package/lib/rendezvous/channels/index.d.ts +0 -2
  310. package/lib/rendezvous/channels/index.d.ts.map +0 -1
  311. package/lib/rendezvous/channels/index.js +0 -18
  312. package/lib/rendezvous/channels/index.js.map +0 -1
  313. package/lib/rendezvous/index.d.ts +0 -10
  314. package/lib/rendezvous/index.d.ts.map +0 -1
  315. package/lib/rendezvous/index.js +0 -23
  316. package/lib/rendezvous/index.js.map +0 -1
  317. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
  318. package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
  319. package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
  320. package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
  321. package/lib/rendezvous/transports/index.d.ts +0 -2
  322. package/lib/rendezvous/transports/index.d.ts.map +0 -1
  323. package/lib/rendezvous/transports/index.js +0 -18
  324. package/lib/rendezvous/transports/index.js.map +0 -1
  325. package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
  326. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
  327. package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
  328. package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
  329. package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
  330. package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
  331. package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
  332. package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
  333. package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
  334. package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
  335. package/lib/rust-crypto/KeyClaimManager.js +0 -82
  336. package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
  337. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
  338. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
  339. package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
  340. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
  341. package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
  342. package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
  343. package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
  344. package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
  345. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
  346. package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
  347. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
  348. package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
  349. package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
  350. package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
  351. package/lib/rust-crypto/RoomEncryptor.js +0 -299
  352. package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
  353. package/lib/rust-crypto/backup.d.ts +0 -254
  354. package/lib/rust-crypto/backup.d.ts.map +0 -1
  355. package/lib/rust-crypto/backup.js +0 -837
  356. package/lib/rust-crypto/backup.js.map +0 -1
  357. package/lib/rust-crypto/constants.d.ts +0 -3
  358. package/lib/rust-crypto/constants.d.ts.map +0 -1
  359. package/lib/rust-crypto/constants.js +0 -19
  360. package/lib/rust-crypto/constants.js.map +0 -1
  361. package/lib/rust-crypto/device-converter.d.ts +0 -28
  362. package/lib/rust-crypto/device-converter.d.ts.map +0 -1
  363. package/lib/rust-crypto/device-converter.js +0 -123
  364. package/lib/rust-crypto/device-converter.js.map +0 -1
  365. package/lib/rust-crypto/index.d.ts +0 -61
  366. package/lib/rust-crypto/index.d.ts.map +0 -1
  367. package/lib/rust-crypto/index.js +0 -152
  368. package/lib/rust-crypto/index.js.map +0 -1
  369. package/lib/rust-crypto/libolm_migration.d.ts +0 -81
  370. package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
  371. package/lib/rust-crypto/libolm_migration.js +0 -459
  372. package/lib/rust-crypto/libolm_migration.js.map +0 -1
  373. package/lib/rust-crypto/rust-crypto.d.ts +0 -556
  374. package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
  375. package/lib/rust-crypto/rust-crypto.js +0 -2016
  376. package/lib/rust-crypto/rust-crypto.js.map +0 -1
  377. package/lib/rust-crypto/secret-storage.d.ts +0 -22
  378. package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
  379. package/lib/rust-crypto/secret-storage.js +0 -63
  380. package/lib/rust-crypto/secret-storage.js.map +0 -1
  381. package/lib/rust-crypto/verification.d.ts +0 -319
  382. package/lib/rust-crypto/verification.d.ts.map +0 -1
  383. package/lib/rust-crypto/verification.js +0 -816
  384. package/lib/rust-crypto/verification.js.map +0 -1
  385. package/lib/secret-storage.d.ts +0 -370
  386. package/lib/secret-storage.d.ts.map +0 -1
  387. package/lib/secret-storage.js +0 -466
  388. package/lib/secret-storage.js.map +0 -1
  389. package/src/@types/crypto.ts +0 -73
  390. package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
  391. package/src/common-crypto/CryptoBackend.ts +0 -302
  392. package/src/common-crypto/README.md +0 -4
  393. package/src/common-crypto/key-passphrase.ts +0 -43
  394. package/src/crypto/CrossSigning.ts +0 -773
  395. package/src/crypto/DeviceList.ts +0 -989
  396. package/src/crypto/EncryptionSetup.ts +0 -351
  397. package/src/crypto/OlmDevice.ts +0 -1500
  398. package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
  399. package/src/crypto/RoomList.ts +0 -70
  400. package/src/crypto/SecretSharing.ts +0 -240
  401. package/src/crypto/SecretStorage.ts +0 -136
  402. package/src/crypto/aes.ts +0 -23
  403. package/src/crypto/algorithms/base.ts +0 -236
  404. package/src/crypto/algorithms/index.ts +0 -20
  405. package/src/crypto/algorithms/megolm.ts +0 -2216
  406. package/src/crypto/algorithms/olm.ts +0 -381
  407. package/src/crypto/api.ts +0 -70
  408. package/src/crypto/backup.ts +0 -922
  409. package/src/crypto/crypto.ts +0 -18
  410. package/src/crypto/dehydration.ts +0 -272
  411. package/src/crypto/device-converter.ts +0 -45
  412. package/src/crypto/deviceinfo.ts +0 -158
  413. package/src/crypto/index.ts +0 -4414
  414. package/src/crypto/key_passphrase.ts +0 -42
  415. package/src/crypto/keybackup.ts +0 -47
  416. package/src/crypto/olmlib.ts +0 -539
  417. package/src/crypto/recoverykey.ts +0 -18
  418. package/src/crypto/store/base.ts +0 -348
  419. package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
  420. package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
  421. package/src/crypto/store/localStorage-crypto-store.ts +0 -579
  422. package/src/crypto/store/memory-crypto-store.ts +0 -680
  423. package/src/crypto/verification/Base.ts +0 -409
  424. package/src/crypto/verification/Error.ts +0 -76
  425. package/src/crypto/verification/IllegalMethod.ts +0 -50
  426. package/src/crypto/verification/QRCode.ts +0 -310
  427. package/src/crypto/verification/SAS.ts +0 -494
  428. package/src/crypto/verification/SASDecimal.ts +0 -37
  429. package/src/crypto/verification/request/Channel.ts +0 -34
  430. package/src/crypto/verification/request/InRoomChannel.ts +0 -371
  431. package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
  432. package/src/crypto/verification/request/VerificationRequest.ts +0 -976
  433. package/src/crypto-api/CryptoEvent.ts +0 -93
  434. package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
  435. package/src/crypto-api/index.ts +0 -1175
  436. package/src/crypto-api/key-passphrase.ts +0 -58
  437. package/src/crypto-api/keybackup.ts +0 -115
  438. package/src/crypto-api/recovery-key.ts +0 -69
  439. package/src/crypto-api/verification.ts +0 -408
  440. package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
  441. package/src/rendezvous/RendezvousChannel.ts +0 -48
  442. package/src/rendezvous/RendezvousCode.ts +0 -25
  443. package/src/rendezvous/RendezvousError.ts +0 -26
  444. package/src/rendezvous/RendezvousFailureReason.ts +0 -49
  445. package/src/rendezvous/RendezvousIntent.ts +0 -20
  446. package/src/rendezvous/RendezvousTransport.ts +0 -58
  447. package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
  448. package/src/rendezvous/channels/index.ts +0 -17
  449. package/src/rendezvous/index.ts +0 -25
  450. package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
  451. package/src/rendezvous/transports/index.ts +0 -17
  452. package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
  453. package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
  454. package/src/rust-crypto/KeyClaimManager.ts +0 -86
  455. package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
  456. package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
  457. package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
  458. package/src/rust-crypto/RoomEncryptor.ts +0 -352
  459. package/src/rust-crypto/backup.ts +0 -881
  460. package/src/rust-crypto/constants.ts +0 -18
  461. package/src/rust-crypto/device-converter.ts +0 -128
  462. package/src/rust-crypto/index.ts +0 -237
  463. package/src/rust-crypto/libolm_migration.ts +0 -530
  464. package/src/rust-crypto/rust-crypto.ts +0 -2205
  465. package/src/rust-crypto/secret-storage.ts +0 -60
  466. package/src/rust-crypto/verification.ts +0 -830
  467. package/src/secret-storage.ts +0 -693
@@ -1 +0,0 @@
1
- {"version":3,"file":"CrossSigning.js","names":["pkSign","pkVerify","logger","IndexedDBCryptoStore","DeviceVerificationStatus","UserVerificationStatus","UserTrustLevel","decodeBase64","encodeBase64","encryptAESSecretStorageItem","decryptAESSecretStorageItem","KEY_REQUEST_TIMEOUT_MS","publicKeyFromKeyInfo","keyInfo","Object","values","keys","CrossSigningInfo","constructor","userId","callbacks","arguments","length","undefined","cacheCallbacks","_defineProperty","fromStorage","obj","res","prop","hasOwnProperty","toStorage","firstUse","crossSigningVerifiedBefore","getCrossSigningKey","type","expectedPubkey","_this","_asyncToGenerator","shouldCache","indexOf","Error","getId","validateKey","key","signing","globalThis","Olm","PkSigning","gotPubkey","init_with_seed","free","privkey","getCrossSigningKeyCache","cacheresult","result","storeCrossSigningKeyCache","isStoredInSecretStorage","secretStorage","stored","isStored","intersect","s","k","concat","storeInSecretStorage","privateKey","encodedKey","store","getFromSecretStorage","get","isStoredInKeyCache","_this2","types","t","_cacheCallbacks$getCr","call","getCrossSigningKeysFromCache","_this3","Map","_cacheCallbacks$getCr2","privKey","set","resetKeys","level","_this4","saveCrossSigningKeys","CrossSigningLevel","MASTER","master","USER_SIGNING","SELF_SIGNING","privateKeys","masterSigning","masterPub","generate_seed","user_id","usage","sskSigning","self_signing","sskPub","uskSigning","user_signing","uskPub","assign","clearKeys","setKeys","signingKeys","error","masterKey","e","updateCrossSigningVerifiedBefore","isCrossSigningVerified","signObject","data","_this5","pubkey","signUser","_this6","info","signDevice","device","_this7","algorithms","device_id","deviceId","checkUserTrust","userCrossSigning","userTrusted","userMaster","uskId","_unused","checkDeviceTrust","localTrust","trustCrossSignedDevices","userTrust","userSSK","DeviceTrustLevel","deviceObj","deviceToObject","fromUserTrustLevel","_unused2","getCacheCallbacks","signatures","crossSigningVerified","tofu","localVerified","signedByOwner","userTrustLevel","isTofu","isLocallyVerified","createCryptoStoreCacheCallbacks","olmDevice","_getCrossSigningKeyCache","_expectedPublicKey","Promise","resolve","doTxn","STORE_ACCOUNT","txn","getSecretStorePrivateKey","ciphertext","pickleKey","Buffer","from","decrypted","_x","_x2","apply","_storeCrossSigningKeyCache","Uint8Array","encryptedKey","storeSecretStorePrivateKey","_x3","_x4","requestKeysDuringVerification","_x5","_x6","_x7","_requestKeysDuringVerification","baseApis","getUserId","log","reject","client","original","crypto","crossSigningInfo","crossSigning","_getCrossSigningKey","debug","promise","requestSecret","decoded","_x8","timeout","setTimeout","backupKeyPromise","cachedKey","getSessionBackupPrivateKey","secretReq","base64Key","decodedKey","storeSessionBackupPrivateKey","backupInfo","getKeyBackupVersion","restoreKeyBackupWithCache","then","race","all","catch","warn"],"sources":["../../src/crypto/CrossSigning.ts"],"sourcesContent":["/*\nCopyright 2019 - 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\n/**\n * Cross signing methods\n */\n\nimport type { PkSigning } from \"@matrix-org/olm\";\nimport { IObject, pkSign, pkVerify } from \"./olmlib.ts\";\nimport { logger } from \"../logger.ts\";\nimport { IndexedDBCryptoStore } from \"../crypto/store/indexeddb-crypto-store.ts\";\nimport { DeviceInfo } from \"./deviceinfo.ts\";\nimport { ISignedKey, MatrixClient } from \"../client.ts\";\nimport { OlmDevice } from \"./OlmDevice.ts\";\nimport { ICryptoCallbacks } from \"./index.ts\";\nimport { ISignatures } from \"../@types/signed.ts\";\nimport { CryptoStore, SecretStorePrivateKeys } from \"./store/base.ts\";\nimport { ServerSideSecretStorage, SecretStorageKeyDescription } from \"../secret-storage.ts\";\nimport {\n CrossSigningKeyInfo,\n DeviceVerificationStatus,\n UserVerificationStatus as UserTrustLevel,\n} from \"../crypto-api/index.ts\";\nimport { decodeBase64, encodeBase64 } from \"../base64.ts\";\nimport encryptAESSecretStorageItem from \"../utils/encryptAESSecretStorageItem.ts\";\nimport decryptAESSecretStorageItem from \"../utils/decryptAESSecretStorageItem.ts\";\n\n// backwards-compatibility re-exports\nexport { UserTrustLevel };\n\nconst KEY_REQUEST_TIMEOUT_MS = 1000 * 60;\n\nfunction publicKeyFromKeyInfo(keyInfo: CrossSigningKeyInfo): string {\n // `keys` is an object with { [`ed25519:${pubKey}`]: pubKey }\n // We assume only a single key, and we want the bare form without type\n // prefix, so we select the values.\n return Object.values(keyInfo.keys)[0];\n}\n\nexport interface ICacheCallbacks {\n getCrossSigningKeyCache?(type: string, expectedPublicKey?: string): Promise<Uint8Array | null>;\n storeCrossSigningKeyCache?(type: string, key?: Uint8Array): Promise<void>;\n}\n\nexport interface ICrossSigningInfo {\n keys: Record<string, CrossSigningKeyInfo>;\n firstUse: boolean;\n crossSigningVerifiedBefore: boolean;\n}\n\nexport class CrossSigningInfo {\n public keys: Record<string, CrossSigningKeyInfo> = {};\n public firstUse = true;\n // This tracks whether we've ever verified this user with any identity.\n // When you verify a user, any devices online at the time that receive\n // the verifying signature via the homeserver will latch this to true\n // and can use it in the future to detect cases where the user has\n // become unverified later for any reason.\n private crossSigningVerifiedBefore = false;\n\n /**\n * Information about a user's cross-signing keys\n *\n * @param userId - the user that the information is about\n * @param callbacks - Callbacks used to interact with the app\n * Requires getCrossSigningKey and saveCrossSigningKeys\n * @param cacheCallbacks - Callbacks used to interact with the cache\n */\n public constructor(\n public readonly userId: string,\n private callbacks: ICryptoCallbacks = {},\n private cacheCallbacks: ICacheCallbacks = {},\n ) {}\n\n public static fromStorage(obj: ICrossSigningInfo, userId: string): CrossSigningInfo {\n const res = new CrossSigningInfo(userId);\n for (const prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n // @ts-ignore - ts doesn't like this and nor should we\n res[prop] = obj[prop];\n }\n }\n return res;\n }\n\n public toStorage(): ICrossSigningInfo {\n return {\n keys: this.keys,\n firstUse: this.firstUse,\n crossSigningVerifiedBefore: this.crossSigningVerifiedBefore,\n };\n }\n\n /**\n * Calls the app callback to ask for a private key\n *\n * @param type - The key type (\"master\", \"self_signing\", or \"user_signing\")\n * @param expectedPubkey - The matching public key or undefined to use\n * the stored public key for the given key type.\n * @returns An array with [ public key, Olm.PkSigning ]\n */\n public async getCrossSigningKey(type: string, expectedPubkey?: string): Promise<[string, PkSigning]> {\n const shouldCache = [\"master\", \"self_signing\", \"user_signing\"].indexOf(type) >= 0;\n\n if (!this.callbacks.getCrossSigningKey) {\n throw new Error(\"No getCrossSigningKey callback supplied\");\n }\n\n if (expectedPubkey === undefined) {\n expectedPubkey = this.getId(type)!;\n }\n\n function validateKey(key: Uint8Array | null): [string, PkSigning] | undefined {\n if (!key) return;\n const signing = new globalThis.Olm.PkSigning();\n const gotPubkey = signing.init_with_seed(key);\n if (gotPubkey === expectedPubkey) {\n return [gotPubkey, signing];\n }\n signing.free();\n }\n\n let privkey: Uint8Array | null = null;\n if (this.cacheCallbacks.getCrossSigningKeyCache && shouldCache) {\n privkey = await this.cacheCallbacks.getCrossSigningKeyCache(type, expectedPubkey);\n }\n\n const cacheresult = validateKey(privkey);\n if (cacheresult) {\n return cacheresult;\n }\n\n privkey = await this.callbacks.getCrossSigningKey(type, expectedPubkey);\n const result = validateKey(privkey);\n if (result) {\n if (this.cacheCallbacks.storeCrossSigningKeyCache && shouldCache) {\n await this.cacheCallbacks.storeCrossSigningKeyCache(type, privkey!);\n }\n return result;\n }\n\n /* No keysource even returned a key */\n if (!privkey) {\n throw new Error(\"getCrossSigningKey callback for \" + type + \" returned falsey\");\n }\n\n /* We got some keys from the keysource, but none of them were valid */\n throw new Error(\"Key type \" + type + \" from getCrossSigningKey callback did not match\");\n }\n\n /**\n * Check whether the private keys exist in secret storage.\n * XXX: This could be static, be we often seem to have an instance when we\n * want to know this anyway...\n *\n * @param secretStorage - The secret store using account data\n * @returns map of key name to key info the secret is encrypted\n * with, or null if it is not present or not encrypted with a trusted\n * key\n */\n public async isStoredInSecretStorage(\n secretStorage: ServerSideSecretStorage,\n ): Promise<Record<string, object> | null> {\n // check what SSSS keys have encrypted the master key (if any)\n const stored = (await secretStorage.isStored(\"m.cross_signing.master\")) || {};\n // then check which of those SSSS keys have also encrypted the SSK and USK\n function intersect(s: Record<string, SecretStorageKeyDescription>): void {\n for (const k of Object.keys(stored)) {\n if (!s[k]) {\n delete stored[k];\n }\n }\n }\n for (const type of [\"self_signing\", \"user_signing\"]) {\n intersect((await secretStorage.isStored(`m.cross_signing.${type}`)) || {});\n }\n return Object.keys(stored).length ? stored : null;\n }\n\n /**\n * Store private keys in secret storage for use by other devices. This is\n * typically called in conjunction with the creation of new cross-signing\n * keys.\n *\n * @param keys - The keys to store\n * @param secretStorage - The secret store using account data\n */\n public static async storeInSecretStorage(\n keys: Map<string, Uint8Array>,\n secretStorage: ServerSideSecretStorage,\n ): Promise<void> {\n for (const [type, privateKey] of keys) {\n const encodedKey = encodeBase64(privateKey);\n await secretStorage.store(`m.cross_signing.${type}`, encodedKey);\n }\n }\n\n /**\n * Get private keys from secret storage created by some other device. This\n * also passes the private keys to the app-specific callback.\n *\n * @param type - The type of key to get. One of \"master\",\n * \"self_signing\", or \"user_signing\".\n * @param secretStorage - The secret store using account data\n * @returns The private key\n */\n public static async getFromSecretStorage(\n type: string,\n secretStorage: ServerSideSecretStorage,\n ): Promise<Uint8Array | null> {\n const encodedKey = await secretStorage.get(`m.cross_signing.${type}`);\n if (!encodedKey) {\n return null;\n }\n return decodeBase64(encodedKey);\n }\n\n /**\n * Check whether the private keys exist in the local key cache.\n *\n * @param type - The type of key to get. One of \"master\",\n * \"self_signing\", or \"user_signing\". Optional, will check all by default.\n * @returns True if all keys are stored in the local cache.\n */\n public async isStoredInKeyCache(type?: string): Promise<boolean> {\n const cacheCallbacks = this.cacheCallbacks;\n if (!cacheCallbacks) return false;\n const types = type ? [type] : [\"master\", \"self_signing\", \"user_signing\"];\n for (const t of types) {\n if (!(await cacheCallbacks.getCrossSigningKeyCache?.(t))) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Get cross-signing private keys from the local cache.\n *\n * @returns A map from key type (string) to private key (Uint8Array)\n */\n public async getCrossSigningKeysFromCache(): Promise<Map<string, Uint8Array>> {\n const keys = new Map<string, Uint8Array>();\n const cacheCallbacks = this.cacheCallbacks;\n if (!cacheCallbacks) return keys;\n for (const type of [\"master\", \"self_signing\", \"user_signing\"]) {\n const privKey = await cacheCallbacks.getCrossSigningKeyCache?.(type);\n if (!privKey) {\n continue;\n }\n keys.set(type, privKey);\n }\n return keys;\n }\n\n /**\n * Get the ID used to identify the user. This can also be used to test for\n * the existence of a given key type.\n *\n * @param type - The type of key to get the ID of. One of \"master\",\n * \"self_signing\", or \"user_signing\". Defaults to \"master\".\n *\n * @returns the ID\n */\n public getId(type = \"master\"): string | null {\n if (!this.keys[type]) return null;\n const keyInfo = this.keys[type];\n return publicKeyFromKeyInfo(keyInfo);\n }\n\n /**\n * Create new cross-signing keys for the given key types. The public keys\n * will be held in this class, while the private keys are passed off to the\n * `saveCrossSigningKeys` application callback.\n *\n * @param level - The key types to reset\n */\n public async resetKeys(level?: CrossSigningLevel): Promise<void> {\n if (!this.callbacks.saveCrossSigningKeys) {\n throw new Error(\"No saveCrossSigningKeys callback supplied\");\n }\n\n // If we're resetting the master key, we reset all keys\n if (level === undefined || level & CrossSigningLevel.MASTER || !this.keys.master) {\n level = CrossSigningLevel.MASTER | CrossSigningLevel.USER_SIGNING | CrossSigningLevel.SELF_SIGNING;\n } else if (level === (0 as CrossSigningLevel)) {\n return;\n }\n\n const privateKeys: Record<string, Uint8Array> = {};\n const keys: Record<string, CrossSigningKeyInfo> = {};\n let masterSigning: PkSigning | undefined;\n let masterPub: string | undefined;\n\n try {\n if (level & CrossSigningLevel.MASTER) {\n masterSigning = new globalThis.Olm.PkSigning();\n privateKeys.master = masterSigning.generate_seed();\n masterPub = masterSigning.init_with_seed(privateKeys.master);\n keys.master = {\n user_id: this.userId,\n usage: [\"master\"],\n keys: {\n [\"ed25519:\" + masterPub]: masterPub,\n },\n };\n } else {\n [masterPub, masterSigning] = await this.getCrossSigningKey(\"master\");\n }\n\n if (level & CrossSigningLevel.SELF_SIGNING) {\n const sskSigning = new globalThis.Olm.PkSigning();\n try {\n privateKeys.self_signing = sskSigning.generate_seed();\n const sskPub = sskSigning.init_with_seed(privateKeys.self_signing);\n keys.self_signing = {\n user_id: this.userId,\n usage: [\"self_signing\"],\n keys: {\n [\"ed25519:\" + sskPub]: sskPub,\n },\n };\n pkSign(keys.self_signing, masterSigning, this.userId, masterPub);\n } finally {\n sskSigning.free();\n }\n }\n\n if (level & CrossSigningLevel.USER_SIGNING) {\n const uskSigning = new globalThis.Olm.PkSigning();\n try {\n privateKeys.user_signing = uskSigning.generate_seed();\n const uskPub = uskSigning.init_with_seed(privateKeys.user_signing);\n keys.user_signing = {\n user_id: this.userId,\n usage: [\"user_signing\"],\n keys: {\n [\"ed25519:\" + uskPub]: uskPub,\n },\n };\n pkSign(keys.user_signing, masterSigning, this.userId, masterPub);\n } finally {\n uskSigning.free();\n }\n }\n\n Object.assign(this.keys, keys);\n this.callbacks.saveCrossSigningKeys(privateKeys);\n } finally {\n if (masterSigning) {\n masterSigning.free();\n }\n }\n }\n\n /**\n * unsets the keys, used when another session has reset the keys, to disable cross-signing\n */\n public clearKeys(): void {\n this.keys = {};\n }\n\n public setKeys(keys: Record<string, CrossSigningKeyInfo>): void {\n const signingKeys: Record<string, CrossSigningKeyInfo> = {};\n if (keys.master) {\n if (keys.master.user_id !== this.userId) {\n const error = \"Mismatched user ID \" + keys.master.user_id + \" in master key from \" + this.userId;\n logger.error(error);\n throw new Error(error);\n }\n if (!this.keys.master) {\n // this is the first key we've seen, so first-use is true\n this.firstUse = true;\n } else if (publicKeyFromKeyInfo(keys.master) !== this.getId()) {\n // this is a different key, so first-use is false\n this.firstUse = false;\n } // otherwise, same key, so no change\n signingKeys.master = keys.master;\n } else if (this.keys.master) {\n signingKeys.master = this.keys.master;\n } else {\n throw new Error(\"Tried to set cross-signing keys without a master key\");\n }\n const masterKey = publicKeyFromKeyInfo(signingKeys.master);\n\n // verify signatures\n if (keys.user_signing) {\n if (keys.user_signing.user_id !== this.userId) {\n const error = \"Mismatched user ID \" + keys.master.user_id + \" in user_signing key from \" + this.userId;\n logger.error(error);\n throw new Error(error);\n }\n try {\n pkVerify(keys.user_signing, masterKey, this.userId);\n } catch (e) {\n logger.error(\"invalid signature on user-signing key\");\n // FIXME: what do we want to do here?\n throw e;\n }\n }\n if (keys.self_signing) {\n if (keys.self_signing.user_id !== this.userId) {\n const error = \"Mismatched user ID \" + keys.master.user_id + \" in self_signing key from \" + this.userId;\n logger.error(error);\n throw new Error(error);\n }\n try {\n pkVerify(keys.self_signing, masterKey, this.userId);\n } catch (e) {\n logger.error(\"invalid signature on self-signing key\");\n // FIXME: what do we want to do here?\n throw e;\n }\n }\n\n // if everything checks out, then save the keys\n if (keys.master) {\n this.keys.master = keys.master;\n // if the master key is set, then the old self-signing and user-signing keys are obsolete\n delete this.keys[\"self_signing\"];\n delete this.keys[\"user_signing\"];\n }\n if (keys.self_signing) {\n this.keys.self_signing = keys.self_signing;\n }\n if (keys.user_signing) {\n this.keys.user_signing = keys.user_signing;\n }\n }\n\n public updateCrossSigningVerifiedBefore(isCrossSigningVerified: boolean): void {\n // It is critical that this value latches forward from false to true but\n // never back to false to avoid a downgrade attack.\n if (!this.crossSigningVerifiedBefore && isCrossSigningVerified) {\n this.crossSigningVerifiedBefore = true;\n }\n }\n\n public async signObject<T extends object>(data: T, type: string): Promise<T & { signatures: ISignatures }> {\n if (!this.keys[type]) {\n throw new Error(\"Attempted to sign with \" + type + \" key but no such key present\");\n }\n const [pubkey, signing] = await this.getCrossSigningKey(type);\n try {\n pkSign(data, signing, this.userId, pubkey);\n return data as T & { signatures: ISignatures };\n } finally {\n signing.free();\n }\n }\n\n public async signUser(key: CrossSigningInfo): Promise<CrossSigningKeyInfo | undefined> {\n if (!this.keys.user_signing) {\n logger.info(\"No user signing key: not signing user\");\n return;\n }\n return this.signObject(key.keys.master, \"user_signing\");\n }\n\n public async signDevice(userId: string, device: DeviceInfo): Promise<ISignedKey | undefined> {\n if (userId !== this.userId) {\n throw new Error(`Trying to sign ${userId}'s device; can only sign our own device`);\n }\n if (!this.keys.self_signing) {\n logger.info(\"No self signing key: not signing device\");\n return;\n }\n return this.signObject<Omit<ISignedKey, \"signatures\">>(\n {\n algorithms: device.algorithms,\n keys: device.keys,\n device_id: device.deviceId,\n user_id: userId,\n },\n \"self_signing\",\n );\n }\n\n /**\n * Check whether a given user is trusted.\n *\n * @param userCrossSigning - Cross signing info for user\n *\n * @returns\n */\n public checkUserTrust(userCrossSigning: CrossSigningInfo): UserTrustLevel {\n // if we're checking our own key, then it's trusted if the master key\n // and self-signing key match\n if (\n this.userId === userCrossSigning.userId &&\n this.getId() &&\n this.getId() === userCrossSigning.getId() &&\n this.getId(\"self_signing\") &&\n this.getId(\"self_signing\") === userCrossSigning.getId(\"self_signing\")\n ) {\n return new UserTrustLevel(true, true, this.firstUse);\n }\n\n if (!this.keys.user_signing) {\n // If there's no user signing key, they can't possibly be verified.\n // They may be TOFU trusted though.\n return new UserTrustLevel(false, false, userCrossSigning.firstUse);\n }\n\n let userTrusted: boolean;\n const userMaster = userCrossSigning.keys.master;\n const uskId = this.getId(\"user_signing\")!;\n try {\n pkVerify(userMaster, uskId, this.userId);\n userTrusted = true;\n } catch {\n userTrusted = false;\n }\n return new UserTrustLevel(userTrusted, userCrossSigning.crossSigningVerifiedBefore, userCrossSigning.firstUse);\n }\n\n /**\n * Check whether a given device is trusted.\n *\n * @param userCrossSigning - Cross signing info for user\n * @param device - The device to check\n * @param localTrust - Whether the device is trusted locally\n * @param trustCrossSignedDevices - Whether we trust cross signed devices\n *\n * @returns\n */\n public checkDeviceTrust(\n userCrossSigning: CrossSigningInfo,\n device: DeviceInfo,\n localTrust: boolean,\n trustCrossSignedDevices: boolean,\n ): DeviceTrustLevel {\n const userTrust = this.checkUserTrust(userCrossSigning);\n\n const userSSK = userCrossSigning.keys.self_signing;\n if (!userSSK) {\n // if the user has no self-signing key then we cannot make any\n // trust assertions about this device from cross-signing\n return new DeviceTrustLevel(false, false, localTrust, trustCrossSignedDevices);\n }\n\n const deviceObj = deviceToObject(device, userCrossSigning.userId);\n try {\n // if we can verify the user's SSK from their master key...\n pkVerify(userSSK, userCrossSigning.getId()!, userCrossSigning.userId);\n // ...and this device's key from their SSK...\n pkVerify(deviceObj, publicKeyFromKeyInfo(userSSK), userCrossSigning.userId);\n // ...then we trust this device as much as far as we trust the user\n return DeviceTrustLevel.fromUserTrustLevel(userTrust, localTrust, trustCrossSignedDevices);\n } catch {\n return new DeviceTrustLevel(false, false, localTrust, trustCrossSignedDevices);\n }\n }\n\n /**\n * @returns Cache callbacks\n */\n public getCacheCallbacks(): ICacheCallbacks {\n return this.cacheCallbacks;\n }\n}\n\ninterface DeviceObject extends IObject {\n algorithms: string[];\n keys: Record<string, string>;\n device_id: string;\n user_id: string;\n}\n\nfunction deviceToObject(device: DeviceInfo, userId: string): DeviceObject {\n return {\n algorithms: device.algorithms,\n keys: device.keys,\n device_id: device.deviceId,\n user_id: userId,\n signatures: device.signatures,\n };\n}\n\nexport enum CrossSigningLevel {\n MASTER = 4,\n USER_SIGNING = 2,\n SELF_SIGNING = 1,\n}\n\n/**\n * Represents the ways in which we trust a device.\n *\n * @deprecated Use {@link DeviceVerificationStatus}.\n */\nexport class DeviceTrustLevel extends DeviceVerificationStatus {\n public constructor(\n crossSigningVerified: boolean,\n tofu: boolean,\n localVerified: boolean,\n trustCrossSignedDevices: boolean,\n signedByOwner = false,\n ) {\n super({ crossSigningVerified, tofu, localVerified, trustCrossSignedDevices, signedByOwner });\n }\n\n public static fromUserTrustLevel(\n userTrustLevel: UserTrustLevel,\n localVerified: boolean,\n trustCrossSignedDevices: boolean,\n ): DeviceTrustLevel {\n return new DeviceTrustLevel(\n userTrustLevel.isCrossSigningVerified(),\n userTrustLevel.isTofu(),\n localVerified,\n trustCrossSignedDevices,\n true,\n );\n }\n\n /**\n * @returns true if this device is verified via cross signing\n */\n public isCrossSigningVerified(): boolean {\n return this.crossSigningVerified;\n }\n\n /**\n * @returns true if this device is verified locally\n */\n public isLocallyVerified(): boolean {\n return this.localVerified;\n }\n\n /**\n * @returns true if this device is trusted from a user's key\n * that is trusted on first use\n */\n public isTofu(): boolean {\n return this.tofu;\n }\n}\n\nexport function createCryptoStoreCacheCallbacks(store: CryptoStore, olmDevice: OlmDevice): ICacheCallbacks {\n return {\n getCrossSigningKeyCache: async function (\n type: keyof SecretStorePrivateKeys,\n _expectedPublicKey: string,\n ): Promise<Uint8Array> {\n const key = await new Promise<any>((resolve) => {\n store.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n store.getSecretStorePrivateKey(txn, resolve, type);\n });\n });\n\n if (key && key.ciphertext) {\n const pickleKey = Buffer.from(olmDevice.pickleKey);\n const decrypted = await decryptAESSecretStorageItem(key, pickleKey, type);\n return decodeBase64(decrypted);\n } else {\n return key;\n }\n },\n storeCrossSigningKeyCache: async function (\n type: keyof SecretStorePrivateKeys,\n key?: Uint8Array,\n ): Promise<void> {\n if (!(key instanceof Uint8Array)) {\n throw new Error(`storeCrossSigningKeyCache expects Uint8Array, got ${key}`);\n }\n const pickleKey = Buffer.from(olmDevice.pickleKey);\n const encryptedKey = await encryptAESSecretStorageItem(encodeBase64(key), pickleKey, type);\n return store.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n store.storeSecretStorePrivateKey(txn, type, encryptedKey);\n });\n },\n };\n}\n\nexport type KeysDuringVerification = [[string, PkSigning], [string, PkSigning], [string, PkSigning], void];\n\n/**\n * Request cross-signing keys from another device during verification.\n *\n * @param baseApis - base Matrix API interface\n * @param userId - The user ID being verified\n * @param deviceId - The device ID being verified\n */\nexport async function requestKeysDuringVerification(\n baseApis: MatrixClient,\n userId: string,\n deviceId: string,\n): Promise<KeysDuringVerification | void> {\n // If this is a self-verification, ask the other party for keys\n if (baseApis.getUserId() !== userId) {\n return;\n }\n logger.log(\"Cross-signing: Self-verification done; requesting keys\");\n // This happens asynchronously, and we're not concerned about waiting for\n // it. We return here in order to test.\n return new Promise<KeysDuringVerification | void>((resolve, reject) => {\n const client = baseApis;\n const original = client.crypto!.crossSigningInfo;\n\n // We already have all of the infrastructure we need to validate and\n // cache cross-signing keys, so instead of replicating that, here we set\n // up callbacks that request them from the other device and call\n // CrossSigningInfo.getCrossSigningKey() to validate/cache\n const crossSigning = new CrossSigningInfo(\n original.userId,\n {\n getCrossSigningKey: async (type): Promise<Uint8Array> => {\n logger.debug(\"Cross-signing: requesting secret\", type, deviceId);\n const { promise } = client.requestSecret(`m.cross_signing.${type}`, [deviceId]);\n const result = await promise;\n const decoded = decodeBase64(result);\n return Uint8Array.from(decoded);\n },\n },\n original.getCacheCallbacks(),\n );\n crossSigning.keys = original.keys;\n\n // XXX: get all keys out if we get one key out\n // https://github.com/vector-im/element-web/issues/12604\n // then change here to reject on the timeout\n // Requests can be ignored, so don't wait around forever\n const timeout = new Promise<void>((resolve) => {\n setTimeout(resolve, KEY_REQUEST_TIMEOUT_MS, new Error(\"Timeout\"));\n });\n\n // also request and cache the key backup key\n const backupKeyPromise = (async (): Promise<void> => {\n const cachedKey = await client.crypto!.getSessionBackupPrivateKey();\n if (!cachedKey) {\n logger.info(\"No cached backup key found. Requesting...\");\n const secretReq = client.requestSecret(\"m.megolm_backup.v1\", [deviceId]);\n const base64Key = await secretReq.promise;\n logger.info(\"Got key backup key, decoding...\");\n const decodedKey = decodeBase64(base64Key);\n logger.info(\"Decoded backup key, storing...\");\n await client.crypto!.storeSessionBackupPrivateKey(Uint8Array.from(decodedKey));\n logger.info(\"Backup key stored. Starting backup restore...\");\n const backupInfo = await client.getKeyBackupVersion();\n // no need to await for this - just let it go in the bg\n client.restoreKeyBackupWithCache(undefined, undefined, backupInfo!).then(() => {\n logger.info(\"Backup restored.\");\n });\n }\n })();\n\n // We call getCrossSigningKey() for its side-effects\n Promise.race<KeysDuringVerification | void>([\n Promise.all([\n crossSigning.getCrossSigningKey(\"master\"),\n crossSigning.getCrossSigningKey(\"self_signing\"),\n crossSigning.getCrossSigningKey(\"user_signing\"),\n backupKeyPromise,\n ]) as Promise<KeysDuringVerification>,\n timeout,\n ]).then(resolve, reject);\n }).catch((e) => {\n logger.warn(\"Cross-signing: failure while requesting keys:\", e);\n });\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA,SAAkBA,MAAM,EAAEC,QAAQ,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,oBAAoB,QAAQ,2CAA2C;AAQhF,SAEIC,wBAAwB,EACxBC,sBAAsB,IAAIC,cAAc,QACrC,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,YAAY,QAAQ,cAAc;AACzD,OAAOC,2BAA2B,MAAM,yCAAyC;AACjF,OAAOC,2BAA2B,MAAM,yCAAyC;;AAEjF;AACA,SAASJ,cAAc;AAEvB,IAAMK,sBAAsB,GAAG,IAAI,GAAG,EAAE;AAExC,SAASC,oBAAoBA,CAACC,OAA4B,EAAU;EAChE;EACA;EACA;EACA,OAAOC,MAAM,CAACC,MAAM,CAACF,OAAO,CAACG,IAAI,CAAC,CAAC,CAAC,CAAC;AACzC;AAaA,OAAO,MAAMC,gBAAgB,CAAC;EAU1B;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACWC,WAAWA,CACEC,MAAc,EAGhC;IAAA,IAFUC,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AACqH,IAAI,CAAC,+CAA+C,CAAC;UAC5D,IAAMqF,UAAU,SAASpB,MAAM,CAACqB,mBAAmB,CAAC,CAAC;UACrD;UACArB,MAAM,CAACsB,yBAAyB,CAACvL,SAAS,EAAEA,SAAS,EAAEqL,UAAW,CAAC,CAACG,IAAI,CAAC,MAAM;YAC3E7M,MAAM,CAACqH,IAAI,CAAC,kBAAkB,CAAC;UACnC,CAAC,CAAC;QACN;MACJ,CAAC,EAAE,CAAC;;MAEJ;MACAoC,OAAO,CAACqD,IAAI,CAAgC,CACxCrD,OAAO,CAACsD,GAAG,CAAC,CACRrB,YAAY,CAAC1J,kBAAkB,CAAC,QAAQ,CAAC,EACzC0J,YAAY,CAAC1J,kBAAkB,CAAC,cAAc,CAAC,EAC/C0J,YAAY,CAAC1J,kBAAkB,CAAC,cAAc,CAAC,EAC/CmK,gBAAgB,CACnB,CAAC,EACFF,OAAO,CACV,CAAC,CAACY,IAAI,CAACnD,OAAO,EAAE2B,MAAM,CAAC;IAC5B,CAAC,CAAC,CAAC2B,KAAK,CAAEpG,CAAC,IAAK;MACZ5G,MAAM,CAACiN,IAAI,CAAC,+CAA+C,EAAErG,CAAC,CAAC;IACnE,CAAC,CAAC;EACN,CAAC;EAAA,OAAAqE,8BAAA,CAAAX,KAAA,OAAAnJ,SAAA;AAAA","ignoreList":[]}
@@ -1,216 +0,0 @@
1
- import { DeviceInfo, IDevice } from "./deviceinfo.ts";
2
- import { CrossSigningInfo, ICrossSigningInfo } from "./CrossSigning.ts";
3
- import { MatrixClient } from "../client.ts";
4
- import { OlmDevice } from "./OlmDevice.ts";
5
- import { CryptoStore } from "./store/base.ts";
6
- import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
7
- import { CryptoEvent, CryptoEventHandlerMap } from "./index.ts";
8
- export declare enum TrackingStatus {
9
- NotTracked = 0,
10
- PendingDownload = 1,
11
- DownloadInProgress = 2,
12
- UpToDate = 3
13
- }
14
- export type DeviceInfoMap = Map<string, Map<string, DeviceInfo>>;
15
- type EmittedEvents = CryptoEvent.WillUpdateDevices | CryptoEvent.DevicesUpdated | CryptoEvent.UserCrossSigningUpdated;
16
- export declare class DeviceList extends TypedEventEmitter<EmittedEvents, CryptoEventHandlerMap> {
17
- private readonly cryptoStore;
18
- readonly keyDownloadChunkSize: number;
19
- private devices;
20
- crossSigningInfo: {
21
- [userId: string]: ICrossSigningInfo;
22
- };
23
- private userByIdentityKey;
24
- private deviceTrackingStatus;
25
- private syncToken;
26
- private keyDownloadsInProgressByUser;
27
- private dirty;
28
- private savePromise;
29
- private resolveSavePromise;
30
- private savePromiseTime;
31
- private saveTimer;
32
- private hasFetched;
33
- private readonly serialiser;
34
- constructor(baseApis: MatrixClient, cryptoStore: CryptoStore, olmDevice: OlmDevice, keyDownloadChunkSize?: number);
35
- /**
36
- * Load the device tracking state from storage
37
- */
38
- load(): Promise<void>;
39
- stop(): void;
40
- /**
41
- * Save the device tracking state to storage, if any changes are
42
- * pending other than updating the sync token
43
- *
44
- * The actual save will be delayed by a short amount of time to
45
- * aggregate multiple writes to the database.
46
- *
47
- * @param delay - Time in ms before which the save actually happens.
48
- * By default, the save is delayed for a short period in order to batch
49
- * multiple writes, but this behaviour can be disabled by passing 0.
50
- *
51
- * @returns true if the data was saved, false if
52
- * it was not (eg. because no changes were pending). The promise
53
- * will only resolve once the data is saved, so may take some time
54
- * to resolve.
55
- */
56
- saveIfDirty(delay?: number): Promise<boolean>;
57
- /**
58
- * Gets the sync token last set with setSyncToken
59
- *
60
- * @returns The sync token
61
- */
62
- getSyncToken(): string | null;
63
- /**
64
- * Sets the sync token that the app will pass as the 'since' to the /sync
65
- * endpoint next time it syncs.
66
- * The sync token must always be set after any changes made as a result of
67
- * data in that sync since setting the sync token to a newer one will mean
68
- * those changed will not be synced from the server if a new client starts
69
- * up with that data.
70
- *
71
- * @param st - The sync token
72
- */
73
- setSyncToken(st: string | null): void;
74
- /**
75
- * Ensures up to date keys for a list of users are stored in the session store,
76
- * downloading and storing them if they're not (or if forceDownload is
77
- * true).
78
- * @param userIds - The users to fetch.
79
- * @param forceDownload - Always download the keys even if cached.
80
- *
81
- * @returns A promise which resolves to a map userId-\>deviceId-\>{@link DeviceInfo}.
82
- */
83
- downloadKeys(userIds: string[], forceDownload: boolean): Promise<DeviceInfoMap>;
84
- /**
85
- * Get the stored device keys for a list of user ids
86
- *
87
- * @param userIds - the list of users to list keys for.
88
- *
89
- * @returns userId-\>deviceId-\>{@link DeviceInfo}.
90
- */
91
- private getDevicesFromStore;
92
- /**
93
- * Returns a list of all user IDs the DeviceList knows about
94
- *
95
- * @returns All known user IDs
96
- */
97
- getKnownUserIds(): string[];
98
- /**
99
- * Get the stored device keys for a user id
100
- *
101
- * @param userId - the user to list keys for.
102
- *
103
- * @returns list of devices, or null if we haven't
104
- * managed to get a list of devices for this user yet.
105
- */
106
- getStoredDevicesForUser(userId: string): DeviceInfo[] | null;
107
- /**
108
- * Get the stored device data for a user, in raw object form
109
- *
110
- * @param userId - the user to get data for
111
- *
112
- * @returns `deviceId->{object}` devices, or undefined if
113
- * there is no data for this user.
114
- */
115
- getRawStoredDevicesForUser(userId: string): Record<string, IDevice>;
116
- getStoredCrossSigningForUser(userId: string): CrossSigningInfo | null;
117
- storeCrossSigningForUser(userId: string, info: ICrossSigningInfo): void;
118
- /**
119
- * Get the stored keys for a single device
120
- *
121
- *
122
- * @returns device, or undefined
123
- * if we don't know about this device
124
- */
125
- getStoredDevice(userId: string, deviceId: string): DeviceInfo | undefined;
126
- /**
127
- * Get a user ID by one of their device's curve25519 identity key
128
- *
129
- * @param algorithm - encryption algorithm
130
- * @param senderKey - curve25519 key to match
131
- *
132
- * @returns user ID
133
- */
134
- getUserByIdentityKey(algorithm: string, senderKey: string): string | null;
135
- /**
136
- * Find a device by curve25519 identity key
137
- *
138
- * @param algorithm - encryption algorithm
139
- * @param senderKey - curve25519 key to match
140
- */
141
- getDeviceByIdentityKey(algorithm: string, senderKey: string): DeviceInfo | null;
142
- /**
143
- * Replaces the list of devices for a user with the given device list
144
- *
145
- * @param userId - The user ID
146
- * @param devices - New device info for user
147
- */
148
- storeDevicesForUser(userId: string, devices: Record<string, IDevice>): void;
149
- /**
150
- * flag the given user for device-list tracking, if they are not already.
151
- *
152
- * This will mean that a subsequent call to refreshOutdatedDeviceLists()
153
- * will download the device list for the user, and that subsequent calls to
154
- * invalidateUserDeviceList will trigger more updates.
155
- *
156
- */
157
- startTrackingDeviceList(userId: string): void;
158
- /**
159
- * Mark the given user as no longer being tracked for device-list updates.
160
- *
161
- * This won't affect any in-progress downloads, which will still go on to
162
- * complete; it will just mean that we don't think that we have an up-to-date
163
- * list for future calls to downloadKeys.
164
- *
165
- */
166
- stopTrackingDeviceList(userId: string): void;
167
- /**
168
- * Set all users we're currently tracking to untracked
169
- *
170
- * This will flag each user whose devices we are tracking as in need of an
171
- * update.
172
- */
173
- stopTrackingAllDeviceLists(): void;
174
- /**
175
- * Mark the cached device list for the given user outdated.
176
- *
177
- * If we are not tracking this user's devices, we'll do nothing. Otherwise
178
- * we flag the user as needing an update.
179
- *
180
- * This doesn't actually set off an update, so that several users can be
181
- * batched together. Call refreshOutdatedDeviceLists() for that.
182
- *
183
- */
184
- invalidateUserDeviceList(userId: string): void;
185
- /**
186
- * If we have users who have outdated device lists, start key downloads for them
187
- *
188
- * @returns which completes when the download completes; normally there
189
- * is no need to wait for this (it's mostly for the unit tests).
190
- */
191
- refreshOutdatedDeviceLists(): Promise<void>;
192
- /**
193
- * Set the stored device data for a user, in raw object form
194
- * Used only by internal class DeviceListUpdateSerialiser
195
- *
196
- * @param userId - the user to get data for
197
- *
198
- * @param devices - `deviceId->{object}` the new devices
199
- */
200
- setRawStoredDevicesForUser(userId: string, devices: Record<string, IDevice>): void;
201
- setRawStoredCrossSigningForUser(userId: string, info: ICrossSigningInfo): void;
202
- /**
203
- * Fire off download update requests for the given users, and update the
204
- * device list tracking status for them, and the
205
- * keyDownloadsInProgressByUser map for them.
206
- *
207
- * @param users - list of userIds
208
- *
209
- * @returns resolves when all the users listed have
210
- * been updated. rejects if there was a problem updating any of the
211
- * users.
212
- */
213
- private doKeyDownload;
214
- }
215
- export {};
216
- //# sourceMappingURL=DeviceList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeviceList.d.ts","sourceRoot":"","sources":["../../src/crypto/DeviceList.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAIxE,OAAO,EAAwC,YAAY,EAAe,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAuBhE,oBAAY,cAAc;IACtB,UAAU,IAAA;IACV,eAAe,IAAA;IACf,kBAAkB,IAAA;IAClB,QAAQ,IAAA;CACX;AAGD,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjE,KAAK,aAAa,GAAG,WAAW,CAAC,iBAAiB,GAAG,WAAW,CAAC,cAAc,GAAG,WAAW,CAAC,uBAAuB,CAAC;AAEtH,qBAAa,UAAW,SAAQ,iBAAiB,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAqC/E,OAAO,CAAC,QAAQ,CAAC,WAAW;aAGZ,oBAAoB;IAvCxC,OAAO,CAAC,OAAO,CAA6D;IAErE,gBAAgB,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE,CAAM;IAGtE,OAAO,CAAC,iBAAiB,CAA8B;IAGvD,OAAO,CAAC,oBAAoB,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