@openclaw/matrix 2026.8.1-beta.3 → 2026.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1022) hide show
  1. package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
  2. package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
  3. package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
  4. package/dist/api.js +5 -5
  5. package/dist/{approval-handler.runtime-CSvueU9P.js → approval-handler.runtime-xcVrZw9o.js} +8 -6
  6. package/dist/{approval-ids-CEcf-EiM.js → approval-ids-hmvhDNBj.js} +1 -1
  7. package/dist/{approval-reaction-auth-CziKXatm.js → approval-reaction-auth-DziFGHSk.js} +2 -2
  8. package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
  9. package/dist/{channel-CzQw5OZN.js → channel-D6-ajB_u.js} +70 -55
  10. package/dist/channel-plugin-api.js +1 -1
  11. package/dist/{channel.runtime-I9pBRQb3.js → channel.runtime-BMA0dG2k.js} +18 -14
  12. package/dist/{channel.setup-aNaa3Uyn.js → channel.setup-OIEzCzSs.js} +28 -21
  13. package/dist/{cli-iR6QJ5U0.js → cli-B6HF7Hmn.js} +43 -33
  14. package/dist/{cli-metadata-BmUYWjuM.js → cli-metadata-Mtzu5-AY.js} +1 -1
  15. package/dist/cli-metadata.js +1 -1
  16. package/dist/{client-D8XghqmX.js → client-B0yMDho1.js} +2 -2
  17. package/dist/{client-BBQdBG7t.js → client-DFsRJEgB.js} +137 -75
  18. package/dist/{client-bootstrap-Co3RlItb.js → client-bootstrap-DjXCKEtg.js} +1 -1
  19. package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
  20. package/dist/contract-api.js +2 -2
  21. package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
  22. package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
  23. package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
  24. package/dist/{crypto-runtime-Bnz3zEcS.js → crypto-runtime-QvlgyCkj.js} +6 -6
  25. package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
  26. package/dist/{directory-live-DLQzel12.js → directory-live-Drh343TW.js} +8 -6
  27. package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
  28. package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
  29. package/dist/doctor-contract-api.js +7 -7
  30. package/dist/{draft-stream-DQ7QNC-l.js → draft-stream-DhGHVdO4.js} +1 -1
  31. package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
  32. package/dist/event-helpers-XRfAbOIh.js +46 -0
  33. package/dist/helper-api.js +1 -1
  34. package/dist/{http-client-CycYxU9-.js → http-client-DOmFvKvB.js} +13 -54
  35. package/dist/{idb-persistence-BM0P27Zg.js → idb-persistence-D4NGNQxt.js} +3 -3
  36. package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
  37. package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/{messages-DEqg7HVy.js → messages-DlMQaC02.js} +161 -25
  40. package/dist/{monitor-FNrfkuWL.js → monitor-U2LcVtHt.js} +232 -203
  41. package/dist/plugin-entry.handlers.runtime.js +1 -1
  42. package/dist/probe.runtime-CNo-5_iz.js +2 -0
  43. package/dist/{profile-update-BQlE5s2J.js → profile-update-CsyKA9jI.js} +5 -4
  44. package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
  45. package/dist/{reaction-events-BKOLlnCo.js → reaction-events-lwNc5I1X.js} +10 -8
  46. package/dist/{resolve-targets-e7AI0P75.js → resolve-targets-D3Eakgzs.js} +1 -1
  47. package/dist/{resolver.runtime-V8u0pHEb.js → resolver.runtime-DJQxR35r.js} +1 -1
  48. package/dist/{room-info-BXQA7y10.js → room-info-DIU67XLP.js} +55 -1
  49. package/dist/runtime-api.js +2 -2
  50. package/dist/{sdk-NxK3vzMa.js → sdk-Jl2CgAbJ.js} +573 -47
  51. package/dist/{send-ClHgDZLT.js → send-DfS5ciUL.js} +57 -34
  52. package/dist/session-binding-contract-api.js +1 -1
  53. package/dist/{setup-bootstrap-BGPjbA5N.js → setup-bootstrap-CWoIWudw.js} +3 -3
  54. package/dist/{setup-core-DigrLebY.js → setup-core-CZM496H-.js} +8 -7
  55. package/dist/setup-plugin-api.js +1 -1
  56. package/dist/{setup-surface-Dtn8sAWs.js → setup-surface-DSZtOsWK.js} +84 -79
  57. package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
  58. package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
  59. package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
  60. package/dist/subagent-hooks-api.js +1 -1
  61. package/dist/sync-cache-state-d-A_OhbU.js +234 -0
  62. package/dist/{thread-bindings-BYEGfw3h.js → thread-bindings-2HN2AyLu.js} +4 -4
  63. package/dist/{tool-actions.runtime-ck6IJyP0.js → tool-actions.runtime-CFZZPG5g.js} +267 -213
  64. package/dist/{verification-CabtBTtB.js → verification-CD7k5vE9.js} +2 -2
  65. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +29 -3
  66. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +23 -14
  67. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/RELEASING.md +6 -2
  68. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js +33 -14
  69. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.d.ts +14 -0
  70. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +41 -42
  71. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  72. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +16 -4
  73. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +25 -9
  74. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +23 -7
  75. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  76. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +1 -0
  77. package/node_modules/markdown-it/README.md +18 -294
  78. package/node_modules/markdown-it/bin/markdown-it.mjs +2 -2
  79. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +2972 -0
  80. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -0
  81. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +14 -0
  82. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -0
  83. package/node_modules/markdown-it/dist/markdown-it.cjs.js +4412 -0
  84. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -0
  85. package/node_modules/markdown-it/dist/markdown-it.d.cts +19 -0
  86. package/node_modules/markdown-it/dist/markdown-it.d.mts +979 -0
  87. package/node_modules/markdown-it/dist/{index.cjs.js → markdown-it.mjs} +1437 -1466
  88. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -0
  89. package/node_modules/markdown-it/node_modules/argparse/README.md +46 -41
  90. package/node_modules/markdown-it/node_modules/argparse/lib/_colorize.js +72 -0
  91. package/node_modules/markdown-it/node_modules/argparse/lib/argparse.d.ts +292 -0
  92. package/node_modules/markdown-it/node_modules/argparse/{argparse.js → lib/argparse.js} +1124 -1027
  93. package/node_modules/markdown-it/node_modules/argparse/lib/difflib.js +190 -0
  94. package/node_modules/markdown-it/node_modules/argparse/lib/sub.js +4 -4
  95. package/node_modules/markdown-it/node_modules/argparse/lib/textwrap.js +28 -28
  96. package/node_modules/markdown-it/node_modules/argparse/package.json +17 -10
  97. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts +8 -0
  98. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
  99. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js +46 -0
  100. package/node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js.map +1 -0
  101. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.d.ts +28 -45
  102. package/node_modules/markdown-it/node_modules/entities/dist/decode.d.ts.map +1 -0
  103. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/decode.js +189 -141
  104. package/node_modules/markdown-it/node_modules/entities/dist/decode.js.map +1 -0
  105. package/node_modules/markdown-it/node_modules/entities/{lib/esm → dist}/encode.d.ts +4 -2
  106. package/node_modules/markdown-it/node_modules/entities/dist/encode.d.ts.map +1 -0
  107. package/node_modules/markdown-it/node_modules/entities/dist/encode.js +90 -0
  108. package/node_modules/markdown-it/node_modules/entities/dist/encode.js.map +1 -0
  109. package/node_modules/markdown-it/node_modules/entities/{lib → dist}/escape.d.ts +15 -10
  110. package/node_modules/markdown-it/node_modules/entities/dist/escape.d.ts.map +1 -0
  111. package/node_modules/markdown-it/node_modules/entities/dist/escape.js +132 -0
  112. package/node_modules/markdown-it/node_modules/entities/dist/escape.js.map +1 -0
  113. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
  114. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
  115. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js +5 -0
  116. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
  117. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
  118. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
  119. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js +5 -0
  120. package/node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
  121. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts +5 -0
  122. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
  123. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js +12 -0
  124. package/node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js.map +1 -0
  125. package/node_modules/markdown-it/node_modules/entities/{lib → dist}/index.d.ts +14 -21
  126. package/node_modules/markdown-it/node_modules/entities/dist/index.d.ts.map +1 -0
  127. package/node_modules/markdown-it/node_modules/entities/dist/index.js +91 -0
  128. package/node_modules/markdown-it/node_modules/entities/dist/index.js.map +1 -0
  129. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts +17 -0
  130. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
  131. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js +18 -0
  132. package/node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
  133. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts +7 -0
  134. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
  135. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js +17 -0
  136. package/node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
  137. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts +33 -0
  138. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.d.ts.map +1 -0
  139. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js +93 -0
  140. package/node_modules/markdown-it/node_modules/entities/dist/internal/encode-shared.js.map +1 -0
  141. package/node_modules/markdown-it/node_modules/entities/package.json +63 -70
  142. package/node_modules/markdown-it/node_modules/entities/readme.md +54 -45
  143. package/node_modules/markdown-it/node_modules/entities/src/decode-codepoint.ts +50 -0
  144. package/node_modules/markdown-it/node_modules/entities/src/decode.ts +671 -0
  145. package/node_modules/markdown-it/node_modules/entities/src/encode.ts +95 -0
  146. package/node_modules/markdown-it/node_modules/entities/src/escape.ts +160 -0
  147. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-html.ts +7 -0
  148. package/node_modules/markdown-it/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
  149. package/node_modules/markdown-it/node_modules/entities/src/generated/encode-html.ts +18 -0
  150. package/node_modules/markdown-it/node_modules/entities/src/index.ts +162 -0
  151. package/node_modules/markdown-it/node_modules/entities/src/internal/bin-trie-flags.ts +16 -0
  152. package/node_modules/markdown-it/node_modules/entities/src/internal/decode-shared.ts +18 -0
  153. package/node_modules/markdown-it/node_modules/entities/src/internal/encode-shared.ts +123 -0
  154. package/node_modules/markdown-it/node_modules/linkify-it/README.md +49 -86
  155. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js +636 -825
  156. package/node_modules/markdown-it/node_modules/linkify-it/build/index.cjs.js.map +1 -0
  157. package/node_modules/markdown-it/node_modules/linkify-it/build/index.d.ts +236 -0
  158. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs +538 -0
  159. package/node_modules/markdown-it/node_modules/linkify-it/build/index.mjs.map +1 -0
  160. package/node_modules/markdown-it/node_modules/linkify-it/package.json +23 -20
  161. package/node_modules/markdown-it/node_modules/uc.micro/README.md +18 -1
  162. package/node_modules/markdown-it/node_modules/uc.micro/build/index.cjs.js +13 -18
  163. package/node_modules/markdown-it/node_modules/uc.micro/build/index.d.ts +6 -0
  164. package/node_modules/markdown-it/node_modules/uc.micro/build/index.mjs +8 -0
  165. package/node_modules/markdown-it/node_modules/uc.micro/package.json +12 -17
  166. package/node_modules/markdown-it/package.json +48 -30
  167. package/node_modules/matrix-js-sdk/CHANGELOG.md +33 -0
  168. package/node_modules/matrix-js-sdk/lib/@types/PushRules.d.ts.map +1 -1
  169. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js +0 -5
  170. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js.map +1 -1
  171. package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts +0 -5
  172. package/node_modules/matrix-js-sdk/lib/@types/auth.d.ts.map +1 -1
  173. package/node_modules/matrix-js-sdk/lib/@types/auth.js +0 -11
  174. package/node_modules/matrix-js-sdk/lib/@types/auth.js.map +1 -1
  175. package/node_modules/matrix-js-sdk/lib/@types/beacon.d.ts +1 -1
  176. package/node_modules/matrix-js-sdk/lib/@types/beacon.js +1 -1
  177. package/node_modules/matrix-js-sdk/lib/@types/beacon.js.map +1 -1
  178. package/node_modules/matrix-js-sdk/lib/@types/crypto.d.ts.map +1 -1
  179. package/node_modules/matrix-js-sdk/lib/@types/crypto.js.map +1 -1
  180. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts +3 -1
  181. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts.map +1 -1
  182. package/node_modules/matrix-js-sdk/lib/@types/event.js +1 -0
  183. package/node_modules/matrix-js-sdk/lib/@types/event.js.map +1 -1
  184. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.d.ts.map +1 -1
  185. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js.map +1 -1
  186. package/node_modules/matrix-js-sdk/lib/@types/matrix-sdk-crypto-wasm.d.js.map +1 -1
  187. package/node_modules/matrix-js-sdk/lib/@types/media.js.map +1 -1
  188. package/node_modules/matrix-js-sdk/lib/@types/partials.d.ts.map +1 -1
  189. package/node_modules/matrix-js-sdk/lib/@types/partials.js.map +1 -1
  190. package/node_modules/matrix-js-sdk/lib/@types/requests.d.ts.map +1 -1
  191. package/node_modules/matrix-js-sdk/lib/@types/requests.js +0 -5
  192. package/node_modules/matrix-js-sdk/lib/@types/requests.js.map +1 -1
  193. package/node_modules/matrix-js-sdk/lib/@types/search.d.ts.map +1 -1
  194. package/node_modules/matrix-js-sdk/lib/@types/search.js +0 -3
  195. package/node_modules/matrix-js-sdk/lib/@types/search.js.map +1 -1
  196. package/node_modules/matrix-js-sdk/lib/@types/spaces.d.ts.map +1 -1
  197. package/node_modules/matrix-js-sdk/lib/@types/spaces.js.map +1 -1
  198. package/node_modules/matrix-js-sdk/lib/@types/synapse.d.ts.map +1 -1
  199. package/node_modules/matrix-js-sdk/lib/@types/synapse.js.map +1 -1
  200. package/node_modules/matrix-js-sdk/lib/@types/threepids.js.map +1 -1
  201. package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts +43 -0
  202. package/node_modules/matrix-js-sdk/lib/@types/type-guards.d.ts.map +1 -0
  203. package/node_modules/matrix-js-sdk/lib/@types/type-guards.js +104 -0
  204. package/node_modules/matrix-js-sdk/lib/@types/type-guards.js.map +1 -0
  205. package/node_modules/matrix-js-sdk/lib/NamespacedValue.d.ts.map +1 -1
  206. package/node_modules/matrix-js-sdk/lib/ReEmitter.d.ts.map +1 -1
  207. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.d.ts.map +1 -1
  208. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js +0 -2
  209. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js.map +1 -1
  210. package/node_modules/matrix-js-sdk/lib/autodiscovery.d.ts.map +1 -1
  211. package/node_modules/matrix-js-sdk/lib/autodiscovery.js.map +1 -1
  212. package/node_modules/matrix-js-sdk/lib/browser-index.d.ts.map +1 -1
  213. package/node_modules/matrix-js-sdk/lib/browser-index.js +3 -1
  214. package/node_modules/matrix-js-sdk/lib/browser-index.js.map +1 -1
  215. package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts.map +1 -1
  216. package/node_modules/matrix-js-sdk/lib/client.d.ts +23 -21
  217. package/node_modules/matrix-js-sdk/lib/client.d.ts.map +1 -1
  218. package/node_modules/matrix-js-sdk/lib/client.js +44 -96
  219. package/node_modules/matrix-js-sdk/lib/client.js.map +1 -1
  220. package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.d.ts.map +1 -1
  221. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.d.ts.map +1 -1
  222. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js +1 -4
  223. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js.map +1 -1
  224. package/node_modules/matrix-js-sdk/lib/content-helpers.d.ts.map +1 -1
  225. package/node_modules/matrix-js-sdk/lib/crypto/store/base.d.ts.map +1 -1
  226. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js +0 -9
  227. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js.map +1 -1
  228. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +1 -1
  229. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js +2 -1
  230. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  231. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.d.ts.map +1 -1
  232. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js +1 -1
  233. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
  234. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.d.ts.map +1 -1
  235. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js +0 -2
  236. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
  237. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.d.ts.map +1 -1
  238. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js.map +1 -1
  239. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts +1 -1
  240. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts.map +1 -1
  241. package/node_modules/matrix-js-sdk/lib/crypto-api/index.js.map +1 -1
  242. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts +13 -6
  243. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.d.ts.map +1 -1
  244. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.js.map +1 -1
  245. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts +23 -5
  246. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.d.ts.map +1 -1
  247. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js.map +1 -1
  248. package/node_modules/matrix-js-sdk/lib/embedded.d.ts +16 -0
  249. package/node_modules/matrix-js-sdk/lib/embedded.d.ts.map +1 -1
  250. package/node_modules/matrix-js-sdk/lib/embedded.js +19 -11
  251. package/node_modules/matrix-js-sdk/lib/embedded.js.map +1 -1
  252. package/node_modules/matrix-js-sdk/lib/errors.d.ts.map +1 -1
  253. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/ExtensibleEvent.d.ts.map +1 -1
  254. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/InvalidEventError.d.ts.map +1 -1
  255. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.d.ts.map +1 -1
  256. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.d.ts.map +1 -1
  257. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.d.ts.map +1 -1
  258. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.d.ts.map +1 -1
  259. package/node_modules/matrix-js-sdk/lib/feature.d.ts.map +1 -1
  260. package/node_modules/matrix-js-sdk/lib/feature.js +0 -3
  261. package/node_modules/matrix-js-sdk/lib/feature.js.map +1 -1
  262. package/node_modules/matrix-js-sdk/lib/filter-component.d.ts.map +1 -1
  263. package/node_modules/matrix-js-sdk/lib/filter-component.js +2 -5
  264. package/node_modules/matrix-js-sdk/lib/filter-component.js.map +1 -1
  265. package/node_modules/matrix-js-sdk/lib/filter.d.ts.map +1 -1
  266. package/node_modules/matrix-js-sdk/lib/filter.js +0 -4
  267. package/node_modules/matrix-js-sdk/lib/filter.js.map +1 -1
  268. package/node_modules/matrix-js-sdk/lib/http-api/errors.d.ts.map +1 -1
  269. package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts +1 -1
  270. package/node_modules/matrix-js-sdk/lib/http-api/fetch.d.ts.map +1 -1
  271. package/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map +1 -1
  272. package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts +1 -7
  273. package/node_modules/matrix-js-sdk/lib/http-api/index.d.ts.map +1 -1
  274. package/node_modules/matrix-js-sdk/lib/http-api/index.js +0 -15
  275. package/node_modules/matrix-js-sdk/lib/http-api/index.js.map +1 -1
  276. package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts +0 -9
  277. package/node_modules/matrix-js-sdk/lib/http-api/interface.d.ts.map +1 -1
  278. package/node_modules/matrix-js-sdk/lib/http-api/interface.js +0 -2
  279. package/node_modules/matrix-js-sdk/lib/http-api/interface.js.map +1 -1
  280. package/node_modules/matrix-js-sdk/lib/http-api/refresh.d.ts.map +1 -1
  281. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js +0 -3
  282. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js.map +1 -1
  283. package/node_modules/matrix-js-sdk/lib/index.d.ts.map +1 -1
  284. package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts.map +1 -1
  285. package/node_modules/matrix-js-sdk/lib/interactive-auth.js +5 -6
  286. package/node_modules/matrix-js-sdk/lib/interactive-auth.js.map +1 -1
  287. package/node_modules/matrix-js-sdk/lib/logger.d.ts.map +1 -1
  288. package/node_modules/matrix-js-sdk/lib/logger.js +0 -2
  289. package/node_modules/matrix-js-sdk/lib/logger.js.map +1 -1
  290. package/node_modules/matrix-js-sdk/lib/matrix.d.ts +1 -1
  291. package/node_modules/matrix-js-sdk/lib/matrix.d.ts.map +1 -1
  292. package/node_modules/matrix-js-sdk/lib/matrix.js +1 -1
  293. package/node_modules/matrix-js-sdk/lib/matrix.js.map +1 -1
  294. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts +3 -3
  295. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts.map +1 -1
  296. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +5 -5
  297. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
  298. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts.map +1 -1
  299. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts +18 -1
  300. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
  301. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js +56 -4
  302. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
  303. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts +14 -1
  304. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +1 -1
  305. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js +20 -1
  306. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
  307. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
  308. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +9 -6
  309. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js.map +1 -1
  310. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.d.ts.map +1 -1
  311. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
  312. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.d.ts.map +1 -1
  313. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
  314. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.d.ts.map +1 -1
  315. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
  316. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts +1 -1
  317. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.d.ts.map +1 -1
  318. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js +1 -1
  319. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js.map +1 -1
  320. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.d.ts.map +1 -1
  321. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts +6 -3
  322. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts.map +1 -1
  323. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +7 -4
  324. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
  325. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.d.ts.map +1 -1
  326. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts +19 -6
  327. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts.map +1 -1
  328. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +11 -1
  329. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
  330. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts +0 -1
  331. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.d.ts.map +1 -1
  332. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js +0 -1
  333. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js.map +1 -1
  334. package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.d.ts.map +1 -1
  335. package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.d.ts.map +1 -1
  336. package/node_modules/matrix-js-sdk/lib/models/beacon.d.ts.map +1 -1
  337. package/node_modules/matrix-js-sdk/lib/models/device.d.ts.map +1 -1
  338. package/node_modules/matrix-js-sdk/lib/models/event-context.d.ts.map +1 -1
  339. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.d.ts.map +1 -1
  340. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +3 -3
  341. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js.map +1 -1
  342. package/node_modules/matrix-js-sdk/lib/models/event-timeline.d.ts.map +1 -1
  343. package/node_modules/matrix-js-sdk/lib/models/event.d.ts.map +1 -1
  344. package/node_modules/matrix-js-sdk/lib/models/event.js +0 -6
  345. package/node_modules/matrix-js-sdk/lib/models/event.js.map +1 -1
  346. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.d.ts.map +1 -1
  347. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js.map +1 -1
  348. package/node_modules/matrix-js-sdk/lib/models/poll.d.ts.map +1 -1
  349. package/node_modules/matrix-js-sdk/lib/models/poll.js.map +1 -1
  350. package/node_modules/matrix-js-sdk/lib/models/read-receipt.d.ts.map +1 -1
  351. package/node_modules/matrix-js-sdk/lib/models/read-receipt.js.map +1 -1
  352. package/node_modules/matrix-js-sdk/lib/models/related-relations.d.ts.map +1 -1
  353. package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts +10 -0
  354. package/node_modules/matrix-js-sdk/lib/models/relations-container.d.ts.map +1 -1
  355. package/node_modules/matrix-js-sdk/lib/models/relations-container.js +39 -17
  356. package/node_modules/matrix-js-sdk/lib/models/relations-container.js.map +1 -1
  357. package/node_modules/matrix-js-sdk/lib/models/relations.d.ts.map +1 -1
  358. package/node_modules/matrix-js-sdk/lib/models/relations.js +1 -1
  359. package/node_modules/matrix-js-sdk/lib/models/relations.js.map +1 -1
  360. package/node_modules/matrix-js-sdk/lib/models/room-member.d.ts.map +1 -1
  361. package/node_modules/matrix-js-sdk/lib/models/room-receipts.d.ts.map +1 -1
  362. package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts.map +1 -1
  363. package/node_modules/matrix-js-sdk/lib/models/room-state.d.ts.map +1 -1
  364. package/node_modules/matrix-js-sdk/lib/models/room-state.js.map +1 -1
  365. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts.map +1 -1
  366. package/node_modules/matrix-js-sdk/lib/models/room-summary.d.ts.map +1 -1
  367. package/node_modules/matrix-js-sdk/lib/models/room.d.ts.map +1 -1
  368. package/node_modules/matrix-js-sdk/lib/models/room.js +9 -9
  369. package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
  370. package/node_modules/matrix-js-sdk/lib/models/search-result.d.ts.map +1 -1
  371. package/node_modules/matrix-js-sdk/lib/models/thread.d.ts +5 -2
  372. package/node_modules/matrix-js-sdk/lib/models/thread.d.ts.map +1 -1
  373. package/node_modules/matrix-js-sdk/lib/models/thread.js +36 -3
  374. package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
  375. package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.d.ts.map +1 -1
  376. package/node_modules/matrix-js-sdk/lib/models/user.d.ts.map +1 -1
  377. package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts +133 -0
  378. package/node_modules/matrix-js-sdk/lib/oauth/authorize.d.ts.map +1 -0
  379. package/node_modules/matrix-js-sdk/lib/oauth/authorize.js +193 -0
  380. package/node_modules/matrix-js-sdk/lib/oauth/authorize.js.map +1 -0
  381. package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts +58 -0
  382. package/node_modules/matrix-js-sdk/lib/oauth/discover.d.ts.map +1 -0
  383. package/node_modules/matrix-js-sdk/lib/oauth/discover.js +35 -0
  384. package/node_modules/matrix-js-sdk/lib/oauth/discover.js.map +1 -0
  385. package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts +19 -0
  386. package/node_modules/matrix-js-sdk/lib/oauth/error.d.ts.map +1 -0
  387. package/node_modules/matrix-js-sdk/lib/oauth/error.js +36 -0
  388. package/node_modules/matrix-js-sdk/lib/oauth/error.js.map +1 -0
  389. package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts +87 -0
  390. package/node_modules/matrix-js-sdk/lib/oauth/index.d.ts.map +1 -0
  391. package/node_modules/matrix-js-sdk/lib/oauth/index.js +236 -0
  392. package/node_modules/matrix-js-sdk/lib/oauth/index.js.map +1 -0
  393. package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts +136 -0
  394. package/node_modules/matrix-js-sdk/lib/oauth/register.d.ts.map +1 -0
  395. package/node_modules/matrix-js-sdk/lib/oauth/register.js +73 -0
  396. package/node_modules/matrix-js-sdk/lib/oauth/register.js.map +1 -0
  397. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts +21 -0
  398. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.d.ts.map +1 -0
  399. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js +68 -0
  400. package/node_modules/matrix-js-sdk/lib/oauth/tokenRefresher.js.map +1 -0
  401. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts +77 -0
  402. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.d.ts.map +1 -0
  403. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js +160 -0
  404. package/node_modules/matrix-js-sdk/lib/pollingCachedValue.js.map +1 -0
  405. package/node_modules/matrix-js-sdk/lib/pushprocessor.d.ts.map +1 -1
  406. package/node_modules/matrix-js-sdk/lib/pushprocessor.js.map +1 -1
  407. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js +0 -1
  408. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js.map +1 -1
  409. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts.map +1 -1
  410. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js.map +1 -1
  411. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts +7 -7
  412. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -1
  413. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js +13 -14
  414. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
  415. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousError.d.ts.map +1 -1
  416. package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +1 -1
  417. package/node_modules/matrix-js-sdk/lib/rendezvous/index.d.ts.map +1 -1
  418. package/node_modules/matrix-js-sdk/lib/rendezvous/index.js.map +1 -1
  419. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +1 -1
  420. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -1
  421. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
  422. package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts.map +1 -1
  423. package/node_modules/matrix-js-sdk/lib/room-hierarchy.d.ts.map +1 -1
  424. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts +9 -0
  425. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.d.ts.map +1 -0
  426. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js +38 -0
  427. package/node_modules/matrix-js-sdk/lib/rtcTransportsCachedValue.js.map +1 -0
  428. package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.d.ts.map +1 -1
  429. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +1 -1
  430. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js +11 -13
  431. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
  432. package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.d.ts.map +1 -1
  433. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -1
  434. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js +0 -2
  435. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
  436. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +1 -1
  437. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +1 -1
  438. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
  439. package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.d.ts.map +1 -1
  440. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts +23 -4
  441. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts.map +1 -1
  442. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js +62 -21
  443. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js.map +1 -1
  444. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.d.ts.map +1 -1
  445. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js +1 -0
  446. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js.map +1 -1
  447. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts +17 -4
  448. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.d.ts.map +1 -1
  449. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js +21 -4
  450. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map +1 -1
  451. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.d.ts.map +1 -1
  452. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js +0 -2
  453. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js.map +1 -1
  454. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
  455. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js +0 -3
  456. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js.map +1 -1
  457. package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.d.ts.map +1 -1
  458. package/node_modules/matrix-js-sdk/lib/scheduler.d.ts.map +1 -1
  459. package/node_modules/matrix-js-sdk/lib/scheduler.js +0 -3
  460. package/node_modules/matrix-js-sdk/lib/scheduler.js.map +1 -1
  461. package/node_modules/matrix-js-sdk/lib/secret-storage.d.ts.map +1 -1
  462. package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts.map +1 -1
  463. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.d.ts.map +1 -1
  464. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js +6 -0
  465. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js.map +1 -1
  466. package/node_modules/matrix-js-sdk/lib/sliding-sync.d.ts.map +1 -1
  467. package/node_modules/matrix-js-sdk/lib/sliding-sync.js +3 -0
  468. package/node_modules/matrix-js-sdk/lib/sliding-sync.js.map +1 -1
  469. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts.map +1 -1
  470. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js +1 -1
  471. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js.map +1 -1
  472. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts.map +1 -1
  473. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.d.ts.map +1 -1
  474. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js +1 -0
  475. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js.map +1 -1
  476. package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts.map +1 -1
  477. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js +0 -2
  478. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js.map +1 -1
  479. package/node_modules/matrix-js-sdk/lib/store/memory.d.ts.map +1 -1
  480. package/node_modules/matrix-js-sdk/lib/store/memory.js +7 -9
  481. package/node_modules/matrix-js-sdk/lib/store/memory.js.map +1 -1
  482. package/node_modules/matrix-js-sdk/lib/store/stub.d.ts.map +1 -1
  483. package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts.map +1 -1
  484. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js +1 -5
  485. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js.map +1 -1
  486. package/node_modules/matrix-js-sdk/lib/sync.d.ts.map +1 -1
  487. package/node_modules/matrix-js-sdk/lib/sync.js +9 -9
  488. package/node_modules/matrix-js-sdk/lib/sync.js.map +1 -1
  489. package/node_modules/matrix-js-sdk/lib/testing.d.ts +2 -10
  490. package/node_modules/matrix-js-sdk/lib/testing.d.ts.map +1 -1
  491. package/node_modules/matrix-js-sdk/lib/testing.js +4 -19
  492. package/node_modules/matrix-js-sdk/lib/testing.js.map +1 -1
  493. package/node_modules/matrix-js-sdk/lib/timeline-window.d.ts.map +1 -1
  494. package/node_modules/matrix-js-sdk/lib/timeline-window.js +0 -1
  495. package/node_modules/matrix-js-sdk/lib/timeline-window.js.map +1 -1
  496. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.d.ts.map +1 -1
  497. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js +0 -1
  498. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js.map +1 -1
  499. package/node_modules/matrix-js-sdk/lib/utils.d.ts +1 -1
  500. package/node_modules/matrix-js-sdk/lib/utils.d.ts.map +1 -1
  501. package/node_modules/matrix-js-sdk/lib/utils.js +1 -0
  502. package/node_modules/matrix-js-sdk/lib/utils.js.map +1 -1
  503. package/node_modules/matrix-js-sdk/lib/webrtc/call.d.ts.map +1 -1
  504. package/node_modules/matrix-js-sdk/lib/webrtc/call.js.map +1 -1
  505. package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.d.ts.map +1 -1
  506. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.d.ts.map +1 -1
  507. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js +0 -5
  508. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js.map +1 -1
  509. package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.d.ts.map +1 -1
  510. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.d.ts.map +1 -1
  511. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js.map +1 -1
  512. package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.d.ts.map +1 -1
  513. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.d.ts.map +1 -1
  514. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js.map +1 -1
  515. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +1 -1
  516. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +1 -1
  517. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  518. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +1 -1
  519. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +1 -1
  520. package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.d.ts.map +1 -1
  521. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +1 -1
  522. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +1 -1
  523. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +1 -1
  524. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +1 -1
  525. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReportEmitter.d.ts.map +1 -1
  526. package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +1 -1
  527. package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.d.ts.map +1 -1
  528. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.d.ts.map +1 -1
  529. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  530. package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.d.ts.map +1 -1
  531. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts +8 -0
  532. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.d.ts.map +1 -0
  533. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js +34 -0
  534. package/node_modules/matrix-js-sdk/lib/wellKnownCachedValue.js.map +1 -0
  535. package/node_modules/matrix-js-sdk/node_modules/content-type/README.md +2 -0
  536. package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.d.ts +20 -0
  537. package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js +20 -14
  538. package/node_modules/matrix-js-sdk/node_modules/content-type/dist/index.js.map +1 -1
  539. package/node_modules/matrix-js-sdk/node_modules/content-type/package.json +1 -1
  540. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.js +227 -131
  541. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/dist/api.min.js +1 -1
  542. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.d.ts +1 -0
  543. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js +142 -97
  544. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/ClientWidgetApi.js.map +1 -1
  545. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.d.ts +15 -0
  546. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js +61 -19
  547. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/WidgetApi.js.map +1 -1
  548. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.d.ts +15 -11
  549. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js +19 -13
  550. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/driver/WidgetDriver.js.map +1 -1
  551. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.d.ts +1 -0
  552. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/index.js.map +1 -1
  553. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.d.ts +2 -1
  554. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js +2 -1
  555. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/ApiVersion.js.map +1 -1
  556. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.d.ts +5 -1
  557. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js +1 -0
  558. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/Capabilities.js.map +1 -1
  559. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.d.ts +24 -0
  560. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js +6 -0
  561. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/RtcTransportsAction.js.map +1 -0
  562. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.d.ts +1 -0
  563. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/SendEventAction.js.map +1 -1
  564. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.d.ts +5 -1
  565. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js +1 -0
  566. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/lib/interfaces/WidgetApiAction.js.map +1 -1
  567. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/package.json +1 -1
  568. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/ClientWidgetApi.ts +37 -14
  569. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/WidgetApi.ts +69 -0
  570. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/driver/WidgetDriver.ts +19 -12
  571. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/index.ts +1 -0
  572. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/ApiVersion.ts +2 -0
  573. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/Capabilities.ts +4 -0
  574. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/RtcTransportsAction.ts +44 -0
  575. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/SendEventAction.ts +1 -0
  576. package/node_modules/matrix-js-sdk/node_modules/matrix-widget-api/src/interfaces/WidgetApiAction.ts +5 -0
  577. package/node_modules/matrix-js-sdk/package.json +10 -12
  578. package/node_modules/matrix-js-sdk/src/@types/PushRules.ts +0 -5
  579. package/node_modules/matrix-js-sdk/src/@types/auth.ts +0 -12
  580. package/node_modules/matrix-js-sdk/src/@types/beacon.ts +1 -1
  581. package/node_modules/matrix-js-sdk/src/@types/crypto.ts +2 -6
  582. package/node_modules/matrix-js-sdk/src/@types/event.ts +3 -0
  583. package/node_modules/matrix-js-sdk/src/@types/extensible_events.ts +5 -6
  584. package/node_modules/matrix-js-sdk/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -1
  585. package/node_modules/matrix-js-sdk/src/@types/media.ts +1 -1
  586. package/node_modules/matrix-js-sdk/src/@types/partials.ts +0 -2
  587. package/node_modules/matrix-js-sdk/src/@types/requests.ts +0 -5
  588. package/node_modules/matrix-js-sdk/src/@types/search.ts +0 -2
  589. package/node_modules/matrix-js-sdk/src/@types/spaces.ts +0 -2
  590. package/node_modules/matrix-js-sdk/src/@types/synapse.ts +0 -2
  591. package/node_modules/matrix-js-sdk/src/@types/threepids.ts +2 -2
  592. package/node_modules/matrix-js-sdk/src/@types/type-guards.ts +126 -0
  593. package/node_modules/matrix-js-sdk/src/ToDeviceMessageQueue.ts +0 -2
  594. package/node_modules/matrix-js-sdk/src/autodiscovery.ts +2 -2
  595. package/node_modules/matrix-js-sdk/src/browser-index.ts +4 -4
  596. package/node_modules/matrix-js-sdk/src/client.ts +86 -133
  597. package/node_modules/matrix-js-sdk/src/common-crypto/key-passphrase.ts +1 -2
  598. package/node_modules/matrix-js-sdk/src/crypto/store/base.ts +1 -8
  599. package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store-backend.ts +3 -2
  600. package/node_modules/matrix-js-sdk/src/crypto/store/indexeddb-crypto-store.ts +1 -3
  601. package/node_modules/matrix-js-sdk/src/crypto/store/localStorage-crypto-store.ts +0 -1
  602. package/node_modules/matrix-js-sdk/src/crypto/store/memory-crypto-store.ts +1 -1
  603. package/node_modules/matrix-js-sdk/src/crypto-api/index.ts +1 -1
  604. package/node_modules/matrix-js-sdk/src/crypto-api/keybackup.ts +14 -7
  605. package/node_modules/matrix-js-sdk/src/crypto-api/verification.ts +23 -5
  606. package/node_modules/matrix-js-sdk/src/embedded.ts +34 -16
  607. package/node_modules/matrix-js-sdk/src/feature.ts +0 -3
  608. package/node_modules/matrix-js-sdk/src/filter-component.ts +1 -2
  609. package/node_modules/matrix-js-sdk/src/filter.ts +0 -3
  610. package/node_modules/matrix-js-sdk/src/http-api/fetch.ts +1 -1
  611. package/node_modules/matrix-js-sdk/src/http-api/index.ts +1 -23
  612. package/node_modules/matrix-js-sdk/src/http-api/interface.ts +0 -12
  613. package/node_modules/matrix-js-sdk/src/http-api/refresh.ts +0 -1
  614. package/node_modules/matrix-js-sdk/src/interactive-auth.ts +4 -4
  615. package/node_modules/matrix-js-sdk/src/logger.ts +0 -2
  616. package/node_modules/matrix-js-sdk/src/matrix.ts +1 -1
  617. package/node_modules/matrix-js-sdk/src/matrixrtc/CallMembership.ts +5 -5
  618. package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +73 -6
  619. package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager.ts +21 -2
  620. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +9 -6
  621. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManagerActionScheduler.ts +1 -1
  622. package/node_modules/matrix-js-sdk/src/matrixrtc/RTCEncryptionManager.ts +2 -2
  623. package/node_modules/matrix-js-sdk/src/matrixrtc/ToDeviceKeyTransport.ts +3 -3
  624. package/node_modules/matrix-js-sdk/src/matrixrtc/index.ts +1 -1
  625. package/node_modules/matrix-js-sdk/src/matrixrtc/membershipData/rtc.ts +19 -8
  626. package/node_modules/matrix-js-sdk/src/matrixrtc/types.ts +24 -7
  627. package/node_modules/matrix-js-sdk/src/matrixrtc/utils.ts +0 -2
  628. package/node_modules/matrix-js-sdk/src/models/event-timeline-set.ts +3 -3
  629. package/node_modules/matrix-js-sdk/src/models/event.ts +7 -13
  630. package/node_modules/matrix-js-sdk/src/models/invites-ignorer.ts +1 -1
  631. package/node_modules/matrix-js-sdk/src/models/poll.ts +1 -1
  632. package/node_modules/matrix-js-sdk/src/models/read-receipt.ts +1 -1
  633. package/node_modules/matrix-js-sdk/src/models/relations-container.ts +55 -19
  634. package/node_modules/matrix-js-sdk/src/models/relations.ts +1 -1
  635. package/node_modules/matrix-js-sdk/src/models/room-state.ts +0 -3
  636. package/node_modules/matrix-js-sdk/src/models/room.ts +15 -15
  637. package/node_modules/matrix-js-sdk/src/models/thread.ts +51 -6
  638. package/node_modules/matrix-js-sdk/src/oauth/authorize.ts +274 -0
  639. package/node_modules/matrix-js-sdk/src/oauth/discover.ts +102 -0
  640. package/node_modules/matrix-js-sdk/src/{oidc → oauth}/error.ts +8 -7
  641. package/node_modules/matrix-js-sdk/src/oauth/index.ts +297 -0
  642. package/node_modules/matrix-js-sdk/src/oauth/register.ts +166 -0
  643. package/node_modules/matrix-js-sdk/src/oauth/tokenRefresher.ts +77 -0
  644. package/node_modules/matrix-js-sdk/src/pollingCachedValue.ts +184 -0
  645. package/node_modules/matrix-js-sdk/src/pushprocessor.ts +3 -3
  646. package/node_modules/matrix-js-sdk/src/realtime-callbacks.ts +0 -1
  647. package/node_modules/matrix-js-sdk/src/receipt-accumulator.ts +1 -2
  648. package/node_modules/matrix-js-sdk/src/rendezvous/MSC4108SignInWithQR.ts +14 -16
  649. package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +2 -2
  650. package/node_modules/matrix-js-sdk/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -1
  651. package/node_modules/matrix-js-sdk/src/rtcTransportsCachedValue.ts +40 -0
  652. package/node_modules/matrix-js-sdk/src/rust-crypto/DehydratedDeviceManager.ts +14 -13
  653. package/node_modules/matrix-js-sdk/src/rust-crypto/OutgoingRequestProcessor.ts +0 -1
  654. package/node_modules/matrix-js-sdk/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
  655. package/node_modules/matrix-js-sdk/src/rust-crypto/backup.ts +67 -33
  656. package/node_modules/matrix-js-sdk/src/rust-crypto/device-converter.ts +1 -0
  657. package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +32 -23
  658. package/node_modules/matrix-js-sdk/src/rust-crypto/libolm_migration.ts +1 -3
  659. package/node_modules/matrix-js-sdk/src/rust-crypto/rust-crypto.ts +3 -6
  660. package/node_modules/matrix-js-sdk/src/scheduler.ts +0 -3
  661. package/node_modules/matrix-js-sdk/src/sliding-sync-sdk.ts +4 -1
  662. package/node_modules/matrix-js-sdk/src/sliding-sync.ts +3 -1
  663. package/node_modules/matrix-js-sdk/src/store/indexeddb-local-backend.ts +1 -1
  664. package/node_modules/matrix-js-sdk/src/store/indexeddb-store-worker.ts +1 -0
  665. package/node_modules/matrix-js-sdk/src/store/indexeddb.ts +0 -2
  666. package/node_modules/matrix-js-sdk/src/store/memory.ts +7 -9
  667. package/node_modules/matrix-js-sdk/src/sync-accumulator.ts +1 -3
  668. package/node_modules/matrix-js-sdk/src/sync.ts +13 -14
  669. package/node_modules/matrix-js-sdk/src/testing.ts +3 -22
  670. package/node_modules/matrix-js-sdk/src/timeline-window.ts +0 -1
  671. package/node_modules/matrix-js-sdk/src/utils/internal/deriveKeys.ts +0 -1
  672. package/node_modules/matrix-js-sdk/src/utils.ts +3 -2
  673. package/node_modules/matrix-js-sdk/src/webrtc/call.ts +6 -6
  674. package/node_modules/matrix-js-sdk/src/webrtc/callEventTypes.ts +0 -5
  675. package/node_modules/matrix-js-sdk/src/webrtc/groupCall.ts +7 -7
  676. package/node_modules/matrix-js-sdk/src/webrtc/mediaHandler.ts +1 -1
  677. package/node_modules/matrix-js-sdk/src/webrtc/stats/callStatsReportGatherer.ts +2 -2
  678. package/node_modules/matrix-js-sdk/src/webrtc/stats/transportStatsBuilder.ts +1 -1
  679. package/node_modules/matrix-js-sdk/src/wellKnownCachedValue.ts +34 -0
  680. package/node_modules/music-metadata/LICENSE.txt +9 -9
  681. package/node_modules/music-metadata/README.md +878 -878
  682. package/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
  683. package/node_modules/music-metadata/lib/ParseError.js +1 -1
  684. package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
  685. package/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
  686. package/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
  687. package/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
  688. package/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
  689. package/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
  690. package/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
  691. package/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
  692. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
  693. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
  694. package/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
  695. package/node_modules/music-metadata/node_modules/content-type/README.md +2 -0
  696. package/node_modules/music-metadata/node_modules/content-type/dist/index.d.ts +20 -0
  697. package/node_modules/music-metadata/node_modules/content-type/dist/index.js +20 -14
  698. package/node_modules/music-metadata/node_modules/content-type/dist/index.js.map +1 -1
  699. package/node_modules/music-metadata/node_modules/content-type/package.json +1 -1
  700. package/node_modules/music-metadata/node_modules/file-type/package.json +1 -1
  701. package/node_modules/music-metadata/node_modules/file-type/readme.md +3 -0
  702. package/node_modules/music-metadata/node_modules/file-type/source/detectors/zip.js +6 -1
  703. package/node_modules/music-metadata/node_modules/file-type/source/index.d.ts +3 -0
  704. package/node_modules/music-metadata/node_modules/file-type/source/index.js +25 -13
  705. package/node_modules/music-metadata/package.json +156 -156
  706. package/node_modules/typebox/build/format/date.d.mts +1 -1
  707. package/node_modules/typebox/build/format/date.mjs +1 -1
  708. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  709. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  710. package/node_modules/typebox/build/format/email.d.mts +1 -1
  711. package/node_modules/typebox/build/format/email.mjs +2 -2
  712. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  713. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  714. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  715. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  716. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  717. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  718. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  719. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  720. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  721. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  722. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  723. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  724. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
  725. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  726. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  727. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  728. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  729. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  730. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  731. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  732. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  733. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  734. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  735. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  736. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  737. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  738. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  739. package/node_modules/typebox/build/format/iri.mjs +26 -8
  740. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  741. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  742. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  743. package/node_modules/typebox/build/format/regex.mjs +2 -6
  744. package/node_modules/typebox/build/format/time.d.mts +2 -2
  745. package/node_modules/typebox/build/format/time.mjs +19 -14
  746. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  747. package/node_modules/typebox/build/format/uri.mjs +3 -130
  748. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  749. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  750. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  751. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  752. package/node_modules/typebox/build/format/url.d.mts +3 -3
  753. package/node_modules/typebox/build/format/url.mjs +4 -5
  754. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  755. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  756. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  757. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  758. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  759. package/node_modules/typebox/build/guard/string.mjs +7 -7
  760. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  761. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  762. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  763. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  764. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  765. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  766. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  767. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  768. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  769. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  770. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  771. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  772. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  773. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  774. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  775. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  776. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  777. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  778. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  779. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  780. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  781. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  782. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  783. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  784. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  785. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  786. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  787. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  788. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  789. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  790. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  791. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  792. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  793. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  794. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  795. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  796. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  797. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  798. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  799. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  800. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  801. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  802. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  803. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  804. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  805. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  806. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  807. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  808. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  809. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  810. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  811. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  812. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  813. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  814. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  815. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  816. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  817. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  818. package/node_modules/typebox/package.json +27 -27
  819. package/node_modules/typebox/readme.md +79 -82
  820. package/openclaw.plugin.json +16 -1
  821. package/package.json +10 -10
  822. package/dist/env-auth-MVS-Vv41.js +0 -64
  823. package/dist/file-sync-store-DjskBX2o.js +0 -436
  824. package/dist/media-text-Dh-DpTc3.js +0 -149
  825. package/dist/probe.runtime-NIJZYqc2.js +0 -2
  826. package/dist/recovery-key-store-CognuDys.js +0 -276
  827. package/dist/runtime-api-BGO16Fu8.js +0 -21
  828. package/dist/timeout-abort-signal-DMrgRFIy.js +0 -2
  829. package/node_modules/markdown-it/dist/index.cjs.js.map +0 -1
  830. package/node_modules/markdown-it/dist/markdown-it.js +0 -3975
  831. package/node_modules/markdown-it/dist/markdown-it.js.map +0 -1
  832. package/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  833. package/node_modules/markdown-it/dist/markdown-it.min.js.map +0 -1
  834. package/node_modules/markdown-it/index.mjs +0 -1
  835. package/node_modules/markdown-it/lib/common/html_blocks.mjs +0 -67
  836. package/node_modules/markdown-it/lib/common/html_re.mjs +0 -25
  837. package/node_modules/markdown-it/lib/common/utils.mjs +0 -324
  838. package/node_modules/markdown-it/lib/helpers/index.mjs +0 -11
  839. package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +0 -77
  840. package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +0 -49
  841. package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +0 -66
  842. package/node_modules/markdown-it/lib/index.mjs +0 -565
  843. package/node_modules/markdown-it/lib/parser_block.mjs +0 -134
  844. package/node_modules/markdown-it/lib/parser_core.mjs +0 -62
  845. package/node_modules/markdown-it/lib/parser_inline.mjs +0 -197
  846. package/node_modules/markdown-it/lib/presets/commonmark.mjs +0 -88
  847. package/node_modules/markdown-it/lib/presets/default.mjs +0 -47
  848. package/node_modules/markdown-it/lib/presets/zero.mjs +0 -70
  849. package/node_modules/markdown-it/lib/renderer.mjs +0 -322
  850. package/node_modules/markdown-it/lib/ruler.mjs +0 -340
  851. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +0 -209
  852. package/node_modules/markdown-it/lib/rules_block/code.mjs +0 -30
  853. package/node_modules/markdown-it/lib/rules_block/fence.mjs +0 -94
  854. package/node_modules/markdown-it/lib/rules_block/heading.mjs +0 -51
  855. package/node_modules/markdown-it/lib/rules_block/hr.mjs +0 -40
  856. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +0 -80
  857. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +0 -85
  858. package/node_modules/markdown-it/lib/rules_block/list.mjs +0 -331
  859. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +0 -48
  860. package/node_modules/markdown-it/lib/rules_block/reference.mjs +0 -212
  861. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +0 -220
  862. package/node_modules/markdown-it/lib/rules_block/table.mjs +0 -228
  863. package/node_modules/markdown-it/lib/rules_core/block.mjs +0 -13
  864. package/node_modules/markdown-it/lib/rules_core/inline.mjs +0 -11
  865. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +0 -134
  866. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +0 -17
  867. package/node_modules/markdown-it/lib/rules_core/replacements.mjs +0 -101
  868. package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +0 -209
  869. package/node_modules/markdown-it/lib/rules_core/state_core.mjs +0 -17
  870. package/node_modules/markdown-it/lib/rules_core/text_join.mjs +0 -43
  871. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +0 -72
  872. package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +0 -60
  873. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +0 -124
  874. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +0 -123
  875. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +0 -51
  876. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +0 -83
  877. package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +0 -38
  878. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +0 -50
  879. package/node_modules/markdown-it/lib/rules_inline/image.mjs +0 -138
  880. package/node_modules/markdown-it/lib/rules_inline/link.mjs +0 -139
  881. package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +0 -63
  882. package/node_modules/markdown-it/lib/rules_inline/newline.mjs +0 -42
  883. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +0 -154
  884. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +0 -127
  885. package/node_modules/markdown-it/lib/rules_inline/text.mjs +0 -86
  886. package/node_modules/markdown-it/lib/token.mjs +0 -191
  887. package/node_modules/markdown-it/node_modules/argparse/CHANGELOG.md +0 -216
  888. package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts +0 -211
  889. package/node_modules/markdown-it/node_modules/entities/lib/decode.d.ts.map +0 -1
  890. package/node_modules/markdown-it/node_modules/entities/lib/decode.js +0 -536
  891. package/node_modules/markdown-it/node_modules/entities/lib/decode.js.map +0 -1
  892. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts +0 -19
  893. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts.map +0 -1
  894. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js +0 -76
  895. package/node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js.map +0 -1
  896. package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts +0 -22
  897. package/node_modules/markdown-it/node_modules/entities/lib/encode.d.ts.map +0 -1
  898. package/node_modules/markdown-it/node_modules/entities/lib/encode.js +0 -77
  899. package/node_modules/markdown-it/node_modules/entities/lib/encode.js.map +0 -1
  900. package/node_modules/markdown-it/node_modules/entities/lib/escape.d.ts.map +0 -1
  901. package/node_modules/markdown-it/node_modules/entities/lib/escape.js +0 -122
  902. package/node_modules/markdown-it/node_modules/entities/lib/escape.js.map +0 -1
  903. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts.map +0 -1
  904. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode.js.map +0 -1
  905. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts +0 -19
  906. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +0 -1
  907. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js +0 -71
  908. package/node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js.map +0 -1
  909. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts.map +0 -1
  910. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js +0 -69
  911. package/node_modules/markdown-it/node_modules/entities/lib/esm/encode.js.map +0 -1
  912. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts +0 -43
  913. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts.map +0 -1
  914. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js +0 -116
  915. package/node_modules/markdown-it/node_modules/entities/lib/esm/escape.js.map +0 -1
  916. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +0 -3
  917. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +0 -1
  918. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
  919. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js.map +0 -1
  920. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +0 -3
  921. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +0 -1
  922. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
  923. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +0 -1
  924. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts +0 -8
  925. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +0 -1
  926. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js +0 -10
  927. package/node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js.map +0 -1
  928. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts +0 -96
  929. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts.map +0 -1
  930. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js +0 -99
  931. package/node_modules/markdown-it/node_modules/entities/lib/esm/index.js.map +0 -1
  932. package/node_modules/markdown-it/node_modules/entities/lib/esm/package.json +0 -1
  933. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts +0 -3
  934. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts.map +0 -1
  935. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js +0 -9
  936. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
  937. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts +0 -3
  938. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +0 -1
  939. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js +0 -9
  940. package/node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
  941. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts +0 -8
  942. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts.map +0 -1
  943. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js +0 -12
  944. package/node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js.map +0 -1
  945. package/node_modules/markdown-it/node_modules/entities/lib/index.d.ts.map +0 -1
  946. package/node_modules/markdown-it/node_modules/entities/lib/index.js +0 -126
  947. package/node_modules/markdown-it/node_modules/entities/lib/index.js.map +0 -1
  948. package/node_modules/markdown-it/node_modules/linkify-it/index.mjs +0 -646
  949. package/node_modules/markdown-it/node_modules/linkify-it/lib/re.mjs +0 -193
  950. package/node_modules/markdown-it/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
  951. package/node_modules/markdown-it/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
  952. package/node_modules/markdown-it/node_modules/uc.micro/categories/P/regex.mjs +0 -1
  953. package/node_modules/markdown-it/node_modules/uc.micro/categories/S/regex.mjs +0 -1
  954. package/node_modules/markdown-it/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
  955. package/node_modules/markdown-it/node_modules/uc.micro/index.mjs +0 -8
  956. package/node_modules/markdown-it/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
  957. package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts +0 -157
  958. package/node_modules/matrix-js-sdk/lib/oidc/authorize.d.ts.map +0 -1
  959. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js +0 -365
  960. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js.map +0 -1
  961. package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts +0 -22
  962. package/node_modules/matrix-js-sdk/lib/oidc/discovery.d.ts.map +0 -1
  963. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js +0 -65
  964. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js.map +0 -1
  965. package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts +0 -18
  966. package/node_modules/matrix-js-sdk/lib/oidc/error.d.ts.map +0 -1
  967. package/node_modules/matrix-js-sdk/lib/oidc/error.js +0 -35
  968. package/node_modules/matrix-js-sdk/lib/oidc/error.js.map +0 -1
  969. package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts +0 -16
  970. package/node_modules/matrix-js-sdk/lib/oidc/index.d.ts.map +0 -1
  971. package/node_modules/matrix-js-sdk/lib/oidc/index.js +0 -30
  972. package/node_modules/matrix-js-sdk/lib/oidc/index.js.map +0 -1
  973. package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts +0 -70
  974. package/node_modules/matrix-js-sdk/lib/oidc/register.d.ts.map +0 -1
  975. package/node_modules/matrix-js-sdk/lib/oidc/register.js +0 -134
  976. package/node_modules/matrix-js-sdk/lib/oidc/register.js.map +0 -1
  977. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts +0 -91
  978. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.d.ts.map +0 -1
  979. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js +0 -173
  980. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js.map +0 -1
  981. package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts +0 -78
  982. package/node_modules/matrix-js-sdk/lib/oidc/validate.d.ts.map +0 -1
  983. package/node_modules/matrix-js-sdk/lib/oidc/validate.js +0 -181
  984. package/node_modules/matrix-js-sdk/lib/oidc/validate.js.map +0 -1
  985. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/LICENSE +0 -21
  986. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/README.md +0 -134
  987. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.d.ts +0 -23
  988. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/index.js +0 -62
  989. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/cjs/package.json +0 -1
  990. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.d.ts +0 -23
  991. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/build/esm/index.js +0 -57
  992. package/node_modules/matrix-js-sdk/node_modules/jwt-decode/package.json +0 -81
  993. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/LICENSE +0 -202
  994. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/README.md +0 -87
  995. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js +0 -3751
  996. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.js.map +0 -7
  997. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js +0 -2
  998. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/browser/oidc-client-ts.min.js.map +0 -7
  999. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js +0 -3671
  1000. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js.map +0 -7
  1001. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/esm/package.json +0 -4
  1002. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/oidc-client-ts.d.ts +0 -2003
  1003. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/types/tsdoc-metadata.json +0 -11
  1004. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js +0 -3719
  1005. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/dist/umd/oidc-client-ts.js.map +0 -7
  1006. package/node_modules/matrix-js-sdk/node_modules/oidc-client-ts/package.json +0 -75
  1007. package/node_modules/matrix-js-sdk/src/oidc/authorize.ts +0 -431
  1008. package/node_modules/matrix-js-sdk/src/oidc/discovery.ts +0 -67
  1009. package/node_modules/matrix-js-sdk/src/oidc/index.ts +0 -33
  1010. package/node_modules/matrix-js-sdk/src/oidc/register.ts +0 -168
  1011. package/node_modules/matrix-js-sdk/src/oidc/tokenRefresher.ts +0 -184
  1012. package/node_modules/matrix-js-sdk/src/oidc/validate.ts +0 -265
  1013. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  1014. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  1015. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  1016. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  1017. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  1018. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  1019. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  1020. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  1021. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  1022. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rtcTransportsCachedValue.js","names":[],"sources":["../src/rtcTransportsCachedValue.ts"],"sourcesContent":["/*\nCopyright 2026 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { PollingCachedValue } from \"./pollingCachedValue.ts\";\nimport { type Transport } from \"./matrixrtc/index.ts\";\nimport { ClientEvent, type MatrixClient } from \"./client.ts\";\nimport { type Logger } from \"./logger.ts\";\nimport { MatrixError } from \"./http-api/index.ts\";\n\nconst TRANSPORT_CACHE_TTL_MILLISECONDS = 1000 * 60 * 60 * 24; // 1 day\n\n/**\n * Builds a cache for the rtc/transport discovery end-point of the given client.\n */\nexport function createRtcTransportsCachedValue(client: MatrixClient, logger: Logger): PollingCachedValue<Transport[]> {\n return new PollingCachedValue({\n name: \"RTCTransports\",\n logger,\n ttlMillis: TRANSPORT_CACHE_TTL_MILLISECONDS,\n fetch: () => client._unstable_getRTCTransports(),\n onValueCached: (transports) => client.emit(ClientEvent.RtcTransportsUpdated, transports),\n // If the end point is not supported by the homeserver it will be a 404 error.\n // This is a final error, it can be cached, no need to retry everytime.\n // It will retry when ttl has expired.\n shouldCacheError: (error) => error instanceof MatrixError && error.httpStatus === 404,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,kBAAkB,QAAQ,yBAAyB;AAE5D,SAAS,WAAW,QAA2B,aAAa;AAE5D,SAAS,WAAW,QAAQ,qBAAqB;AAEjD,MAAM,gCAAgC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;;AAE9D;AACA;AACA;AACA,OAAO,SAAS,8BAA8B,CAAC,MAAoB,EAAE,MAAc,EAAmC;EAClH,OAAO,IAAI,kBAAkB,CAAC;IAC1B,IAAI,EAAE,eAAe;IACrB,MAAM;IACN,SAAS,EAAE,gCAAgC;IAC3C,KAAK,EAAE,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;IAChD,aAAa,EAAG,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,EAAE,UAAU,CAAC;IACxF;IACA;IACA;IACA,gBAAgB,EAAG,KAAK,IAAK,KAAK,YAAY,WAAW,IAAI,KAAK,CAAC,UAAU,KAAK;EACtF,CAAC,CAAC;AACN","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"CrossSigningIdentity.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/CrossSigningIdentity.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,UAAU,EAGlB,MAAM,oCAAoC,C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OAeG;IACU,KAAK,CAAC,IAAI,GAAE,oBAAoB,GAAG,OAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB3E;IAED;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAE3C;IAED;;;;;;OAMG;IACU,QAAQ,IAAI,OAAO,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAMpE;IAED;;;;;;OAMG;YACW,MAAM;IAuBpB;;;;;;;OAOG;IACU,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC,CA2E1D;IAED;;;;OAIG;IACU,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC,CAW5D;IAED;;OAEG;IACU,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAWtD;IAED;;;;OAIG;IACI,IAAI,IAAI,IAAI,CAKlB;IAED;;OAEG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAwBnC;CACJ;AAED;;;GAGG;AACH,KAAK,uBAAuB,GACtB,WAAW,CAAC,uBAAuB,GACnC,WAAW,CAAC,wBAAwB,GACpC,WAAW,CAAC,kBAAkB,GAC9B,WAAW,CAAC,mBAAmB,GAC/B,WAAW,CAAC,oBAAoB,GAChC,WAAW,CAAC,gBAAgB,GAC5B,WAAW,CAAC,oBAAoB,GAChC,WAAW,CAAC,6BAA6B,CAAC;AAEhD;;;GAGG;AACH,KAAK,yBAAyB,GAAG,IAAI,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC"}
@@ -27,7 +27,7 @@ import { TypedEventEmitter } from "../models/typed-event-emitter.js";
27
27
  */
28
28
 
29
29
  /**
30
- * The response body of `POST /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/events`.
30
+ * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/{device_id}/events`.
31
31
  */
32
32
 
33
33
  /**
@@ -229,22 +229,20 @@ export class DehydratedDeviceManager extends TypedEventEmitter {
229
229
  const path = encodeUri("/dehydrated_device/$device_id/events", {
230
230
  $device_id: dehydratedDeviceResp.device_id
231
231
  });
232
- // eslint-disable-next-line no-constant-condition
233
- while (true) {
234
- const eventResp = await this.http.authedRequest(Method.Post, path, undefined, nextBatch ? {
235
- next_batch: nextBatch
236
- } : {}, {
232
+ do {
233
+ const eventResp = await this.http.authedRequest(Method.Get, path, nextBatch ? {
234
+ from: nextBatch
235
+ } : undefined, undefined, {
237
236
  prefix: UnstablePrefix
238
237
  });
239
- if (eventResp.events.length === 0) {
240
- break;
241
- }
242
238
  toDeviceCount += eventResp.events.length;
243
239
  nextBatch = eventResp.next_batch;
244
- const roomKeyInfos = await rehydratedDevice.receiveEvents(JSON.stringify(eventResp.events));
245
- roomKeyCount += roomKeyInfos.length;
246
- this.emit(CryptoEvent.RehydrationProgress, roomKeyCount, toDeviceCount);
247
- }
240
+ if (eventResp.events.length > 0) {
241
+ const roomKeyInfos = await rehydratedDevice.receiveEvents(JSON.stringify(eventResp.events));
242
+ roomKeyCount += roomKeyInfos.length;
243
+ this.emit(CryptoEvent.RehydrationProgress, roomKeyCount, toDeviceCount);
244
+ }
245
+ } while (nextBatch !== undefined);
248
246
  this.logger.info(`dehydration: received ${roomKeyCount} room keys from ${toDeviceCount} to-device events`);
249
247
  this.emit(CryptoEvent.RehydrationCompleted);
250
248
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"DehydratedDeviceManager.js","names":[],"sources":["../../src/rust-crypto/DehydratedDeviceManager.ts"],"sourcesContent":["/*\nCopyright 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport { type OutgoingRequestProcessor } from \"./OutgoingRequestProcessor.ts\";\nimport { encodeUri } from \"../utils.ts\";\nimport { type IHttpOpts, type MatrixError, type MatrixHttpApi, Method } from \"../http-api/index.ts\";\nimport { type IToDeviceEvent } from \"../sync-accumulator.ts\";\nimport { type ServerSideSecretStorage } from \"../secret-storage.ts\";\nimport { decodeBase64 } from \"../base64.ts\";\nimport { type Logger } from \"../logger.ts\";\nimport { CryptoEvent, type CryptoEventHandlerMap, type StartDehydrationOpts } from \"../crypto-api/index.ts\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\n\n/**\n * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device`.\n */\ninterface DehydratedDeviceResp {\n device_id: string;\n device_data: {\n algorithm: string;\n };\n}\n/**\n * The response body of `POST /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/events`.\n */\ninterface DehydratedDeviceEventsResp {\n events: IToDeviceEvent[];\n next_batch: string;\n}\n\n/**\n * The unstable URL prefix for dehydrated device endpoints\n */\nexport const UnstablePrefix = \"/_matrix/client/unstable/org.matrix.msc3814.v1\";\n/**\n * The name used for the dehydration key in Secret Storage\n */\nconst SECRET_STORAGE_NAME = \"org.matrix.msc3814\";\n\n/**\n * The interval between creating dehydrated devices. (one week)\n */\nconst DEHYDRATION_INTERVAL = 7 * 24 * 60 * 60 * 1000;\n\n/**\n * Manages dehydrated devices\n *\n * We have one of these per `RustCrypto`. It's responsible for\n *\n * * determining server support for dehydrated devices\n * * creating new dehydrated devices when requested, including periodically\n * replacing the dehydrated device with a new one\n * * rehydrating a device when requested, and when present\n *\n * @internal\n */\nexport class DehydratedDeviceManager extends TypedEventEmitter<DehydratedDevicesEvents, DehydratedDevicesEventMap> {\n /** the ID of the interval for periodically replacing the dehydrated device */\n private intervalId?: ReturnType<typeof setInterval>;\n\n public constructor(\n private readonly logger: Logger,\n private readonly olmMachine: RustSdkCryptoJs.OlmMachine,\n private readonly http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n private readonly outgoingRequestProcessor: OutgoingRequestProcessor,\n private readonly secretStorage: ServerSideSecretStorage,\n ) {\n super();\n }\n\n private async cacheKey(key: RustSdkCryptoJs.DehydratedDeviceKey): Promise<void> {\n await this.olmMachine.dehydratedDevices().saveDehydratedDeviceKey(key);\n this.emit(CryptoEvent.DehydrationKeyCached);\n }\n\n /**\n * Return whether the server supports dehydrated devices.\n */\n public async isSupported(): Promise<boolean> {\n // call the endpoint to get a dehydrated device. If it returns an\n // M_UNRECOGNIZED error, then dehydration is unsupported. If it returns\n // a successful response, or an M_NOT_FOUND, then dehydration is supported.\n // Any other exceptions are passed through.\n try {\n await this.http.authedRequest<DehydratedDeviceResp>(\n Method.Get,\n \"/dehydrated_device\",\n undefined,\n undefined,\n {\n prefix: UnstablePrefix,\n },\n );\n } catch (error) {\n const err = error as MatrixError;\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return false;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return true;\n }\n throw error;\n }\n return true;\n }\n\n /**\n * Start using device dehydration.\n *\n * - Rehydrates a dehydrated device, if one is available and `opts.rehydrate`\n * is `true`.\n * - Creates a new dehydration key, if necessary, and stores it in Secret\n * Storage.\n * - If `opts.createNewKey` is set to true, always creates a new key.\n * - If a dehydration key is not available, creates a new one.\n * - Creates a new dehydrated device, and schedules periodically creating\n * new dehydrated devices.\n *\n * @param opts - options for device dehydration. For backwards compatibility\n * with old code, a boolean can be given here, which will be treated as\n * the `createNewKey` option. However, this is deprecated.\n */\n public async start(opts: StartDehydrationOpts | boolean = {}): Promise<void> {\n if (typeof opts === \"boolean\") {\n opts = { createNewKey: opts };\n }\n\n if (opts.onlyIfKeyCached && !(await this.olmMachine.dehydratedDevices().getDehydratedDeviceKey())) {\n return;\n }\n this.stop();\n if (opts.rehydrate !== false) {\n try {\n await this.rehydrateDeviceIfAvailable();\n } catch (e) {\n // If rehydration fails, there isn't much we can do about it. Log\n // the error, and create a new device.\n this.logger.info(\"dehydration: Error rehydrating device:\", e);\n this.emit(CryptoEvent.RehydrationError, (e as Error).message);\n }\n }\n if (opts.createNewKey) {\n await this.resetKey();\n }\n await this.scheduleDeviceDehydration();\n }\n\n /**\n * Return whether the dehydration key is stored in Secret Storage.\n */\n public async isKeyStored(): Promise<boolean> {\n return Boolean(await this.secretStorage.isStored(SECRET_STORAGE_NAME));\n }\n\n /**\n * Reset the dehydration key.\n *\n * Creates a new key and stores it in secret storage.\n *\n * @returns The newly-generated key.\n */\n public async resetKey(): Promise<RustSdkCryptoJs.DehydratedDeviceKey> {\n const key = RustSdkCryptoJs.DehydratedDeviceKey.createRandomKey();\n await this.secretStorage.store(SECRET_STORAGE_NAME, key.toBase64());\n // Also cache it in the rust SDK's crypto store.\n await this.cacheKey(key);\n return key;\n }\n\n /**\n * Get and cache the encryption key from secret storage.\n *\n * If `create` is `true`, creates a new key if no existing key is present.\n *\n * @returns the key, if available, or `null` if no key is available\n */\n private async getKey(create: boolean): Promise<RustSdkCryptoJs.DehydratedDeviceKey | null> {\n const cachedKey = await this.olmMachine.dehydratedDevices().getDehydratedDeviceKey();\n if (cachedKey) return cachedKey;\n const keyB64 = await this.secretStorage.get(SECRET_STORAGE_NAME);\n if (keyB64 === undefined) {\n if (!create) {\n return null;\n }\n return await this.resetKey();\n }\n\n // We successfully found the key in secret storage: decode it, and cache it in\n // the rust SDK's crypto store.\n const bytes = decodeBase64(keyB64);\n try {\n const key = RustSdkCryptoJs.DehydratedDeviceKey.createKeyFromArray(bytes);\n await this.cacheKey(key);\n return key;\n } finally {\n bytes.fill(0);\n }\n }\n\n /**\n * Rehydrate the dehydrated device stored on the server.\n *\n * Checks if there is a dehydrated device on the server. If so, rehydrates\n * the device and processes the to-device events.\n *\n * Returns whether or not a dehydrated device was found.\n */\n public async rehydrateDeviceIfAvailable(): Promise<boolean> {\n const key = await this.getKey(false);\n if (!key) {\n return false;\n }\n\n let dehydratedDeviceResp;\n try {\n dehydratedDeviceResp = await this.http.authedRequest<DehydratedDeviceResp>(\n Method.Get,\n \"/dehydrated_device\",\n undefined,\n undefined,\n {\n prefix: UnstablePrefix,\n },\n );\n } catch (error) {\n const err = error as MatrixError;\n // We ignore M_NOT_FOUND (there is no dehydrated device, so nothing\n // us to do) and M_UNRECOGNIZED (the server does not understand the\n // endpoint). We pass through any other errors.\n if (err.errcode === \"M_NOT_FOUND\" || err.errcode === \"M_UNRECOGNIZED\") {\n this.logger.info(\"dehydration: No dehydrated device\");\n return false;\n }\n throw err;\n }\n\n this.logger.info(\"dehydration: dehydrated device found\");\n this.emit(CryptoEvent.RehydrationStarted);\n\n const rehydratedDevice = await this.olmMachine\n .dehydratedDevices()\n .rehydrate(\n key,\n new RustSdkCryptoJs.DeviceId(dehydratedDeviceResp.device_id),\n JSON.stringify(dehydratedDeviceResp.device_data),\n );\n\n this.logger.info(\"dehydration: device rehydrated\");\n\n let nextBatch: string | undefined = undefined;\n let toDeviceCount = 0;\n let roomKeyCount = 0;\n const path = encodeUri(\"/dehydrated_device/$device_id/events\", {\n $device_id: dehydratedDeviceResp.device_id,\n });\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const eventResp: DehydratedDeviceEventsResp = await this.http.authedRequest<DehydratedDeviceEventsResp>(\n Method.Post,\n path,\n undefined,\n nextBatch ? { next_batch: nextBatch } : {},\n {\n prefix: UnstablePrefix,\n },\n );\n\n if (eventResp.events.length === 0) {\n break;\n }\n toDeviceCount += eventResp.events.length;\n nextBatch = eventResp.next_batch;\n const roomKeyInfos = await rehydratedDevice.receiveEvents(JSON.stringify(eventResp.events));\n roomKeyCount += roomKeyInfos.length;\n\n this.emit(CryptoEvent.RehydrationProgress, roomKeyCount, toDeviceCount);\n }\n this.logger.info(`dehydration: received ${roomKeyCount} room keys from ${toDeviceCount} to-device events`);\n this.emit(CryptoEvent.RehydrationCompleted);\n\n return true;\n }\n\n /**\n * Creates and uploads a new dehydrated device.\n *\n * Creates and stores a new key in secret storage if none is available.\n */\n public async createAndUploadDehydratedDevice(): Promise<void> {\n const key = (await this.getKey(true))!;\n\n const dehydratedDevice = await this.olmMachine.dehydratedDevices().create();\n this.emit(CryptoEvent.DehydratedDeviceCreated);\n const request = await dehydratedDevice.keysForUpload(\"Dehydrated device\", key);\n\n await this.outgoingRequestProcessor.makeOutgoingRequest(request);\n this.emit(CryptoEvent.DehydratedDeviceUploaded);\n\n this.logger.info(\"dehydration: uploaded device\");\n }\n\n /**\n * Schedule periodic creation of dehydrated devices.\n */\n public async scheduleDeviceDehydration(): Promise<void> {\n // cancel any previously-scheduled tasks\n this.stop();\n\n await this.createAndUploadDehydratedDevice();\n this.intervalId = setInterval(() => {\n this.createAndUploadDehydratedDevice().catch((error) => {\n this.emit(CryptoEvent.DehydratedDeviceRotationError, error.message);\n this.logger.error(\"Error creating dehydrated device:\", error);\n });\n }, DEHYDRATION_INTERVAL);\n }\n\n /**\n * Stop the dehydrated device manager.\n *\n * Cancels any scheduled dehydration tasks.\n */\n public stop(): void {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = undefined;\n }\n }\n\n /**\n * Delete the current dehydrated device and stop the dehydrated device manager.\n */\n public async delete(): Promise<void> {\n this.stop();\n try {\n await this.http.authedRequest(\n Method.Delete,\n \"/dehydrated_device\",\n undefined,\n {},\n {\n prefix: UnstablePrefix,\n },\n );\n } catch (error) {\n const err = error as MatrixError;\n // If dehydrated devices aren't supported, or no dehydrated device\n // is found, we don't consider it an error, because we we'll end up\n // with no dehydrated device.\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return;\n }\n throw error;\n }\n }\n}\n\n/**\n * The events fired by the DehydratedDeviceManager\n * @internal\n */\ntype DehydratedDevicesEvents =\n | CryptoEvent.DehydratedDeviceCreated\n | CryptoEvent.DehydratedDeviceUploaded\n | CryptoEvent.RehydrationStarted\n | CryptoEvent.RehydrationProgress\n | CryptoEvent.RehydrationCompleted\n | CryptoEvent.RehydrationError\n | CryptoEvent.DehydrationKeyCached\n | CryptoEvent.DehydratedDeviceRotationError;\n\n/**\n * A map of the {@link DehydratedDeviceEvents} fired by the {@link DehydratedDeviceManager} and their payloads.\n * @internal\n */\ntype DehydratedDevicesEventMap = Pick<CryptoEventHandlerMap, DehydratedDevicesEvents>;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAK,eAAe,MAAM,oCAAoC;AAGrE,SAAS,SAAS,QAAQ,aAAa;AACvC,SAA+D,MAAM,QAAQ,sBAAsB;AAGnG,SAAS,YAAY,QAAQ,cAAc;AAE3C,SAAS,WAAW,QAA+D,wBAAwB;AAC3G,SAAS,iBAAiB,QAAQ,kCAAkC;;AAEpE;AACA;AACA;;AAOA;AACA;AACA;;AAMA;AACA;AACA;AACA,OAAO,MAAM,cAAc,GAAG,gDAAgD;AAC9E;AACA;AACA;AACA,MAAM,mBAAmB,GAAG,oBAAoB;;AAEhD;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,uBAAuB,SAAS,iBAAiB,CAAqD;EAIxG,WAAW,CACG,MAAc,EACd,UAAsC,EACtC,IAAmD,EACnD,wBAAkD,EAClD,aAAsC,EACzD;IACE,KAAK,CAAC,CAAC;IAVX;IAAA;IAAA,KAIqB,MAAc,GAAd,MAAc;IAAA,KACd,UAAsC,GAAtC,UAAsC;IAAA,KACtC,IAAmD,GAAnD,IAAmD;IAAA,KACnD,wBAAkD,GAAlD,wBAAkD;IAAA,KAClD,aAAsC,GAAtC,aAAsC;EAG3D;EAEA,MAAc,QAAQ,CAAC,GAAwC,EAAiB;IAC5E,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,C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,KAAK,gBAAgB,EAAE;QAClC;MACJ,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,aAAa,EAAE;QACtC;MACJ;MACA,MAAM,KAAK;IACf;EACJ;AACJ;;AAEA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"DehydratedDeviceManager.js","names":[],"sources":["../../src/rust-crypto/DehydratedDeviceManager.ts"],"sourcesContent":["/*\nCopyright 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport { type OutgoingRequestProcessor } from \"./OutgoingRequestProcessor.ts\";\nimport { encodeUri } from \"../utils.ts\";\nimport { type IHttpOpts, type MatrixError, type MatrixHttpApi, Method } from \"../http-api/index.ts\";\nimport { type IToDeviceEvent } from \"../sync-accumulator.ts\";\nimport { type ServerSideSecretStorage } from \"../secret-storage.ts\";\nimport { decodeBase64 } from \"../base64.ts\";\nimport { type Logger } from \"../logger.ts\";\nimport { CryptoEvent, type CryptoEventHandlerMap, type StartDehydrationOpts } from \"../crypto-api/index.ts\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.ts\";\n\n/**\n * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device`.\n */\ninterface DehydratedDeviceResp {\n device_id: string;\n device_data: {\n algorithm: string;\n };\n}\n/**\n * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/{device_id}/events`.\n */\ninterface DehydratedDeviceEventsResp {\n events: IToDeviceEvent[];\n next_batch?: string;\n}\n\n/**\n * The unstable URL prefix for dehydrated device endpoints\n */\nexport const UnstablePrefix = \"/_matrix/client/unstable/org.matrix.msc3814.v1\";\n/**\n * The name used for the dehydration key in Secret Storage\n */\nconst SECRET_STORAGE_NAME = \"org.matrix.msc3814\";\n\n/**\n * The interval between creating dehydrated devices. (one week)\n */\nconst DEHYDRATION_INTERVAL = 7 * 24 * 60 * 60 * 1000;\n\n/**\n * Manages dehydrated devices\n *\n * We have one of these per `RustCrypto`. It's responsible for\n *\n * * determining server support for dehydrated devices\n * * creating new dehydrated devices when requested, including periodically\n * replacing the dehydrated device with a new one\n * * rehydrating a device when requested, and when present\n *\n * @internal\n */\nexport class DehydratedDeviceManager extends TypedEventEmitter<DehydratedDevicesEvents, DehydratedDevicesEventMap> {\n /** the ID of the interval for periodically replacing the dehydrated device */\n private intervalId?: ReturnType<typeof setInterval>;\n\n public constructor(\n private readonly logger: Logger,\n private readonly olmMachine: RustSdkCryptoJs.OlmMachine,\n private readonly http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n private readonly outgoingRequestProcessor: OutgoingRequestProcessor,\n private readonly secretStorage: ServerSideSecretStorage,\n ) {\n super();\n }\n\n private async cacheKey(key: RustSdkCryptoJs.DehydratedDeviceKey): Promise<void> {\n await this.olmMachine.dehydratedDevices().saveDehydratedDeviceKey(key);\n this.emit(CryptoEvent.DehydrationKeyCached);\n }\n\n /**\n * Return whether the server supports dehydrated devices.\n */\n public async isSupported(): Promise<boolean> {\n // call the endpoint to get a dehydrated device. If it returns an\n // M_UNRECOGNIZED error, then dehydration is unsupported. If it returns\n // a successful response, or an M_NOT_FOUND, then dehydration is supported.\n // Any other exceptions are passed through.\n try {\n await this.http.authedRequest<DehydratedDeviceResp>(\n Method.Get,\n \"/dehydrated_device\",\n undefined,\n undefined,\n {\n prefix: UnstablePrefix,\n },\n );\n } catch (error) {\n const err = error as MatrixError;\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return false;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return true;\n }\n throw error;\n }\n return true;\n }\n\n /**\n * Start using device dehydration.\n *\n * - Rehydrates a dehydrated device, if one is available and `opts.rehydrate`\n * is `true`.\n * - Creates a new dehydration key, if necessary, and stores it in Secret\n * Storage.\n * - If `opts.createNewKey` is set to true, always creates a new key.\n * - If a dehydration key is not available, creates a new one.\n * - Creates a new dehydrated device, and schedules periodically creating\n * new dehydrated devices.\n *\n * @param opts - options for device dehydration. For backwards compatibility\n * with old code, a boolean can be given here, which will be treated as\n * the `createNewKey` option. However, this is deprecated.\n */\n public async start(opts: StartDehydrationOpts | boolean = {}): Promise<void> {\n if (typeof opts === \"boolean\") {\n opts = { createNewKey: opts };\n }\n\n if (opts.onlyIfKeyCached && !(await this.olmMachine.dehydratedDevices().getDehydratedDeviceKey())) {\n return;\n }\n this.stop();\n if (opts.rehydrate !== false) {\n try {\n await this.rehydrateDeviceIfAvailable();\n } catch (e) {\n // If rehydration fails, there isn't much we can do about it. Log\n // the error, and create a new device.\n this.logger.info(\"dehydration: Error rehydrating device:\", e);\n this.emit(CryptoEvent.RehydrationError, (e as Error).message);\n }\n }\n if (opts.createNewKey) {\n await this.resetKey();\n }\n await this.scheduleDeviceDehydration();\n }\n\n /**\n * Return whether the dehydration key is stored in Secret Storage.\n */\n public async isKeyStored(): Promise<boolean> {\n return Boolean(await this.secretStorage.isStored(SECRET_STORAGE_NAME));\n }\n\n /**\n * Reset the dehydration key.\n *\n * Creates a new key and stores it in secret storage.\n *\n * @returns The newly-generated key.\n */\n public async resetKey(): Promise<RustSdkCryptoJs.DehydratedDeviceKey> {\n const key = RustSdkCryptoJs.DehydratedDeviceKey.createRandomKey();\n await this.secretStorage.store(SECRET_STORAGE_NAME, key.toBase64());\n // Also cache it in the rust SDK's crypto store.\n await this.cacheKey(key);\n return key;\n }\n\n /**\n * Get and cache the encryption key from secret storage.\n *\n * If `create` is `true`, creates a new key if no existing key is present.\n *\n * @returns the key, if available, or `null` if no key is available\n */\n private async getKey(create: boolean): Promise<RustSdkCryptoJs.DehydratedDeviceKey | null> {\n const cachedKey = await this.olmMachine.dehydratedDevices().getDehydratedDeviceKey();\n if (cachedKey) return cachedKey;\n const keyB64 = await this.secretStorage.get(SECRET_STORAGE_NAME);\n if (keyB64 === undefined) {\n if (!create) {\n return null;\n }\n return await this.resetKey();\n }\n\n // We successfully found the key in secret storage: decode it, and cache it in\n // the rust SDK's crypto store.\n const bytes = decodeBase64(keyB64);\n try {\n const key = RustSdkCryptoJs.DehydratedDeviceKey.createKeyFromArray(bytes);\n await this.cacheKey(key);\n return key;\n } finally {\n bytes.fill(0);\n }\n }\n\n /**\n * Rehydrate the dehydrated device stored on the server.\n *\n * Checks if there is a dehydrated device on the server. If so, rehydrates\n * the device and processes the to-device events.\n *\n * Returns whether or not a dehydrated device was found.\n */\n public async rehydrateDeviceIfAvailable(): Promise<boolean> {\n const key = await this.getKey(false);\n if (!key) {\n return false;\n }\n\n let dehydratedDeviceResp;\n try {\n dehydratedDeviceResp = await this.http.authedRequest<DehydratedDeviceResp>(\n Method.Get,\n \"/dehydrated_device\",\n undefined,\n undefined,\n {\n prefix: UnstablePrefix,\n },\n );\n } catch (error) {\n const err = error as MatrixError;\n // We ignore M_NOT_FOUND (there is no dehydrated device, so nothing\n // us to do) and M_UNRECOGNIZED (the server does not understand the\n // endpoint). We pass through any other errors.\n if (err.errcode === \"M_NOT_FOUND\" || err.errcode === \"M_UNRECOGNIZED\") {\n this.logger.info(\"dehydration: No dehydrated device\");\n return false;\n }\n throw err;\n }\n\n this.logger.info(\"dehydration: dehydrated device found\");\n this.emit(CryptoEvent.RehydrationStarted);\n\n const rehydratedDevice = await this.olmMachine\n .dehydratedDevices()\n .rehydrate(\n key,\n new RustSdkCryptoJs.DeviceId(dehydratedDeviceResp.device_id),\n JSON.stringify(dehydratedDeviceResp.device_data),\n );\n\n this.logger.info(\"dehydration: device rehydrated\");\n\n let nextBatch: string | undefined = undefined;\n let toDeviceCount = 0;\n let roomKeyCount = 0;\n const path = encodeUri(\"/dehydrated_device/$device_id/events\", {\n $device_id: dehydratedDeviceResp.device_id,\n });\n\n do {\n const eventResp: DehydratedDeviceEventsResp = await this.http.authedRequest<DehydratedDeviceEventsResp>(\n Method.Get,\n path,\n nextBatch ? { from: nextBatch } : undefined,\n undefined,\n {\n prefix: UnstablePrefix,\n },\n );\n\n toDeviceCount += eventResp.events.length;\n nextBatch = eventResp.next_batch;\n\n if (eventResp.events.length > 0) {\n const roomKeyInfos = await rehydratedDevice.receiveEvents(JSON.stringify(eventResp.events));\n roomKeyCount += roomKeyInfos.length;\n\n this.emit(CryptoEvent.RehydrationProgress, roomKeyCount, toDeviceCount);\n }\n } while (nextBatch !== undefined);\n\n this.logger.info(`dehydration: received ${roomKeyCount} room keys from ${toDeviceCount} to-device events`);\n this.emit(CryptoEvent.RehydrationCompleted);\n\n return true;\n }\n\n /**\n * Creates and uploads a new dehydrated device.\n *\n * Creates and stores a new key in secret storage if none is available.\n */\n public async createAndUploadDehydratedDevice(): Promise<void> {\n const key = (await this.getKey(true))!;\n\n const dehydratedDevice = await this.olmMachine.dehydratedDevices().create();\n this.emit(CryptoEvent.DehydratedDeviceCreated);\n const request = await dehydratedDevice.keysForUpload(\"Dehydrated device\", key);\n\n await this.outgoingRequestProcessor.makeOutgoingRequest(request);\n this.emit(CryptoEvent.DehydratedDeviceUploaded);\n\n this.logger.info(\"dehydration: uploaded device\");\n }\n\n /**\n * Schedule periodic creation of dehydrated devices.\n */\n public async scheduleDeviceDehydration(): Promise<void> {\n // cancel any previously-scheduled tasks\n this.stop();\n\n await this.createAndUploadDehydratedDevice();\n this.intervalId = setInterval(() => {\n this.createAndUploadDehydratedDevice().catch((error) => {\n this.emit(CryptoEvent.DehydratedDeviceRotationError, error.message);\n this.logger.error(\"Error creating dehydrated device:\", error);\n });\n }, DEHYDRATION_INTERVAL);\n }\n\n /**\n * Stop the dehydrated device manager.\n *\n * Cancels any scheduled dehydration tasks.\n */\n public stop(): void {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = undefined;\n }\n }\n\n /**\n * Delete the current dehydrated device and stop the dehydrated device manager.\n */\n public async delete(): Promise<void> {\n this.stop();\n try {\n await this.http.authedRequest(\n Method.Delete,\n \"/dehydrated_device\",\n undefined,\n {},\n {\n prefix: UnstablePrefix,\n },\n );\n } catch (error) {\n const err = error as MatrixError;\n // If dehydrated devices aren't supported, or no dehydrated device\n // is found, we don't consider it an error, because we we'll end up\n // with no dehydrated device.\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return;\n }\n throw error;\n }\n }\n}\n\n/**\n * The events fired by the DehydratedDeviceManager\n * @internal\n */\ntype DehydratedDevicesEvents =\n | CryptoEvent.DehydratedDeviceCreated\n | CryptoEvent.DehydratedDeviceUploaded\n | CryptoEvent.RehydrationStarted\n | CryptoEvent.RehydrationProgress\n | CryptoEvent.RehydrationCompleted\n | CryptoEvent.RehydrationError\n | CryptoEvent.DehydrationKeyCached\n | CryptoEvent.DehydratedDeviceRotationError;\n\n/**\n * A map of the {@link DehydratedDeviceEvents} fired by the {@link DehydratedDeviceManager} and their payloads.\n * @internal\n */\ntype DehydratedDevicesEventMap = Pick<CryptoEventHandlerMap, DehydratedDevicesEvents>;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAK,eAAe,MAAM,oCAAoC;AAGrE,SAAS,SAAS,QAAQ,aAAa;AACvC,SAA+D,MAAM,QAAQ,sBAAsB;AAGnG,SAAS,YAAY,QAAQ,cAAc;AAE3C,SAAS,WAAW,QAA+D,wBAAwB;AAC3G,SAAS,iBAAiB,QAAQ,kCAAkC;;AAEpE;AACA;AACA;;AAOA;AACA;AACA;;AAMA;AACA;AACA;AACA,OAAO,MAAM,cAAc,GAAG,gDAAgD;AAC9E;AACA;AACA;AACA,MAAM,mBAAmB,GAAG,o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AAC,mCAAmC,EAAE,KAAK,CAAC;MACjE,CAAC,CAAC;IACN,CAAC,EAAE,oBAAoB,CAAC;EAC5B;;EAEA;AACJ;AACA;AACA;AACA;EACW,IAAI,GAAS;IAChB,IAAI,IAAI,CAAC,UAAU,EAAE;MACjB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC;MAC9B,IAAI,CAAC,UAAU,GAAG,SAAS;IAC/B;EACJ;;EAEA;AACJ;AACA;EACI,MAAa,MAAM,GAAkB;IACjC,IAAI,CAAC,IAAI,CAAC,CAAC;IACX,IAAI;MACA,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CACzB,MAAM,CAAC,MAAM,EACb,oBAAoB,EACpB,SAAS,EACT,CAAC,CAAC,EACF;QACI,MAAM,EAAE;MACZ,CACJ,CAAC;IACL,CAAC,CAAC,OAAO,KAAK,EAAE;MACZ,MAAM,GAAG,GAAG,KAAoB;MAChC;MACA;MACA;MACA,IAAI,GAAG,CAAC,OAAO,KAAK,gBAAgB,EAAE;QAClC;MACJ,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,aAAa,EAAE;QACtC;MACJ;MACA,MAAM,KAAK;IACf;EACJ;AACJ;;AAEA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyClaimManager.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/KeyClaimManager.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;GAMG;AACH,qBAAa,eAAe;IAKpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IAL7C,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,OAAO,CAAS;gBAGH,UAAU,EAAE,UAAU,EACtB,wBAAwB,EAAE,wBAAwB;IAKvE;;;;OAIG;IACI,IAAI,IAAI,IAAI;IAInB;;;;;;OAMG;IACI,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAcxE,2BAA2B;CAgB5C"}
1
+ {"version":3,"file":"KeyClaimManager.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/KeyClaimManager.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;GAMG;AACH,qBAAa,eAAe;IAKpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IAL7C,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,OAAO,CAAS;IAExB,YACqB,UAAU,EAAE,UAAU,EACtB,wBAAwB,EAAE,wBAAwB,EAGtE;IAED;;;;OAIG;IACI,IAAI,IAAI,IAAI,CAElB;IAED;;;;;;OAMG;IACI,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAYrF;YAEa,2BAA2B;CAgB5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"OutgoingRequestProcessor.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/OutgoingRequestProcessor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAKH,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,0BAA0B,EAI1B,wBAAwB,EAC3B,MAAM,oC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;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHzB,YACqB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,aAAa,CAAC,SAAS,GAAG;QAAE,QAAQ,EAAE,IAAI,CAAA;KAAE,CAAC,EACpE;IAES,mBAAmB,CAAC,CAAC,EAC9B,GAAG,EAAE,eAAe,GAAG,wBAAwB,GAAG,0BAA0B,EAC5E,WAAW,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAoEf;IAED;;;;;OAKG;YACW,mBAAmB;YAsBnB,kBAAkB;YA2BlB,gBAAgB;YAwBhB,cAAc;CAuB/B"}
@@ -131,8 +131,6 @@ export class OutgoingRequestProcessor {
131
131
  }
132
132
  async requestWithRetry(method, path, queryParams, body) {
133
133
  let currentRetryCount = 0;
134
-
135
- // eslint-disable-next-line no-constant-condition
136
134
  while (true) {
137
135
  try {
138
136
  return await this.rawJsonRequest(method, path, queryParams, body);
@@ -1 +1 @@
1
- {"version":3,"file":"OutgoingRequestProcessor.js","names":[],"sources":["../../src/rust-crypto/OutgoingRequestProcessor.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport {\n KeysBackupRequest,\n KeysClaimRequest,\n KeysQueryRequest,\n KeysUploadRequest,\n type OlmMachine,\n type OutgoingRequest,\n PutDehydratedDeviceRequest,\n RoomMessageRequest,\n SignatureUploadRequest,\n ToDeviceRequest,\n UploadSigningKeysRequest,\n} from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport { type Logger } from \"../logger.ts\";\nimport { calculateRetryBackoff, type IHttpOpts, type MatrixHttpApi, Method } from \"../http-api/index.ts\";\nimport { logDuration, type QueryDict, sleep } from \"../utils.ts\";\nimport { type AuthDict, type UIAuthCallback } from \"../interactive-auth.ts\";\nimport { ToDeviceMessageId } from \"../@types/event.ts\";\nimport { UnstablePrefix as DehydrationUnstablePrefix } from \"./DehydratedDeviceManager.ts\";\n\n/**\n * OutgoingRequestManager: turns `OutgoingRequest`s from the rust sdk into HTTP requests\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`), not that it does anything terribly complicated.\n * It's responsible for:\n *\n * * holding the reference to the `MatrixHttpApi`\n * * turning `OutgoingRequest`s from the rust backend into HTTP requests, and sending them\n * * sending the results of such requests back to the rust backend.\n *\n * @internal\n */\nexport class OutgoingRequestProcessor {\n public constructor(\n private readonly logger: Logger,\n private readonly olmMachine: OlmMachine,\n private readonly http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n ) {}\n\n public async makeOutgoingRequest<T>(\n msg: OutgoingRequest | UploadSigningKeysRequest | PutDehydratedDeviceRequest,\n uiaCallback?: UIAuthCallback<T>,\n ): Promise<void> {\n let resp: string;\n\n /* refer https://docs.rs/matrix-sdk-crypto/0.6.0/matrix_sdk_crypto/requests/enum.OutgoingRequests.html\n * for the complete list of request types\n */\n if (msg instanceof KeysUploadRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/upload\", {}, msg.body);\n } else if (msg instanceof KeysQueryRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/query\", {}, msg.body);\n } else if (msg instanceof KeysClaimRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/claim\", {}, msg.body);\n } else if (msg instanceof SignatureUploadRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/signatures/upload\", {}, msg.body);\n } else if (msg instanceof KeysBackupRequest) {\n resp = await this.requestWithRetry(\n Method.Put,\n \"/_matrix/client/v3/room_keys/keys\",\n { version: msg.version },\n msg.body,\n );\n } else if (msg instanceof ToDeviceRequest) {\n resp = await this.sendToDeviceRequest(msg);\n } else if (msg instanceof RoomMessageRequest) {\n const path =\n `/_matrix/client/v3/rooms/${encodeURIComponent(msg.room_id)}/send/` +\n `${encodeURIComponent(msg.event_type)}/${encodeURIComponent(msg.txn_id)}`;\n resp = await this.requestWithRetry(Method.Put, path, {}, msg.body);\n } else if (msg instanceof UploadSigningKeysRequest) {\n await this.makeRequestWithUIA(\n Method.Post,\n \"/_matrix/client/v3/keys/device_signing/upload\",\n {},\n msg.body,\n uiaCallback,\n );\n // SigningKeysUploadRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else if (msg instanceof PutDehydratedDeviceRequest) {\n const path = DehydrationUnstablePrefix + \"/dehydrated_device\";\n await this.rawJsonRequest(Method.Put, path, {}, msg.body);\n // PutDehydratedDeviceRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else {\n this.logger.warn(\"Unsupported outgoing message\", Object.getPrototypeOf(msg));\n resp = \"\";\n }\n\n if (msg.id) {\n try {\n await logDuration(this.logger, `Mark Request as sent ${msg.type}`, async () => {\n await this.olmMachine.markRequestAsSent(msg.id!, msg.type, resp);\n });\n } catch (e) {\n // Ignore errors which are caused by the olmMachine having been freed. The exact error message depends\n // on whether we are using a release or develop build of rust-sdk-crypto-wasm.\n if (\n e instanceof Error &&\n (e.message === \"Attempt to use a moved value\" || e.message === \"null pointer passed to rust\")\n ) {\n this.logger.debug(`Ignoring error '${e.message}': client is likely shutting down`);\n } else {\n throw e;\n }\n }\n } else {\n this.logger.trace(`Outgoing request type:${msg.type} does not have an ID`);\n }\n }\n\n /**\n * Send the HTTP request for a `ToDeviceRequest`\n *\n * @param request - request to send\n * @returns JSON-serialized body of the response, if successful\n */\n private async sendToDeviceRequest(request: ToDeviceRequest): Promise<string> {\n // a bit of extra logging, to help trace to-device messages through the system\n const parsedBody: { messages: Record<string, Record<string, Record<string, any>>> } = JSON.parse(request.body);\n\n const messageList = [];\n for (const [userId, perUserMessages] of Object.entries(parsedBody.messages)) {\n for (const [deviceId, message] of Object.entries(perUserMessages)) {\n messageList.push(`${userId}/${deviceId} (msgid ${message[ToDeviceMessageId]})`);\n }\n }\n\n this.logger.info(\n `Sending batch of to-device messages. type=${request.event_type} txnid=${request.txn_id}`,\n messageList,\n );\n\n const path =\n `/_matrix/client/v3/sendToDevice/${encodeURIComponent(request.event_type)}/` +\n encodeURIComponent(request.txn_id);\n return await this.requestWithRetry(Method.Put, path, {}, request.body);\n }\n\n private async makeRequestWithUIA<T>(\n method: Method,\n path: string,\n queryParams: QueryDict,\n body: string,\n uiaCallback: UIAuthCallback<T> | undefined,\n ): Promise<string> {\n if (!uiaCallback) {\n return await this.requestWithRetry(method, path, queryParams, body);\n }\n\n const parsedBody = JSON.parse(body);\n const makeRequest = async (auth: AuthDict | null): Promise<T> => {\n const newBody: Record<string, any> = {\n ...parsedBody,\n };\n if (auth !== null) {\n newBody.auth = auth;\n }\n const resp = await this.requestWithRetry(method, path, queryParams, JSON.stringify(newBody));\n return JSON.parse(resp) as T;\n };\n\n const resp = await uiaCallback(makeRequest);\n return JSON.stringify(resp);\n }\n\n private async requestWithRetry(\n method: Method,\n path: string,\n queryParams: QueryDict,\n body: string,\n ): Promise<string> {\n let currentRetryCount = 0;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n return await this.rawJsonRequest(method, path, queryParams, body);\n } catch (e) {\n currentRetryCount++;\n const backoff = calculateRetryBackoff(e, currentRetryCount, true);\n if (backoff < 0) {\n // Max number of retries reached, or error is not retryable. rethrow the error\n throw e;\n }\n // wait for the specified time and then retry the request\n await sleep(backoff);\n }\n }\n }\n\n private async rawJsonRequest(method: Method, path: string, queryParams: QueryDict, body: string): Promise<string> {\n const opts = {\n // inhibit the JSON stringification and parsing within HttpApi.\n json: false,\n\n // nevertheless, we are sending, and accept, JSON.\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\",\n },\n\n // we use the full prefix\n prefix: \"\",\n\n // We set a timeout of 60 seconds to guard against requests getting stuck forever and wedging the\n // request loop (cf https://github.com/element-hq/element-web/issues/29534).\n //\n // (XXX: should we do this in the whole of the js-sdk?)\n localTimeoutMs: 60000,\n };\n\n return await this.http.authedRequest<string>(method, path, queryParams, body, opts);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACI,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAGjB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,wBAAwB,QACrB,oCAAoC;AAG3C,SAAS,qBAAqB,EAAsC,MAAM,QAAQ,sBAAsB;AACxG,SAAS,WAAW,EAAkB,KAAK,QAAQ,aAAa;AAEhE,SAAS,iBAAiB,QAAQ,oBAAoB;AACtD,SAAS,cAAc,IAAI,yBAAyB,QAAQ,8BAA8B;;AAE1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,wBAAwB,CAAC;EAC3B,WAAW,CACG,MAAc,EACd,UAAsB,EACtB,IAAmD,EACtE;IAAA,KAHmB,MAAc,GAAd,MAAc;IAAA,KACd,UAAsB,GAAtB,UAAsB;IAAA,KACtB,IAAmD,GAAnD,IAAmD;EACrE;EAEH,MAAa,mBAAmB,CAC5B,GAA4E,EAC5E,WAA+B,EAClB;IACb,IAAI,IAAY;;IAEhB;AACR;AACA;IACQ,IAAI,GAAG,YAAY,iBAAiB,EAAE;MAClC,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,gCAAgC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC;IACnG,CAAC,MAA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,IAAI,CAAC;EACvF;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"OutgoingRequestProcessor.js","names":[],"sources":["../../src/rust-crypto/OutgoingRequestProcessor.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport {\n KeysBackupRequest,\n KeysClaimRequest,\n KeysQueryRequest,\n KeysUploadRequest,\n type OlmMachine,\n type OutgoingRequest,\n PutDehydratedDeviceRequest,\n RoomMessageRequest,\n SignatureUploadRequest,\n ToDeviceRequest,\n UploadSigningKeysRequest,\n} from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport { type Logger } from \"../logger.ts\";\nimport { calculateRetryBackoff, type IHttpOpts, type MatrixHttpApi, Method } from \"../http-api/index.ts\";\nimport { logDuration, type QueryDict, sleep } from \"../utils.ts\";\nimport { type AuthDict, type UIAuthCallback } from \"../interactive-auth.ts\";\nimport { ToDeviceMessageId } from \"../@types/event.ts\";\nimport { UnstablePrefix as DehydrationUnstablePrefix } from \"./DehydratedDeviceManager.ts\";\n\n/**\n * OutgoingRequestManager: turns `OutgoingRequest`s from the rust sdk into HTTP requests\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`), not that it does anything terribly complicated.\n * It's responsible for:\n *\n * * holding the reference to the `MatrixHttpApi`\n * * turning `OutgoingRequest`s from the rust backend into HTTP requests, and sending them\n * * sending the results of such requests back to the rust backend.\n *\n * @internal\n */\nexport class OutgoingRequestProcessor {\n public constructor(\n private readonly logger: Logger,\n private readonly olmMachine: OlmMachine,\n private readonly http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n ) {}\n\n public async makeOutgoingRequest<T>(\n msg: OutgoingRequest | UploadSigningKeysRequest | PutDehydratedDeviceRequest,\n uiaCallback?: UIAuthCallback<T>,\n ): Promise<void> {\n let resp: string;\n\n /* refer https://docs.rs/matrix-sdk-crypto/0.6.0/matrix_sdk_crypto/requests/enum.OutgoingRequests.html\n * for the complete list of request types\n */\n if (msg instanceof KeysUploadRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/upload\", {}, msg.body);\n } else if (msg instanceof KeysQueryRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/query\", {}, msg.body);\n } else if (msg instanceof KeysClaimRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/claim\", {}, msg.body);\n } else if (msg instanceof SignatureUploadRequest) {\n resp = await this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/signatures/upload\", {}, msg.body);\n } else if (msg instanceof KeysBackupRequest) {\n resp = await this.requestWithRetry(\n Method.Put,\n \"/_matrix/client/v3/room_keys/keys\",\n { version: msg.version },\n msg.body,\n );\n } else if (msg instanceof ToDeviceRequest) {\n resp = await this.sendToDeviceRequest(msg);\n } else if (msg instanceof RoomMessageRequest) {\n const path =\n `/_matrix/client/v3/rooms/${encodeURIComponent(msg.room_id)}/send/` +\n `${encodeURIComponent(msg.event_type)}/${encodeURIComponent(msg.txn_id)}`;\n resp = await this.requestWithRetry(Method.Put, path, {}, msg.body);\n } else if (msg instanceof UploadSigningKeysRequest) {\n await this.makeRequestWithUIA(\n Method.Post,\n \"/_matrix/client/v3/keys/device_signing/upload\",\n {},\n msg.body,\n uiaCallback,\n );\n // SigningKeysUploadRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else if (msg instanceof PutDehydratedDeviceRequest) {\n const path = DehydrationUnstablePrefix + \"/dehydrated_device\";\n await this.rawJsonRequest(Method.Put, path, {}, msg.body);\n // PutDehydratedDeviceRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else {\n this.logger.warn(\"Unsupported outgoing message\", Object.getPrototypeOf(msg));\n resp = \"\";\n }\n\n if (msg.id) {\n try {\n await logDuration(this.logger, `Mark Request as sent ${msg.type}`, async () => {\n await this.olmMachine.markRequestAsSent(msg.id!, msg.type, resp);\n });\n } catch (e) {\n // Ignore errors which are caused by the olmMachine having been freed. The exact error message depends\n // on whether we are using a release or develop build of rust-sdk-crypto-wasm.\n if (\n e instanceof Error &&\n (e.message === \"Attempt to use a moved value\" || e.message === \"null pointer passed to rust\")\n ) {\n this.logger.debug(`Ignoring error '${e.message}': client is likely shutting down`);\n } else {\n throw e;\n }\n }\n } else {\n this.logger.trace(`Outgoing request type:${msg.type} does not have an ID`);\n }\n }\n\n /**\n * Send the HTTP request for a `ToDeviceRequest`\n *\n * @param request - request to send\n * @returns JSON-serialized body of the response, if successful\n */\n private async sendToDeviceRequest(request: ToDeviceRequest): Promise<string> {\n // a bit of extra logging, to help trace to-device messages through the system\n const parsedBody: { messages: Record<string, Record<string, Record<string, any>>> } = JSON.parse(request.body);\n\n const messageList = [];\n for (const [userId, perUserMessages] of Object.entries(parsedBody.messages)) {\n for (const [deviceId, message] of Object.entries(perUserMessages)) {\n messageList.push(`${userId}/${deviceId} (msgid ${message[ToDeviceMessageId]})`);\n }\n }\n\n this.logger.info(\n `Sending batch of to-device messages. type=${request.event_type} txnid=${request.txn_id}`,\n messageList,\n );\n\n const path =\n `/_matrix/client/v3/sendToDevice/${encodeURIComponent(request.event_type)}/` +\n encodeURIComponent(request.txn_id);\n return await this.requestWithRetry(Method.Put, path, {}, request.body);\n }\n\n private async makeRequestWithUIA<T>(\n method: Method,\n path: string,\n queryParams: QueryDict,\n body: string,\n uiaCallback: UIAuthCallback<T> | undefined,\n ): Promise<string> {\n if (!uiaCallback) {\n return await this.requestWithRetry(method, path, queryParams, body);\n }\n\n const parsedBody = JSON.parse(body);\n const makeRequest = async (auth: AuthDict | null): Promise<T> => {\n const newBody: Record<string, any> = {\n ...parsedBody,\n };\n if (auth !== null) {\n newBody.auth = auth;\n }\n const resp = await this.requestWithRetry(method, path, queryParams, JSON.stringify(newBody));\n return JSON.parse(resp) as T;\n };\n\n const resp = await uiaCallback(makeRequest);\n return JSON.stringify(resp);\n }\n\n private async requestWithRetry(\n method: Method,\n path: string,\n queryParams: QueryDict,\n body: string,\n ): Promise<string> {\n let currentRetryCount = 0;\n\n while (true) {\n try {\n return await this.rawJsonRequest(method, path, queryParams, body);\n } catch (e) {\n currentRetryCount++;\n const backoff = calculateRetryBackoff(e, currentRetryCount, true);\n if (backoff < 0) {\n // Max number of retries reached, or error is not retryable. rethrow the error\n throw e;\n }\n // wait for the specified time and then retry the request\n await sleep(backoff);\n }\n }\n }\n\n private async rawJsonRequest(method: Method, path: string, queryParams: QueryDict, body: string): Promise<string> {\n const opts = {\n // inhibit the JSON stringification and parsing within HttpApi.\n json: false,\n\n // nevertheless, we are sending, and accept, JSON.\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\",\n },\n\n // we use the full prefix\n prefix: \"\",\n\n // We set a timeout of 60 seconds to guard against requests getting stuck forever and wedging the\n // request loop (cf https://github.com/element-hq/element-web/issues/29534).\n //\n // (XXX: should we do this in the whole of the js-sdk?)\n localTimeoutMs: 60000,\n };\n\n return await this.http.authedRequest<string>(method, path, queryParams, body, opts);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACI,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAGjB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,wBAAwB,QACrB,oCAAoC;AAG3C,SAAS,qBAAqB,EAAsC,MAAM,QAAQ,sBAAsB;AACxG,SAAS,WAAW,EAAkB,KAAK,QAAQ,aAAa;AAEhE,SAAS,iBAAiB,QAAQ,oBAAoB;AACtD,SAAS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G,qBAAqB,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC;QACjE,IAAI,OAAO,GAAG,CAAC,EAAE;UACb;UACA,MAAM,CAAC;QACX;QACA;QACA,MAAM,KAAK,CAAC,OAAO,CAAC;MACxB;IACJ;EACJ;EAEA,MAAc,cAAc,CAAC,MAAc,EAAE,IAAY,EAAE,WAAsB,EAAE,IAAY,EAAmB;IAC9G,MAAM,IAAI,GAAG;MACT;MACA,IAAI,EAAE,KAAK;MAEX;MACA,OAAO,EAAE;QACL,cAAc,EAAE,kBAAkB;QAClC,QAAQ,EAAE;MACd,CAAC;MAED;MACA,MAAM,EAAE,EAAE;MAEV;MACA;MACA;MACA;MACA,cAAc,EAAE;IACpB,CAAC;IAED,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAS,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;EACvF;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"OutgoingRequestsManager.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/OutgoingRequestsManager.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,oCAAoC,CAAC;AAE3F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C;;;GAGG;AACH,qBAAa,uBAAuB;IAkB5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;aACX,wBAAwB,EAAE,wBAAwB;IAnBtE,2CAA2C;IAC3C,OAAO,CAAC,OAAO,CAAS;IAExB,+DAA+D;IAC/D,OAAO,CAAC,0BAA0B,CAAS;IAE3C;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB,CAAC,CAA6B;gBAGjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACvB,wBAAwB,EAAE,wBAAwB;IAGtE;;OAEG;IACI,IAAI,IAAI,IAAI;IAInB;;;;;;;;;OASG;IACI,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;YA2BnC,mBAAmB;IA4BjC;;OAEG;YACW,uBAAuB;CA6CxC"}
1
+ {"version":3,"file":"OutgoingRequestsManager.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/OutgoingRequestsManager.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,oCAAoC,CAAC;AAE3F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C;;;GAGG;AACH,qBAAa,uBAAuB;IAkB5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;aACX,wBAAwB,EAAE,wBAAwB;IAnBtE,2CAA2C;IAC3C,OAAO,CAAC,OAAO,CAAS;IAExB,+DAA+D;IAC/D,OAAO,CAAC,0BAA0B,CAAS;IAE3C;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB,CAAC,CAA6B;IAEtD,YACqB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACvB,wBAAwB,EAAE,wBAAwB,EAClE;IAEJ;;OAEG;IACI,IAAI,IAAI,IAAI,CAElB;IAED;;;;;;;;;OASG;IACI,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAyBhD;YAEa,mBAAmB;IA4BjC;;OAEG;YACW,uBAAuB;CA6CxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PerSessionKeyBackupDownloader.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/PerSessionKeyBackupDownloader.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGrE,OAAO,EAA2B,KAAK,aAAa,EAAyB,MAAM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;IAE/E;;;;;;;OAOG;IACH,YACI,MAAM,EAAE,MAAM,EACG,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,aAAa,CAAC,SAAS,GAAG;QAAE,QAAQ,EAAE,IAAI,CAAA;KAAE,CAAC,EACnD,aAAa,EAAE,iBAAiB,EAOpD;IAED;;;;OAIG;IACI,6BAA6B,IAAI,OAAO,CAE9C;IAED;;;;OAIG;IACU,mBAAmB,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC,CAE5E;IAED;;;;;;;;;OASG;IACI,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,CA0BhF;IAEM,IAAI,IAAI,IAAI,CAKlB;IAED;;;OAGG;IACH,OAAO,CAAC,qBAAqB,CAU3B;IAEF,yEAAyE;IACzE,OAAO,CAAC,gBAAgB;IAMxB;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAa9B,0DAA0D;IAC1D,OAAO,CAAC,oBAAoB;YAMd,sBAAsB;IAQpC;;;;;;OAMG;YACW,wBAAwB;YAexB,gBAAgB;IAoE9B;;;;;;OAMG;YACW,cAAc;YA4Cd,gBAAgB;IAc9B;;;;;;;OAOG;YACW,8BAA8B;YA0B9B,uBAAuB;CA+DxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PerSessionKeyBackupDownloader.js","names":[],"sources":["../../src/rust-crypto/PerSessionKeyBackupDownloader.ts"],"sourcesContent":["/*\nCopyright 2023 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type OlmMachine } from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport type * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { type Curve25519AuthData, type KeyBackupInfo, type KeyBackupSession } from \"../crypto-api/keybackup.ts\";\nimport { CryptoEvent } from \"../crypto-api/index.ts\";\nimport { type Logger } from \"../logger.ts\";\nimport { ClientPrefix, type IHttpOpts, MatrixError, type MatrixHttpApi, Method } from \"../http-api/index.ts\";\nimport { type RustBackupManager } from \"./backup.ts\";\nimport { encodeUri, sleep } from \"../utils.ts\";\nimport { type BackupDecryptor } from \"../common-crypto/CryptoBackend.ts\";\n\n// The minimum time to wait between two retries in case of errors. To avoid hammering the server.\nconst KEY_BACKUP_BACKOFF = 5000; // ms\n\n/**\n * Enumerates the different kind of errors that can occurs when downloading and importing a key from backup.\n */\nenum KeyDownloadErrorCode {\n /** The requested key is not in the backup. */\n MISSING_DECRYPTION_KEY = \"MISSING_DECRYPTION_KEY\",\n /** A network error occurred while trying to download the key from backup. */\n NETWORK_ERROR = \"NETWORK_ERROR\",\n /** The loop has been stopped. */\n STOPPED = \"STOPPED\",\n}\n\nclass KeyDownloadError extends Error {\n public constructor(public readonly code: KeyDownloadErrorCode) {\n super(`Failed to get key from backup: ${code}`);\n this.name = \"KeyDownloadError\";\n }\n}\n\nclass KeyDownloadRateLimitError extends Error {\n public constructor(public readonly retryMillis: number) {\n super(`Failed to get key from backup: rate limited`);\n this.name = \"KeyDownloadRateLimitError\";\n }\n}\n\n/** Details of a megolm session whose key we are trying to fetch. */\ntype SessionInfo = { roomId: string; megolmSessionId: string };\n\n/** Holds the current backup decryptor and version that should be used.\n *\n * This is intended to be used as an immutable object (a new instance should be created if the configuration changes),\n * and some of the logic relies on that, so the properties are marked as `readonly`.\n */\ntype Configuration = {\n readonly backupVersion: string;\n readonly decryptor: BackupDecryptor;\n};\n\n/**\n * Used when an 'unable to decrypt' error occurs. It attempts to download the key from the backup.\n *\n * The current backup API lacks pagination, which can lead to lengthy key retrieval times for large histories (several 10s of minutes).\n * To mitigate this, keys are downloaded on demand as decryption errors occurs.\n * While this approach may result in numerous requests, it improves user experience by reducing wait times for message decryption.\n *\n * The PerSessionKeyBackupDownloader is resistant to backup configuration changes: it will automatically resume querying when\n * the backup is configured correctly.\n */\nexport class PerSessionKeyBackupDownloader {\n private stopped = false;\n\n /**\n * The version and decryption key to use with current backup if all set up correctly.\n *\n * Will not be set unless `hasConfigurationProblem` is `false`.\n */\n private configuration: Configuration | null = null;\n\n /** We remember when a session was requested and not found in backup to avoid query again too soon.\n * Map of session_id to timestamp */\n private sessionLastCheckAttemptedTime: Map<string, number> = new Map();\n\n /** The logger to use */\n private readonly logger: Logger;\n\n /** Whether the download loop is running. */\n private downloadLoopRunning = false;\n\n /** The list of requests that are queued. */\n private queuedRequests: SessionInfo[] = [];\n\n /** Remembers if we have a configuration problem. */\n private hasConfigurationProblem = false;\n\n /** The current server backup version check promise. To avoid doing a server call if one is in flight. */\n private currentBackupVersionCheck: Promise<Configuration | null> | null = null;\n\n /**\n * Creates a new instance of PerSessionKeyBackupDownloader.\n *\n * @param backupManager - The backup manager to use.\n * @param olmMachine - The olm machine to use.\n * @param http - The http instance to use.\n * @param logger - The logger to use.\n */\n public constructor(\n logger: Logger,\n private readonly olmMachine: OlmMachine,\n private readonly http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n private readonly backupManager: RustBackupManager,\n ) {\n this.logger = logger.getChild(\"[PerSessionKeyBackupDownloader]\");\n\n backupManager.on(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n backupManager.on(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n backupManager.on(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n }\n\n /**\n * Check if key download is successfully configured and active.\n *\n * @returns `true` if key download is correctly configured and active; otherwise `false`.\n */\n public isKeyBackupDownloadConfigured(): boolean {\n return this.configuration !== null;\n }\n\n /**\n * Return the details of the latest backup on the server, when we last checked.\n *\n * This is just a convenience method to expose {@link RustBackupManager.getServerBackupInfo}.\n */\n public async getServerBackupInfo(): Promise<KeyBackupInfo | null | undefined> {\n return await this.backupManager.getServerBackupInfo();\n }\n\n /**\n * Called when a MissingRoomKey or UnknownMessageIndex decryption error is encountered.\n *\n * This will try to download the key from the backup if there is a trusted active backup.\n * In case of success the key will be imported and the onRoomKeysUpdated callback will be called\n * internally by the rust-sdk and decryption will be retried.\n *\n * @param roomId - The room ID of the room where the error occurred.\n * @param megolmSessionId - The megolm session ID that is missing.\n */\n public onDecryptionKeyMissingError(roomId: string, megolmSessionId: string): void {\n // Several messages encrypted with the same session may be decrypted at the same time,\n // so we need to be resistant and not query several time the same session.\n if (this.isAlreadyInQueue(roomId, megolmSessionId)) {\n // There is already a request queued for this session, no need to queue another one.\n this.logger.trace(`Not checking key backup for session ${megolmSessionId} as it is already queued`);\n return;\n }\n\n if (this.wasRequestedRecently(megolmSessionId)) {\n // We already tried to download this session recently and it was not in backup, no need to try again.\n this.logger.trace(\n `Not checking key backup for session ${megolmSessionId} as it was already requested recently`,\n );\n return;\n }\n\n // We always add the request to the queue, even if we have a configuration problem (can't access backup).\n // This is to make sure that if the configuration problem is resolved, we will try to download the key.\n // This will happen after an initial sync, at this point the backup will not yet be trusted and the decryption\n // key will not be available, but it will be just after the verification.\n // We don't need to persist it because currently on refresh the sdk will retry to decrypt the messages in error.\n this.queuedRequests.push({ roomId, megolmSessionId });\n\n // Start the download loop if it's not already running.\n this.downloadKeysLoop();\n }\n\n public stop(): void {\n this.stopped = true;\n this.backupManager.off(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n this.backupManager.off(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n this.backupManager.off(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n }\n\n /**\n * Called when the backup status changes (CryptoEvents)\n * This will trigger a check of the backup configuration.\n */\n private onBackupStatusChanged = (): void => {\n // we want to force check configuration, so we clear the current one.\n this.hasConfigurationProblem = false;\n this.configuration = null;\n this.getOrCreateBackupConfiguration().then((configuration) => {\n if (configuration) {\n // restart the download loop if it was stopped\n this.downloadKeysLoop();\n }\n });\n };\n\n /** Returns true if the megolm session is already queued for download. */\n private isAlreadyInQueue(roomId: string, megolmSessionId: string): boolean {\n return this.queuedRequests.some((info) => {\n return info.roomId == roomId && info.megolmSessionId == megolmSessionId;\n });\n }\n\n /**\n * Marks the session as not found in backup, to avoid retrying to soon for a key not in backup\n *\n * @param megolmSessionId - The megolm session ID that is missing.\n */\n private markAsNotFoundInBackup(megolmSessionId: string): void {\n const now = Date.now();\n this.sessionLastCheckAttemptedTime.set(megolmSessionId, now);\n // if too big make some cleaning to keep under control\n if (this.sessionLastCheckAttemptedTime.size > 100) {\n this.sessionLastCheckAttemptedTime = new Map(\n Array.from(this.sessionLastCheckAttemptedTime).filter((sid, ts) => {\n return Math.max(now - ts, 0) < KEY_BACKUP_BACKOFF;\n }),\n );\n }\n }\n\n /** Returns true if the session was requested recently. */\n private wasRequestedRecently(megolmSessionId: string): boolean {\n const lastCheck = this.sessionLastCheckAttemptedTime.get(megolmSessionId);\n if (!lastCheck) return false;\n return Math.max(Date.now() - lastCheck, 0) < KEY_BACKUP_BACKOFF;\n }\n\n private async getBackupDecryptionKey(): Promise<RustSdkCryptoJs.BackupKeys | null> {\n try {\n return await this.olmMachine.getBackupKeys();\n } catch {\n return null;\n }\n }\n\n /**\n * Requests a key from the server side backup.\n *\n * @param version - The backup version to use.\n * @param roomId - The room ID of the room where the error occurred.\n * @param sessionId - The megolm session ID that is missing.\n */\n private async requestRoomKeyFromBackup(\n version: string,\n roomId: string,\n sessionId: string,\n ): Promise<KeyBackupSession> {\n const path = encodeUri(\"/room_keys/keys/$roomId/$sessionId\", {\n $roomId: roomId,\n $sessionId: sessionId,\n });\n\n return await this.http.authedRequest<KeyBackupSession>(Method.Get, path, { version }, undefined, {\n prefix: ClientPrefix.V3,\n });\n }\n\n private async downloadKeysLoop(): Promise<void> {\n if (this.downloadLoopRunning) return;\n\n // If we have a configuration problem, we don't want to try to download.\n // If any configuration change is detected, we will retry and restart the loop.\n if (this.hasConfigurationProblem) return;\n\n this.downloadLoopRunning = true;\n\n try {\n while (this.queuedRequests.length > 0) {\n // we just peek the first one without removing it, so if a new request for same key comes in while we're\n // processing this one, it won't queue another request.\n const request = this.queuedRequests[0];\n try {\n // The backup could have changed between the time we queued the request and now, so we need to check\n const configuration = await this.getOrCreateBackupConfiguration();\n if (!configuration) {\n // Backup is not configured correctly, so stop the loop.\n this.downloadLoopRunning = false;\n return;\n }\n\n const result = await this.queryKeyBackup(request.roomId, request.megolmSessionId, configuration);\n\n if (this.stopped) {\n return;\n }\n // We got the encrypted key from backup, let's try to decrypt and import it.\n try {\n await this.decryptAndImport(request, result, configuration);\n } catch (e) {\n this.logger.error(\n `Error while decrypting and importing key backup for session ${request.megolmSessionId}`,\n e,\n );\n }\n // now remove the request from the queue as we've processed it.\n this.queuedRequests.shift();\n } catch (err) {\n if (err instanceof KeyDownloadError) {\n switch (err.code) {\n case KeyDownloadErrorCode.MISSING_DECRYPTION_KEY:\n this.markAsNotFoundInBackup(request.megolmSessionId);\n // continue for next one\n this.queuedRequests.shift();\n break;\n case KeyDownloadErrorCode.NETWORK_ERROR:\n // We don't want to hammer if there is a problem, so wait a bit.\n await sleep(KEY_BACKUP_BACKOFF);\n break;\n case KeyDownloadErrorCode.STOPPED:\n // If the downloader was stopped, we don't want to retry.\n this.downloadLoopRunning = false;\n return;\n }\n } else if (err instanceof KeyDownloadRateLimitError) {\n // we want to retry after the backoff time\n await sleep(err.retryMillis);\n }\n }\n }\n } finally {\n // all pending request have been processed, we can stop the loop.\n this.downloadLoopRunning = false;\n }\n }\n\n /**\n * Query the backup for a key.\n *\n * @param targetRoomId - ID of the room that the session is used in.\n * @param targetSessionId - ID of the session for which to check backup.\n * @param configuration - The backup configuration to use.\n */\n private async queryKeyBackup(\n targetRoomId: string,\n targetSessionId: string,\n configuration: Configuration,\n ): Promise<KeyBackupSession> {\n this.logger.debug(`Checking key backup for session ${targetSessionId}`);\n if (this.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n try {\n const res = await this.requestRoomKeyFromBackup(configuration.backupVersion, targetRoomId, targetSessionId);\n this.logger.debug(`Got key from backup for sessionId:${targetSessionId}`);\n return res;\n } catch (e) {\n if (this.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n\n this.logger.info(`No luck requesting key backup for session ${targetSessionId}: ${e}`);\n if (e instanceof MatrixError) {\n const errCode = e.data.errcode;\n if (errCode == \"M_NOT_FOUND\") {\n // Unfortunately the spec doesn't give us a way to differentiate between a missing key and a wrong version.\n // Synapse will return:\n // - \"error\": \"Unknown backup version\" if the version is wrong.\n // - \"error\": \"No room_keys found\" if the key is missing.\n // It's useful to know if the key is missing or if the version is wrong.\n // As it's not spec'ed, we fall back on considering the key is not in backup.\n // Notice that this request will be lost if instead the backup got out of sync (updated from other session).\n throw new KeyDownloadError(KeyDownloadErrorCode.MISSING_DECRYPTION_KEY);\n }\n if (e.isRateLimitError()) {\n let waitTime: number | undefined;\n try {\n waitTime = e.getRetryAfterMs() ?? undefined;\n } catch (error) {\n this.logger.warn(\"Error while retrieving a rate-limit retry delay\", error);\n }\n if (waitTime && waitTime > 0) {\n this.logger.info(`Rate limited by server, waiting ${waitTime}ms`);\n }\n throw new KeyDownloadRateLimitError(waitTime ?? KEY_BACKUP_BACKOFF);\n }\n }\n throw new KeyDownloadError(KeyDownloadErrorCode.NETWORK_ERROR);\n }\n }\n\n private async decryptAndImport(\n sessionInfo: SessionInfo,\n data: KeyBackupSession,\n configuration: Configuration,\n ): Promise<void> {\n const sessionsToImport: Record<string, KeyBackupSession> = { [sessionInfo.megolmSessionId]: data };\n\n const keys = await configuration!.decryptor.decryptSessions(sessionsToImport);\n for (const k of keys) {\n k.room_id = sessionInfo.roomId;\n }\n await this.backupManager.importBackedUpRoomKeys(keys, configuration.backupVersion);\n }\n\n /**\n * Gets the current backup configuration or create one if it doesn't exist.\n *\n * When a valid configuration is found it is cached and returned for subsequent calls.\n * Otherwise, if a check is forced or a check has not yet been done, a new check is done.\n *\n * @returns The backup configuration to use or null if there is a configuration problem.\n */\n private async getOrCreateBackupConfiguration(): Promise<Configuration | null> {\n if (this.configuration) {\n return this.configuration;\n }\n\n // We already tried to check the configuration and it failed.\n // We don't want to try again immediately, we will retry if a configuration change is detected.\n if (this.hasConfigurationProblem) {\n return null;\n }\n\n // This method can be called rapidly by several emitted CryptoEvent, so we need to make sure that we don't\n // query the server several times.\n if (this.currentBackupVersionCheck != null) {\n this.logger.debug(`Already checking server version, use current promise`);\n return await this.currentBackupVersionCheck;\n }\n\n this.currentBackupVersionCheck = this.internalCheckFromServer();\n try {\n return await this.currentBackupVersionCheck;\n } finally {\n this.currentBackupVersionCheck = null;\n }\n }\n\n private async internalCheckFromServer(): Promise<Configuration | null> {\n let currentServerVersion = null;\n try {\n currentServerVersion = await this.backupManager.getServerBackupInfo();\n } catch (e) {\n this.logger.debug(`Backup: error while checking server version: ${e}`);\n this.hasConfigurationProblem = true;\n return null;\n }\n this.logger.debug(`Got current backup version from server: ${currentServerVersion?.version}`);\n\n if (currentServerVersion?.algorithm != \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n this.logger.info(`Unsupported algorithm ${currentServerVersion?.algorithm}`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n if (!currentServerVersion?.version) {\n this.logger.info(`No current key backup`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const activeVersion = await this.backupManager.getActiveBackupVersion();\n if (activeVersion == null || currentServerVersion.version != activeVersion) {\n // Either the current backup version on server side is not trusted, or it is out of sync with the active version on the client side.\n this.logger.info(\n `The current backup version on the server (${currentServerVersion.version}) is not trusted. Version we are currently backing up to: ${activeVersion}`,\n );\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const backupKeys = await this.getBackupDecryptionKey();\n if (!backupKeys?.decryptionKey) {\n this.logger.debug(`Not checking key backup for session (no decryption key)`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n if (activeVersion != backupKeys.backupVersion) {\n this.logger.debug(\n `Version for which we have a decryption key (${backupKeys.backupVersion}) doesn't match the version we are backing up to (${activeVersion})`,\n );\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const authData = currentServerVersion.auth_data as Curve25519AuthData;\n if (authData.public_key != backupKeys.decryptionKey.megolmV1PublicKey.publicKeyBase64) {\n this.logger.debug(`Key backup on server does not match our decryption key`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const backupDecryptor = this.backupManager.createBackupDecryptor(backupKeys.decryptionKey);\n this.hasConfigurationProblem = false;\n this.configuration = {\n decryptor: backupDecryptor,\n backupVersion: activeVersion,\n };\n return this.configuration;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAAS,WAAW,QAAQ,wBAAwB;AAEpD,SAAS,YAAY,EAAkB,WAAW,EAAsB,MAAM,QAAQ,sBAAsB;AAE5G,SAAS,SAAS,EAAE,KAAK,QAAQ,aAAa;AAG9C;AACA,MAAM,kBAAkB,GAAG,IAAI,CAAC,CAAC;;AAEjC;AACA;AACA;AAFA,IAGK,oBAAoB,0BAApB,oBAAoB;EACrB;EADC,oBAAoB;EAGrB;EAHC,oBAAoB;EAKrB;EALC,oBAAoB;EAAA,OAApB,oBAAoB;AAAA,EAApB,oBAAoB;AASzB,MAAM,gBAAgB,SAAS,KAAK,CAAC;EAC1B,WAAW,CAAiB,IAA0B,EAAE;IAC3D,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC;IAAC,KADjB,IAA0B,GAA1B,IAA0B;IAEzD,IAAI,CAAC,IAAI,GAAG,kBAAkB;EAClC;AACJ;AAEA,MAAM,yBAAyB,SAAS,KAAK,CAAC;EACnC,WAAW,CAAiB,WAAmB,EAAE;IACpD,KAAK,CAAC,6CAA6C,CAAC;IAAC,KADtB,WAAmB,GAAn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B;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"PerSessionKeyBackupDownloader.js","names":[],"sources":["../../src/rust-crypto/PerSessionKeyBackupDownloader.ts"],"sourcesContent":["/*\nCopyright 2023 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type OlmMachine } from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\nimport type * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { type Curve25519AuthData, type KeyBackupInfo, type KeyBackupSession } from \"../crypto-api/keybackup.ts\";\nimport { CryptoEvent } from \"../crypto-api/index.ts\";\nimport { type Logger } from \"../logger.ts\";\nimport { ClientPrefix, type IHttpOpts, MatrixError, type MatrixHttpApi, Method } from \"../http-api/index.ts\";\nimport { type RustBackupManager } from \"./backup.ts\";\nimport { encodeUri, sleep } from \"../utils.ts\";\nimport { type BackupDecryptor } from \"../common-crypto/CryptoBackend.ts\";\n\n// The minimum time to wait between two retries in case of errors. To avoid hammering the server.\nconst KEY_BACKUP_BACKOFF = 5000; // ms\n\n/**\n * Enumerates the different kind of errors that can occurs when downloading and importing a key from backup.\n */\nenum KeyDownloadErrorCode {\n /** The requested key is not in the backup. */\n MISSING_DECRYPTION_KEY = \"MISSING_DECRYPTION_KEY\",\n /** A network error occurred while trying to download the key from backup. */\n NETWORK_ERROR = \"NETWORK_ERROR\",\n /** The loop has been stopped. */\n STOPPED = \"STOPPED\",\n}\n\nclass KeyDownloadError extends Error {\n public constructor(public readonly code: KeyDownloadErrorCode) {\n super(`Failed to get key from backup: ${code}`);\n this.name = \"KeyDownloadError\";\n }\n}\n\nclass KeyDownloadRateLimitError extends Error {\n public constructor(public readonly retryMillis: number) {\n super(`Failed to get key from backup: rate limited`);\n this.name = \"KeyDownloadRateLimitError\";\n }\n}\n\n/** Details of a megolm session whose key we are trying to fetch. */\ntype SessionInfo = { roomId: string; megolmSessionId: string };\n\n/** Holds the current backup decryptor and version that should be used.\n *\n * This is intended to be used as an immutable object (a new instance should be created if the configuration changes),\n * and some of the logic relies on that, so the properties are marked as `readonly`.\n */\ntype Configuration = {\n readonly backupVersion: string;\n readonly decryptor: BackupDecryptor;\n};\n\n/**\n * Used when an 'unable to decrypt' error occurs. It attempts to download the key from the backup.\n *\n * The current backup API lacks pagination, which can lead to lengthy key retrieval times for large histories (several 10s of minutes).\n * To mitigate this, keys are downloaded on demand as decryption errors occurs.\n * While this approach may result in numerous requests, it improves user experience by reducing wait times for message decryption.\n *\n * The PerSessionKeyBackupDownloader is resistant to backup configuration changes: it will automatically resume querying when\n * the backup is configured correctly.\n */\nexport class PerSessionKeyBackupDownloader {\n private stopped = false;\n\n /**\n * The version and decryption key to use with current backup if all set up correctly.\n *\n * Will not be set unless `hasConfigurationProblem` is `false`.\n */\n private configuration: Configuration | null = null;\n\n /** We remember when a session was requested and not found in backup to avoid query again too soon.\n * Map of session_id to timestamp */\n private sessionLastCheckAttemptedTime: Map<string, number> = new Map();\n\n /** The logger to use */\n private readonly logger: Logger;\n\n /** Whether the download loop is running. */\n private downloadLoopRunning = false;\n\n /** The list of requests that are queued. */\n private queuedRequests: SessionInfo[] = [];\n\n /** Remembers if we have a configuration problem. */\n private hasConfigurationProblem = false;\n\n /** The current server backup version check promise. To avoid doing a server call if one is in flight. */\n private currentBackupVersionCheck: Promise<Configuration | null> | null = null;\n\n /**\n * Creates a new instance of PerSessionKeyBackupDownloader.\n *\n * @param backupManager - The backup manager to use.\n * @param olmMachine - The olm machine to use.\n * @param http - The http instance to use.\n * @param logger - The logger to use.\n */\n public constructor(\n logger: Logger,\n private readonly olmMachine: OlmMachine,\n private readonly http: MatrixHttpApi<IHttpOpts & { onlyData: true }>,\n private readonly backupManager: RustBackupManager,\n ) {\n this.logger = logger.getChild(\"[PerSessionKeyBackupDownloader]\");\n\n backupManager.on(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n backupManager.on(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n backupManager.on(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n }\n\n /**\n * Check if key download is successfully configured and active.\n *\n * @returns `true` if key download is correctly configured and active; otherwise `false`.\n */\n public isKeyBackupDownloadConfigured(): boolean {\n return this.configuration !== null;\n }\n\n /**\n * Return the details of the latest backup on the server, when we last checked.\n *\n * This is just a convenience method to expose {@link RustBackupManager.getServerBackupInfo}.\n */\n public async getServerBackupInfo(): Promise<KeyBackupInfo | null | undefined> {\n return await this.backupManager.getServerBackupInfo();\n }\n\n /**\n * Called when a MissingRoomKey or UnknownMessageIndex decryption error is encountered.\n *\n * This will try to download the key from the backup if there is a trusted active backup.\n * In case of success the key will be imported and the onRoomKeysUpdated callback will be called\n * internally by the rust-sdk and decryption will be retried.\n *\n * @param roomId - The room ID of the room where the error occurred.\n * @param megolmSessionId - The megolm session ID that is missing.\n */\n public onDecryptionKeyMissingError(roomId: string, megolmSessionId: string): void {\n // Several messages encrypted with the same session may be decrypted at the same time,\n // so we need to be resistant and not query several time the same session.\n if (this.isAlreadyInQueue(roomId, megolmSessionId)) {\n // There is already a request queued for this session, no need to queue another one.\n this.logger.trace(`Not checking key backup for session ${megolmSessionId} as it is already queued`);\n return;\n }\n\n if (this.wasRequestedRecently(megolmSessionId)) {\n // We already tried to download this session recently and it was not in backup, no need to try again.\n this.logger.trace(\n `Not checking key backup for session ${megolmSessionId} as it was already requested recently`,\n );\n return;\n }\n\n // We always add the request to the queue, even if we have a configuration problem (can't access backup).\n // This is to make sure that if the configuration problem is resolved, we will try to download the key.\n // This will happen after an initial sync, at this point the backup will not yet be trusted and the decryption\n // key will not be available, but it will be just after the verification.\n // We don't need to persist it because currently on refresh the sdk will retry to decrypt the messages in error.\n this.queuedRequests.push({ roomId, megolmSessionId });\n\n // Start the download loop if it's not already running.\n this.downloadKeysLoop();\n }\n\n public stop(): void {\n this.stopped = true;\n this.backupManager.off(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n this.backupManager.off(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n this.backupManager.off(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n }\n\n /**\n * Called when the backup status changes (CryptoEvents)\n * This will trigger a check of the backup configuration.\n */\n private onBackupStatusChanged = (): void => {\n // we want to force check configuration, so we clear the current one.\n this.hasConfigurationProblem = false;\n this.configuration = null;\n this.getOrCreateBackupConfiguration().then((configuration) => {\n if (configuration) {\n // restart the download loop if it was stopped\n this.downloadKeysLoop();\n }\n });\n };\n\n /** Returns true if the megolm session is already queued for download. */\n private isAlreadyInQueue(roomId: string, megolmSessionId: string): boolean {\n return this.queuedRequests.some((info) => {\n return info.roomId == roomId && info.megolmSessionId == megolmSessionId;\n });\n }\n\n /**\n * Marks the session as not found in backup, to avoid retrying to soon for a key not in backup\n *\n * @param megolmSessionId - The megolm session ID that is missing.\n */\n private markAsNotFoundInBackup(megolmSessionId: string): void {\n const now = Date.now();\n this.sessionLastCheckAttemptedTime.set(megolmSessionId, now);\n // if too big make some cleaning to keep under control\n if (this.sessionLastCheckAttemptedTime.size > 100) {\n this.sessionLastCheckAttemptedTime = new Map(\n Array.from(this.sessionLastCheckAttemptedTime).filter((sid, ts) => {\n return Math.max(now - ts, 0) < KEY_BACKUP_BACKOFF;\n }),\n );\n }\n }\n\n /** Returns true if the session was requested recently. */\n private wasRequestedRecently(megolmSessionId: string): boolean {\n const lastCheck = this.sessionLastCheckAttemptedTime.get(megolmSessionId);\n if (!lastCheck) return false;\n return Math.max(Date.now() - lastCheck, 0) < KEY_BACKUP_BACKOFF;\n }\n\n private async getBackupDecryptionKey(): Promise<RustSdkCryptoJs.BackupKeys | null> {\n try {\n return await this.olmMachine.getBackupKeys();\n } catch {\n return null;\n }\n }\n\n /**\n * Requests a key from the server side backup.\n *\n * @param version - The backup version to use.\n * @param roomId - The room ID of the room where the error occurred.\n * @param sessionId - The megolm session ID that is missing.\n */\n private async requestRoomKeyFromBackup(\n version: string,\n roomId: string,\n sessionId: string,\n ): Promise<KeyBackupSession> {\n const path = encodeUri(\"/room_keys/keys/$roomId/$sessionId\", {\n $roomId: roomId,\n $sessionId: sessionId,\n });\n\n return await this.http.authedRequest<KeyBackupSession>(Method.Get, path, { version }, undefined, {\n prefix: ClientPrefix.V3,\n });\n }\n\n private async downloadKeysLoop(): Promise<void> {\n if (this.downloadLoopRunning) return;\n\n // If we have a configuration problem, we don't want to try to download.\n // If any configuration change is detected, we will retry and restart the loop.\n if (this.hasConfigurationProblem) return;\n\n this.downloadLoopRunning = true;\n\n try {\n while (this.queuedRequests.length > 0) {\n // we just peek the first one without removing it, so if a new request for same key comes in while we're\n // processing this one, it won't queue another request.\n const request = this.queuedRequests[0];\n try {\n // The backup could have changed between the time we queued the request and now, so we need to check\n const configuration = await this.getOrCreateBackupConfiguration();\n if (!configuration) {\n // Backup is not configured correctly, so stop the loop.\n this.downloadLoopRunning = false;\n return;\n }\n\n const result = await this.queryKeyBackup(request.roomId, request.megolmSessionId, configuration);\n\n if (this.stopped) {\n return;\n }\n // We got the encrypted key from backup, let's try to decrypt and import it.\n try {\n await this.decryptAndImport(request, result, configuration);\n } catch (e) {\n this.logger.error(\n `Error while decrypting and importing key backup for session ${request.megolmSessionId}`,\n e,\n );\n }\n // now remove the request from the queue as we've processed it.\n this.queuedRequests.shift();\n } catch (err) {\n if (err instanceof KeyDownloadError) {\n switch (err.code) {\n case KeyDownloadErrorCode.MISSING_DECRYPTION_KEY:\n this.markAsNotFoundInBackup(request.megolmSessionId);\n // continue for next one\n this.queuedRequests.shift();\n break;\n case KeyDownloadErrorCode.NETWORK_ERROR:\n // We don't want to hammer if there is a problem, so wait a bit.\n await sleep(KEY_BACKUP_BACKOFF);\n break;\n case KeyDownloadErrorCode.STOPPED:\n // If the downloader was stopped, we don't want to retry.\n this.downloadLoopRunning = false;\n return;\n }\n } else if (err instanceof KeyDownloadRateLimitError) {\n // we want to retry after the backoff time\n await sleep(err.retryMillis);\n }\n }\n }\n } finally {\n // all pending request have been processed, we can stop the loop.\n this.downloadLoopRunning = false;\n }\n }\n\n /**\n * Query the backup for a key.\n *\n * @param targetRoomId - ID of the room that the session is used in.\n * @param targetSessionId - ID of the session for which to check backup.\n * @param configuration - The backup configuration to use.\n */\n private async queryKeyBackup(\n targetRoomId: string,\n targetSessionId: string,\n configuration: Configuration,\n ): Promise<KeyBackupSession> {\n this.logger.debug(`Checking key backup for session ${targetSessionId}`);\n if (this.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n try {\n const res = await this.requestRoomKeyFromBackup(configuration.backupVersion, targetRoomId, targetSessionId);\n this.logger.debug(`Got key from backup for sessionId:${targetSessionId}`);\n return res;\n } catch (e) {\n if (this.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n\n this.logger.info(`No luck requesting key backup for session ${targetSessionId}: ${e}`);\n if (e instanceof MatrixError) {\n const errCode = e.data.errcode;\n if (errCode == \"M_NOT_FOUND\") {\n // Unfortunately the spec doesn't give us a way to differentiate between a missing key and a wrong version.\n // Synapse will return:\n // - \"error\": \"Unknown backup version\" if the version is wrong.\n // - \"error\": \"No room_keys found\" if the key is missing.\n // It's useful to know if the key is missing or if the version is wrong.\n // As it's not spec'ed, we fall back on considering the key is not in backup.\n // Notice that this request will be lost if instead the backup got out of sync (updated from other session).\n throw new KeyDownloadError(KeyDownloadErrorCode.MISSING_DECRYPTION_KEY);\n }\n if (e.isRateLimitError()) {\n let waitTime: number | undefined;\n try {\n waitTime = e.getRetryAfterMs() ?? undefined;\n } catch (error) {\n this.logger.warn(\"Error while retrieving a rate-limit retry delay\", error);\n }\n if (waitTime && waitTime > 0) {\n this.logger.info(`Rate limited by server, waiting ${waitTime}ms`);\n }\n throw new KeyDownloadRateLimitError(waitTime ?? KEY_BACKUP_BACKOFF);\n }\n }\n throw new KeyDownloadError(KeyDownloadErrorCode.NETWORK_ERROR);\n }\n }\n\n private async decryptAndImport(\n sessionInfo: SessionInfo,\n data: KeyBackupSession,\n configuration: Configuration,\n ): Promise<void> {\n const sessionsToImport: Record<string, KeyBackupSession> = { [sessionInfo.megolmSessionId]: data };\n\n const keys = await configuration.decryptor.decryptSessions(sessionsToImport);\n for (const k of keys) {\n k.room_id = sessionInfo.roomId;\n }\n await this.backupManager.importBackedUpRoomKeys(keys, configuration.backupVersion);\n }\n\n /**\n * Gets the current backup configuration or create one if it doesn't exist.\n *\n * When a valid configuration is found it is cached and returned for subsequent calls.\n * Otherwise, if a check is forced or a check has not yet been done, a new check is done.\n *\n * @returns The backup configuration to use or null if there is a configuration problem.\n */\n private async getOrCreateBackupConfiguration(): Promise<Configuration | null> {\n if (this.configuration) {\n return this.configuration;\n }\n\n // We already tried to check the configuration and it failed.\n // We don't want to try again immediately, we will retry if a configuration change is detected.\n if (this.hasConfigurationProblem) {\n return null;\n }\n\n // This method can be called rapidly by several emitted CryptoEvent, so we need to make sure that we don't\n // query the server several times.\n if (this.currentBackupVersionCheck != null) {\n this.logger.debug(`Already checking server version, use current promise`);\n return await this.currentBackupVersionCheck;\n }\n\n this.currentBackupVersionCheck = this.internalCheckFromServer();\n try {\n return await this.currentBackupVersionCheck;\n } finally {\n this.currentBackupVersionCheck = null;\n }\n }\n\n private async internalCheckFromServer(): Promise<Configuration | null> {\n let currentServerVersion = null;\n try {\n currentServerVersion = await this.backupManager.getServerBackupInfo();\n } catch (e) {\n this.logger.debug(`Backup: error while checking server version: ${e}`);\n this.hasConfigurationProblem = true;\n return null;\n }\n this.logger.debug(`Got current backup version from server: ${currentServerVersion?.version}`);\n\n if (currentServerVersion?.algorithm != \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n this.logger.info(`Unsupported algorithm ${currentServerVersion?.algorithm}`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n if (!currentServerVersion?.version) {\n this.logger.info(`No current key backup`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const activeVersion = await this.backupManager.getActiveBackupVersion();\n if (activeVersion == null || currentServerVersion.version != activeVersion) {\n // Either the current backup version on server side is not trusted, or it is out of sync with the active version on the client side.\n this.logger.info(\n `The current backup version on the server (${currentServerVersion.version}) is not trusted. Version we are currently backing up to: ${activeVersion}`,\n );\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const backupKeys = await this.getBackupDecryptionKey();\n if (!backupKeys?.decryptionKey) {\n this.logger.debug(`Not checking key backup for session (no decryption key)`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n if (activeVersion != backupKeys.backupVersion) {\n this.logger.debug(\n `Version for which we have a decryption key (${backupKeys.backupVersion}) doesn't match the version we are backing up to (${activeVersion})`,\n );\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const authData = currentServerVersion.auth_data as Curve25519AuthData;\n if (authData.public_key != backupKeys.decryptionKey.megolmV1PublicKey.publicKeyBase64) {\n this.logger.debug(`Key backup on server does not match our decryption key`);\n this.hasConfigurationProblem = true;\n return null;\n }\n\n const backupDecryptor = this.backupManager.createBackupDecryptor(backupKeys.decryptionKey);\n this.hasConfigurationProblem = false;\n this.configuration = {\n decryptor: backupDecryptor,\n backupVersion: activeVersion,\n };\n return this.configuration;\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAAS,WAAW,QAAQ,wBAAwB;AAEpD,SAAS,YAAY,EAAkB,WAAW,EAAsB,MAAM,QAAQ,sBAAsB;AAE5G,SAAS,SAAS,EAAE,KAAK,QAAQ,aAAa;AAG9C;AACA,MAAM,kBAAkB,GAAG,IAAI,CAAC,CAAC;;AAEjC;AACA;AACA;AAFA,IAGK,oBAAoB,0BAApB,oBAAo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AAE,mBAAmB,GACzC,OAAO,CAAC,IAAI,CAAC,CASf;IAED;;;;;;;;;;;OAWG;IACI,YAAY,CACf,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,gCAAgC,EAAE,OAAO,EACzC,mBAAmB,EAAE,mBAAmB,GACzC,OAAO,CAAC,IAAI,CAAC,CAsBf;IAED;;;;;;;;;;;OAWG;YACW,uBAAuB;IAiHrC;;OAEG;IACU,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKhD;YAEa,iBAAiB;CA6BlC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,iBAAiB,GAAG,qBAAqB,CAW5F"}
@@ -1,13 +1,12 @@
1
1
  import { type OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm";
2
2
  import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
3
- import { type BackupTrustInfo, type KeyBackupCheck, type KeyBackupInfo, type KeyBackupSession, type Curve25519SessionData, type KeyBackupRestoreOpts, type KeyBackupRestoreResult, type KeyBackupRoomSessions } from "../crypto-api/keybackup.ts";
3
+ import { type BackupTrustInfo, type KeyBackupCheck, type KeyBackupInfo, type KeyBackupSession, type KeyBackupRestoreOpts, type KeyBackupRestoreResult, type KeyBackupRoomSessions } from "../crypto-api/keybackup.ts";
4
4
  import { type Logger } from "../logger.ts";
5
5
  import { type IHttpOpts, type MatrixHttpApi } from "../http-api/index.ts";
6
6
  import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
7
7
  import { type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
8
8
  import { type BackupDecryptor } from "../common-crypto/CryptoBackend.ts";
9
9
  import { type ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts";
10
- import { type AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts";
11
10
  import { type IMegolmSessionData } from "../@types/crypto.ts";
12
11
  /** Authentification of the backup info, depends on algorithm */
13
12
  type AuthData = KeyBackupInfo["auth_data"];
@@ -118,6 +117,23 @@ export declare class RustBackupManager extends TypedEventEmitter<RustBackupCrypt
118
117
  * re-fetch it from the server.
119
118
  */
120
119
  private doCheckKeyBackup;
120
+ /**
121
+ * Enable key backup upload for the given backup version, if it is not already.
122
+ *
123
+ * If backup is currently enabled for a different version, disables it first.
124
+ *
125
+ * Also emits one or more {@link CryptoEvent.KeyBackupStatus} events if the backup status changes.
126
+ *
127
+ * @param backupInfo - the desired backup version (and the encryption key).
128
+ * @param activeVersion - the current active backup version (or `null`, if none).
129
+ */
130
+ private enableOrSwitchKeyBackup;
131
+ /**
132
+ * Helper for {@link enableOrSwitchKeyBackup}.
133
+ *
134
+ * Enables key backup upload for the given backup version. Also emits
135
+ * a {@link CryptoEvent.KeyBackupStatus} event.
136
+ */
121
137
  private enableKeyBackup;
122
138
  /**
123
139
  * Restart the backup key loop if there is an active trusted backup.
@@ -146,11 +162,14 @@ export declare class RustBackupManager extends TypedEventEmitter<RustBackupCrypt
146
162
  */
147
163
  requestKeyBackupVersion(version?: string): Promise<KeyBackupInfo | null>;
148
164
  /**
149
- * Creates a new key backup by generating a new random private key.
165
+ * Creates a new key backup by generating a new random private key, and then enable key backup upload and download
166
+ * using the new backup version.
150
167
  *
151
168
  * If there is an existing backup server side it will be deleted and replaced
152
169
  * by the new one.
153
170
  *
171
+ * Saves the decryption key in the Rust SDK's CryptoStore.
172
+ *
154
173
  * @param signObject - Method that should sign the backup with existing device and
155
174
  * existing identity.
156
175
  * @returns a KeyBackupCreationInfo - All information related to the backup.
@@ -237,7 +256,7 @@ export declare class RustBackupDecryptor implements BackupDecryptor {
237
256
  /**
238
257
  * Implements {@link BackupDecryptor#decryptSessions}
239
258
  */
240
- decryptSessions(ciphertexts: Record<string, KeyBackupSession<Curve25519SessionData | AESEncryptedSecretStoragePayload>>): Promise<IMegolmSessionData[]>;
259
+ decryptSessions(ciphertexts: Record<string, KeyBackupSession>): Promise<IMegolmSessionData[]>;
241
260
  /**
242
261
  * Implements {@link BackupDecryptor#free}
243
262
  */
@@ -1 +1 @@
1
- {"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../src/rust-crypto/backup.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,UAAU,EAA8B,MAAM,oCAAoC,CAAC;AACjG,OAAO,KAAK,eAAe,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EACH,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAgB,KAAK,SAAS,EAAe,KAAK,aAAa,EAAU,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAEH,KAAK,kBAAkB,EACvB,WAAW,EAEd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,gEAAgE;AAChE,KAAK,QAAQ,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAE3C;;;GAGG;AACH,UAAU,qBAAqB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,eAAe,CAAC,mBAAmB,CAAC;CACtD;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,iBAAiB,CAAC,sBAAsB,EAA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