@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,466 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- /*
3
- Copyright 2021-2023 The Matrix.org Foundation C.I.C.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- /**
19
- * Implementation of server-side secret storage
20
- *
21
- * @see https://spec.matrix.org/v1.6/client-server-api/#storage
22
- */
23
-
24
- import { ClientEvent } from "./client.js";
25
- import { randomString } from "./randomstring.js";
26
- import { logger } from "./logger.js";
27
- import encryptAESSecretStorageItem from "./utils/encryptAESSecretStorageItem.js";
28
- import decryptAESSecretStorageItem from "./utils/decryptAESSecretStorageItem.js";
29
- export var SECRET_STORAGE_ALGORITHM_V1_AES = "m.secret_storage.v1.aes-hmac-sha2";
30
-
31
- /**
32
- * Common base interface for Secret Storage Keys.
33
- *
34
- * The common properties for all encryption keys used in server-side secret storage.
35
- *
36
- * @see https://spec.matrix.org/v1.6/client-server-api/#key-storage
37
- */
38
-
39
- /**
40
- * Properties for a SSSS key using the `m.secret_storage.v1.aes-hmac-sha2` algorithm.
41
- *
42
- * Corresponds to `AesHmacSha2KeyDescription` in the specification.
43
- *
44
- * @see https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2
45
- */
46
-
47
- /**
48
- * Union type for secret storage keys.
49
- *
50
- * For now, this is only {@link SecretStorageKeyDescriptionAesV1}, but other interfaces may be added in future.
51
- */
52
-
53
- /**
54
- * Information on how to generate the key from a passphrase.
55
- *
56
- * @see https://spec.matrix.org/v1.6/client-server-api/#deriving-keys-from-passphrases
57
- */
58
-
59
- /**
60
- * Options for {@link ServerSideSecretStorageImpl#addKey}.
61
- */
62
-
63
- /**
64
- * Return type for {@link ServerSideSecretStorageImpl#getKey}.
65
- */
66
-
67
- /**
68
- * Return type for {@link ServerSideSecretStorageImpl#addKey}.
69
- */
70
-
71
- /** Interface for managing account data on the server.
72
- *
73
- * A subset of {@link MatrixClient}.
74
- */
75
-
76
- /**
77
- * Application callbacks for use with {@link SecretStorage.ServerSideSecretStorageImpl}
78
- */
79
-
80
- /**
81
- * Interface provided by SecretStorage implementations
82
- *
83
- * Normally this will just be an {@link ServerSideSecretStorageImpl}, but for backwards
84
- * compatibility some methods allow other implementations.
85
- */
86
-
87
- /**
88
- * Implementation of Server-side secret storage.
89
- *
90
- * Secret *sharing* is *not* implemented here: this class is strictly about the storage component of
91
- * SSSS.
92
- *
93
- * @see https://spec.matrix.org/v1.6/client-server-api/#storage
94
- */
95
- export class ServerSideSecretStorageImpl {
96
- /**
97
- * Construct a new `SecretStorage`.
98
- *
99
- * Normally, it is unnecessary to call this directly, since MatrixClient automatically constructs one.
100
- * However, it may be useful to construct a new `SecretStorage`, if custom `callbacks` are required, for example.
101
- *
102
- * @param accountDataAdapter - interface for fetching and setting account data on the server. Normally an instance
103
- * of {@link MatrixClient}.
104
- * @param callbacks - application level callbacks for retrieving secret keys
105
- */
106
- constructor(accountDataAdapter, callbacks) {
107
- this.accountDataAdapter = accountDataAdapter;
108
- this.callbacks = callbacks;
109
- }
110
-
111
- /**
112
- * Get the current default key ID for encrypting secrets.
113
- *
114
- * @returns The default key ID or null if no default key ID is set
115
- */
116
- getDefaultKeyId() {
117
- var _this = this;
118
- return _asyncToGenerator(function* () {
119
- var defaultKey = yield _this.accountDataAdapter.getAccountDataFromServer("m.secret_storage.default_key");
120
- if (!defaultKey) return null;
121
- return defaultKey.key;
122
- })();
123
- }
124
-
125
- /**
126
- * Set the default key ID for encrypting secrets.
127
- *
128
- * @param keyId - The new default key ID
129
- */
130
- setDefaultKeyId(keyId) {
131
- return new Promise((resolve, reject) => {
132
- var listener = ev => {
133
- if (ev.getType() === "m.secret_storage.default_key" && ev.getContent().key === keyId) {
134
- this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);
135
- resolve();
136
- }
137
- };
138
- this.accountDataAdapter.on(ClientEvent.AccountData, listener);
139
- this.accountDataAdapter.setAccountData("m.secret_storage.default_key", {
140
- key: keyId
141
- }).catch(e => {
142
- this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);
143
- reject(e);
144
- });
145
- });
146
- }
147
-
148
- /**
149
- * Add a key for encrypting secrets.
150
- *
151
- * @param algorithm - the algorithm used by the key.
152
- * @param opts - the options for the algorithm. The properties used
153
- * depend on the algorithm given.
154
- * @param keyId - the ID of the key. If not given, a random
155
- * ID will be generated.
156
- *
157
- * @returns An object with:
158
- * keyId: the ID of the key
159
- * keyInfo: details about the key (iv, mac, passphrase)
160
- */
161
- addKey(algorithm, opts, keyId) {
162
- var _this2 = this;
163
- return _asyncToGenerator(function* () {
164
- if (algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES) {
165
- throw new Error("Unknown key algorithm ".concat(algorithm));
166
- }
167
- var keyInfo = {
168
- algorithm
169
- };
170
- if (opts.name) {
171
- keyInfo.name = opts.name;
172
- }
173
- if (opts.passphrase) {
174
- keyInfo.passphrase = opts.passphrase;
175
- }
176
- var {
177
- iv,
178
- mac
179
- } = yield calculateKeyCheck(opts.key);
180
- keyInfo.iv = iv;
181
- keyInfo.mac = mac;
182
-
183
- // Create a unique key id. XXX: this is racey.
184
- if (!keyId) {
185
- do {
186
- keyId = randomString(32);
187
- } while (yield _this2.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key.".concat(keyId)));
188
- }
189
- yield _this2.accountDataAdapter.setAccountData("m.secret_storage.key.".concat(keyId), keyInfo);
190
- return {
191
- keyId,
192
- keyInfo
193
- };
194
- })();
195
- }
196
-
197
- /**
198
- * Get the key information for a given ID.
199
- *
200
- * @param keyId - The ID of the key to check
201
- * for. Defaults to the default key ID if not provided.
202
- * @returns If the key was found, the return value is an array of
203
- * the form [keyId, keyInfo]. Otherwise, null is returned.
204
- * XXX: why is this an array when addKey returns an object?
205
- */
206
- getKey(keyId) {
207
- var _this3 = this;
208
- return _asyncToGenerator(function* () {
209
- if (!keyId) {
210
- keyId = yield _this3.getDefaultKeyId();
211
- }
212
- if (!keyId) {
213
- return null;
214
- }
215
- var keyInfo = yield _this3.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + keyId);
216
- return keyInfo ? [keyId, keyInfo] : null;
217
- })();
218
- }
219
-
220
- /**
221
- * Check whether we have a key with a given ID.
222
- *
223
- * @param keyId - The ID of the key to check
224
- * for. Defaults to the default key ID if not provided.
225
- * @returns Whether we have the key.
226
- */
227
- hasKey(keyId) {
228
- var _this4 = this;
229
- return _asyncToGenerator(function* () {
230
- var key = yield _this4.getKey(keyId);
231
- return Boolean(key);
232
- })();
233
- }
234
-
235
- /**
236
- * Check whether a key matches what we expect based on the key info
237
- *
238
- * @param key - the key to check
239
- * @param info - the key info
240
- *
241
- * @returns whether or not the key matches
242
- */
243
- checkKey(key, info) {
244
- return _asyncToGenerator(function* () {
245
- if (info.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
246
- if (info.mac) {
247
- var {
248
- mac
249
- } = yield calculateKeyCheck(key, info.iv);
250
- return trimTrailingEquals(info.mac) === trimTrailingEquals(mac);
251
- } else {
252
- // if we have no information, we have to assume the key is right
253
- return true;
254
- }
255
- } else {
256
- throw new Error("Unknown algorithm");
257
- }
258
- })();
259
- }
260
-
261
- /**
262
- * Store an encrypted secret on the server.
263
- *
264
- * Details of the encryption keys to be used must previously have been stored in account data
265
- * (for example, via {@link ServerSideSecretStorageImpl#addKey}. {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage
266
- * key to decrypt the secret.
267
- *
268
- * @param name - The name of the secret - i.e., the "event type" to be stored in the account data
269
- * @param secret - The secret contents.
270
- * @param keys - The IDs of the keys to use to encrypt the secret, or null/undefined to use the default key.
271
- */
272
- store(name, secret, keys) {
273
- var _this5 = this;
274
- return _asyncToGenerator(function* () {
275
- var encrypted = {};
276
- if (!keys) {
277
- var defaultKeyId = yield _this5.getDefaultKeyId();
278
- if (!defaultKeyId) {
279
- throw new Error("No keys specified and no default key present");
280
- }
281
- keys = [defaultKeyId];
282
- }
283
- if (keys.length === 0) {
284
- throw new Error("Zero keys given to encrypt with!");
285
- }
286
- for (var _keyId of keys) {
287
- // get key information from key storage
288
- var _keyInfo = yield _this5.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + _keyId);
289
- if (!_keyInfo) {
290
- throw new Error("Unknown key: " + _keyId);
291
- }
292
-
293
- // encrypt secret, based on the algorithm
294
- if (_keyInfo.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
295
- var _keys = {
296
- [_keyId]: _keyInfo
297
- };
298
- var [, encryption] = yield _this5.getSecretStorageKey(_keys, name);
299
- encrypted[_keyId] = yield encryption.encrypt(secret);
300
- } else {
301
- logger.warn("unknown algorithm for secret storage key " + _keyId + ": " + _keyInfo.algorithm);
302
- // do nothing if we don't understand the encryption algorithm
303
- }
304
- }
305
-
306
- // save encrypted secret
307
- yield _this5.accountDataAdapter.setAccountData(name, {
308
- encrypted
309
- });
310
- })();
311
- }
312
-
313
- /**
314
- * Get a secret from storage, and decrypt it.
315
- *
316
- * {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage
317
- * key to decrypt the secret.
318
- *
319
- * @param name - the name of the secret - i.e., the "event type" stored in the account data
320
- *
321
- * @returns the decrypted contents of the secret, or "undefined" if `name` is not found in
322
- * the user's account data.
323
- */
324
- get(name) {
325
- var _this6 = this;
326
- return _asyncToGenerator(function* () {
327
- var secretInfo = yield _this6.accountDataAdapter.getAccountDataFromServer(name);
328
- if (!secretInfo) {
329
- return;
330
- }
331
- if (!secretInfo.encrypted) {
332
- throw new Error("Content is not encrypted!");
333
- }
334
-
335
- // get possible keys to decrypt
336
- var keys = {};
337
- for (var _keyId2 of Object.keys(secretInfo.encrypted)) {
338
- // get key information from key storage
339
- var _keyInfo2 = yield _this6.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + _keyId2);
340
- var _encInfo = secretInfo.encrypted[_keyId2];
341
- // only use keys we understand the encryption algorithm of
342
- if ((_keyInfo2 === null || _keyInfo2 === void 0 ? void 0 : _keyInfo2.algorithm) === SECRET_STORAGE_ALGORITHM_V1_AES) {
343
- if (_encInfo.iv && _encInfo.ciphertext && _encInfo.mac) {
344
- keys[_keyId2] = _keyInfo2;
345
- }
346
- }
347
- }
348
- if (Object.keys(keys).length === 0) {
349
- throw new Error("Could not decrypt ".concat(name, " because none of ") + "the keys it is encrypted with are for a supported algorithm");
350
- }
351
-
352
- // fetch private key from app
353
- var [keyId, decryption] = yield _this6.getSecretStorageKey(keys, name);
354
- var encInfo = secretInfo.encrypted[keyId];
355
- return decryption.decrypt(encInfo);
356
- })();
357
- }
358
-
359
- /**
360
- * Check if a secret is stored on the server.
361
- *
362
- * @param name - the name of the secret
363
- *
364
- * @returns map of key name to key info the secret is encrypted
365
- * with, or null if it is not present or not encrypted with a trusted
366
- * key
367
- */
368
- isStored(name) {
369
- var _this7 = this;
370
- return _asyncToGenerator(function* () {
371
- // check if secret exists
372
- var secretInfo = yield _this7.accountDataAdapter.getAccountDataFromServer(name);
373
- if (!(secretInfo !== null && secretInfo !== void 0 && secretInfo.encrypted)) return null;
374
- var ret = {};
375
-
376
- // filter secret encryption keys with supported algorithm
377
- for (var _keyId3 of Object.keys(secretInfo.encrypted)) {
378
- // get key information from key storage
379
- var _keyInfo3 = yield _this7.accountDataAdapter.getAccountDataFromServer("m.secret_storage.key." + _keyId3);
380
- if (!_keyInfo3) continue;
381
- var encInfo = secretInfo.encrypted[_keyId3];
382
-
383
- // only use keys we understand the encryption algorithm of
384
- if (_keyInfo3.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
385
- if (encInfo.iv && encInfo.ciphertext && encInfo.mac) {
386
- ret[_keyId3] = _keyInfo3;
387
- }
388
- }
389
- }
390
- return Object.keys(ret).length ? ret : null;
391
- })();
392
- }
393
- getSecretStorageKey(keys, name) {
394
- var _this8 = this;
395
- return _asyncToGenerator(function* () {
396
- if (!_this8.callbacks.getSecretStorageKey) {
397
- throw new Error("No getSecretStorageKey callback supplied");
398
- }
399
- var returned = yield _this8.callbacks.getSecretStorageKey({
400
- keys
401
- }, name);
402
- if (!returned) {
403
- throw new Error("getSecretStorageKey callback returned falsey");
404
- }
405
- if (returned.length < 2) {
406
- throw new Error("getSecretStorageKey callback returned invalid data");
407
- }
408
- var [keyId, privateKey] = returned;
409
- if (!keys[keyId]) {
410
- throw new Error("App returned unknown key from getSecretStorageKey!");
411
- }
412
- if (keys[keyId].algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {
413
- var decryption = {
414
- encrypt: function encrypt(secret) {
415
- return encryptAESSecretStorageItem(secret, privateKey, name);
416
- },
417
- decrypt: function decrypt(encInfo) {
418
- return decryptAESSecretStorageItem(encInfo, privateKey, name);
419
- }
420
- };
421
- return [keyId, decryption];
422
- } else {
423
- throw new Error("Unknown key type: " + keys[keyId].algorithm);
424
- }
425
- })();
426
- }
427
- }
428
-
429
- /** trim trailing instances of '=' from a string
430
- *
431
- * @internal
432
- *
433
- * @param input - input string
434
- */
435
- export function trimTrailingEquals(input) {
436
- // according to Sonar and CodeQL, a regex such as /=+$/ is superlinear.
437
- // Not sure I believe it, but it's easy enough to work around.
438
-
439
- // find the number of characters before the trailing =
440
- var i = input.length;
441
- while (i >= 1 && input.charCodeAt(i - 1) == 0x3d) i--;
442
-
443
- // trim to the calculated length
444
- if (i < input.length) {
445
- return input.substring(0, i);
446
- } else {
447
- return input;
448
- }
449
- }
450
-
451
- // string of zeroes, for calculating the key check
452
- var ZERO_STR = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
453
-
454
- /**
455
- * Calculate the MAC for checking the key.
456
- * See https://spec.matrix.org/v1.11/client-server-api/#msecret_storagev1aes-hmac-sha2, steps 3 and 4.
457
- *
458
- * @param key - the key to use
459
- * @param iv - The initialization vector as a base64-encoded string.
460
- * If omitted, a random initialization vector will be created.
461
- * @returns An object that contains, `mac` and `iv` properties.
462
- */
463
- export function calculateKeyCheck(key, iv) {
464
- return encryptAESSecretStorageItem(ZERO_STR, key, "", iv);
465
- }
466
- //# sourceMappingURL=secret-storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"secret-storage.js","names":["ClientEvent","randomString","logger","encryptAESSecretStorageItem","decryptAESSecretStorageItem","SECRET_STORAGE_ALGORITHM_V1_AES","ServerSideSecretStorageImpl","constructor","accountDataAdapter","callbacks","getDefaultKeyId","_this","_asyncToGenerator","defaultKey","getAccountDataFromServer","key","setDefaultKeyId","keyId","Promise","resolve","reject","listener","ev","getType","getContent","removeListener","AccountData","on","setAccountData","catch","e","addKey","algorithm","opts","_this2","Error","concat","keyInfo","name","passphrase","iv","mac","calculateKeyCheck","getKey","_this3","hasKey","_this4","Boolean","checkKey","info","trimTrailingEquals","store","secret","keys","_this5","encrypted","defaultKeyId","length","encryption","getSecretStorageKey","encrypt","warn","get","_this6","secretInfo","Object","encInfo","ciphertext","decryption","decrypt","isStored","_this7","ret","_this8","returned","privateKey","input","i","charCodeAt","substring","ZERO_STR"],"sources":["../src/secret-storage.ts"],"sourcesContent":["/*\nCopyright 2021-2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Implementation of server-side secret storage\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#storage\n */\n\nimport { TypedEventEmitter } from \"./models/typed-event-emitter.ts\";\nimport { ClientEvent, ClientEventHandlerMap } from \"./client.ts\";\nimport { MatrixEvent } from \"./models/event.ts\";\nimport { randomString } from \"./randomstring.ts\";\nimport { logger } from \"./logger.ts\";\nimport encryptAESSecretStorageItem from \"./utils/encryptAESSecretStorageItem.ts\";\nimport decryptAESSecretStorageItem from \"./utils/decryptAESSecretStorageItem.ts\";\nimport { AESEncryptedSecretStoragePayload } from \"./@types/AESEncryptedSecretStoragePayload.ts\";\n\nexport const SECRET_STORAGE_ALGORITHM_V1_AES = \"m.secret_storage.v1.aes-hmac-sha2\";\n\n/**\n * Common base interface for Secret Storage Keys.\n *\n * The common properties for all encryption keys used in server-side secret storage.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#key-storage\n */\nexport interface SecretStorageKeyDescriptionCommon {\n /** A human-readable name for this key. */\n // XXX: according to the spec, this is optional\n name: string;\n\n /** The encryption algorithm used with this key. */\n algorithm: string;\n\n /** Information for deriving this key from a passphrase. */\n // XXX: according to the spec, this is optional\n passphrase: PassphraseInfo;\n}\n\n/**\n * Properties for a SSSS key using the `m.secret_storage.v1.aes-hmac-sha2` algorithm.\n *\n * Corresponds to `AesHmacSha2KeyDescription` in the specification.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2\n */\nexport interface SecretStorageKeyDescriptionAesV1 extends SecretStorageKeyDescriptionCommon {\n // XXX: strictly speaking, we should be able to enforce the algorithm here. But\n // this interface ends up being incorrectly used where other algorithms are in use (notably\n // in device-dehydration support), and unpicking that is too much like hard work\n // at the moment.\n // algorithm: \"m.secret_storage.v1.aes-hmac-sha2\";\n\n /** The 16-byte AES initialization vector, encoded as base64. */\n iv: string;\n\n /** The MAC of the result of encrypting 32 bytes of 0, encoded as base64. */\n mac: string;\n}\n\n/**\n * Union type for secret storage keys.\n *\n * For now, this is only {@link SecretStorageKeyDescriptionAesV1}, but other interfaces may be added in future.\n */\nexport type SecretStorageKeyDescription = SecretStorageKeyDescriptionAesV1;\n\n/**\n * Information on how to generate the key from a passphrase.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#deriving-keys-from-passphrases\n */\nexport interface PassphraseInfo {\n /** The algorithm to be used to derive the key. */\n algorithm: \"m.pbkdf2\";\n\n /** The number of PBKDF2 iterations to use. */\n iterations: number;\n\n /** The salt to be used for PBKDF2. */\n salt: string;\n\n /** The number of bits to generate. Defaults to 256. */\n bits?: number;\n}\n\n/**\n * Options for {@link ServerSideSecretStorageImpl#addKey}.\n */\nexport interface AddSecretStorageKeyOpts {\n /** Information for deriving the key from a passphrase if any. */\n passphrase?: PassphraseInfo;\n /** Optional name of the key. */\n name?: string;\n /** The private key. Will be used to generate the key check values in the key info; it will not be stored on the server */\n key: Uint8Array;\n}\n\n/**\n * Return type for {@link ServerSideSecretStorageImpl#getKey}.\n */\nexport type SecretStorageKeyTuple = [keyId: string, keyInfo: SecretStorageKeyDescription];\n\n/**\n * Return type for {@link ServerSideSecretStorageImpl#addKey}.\n */\nexport type SecretStorageKeyObject = {\n /** The ID of the key */\n keyId: string;\n /** details about the key */\n keyInfo: SecretStorageKeyDescription;\n};\n\n/** Interface for managing account data on the server.\n *\n * A subset of {@link MatrixClient}.\n */\nexport interface AccountDataClient extends TypedEventEmitter<ClientEvent.AccountData, ClientEventHandlerMap> {\n /**\n * Get account data event of given type for the current user. This variant\n * gets account data directly from the homeserver if the local store is not\n * ready, which can be useful very early in startup before the initial sync.\n *\n * @param eventType - The type of account data\n * @returns The contents of the given account data event, or `null` if the event is not found\n */\n getAccountDataFromServer: <T extends Record<string, any>>(eventType: string) => Promise<T | null>;\n\n /**\n * Set account data event for the current user, with retries\n *\n * @param eventType - The type of account data\n * @param content - the content object to be set\n * @returns an empty object\n */\n setAccountData: (eventType: string, content: any) => Promise<{}>;\n}\n\n/**\n * Application callbacks for use with {@link SecretStorage.ServerSideSecretStorageImpl}\n */\nexport interface SecretStorageCallbacks {\n /**\n * Called to retrieve a secret storage encryption key\n *\n * Before a secret can be stored in server-side storage, it must be encrypted with one or more\n * keys. Similarly, after it has been retrieved from storage, it must be decrypted with one of\n * the keys it was encrypted with. These encryption keys are known as \"secret storage keys\".\n *\n * Descriptions of the secret storage keys are also stored in server-side storage, per the\n * [matrix specification](https://spec.matrix.org/v1.6/client-server-api/#key-storage), so\n * before a key can be used in this way, it must have been stored on the server. This is\n * done via {@link ServerSideSecretStorage#addKey}.\n *\n * Obviously the keys themselves are not stored server-side, so the js-sdk calls this callback\n * in order to retrieve a secret storage key from the application.\n *\n * @param keys - An options object, containing only the property `keys`.\n *\n * @param name - the name of the *secret* (NB: not the encryption key) being stored or retrieved.\n * This is the \"event type\" stored in account data.\n *\n * @returns a pair [`keyId`, `privateKey`], where `keyId` is one of the keys from the `keys` parameter,\n * and `privateKey` is the raw private encryption key, as appropriate for the encryption algorithm.\n * (For `m.secret_storage.v1.aes-hmac-sha2`, it is the input to an HKDF as defined in the\n * [specification](https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2).)\n *\n * Alternatively, if none of the keys are known, may return `null` — in which case the original\n * storage/retrieval operation will fail with an exception.\n */\n getSecretStorageKey?: (\n keys: {\n /**\n * details of the secret storage keys required: a map from the key ID\n * (excluding the `m.secret_storage.key.` prefix) to details of the key.\n *\n * When storing a secret, `keys` will contain exactly one entry; this method will be called\n * once for each secret storage key to be used for encryption.\n *\n * For secret retrieval, `keys` may contain several entries, and the application can return\n * any one of the requested keys.\n */\n keys: Record<string, SecretStorageKeyDescription>;\n },\n name: string,\n ) => Promise<[string, Uint8Array] | null>;\n}\n\ninterface SecretInfo {\n encrypted: {\n [keyId: string]: AESEncryptedSecretStoragePayload;\n };\n}\n\ninterface Decryptors {\n encrypt: (plaintext: string) => Promise<AESEncryptedSecretStoragePayload>;\n decrypt: (ciphertext: AESEncryptedSecretStoragePayload) => Promise<string>;\n}\n\n/**\n * Interface provided by SecretStorage implementations\n *\n * Normally this will just be an {@link ServerSideSecretStorageImpl}, but for backwards\n * compatibility some methods allow other implementations.\n */\nexport interface ServerSideSecretStorage {\n /**\n * Add a key for encrypting secrets.\n *\n * @param algorithm - the algorithm used by the key.\n * @param opts - the options for the algorithm. The properties used\n * depend on the algorithm given.\n * @param keyId - the ID of the key. If not given, a random\n * ID will be generated.\n *\n * @returns details about the key.\n */\n addKey(algorithm: string, opts: AddSecretStorageKeyOpts, keyId?: string): Promise<SecretStorageKeyObject>;\n\n /**\n * Get the key information for a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns If the key was found, the return value is an array of\n * the form [keyId, keyInfo]. Otherwise, null is returned.\n * XXX: why is this an array when addKey returns an object?\n */\n getKey(keyId?: string | null): Promise<SecretStorageKeyTuple | null>;\n\n /**\n * Check whether we have a key with a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns Whether we have the key.\n */\n hasKey(keyId?: string): Promise<boolean>;\n\n /**\n * Check whether a key matches what we expect based on the key info\n *\n * @param key - the key to check\n * @param info - the key info\n *\n * @returns whether or not the key matches\n */\n checkKey(key: Uint8Array, info: SecretStorageKeyDescriptionAesV1): Promise<boolean>;\n\n /**\n * Store an encrypted secret on the server.\n *\n * Details of the encryption keys to be used must previously have been stored in account data\n * (for example, via {@link ServerSideSecretStorage#addKey}.\n *\n * @param name - The name of the secret - i.e., the \"event type\" to be stored in the account data\n * @param secret - The secret contents.\n * @param keys - The IDs of the keys to use to encrypt the secret, or null/undefined to use the default key\n * (will throw if no default key is set).\n */\n store(name: string, secret: string, keys?: string[] | null): Promise<void>;\n\n /**\n * Get a secret from storage, and decrypt it.\n *\n * @param name - the name of the secret - i.e., the \"event type\" stored in the account data\n *\n * @returns the decrypted contents of the secret, or \"undefined\" if `name` is not found in\n * the user's account data.\n */\n get(name: string): Promise<string | undefined>;\n\n /**\n * Check if a secret is stored on the server.\n *\n * @param name - the name of the secret\n *\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 isStored(name: string): Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null>;\n\n /**\n * Get the current default key ID for encrypting secrets.\n *\n * @returns The default key ID or null if no default key ID is set\n */\n getDefaultKeyId(): Promise<string | null>;\n\n /**\n * Set the default key ID for encrypting secrets.\n *\n * @param keyId - The new default key ID\n */\n setDefaultKeyId(keyId: string): Promise<void>;\n}\n\n/**\n * Implementation of Server-side secret storage.\n *\n * Secret *sharing* is *not* implemented here: this class is strictly about the storage component of\n * SSSS.\n *\n * @see https://spec.matrix.org/v1.6/client-server-api/#storage\n */\nexport class ServerSideSecretStorageImpl implements ServerSideSecretStorage {\n /**\n * Construct a new `SecretStorage`.\n *\n * Normally, it is unnecessary to call this directly, since MatrixClient automatically constructs one.\n * However, it may be useful to construct a new `SecretStorage`, if custom `callbacks` are required, for example.\n *\n * @param accountDataAdapter - interface for fetching and setting account data on the server. Normally an instance\n * of {@link MatrixClient}.\n * @param callbacks - application level callbacks for retrieving secret keys\n */\n public constructor(\n private readonly accountDataAdapter: AccountDataClient,\n private readonly callbacks: SecretStorageCallbacks,\n ) {}\n\n /**\n * Get the current default key ID for encrypting secrets.\n *\n * @returns The default key ID or null if no default key ID is set\n */\n public async getDefaultKeyId(): Promise<string | null> {\n const defaultKey = await this.accountDataAdapter.getAccountDataFromServer<{ key: string }>(\n \"m.secret_storage.default_key\",\n );\n if (!defaultKey) return null;\n return defaultKey.key;\n }\n\n /**\n * Set the default key ID for encrypting secrets.\n *\n * @param keyId - The new default key ID\n */\n public setDefaultKeyId(keyId: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const listener = (ev: MatrixEvent): void => {\n if (ev.getType() === \"m.secret_storage.default_key\" && ev.getContent().key === keyId) {\n this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);\n resolve();\n }\n };\n this.accountDataAdapter.on(ClientEvent.AccountData, listener);\n\n this.accountDataAdapter.setAccountData(\"m.secret_storage.default_key\", { key: keyId }).catch((e) => {\n this.accountDataAdapter.removeListener(ClientEvent.AccountData, listener);\n reject(e);\n });\n });\n }\n\n /**\n * Add a key for encrypting secrets.\n *\n * @param algorithm - the algorithm used by the key.\n * @param opts - the options for the algorithm. The properties used\n * depend on the algorithm given.\n * @param keyId - the ID of the key. If not given, a random\n * ID will be generated.\n *\n * @returns An object with:\n * keyId: the ID of the key\n * keyInfo: details about the key (iv, mac, passphrase)\n */\n public async addKey(\n algorithm: string,\n opts: AddSecretStorageKeyOpts,\n keyId?: string,\n ): Promise<SecretStorageKeyObject> {\n if (algorithm !== SECRET_STORAGE_ALGORITHM_V1_AES) {\n throw new Error(`Unknown key algorithm ${algorithm}`);\n }\n\n const keyInfo = { algorithm } as SecretStorageKeyDescriptionAesV1;\n\n if (opts.name) {\n keyInfo.name = opts.name;\n }\n\n if (opts.passphrase) {\n keyInfo.passphrase = opts.passphrase;\n }\n\n const { iv, mac } = await calculateKeyCheck(opts.key);\n keyInfo.iv = iv;\n keyInfo.mac = mac;\n\n // Create a unique key id. XXX: this is racey.\n if (!keyId) {\n do {\n keyId = randomString(32);\n } while (\n await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescription>(\n `m.secret_storage.key.${keyId}`,\n )\n );\n }\n\n await this.accountDataAdapter.setAccountData(`m.secret_storage.key.${keyId}`, keyInfo);\n\n return {\n keyId,\n keyInfo,\n };\n }\n\n /**\n * Get the key information for a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns If the key was found, the return value is an array of\n * the form [keyId, keyInfo]. Otherwise, null is returned.\n * XXX: why is this an array when addKey returns an object?\n */\n public async getKey(keyId?: string | null): Promise<SecretStorageKeyTuple | null> {\n if (!keyId) {\n keyId = await this.getDefaultKeyId();\n }\n if (!keyId) {\n return null;\n }\n\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n return keyInfo ? [keyId, keyInfo] : null;\n }\n\n /**\n * Check whether we have a key with a given ID.\n *\n * @param keyId - The ID of the key to check\n * for. Defaults to the default key ID if not provided.\n * @returns Whether we have the key.\n */\n public async hasKey(keyId?: string): Promise<boolean> {\n const key = await this.getKey(keyId);\n return Boolean(key);\n }\n\n /**\n * Check whether a key matches what we expect based on the key info\n *\n * @param key - the key to check\n * @param info - the key info\n *\n * @returns whether or not the key matches\n */\n public async checkKey(key: Uint8Array, info: SecretStorageKeyDescriptionAesV1): Promise<boolean> {\n if (info.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n if (info.mac) {\n const { mac } = await calculateKeyCheck(key, info.iv);\n return trimTrailingEquals(info.mac) === trimTrailingEquals(mac);\n } else {\n // if we have no information, we have to assume the key is right\n return true;\n }\n } else {\n throw new Error(\"Unknown algorithm\");\n }\n }\n\n /**\n * Store an encrypted secret on the server.\n *\n * Details of the encryption keys to be used must previously have been stored in account data\n * (for example, via {@link ServerSideSecretStorageImpl#addKey}. {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage\n * key to decrypt the secret.\n *\n * @param name - The name of the secret - i.e., the \"event type\" to be stored in the account data\n * @param secret - The secret contents.\n * @param keys - The IDs of the keys to use to encrypt the secret, or null/undefined to use the default key.\n */\n public async store(name: string, secret: string, keys?: string[] | null): Promise<void> {\n const encrypted: Record<string, AESEncryptedSecretStoragePayload> = {};\n\n if (!keys) {\n const defaultKeyId = await this.getDefaultKeyId();\n if (!defaultKeyId) {\n throw new Error(\"No keys specified and no default key present\");\n }\n keys = [defaultKeyId];\n }\n\n if (keys.length === 0) {\n throw new Error(\"Zero keys given to encrypt with!\");\n }\n\n for (const keyId of keys) {\n // get key information from key storage\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n if (!keyInfo) {\n throw new Error(\"Unknown key: \" + keyId);\n }\n\n // encrypt secret, based on the algorithm\n if (keyInfo.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n const keys = { [keyId]: keyInfo };\n const [, encryption] = await this.getSecretStorageKey(keys, name);\n encrypted[keyId] = await encryption.encrypt(secret);\n } else {\n logger.warn(\"unknown algorithm for secret storage key \" + keyId + \": \" + keyInfo.algorithm);\n // do nothing if we don't understand the encryption algorithm\n }\n }\n\n // save encrypted secret\n await this.accountDataAdapter.setAccountData(name, { encrypted });\n }\n\n /**\n * Get a secret from storage, and decrypt it.\n *\n * {@link SecretStorageCallbacks#getSecretStorageKey} will be called to obtain a secret storage\n * key to decrypt the secret.\n *\n * @param name - the name of the secret - i.e., the \"event type\" stored in the account data\n *\n * @returns the decrypted contents of the secret, or \"undefined\" if `name` is not found in\n * the user's account data.\n */\n public async get(name: string): Promise<string | undefined> {\n const secretInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretInfo>(name);\n if (!secretInfo) {\n return;\n }\n if (!secretInfo.encrypted) {\n throw new Error(\"Content is not encrypted!\");\n }\n\n // get possible keys to decrypt\n const keys: Record<string, SecretStorageKeyDescriptionAesV1> = {};\n for (const keyId of Object.keys(secretInfo.encrypted)) {\n // get key information from key storage\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n const encInfo = secretInfo.encrypted[keyId];\n // only use keys we understand the encryption algorithm of\n if (keyInfo?.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n if (encInfo.iv && encInfo.ciphertext && encInfo.mac) {\n keys[keyId] = keyInfo;\n }\n }\n }\n\n if (Object.keys(keys).length === 0) {\n throw new Error(\n `Could not decrypt ${name} because none of ` +\n `the keys it is encrypted with are for a supported algorithm`,\n );\n }\n\n // fetch private key from app\n const [keyId, decryption] = await this.getSecretStorageKey(keys, name);\n const encInfo = secretInfo.encrypted[keyId];\n\n return decryption.decrypt(encInfo);\n }\n\n /**\n * Check if a secret is stored on the server.\n *\n * @param name - the name of the secret\n *\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 isStored(name: string): Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null> {\n // check if secret exists\n const secretInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretInfo>(name);\n if (!secretInfo?.encrypted) return null;\n\n const ret: Record<string, SecretStorageKeyDescriptionAesV1> = {};\n\n // filter secret encryption keys with supported algorithm\n for (const keyId of Object.keys(secretInfo.encrypted)) {\n // get key information from key storage\n const keyInfo = await this.accountDataAdapter.getAccountDataFromServer<SecretStorageKeyDescriptionAesV1>(\n \"m.secret_storage.key.\" + keyId,\n );\n if (!keyInfo) continue;\n const encInfo = secretInfo.encrypted[keyId];\n\n // only use keys we understand the encryption algorithm of\n if (keyInfo.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n if (encInfo.iv && encInfo.ciphertext && encInfo.mac) {\n ret[keyId] = keyInfo;\n }\n }\n }\n return Object.keys(ret).length ? ret : null;\n }\n\n private async getSecretStorageKey(\n keys: Record<string, SecretStorageKeyDescriptionAesV1>,\n name: string,\n ): Promise<[string, Decryptors]> {\n if (!this.callbacks.getSecretStorageKey) {\n throw new Error(\"No getSecretStorageKey callback supplied\");\n }\n\n const returned = await this.callbacks.getSecretStorageKey({ keys }, name);\n\n if (!returned) {\n throw new Error(\"getSecretStorageKey callback returned falsey\");\n }\n if (returned.length < 2) {\n throw new Error(\"getSecretStorageKey callback returned invalid data\");\n }\n\n const [keyId, privateKey] = returned;\n if (!keys[keyId]) {\n throw new Error(\"App returned unknown key from getSecretStorageKey!\");\n }\n\n if (keys[keyId].algorithm === SECRET_STORAGE_ALGORITHM_V1_AES) {\n const decryption = {\n encrypt: function (secret: string): Promise<AESEncryptedSecretStoragePayload> {\n return encryptAESSecretStorageItem(secret, privateKey, name);\n },\n decrypt: function (encInfo: AESEncryptedSecretStoragePayload): Promise<string> {\n return decryptAESSecretStorageItem(encInfo, privateKey, name);\n },\n };\n return [keyId, decryption];\n } else {\n throw new Error(\"Unknown key type: \" + keys[keyId].algorithm);\n }\n }\n}\n\n/** trim trailing instances of '=' from a string\n *\n * @internal\n *\n * @param input - input string\n */\nexport function trimTrailingEquals(input: string): string {\n // according to Sonar and CodeQL, a regex such as /=+$/ is superlinear.\n // Not sure I believe it, but it's easy enough to work around.\n\n // find the number of characters before the trailing =\n let i = input.length;\n while (i >= 1 && input.charCodeAt(i - 1) == 0x3d) i--;\n\n // trim to the calculated length\n if (i < input.length) {\n return input.substring(0, i);\n } else {\n return input;\n }\n}\n\n// string of zeroes, for calculating the key check\nconst ZERO_STR = \"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Calculate the MAC for checking the key.\n * See https://spec.matrix.org/v1.11/client-server-api/#msecret_storagev1aes-hmac-sha2, steps 3 and 4.\n *\n * @param key - the key to use\n * @param iv - The initialization vector as a base64-encoded string.\n * If omitted, a random initialization vector will be created.\n * @returns An object that contains, `mac` and `iv` properties.\n */\nexport function calculateKeyCheck(key: Uint8Array, iv?: string): Promise<AESEncryptedSecretStoragePayload> {\n return encryptAESSecretStorageItem(ZERO_STR, key, \"\", iv);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAGA,SAASA,WAAW,QAA+B,aAAa;AAEhE,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,2BAA2B,MAAM,wCAAwC;AAChF,OAAOC,2BAA2B,MAAM,wCAAwC;AAGhF,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jE;IAAC;EACL;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASkB,kBAAkBA,CAAC0B,KAAa,EAAU;EACtD;EACA;;EAEA;EACA,IAAIC,CAAC,GAAGD,KAAK,CAACnB,MAAM;EACpB,OAAOoB,CAAC,IAAI,CAAC,IAAID,KAAK,CAACE,UAAU,CAACD,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,EAAEA,CAAC,EAAE;;EAErD;EACA,IAAIA,CAAC,GAAGD,KAAK,CAACnB,MAAM,EAAE;IAClB,OAAOmB,KAAK,CAACG,SAAS,CAAC,CAAC,EAAEF,CAAC,CAAC;EAChC,CAAC,MAAM;IACH,OAAOD,KAAK;EAChB;AACJ;;AAEA;AACA,IAAMI,QAAQ,GAAG,kEAAkE;;AAEnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAStC,iBAAiBA,CAAC3B,GAAe,EAAEyB,EAAW,EAA6C;EACvG,OAAOrC,2BAA2B,CAAC6E,QAAQ,EAAEjE,GAAG,EAAE,EAAE,EAAEyB,EAAE,CAAC;AAC7D","ignoreList":[]}
@@ -1,73 +0,0 @@
1
- /*
2
- Copyright 2022-2023 The Matrix.org Foundation C.I.C.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import type { ISignatures } from "./signed.ts";
18
-
19
- export type OlmGroupSessionExtraData = {
20
- untrusted?: boolean;
21
- sharedHistory?: boolean;
22
- };
23
-
24
- // Backwards compatible re-export
25
- export type { EventDecryptionResult as IEventDecryptionResult } from "../common-crypto/CryptoBackend.ts";
26
-
27
- interface Extensible {
28
- [key: string]: any;
29
- }
30
-
31
- /* eslint-disable camelcase */
32
-
33
- /** The result of a call to {@link MatrixClient.exportRoomKeys} */
34
- export interface IMegolmSessionData extends Extensible {
35
- /** Sender's Curve25519 device key */
36
- sender_key: string;
37
- /** Devices which forwarded this session to us (normally empty). */
38
- forwarding_curve25519_key_chain: string[];
39
- /** Other keys the sender claims. */
40
- sender_claimed_keys: Record<string, string>;
41
- /** Room this session is used in */
42
- room_id: string;
43
- /** Unique id for the session */
44
- session_id: string;
45
- /** Base64'ed key data */
46
- session_key: string;
47
- algorithm?: string;
48
- untrusted?: boolean;
49
- }
50
-
51
- /* eslint-enable camelcase */
52
-
53
- /** the type of the `device_keys` parameter on `/_matrix/client/v3/keys/upload`
54
- *
55
- * @see https://spec.matrix.org/v1.5/client-server-api/#post_matrixclientv3keysupload
56
- */
57
- export interface IDeviceKeys {
58
- algorithms: Array<string>;
59
- device_id: string; // eslint-disable-line camelcase
60
- user_id: string; // eslint-disable-line camelcase
61
- keys: Record<string, string>;
62
- signatures?: ISignatures;
63
- }
64
-
65
- /** the type of the `one_time_keys` and `fallback_keys` parameters on `/_matrix/client/v3/keys/upload`
66
- *
67
- * @see https://spec.matrix.org/v1.5/client-server-api/#post_matrixclientv3keysupload
68
- */
69
- export interface IOneTimeKey {
70
- key: string;
71
- fallback?: boolean;
72
- signatures?: ISignatures;
73
- }
@@ -1,44 +0,0 @@
1
- /*
2
- Copyright 2024 The Matrix.org Foundation C.I.C.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import type * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
18
-
19
- declare module "@matrix-org/matrix-sdk-crypto-wasm" {
20
- interface OlmMachine {
21
- importSecretsBundle(bundle: RustSdkCryptoJs.SecretsBundle): Promise<void>;
22
- exportSecretsBundle(): Promise<RustSdkCryptoJs.SecretsBundle>;
23
- }
24
-
25
- interface SecretsBundle {
26
- // eslint-disable-next-line @typescript-eslint/naming-convention
27
- to_json(): Promise<{
28
- cross_signing: {
29
- master_key: string;
30
- self_signing_key: string;
31
- user_signing_key: string;
32
- };
33
- backup?: {
34
- algorithm: string;
35
- key: string;
36
- backup_version: string;
37
- };
38
- }>;
39
- }
40
-
41
- interface Device {
42
- requestVerification(methods?: any[]): [RustSdkCryptoJs.VerificationRequest, RustSdkCryptoJs.ToDeviceRequest];
43
- }
44
- }