@archipelagolab/lobi 1.0.6 → 1.0.8

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 (1533) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/README.md +76 -78
  3. package/SPEC-SUPPORT.md +116 -0
  4. package/api.ts +18 -0
  5. package/auth-presence.ts +56 -0
  6. package/channel-plugin-api.ts +3 -0
  7. package/cli-metadata.ts +11 -0
  8. package/contract-api.ts +17 -0
  9. package/helper-api.ts +3 -0
  10. package/index.test.ts +61 -0
  11. package/index.ts +56 -0
  12. package/openclaw.plugin.json +10 -10
  13. package/package.json +12 -19
  14. package/plugin-entry.handlers.runtime.ts +1 -0
  15. package/runtime-api.ts +54 -0
  16. package/runtime-heavy-api.ts +1 -0
  17. package/secret-contract-api.ts +5 -0
  18. package/setup-entry.ts +13 -0
  19. package/src/account-selection.test.ts +124 -0
  20. package/src/account-selection.ts +220 -0
  21. package/src/actions.account-propagation.test.ts +251 -0
  22. package/src/actions.test.ts +251 -0
  23. package/src/actions.ts +336 -0
  24. package/src/approval-auth.test.ts +23 -0
  25. package/src/approval-auth.ts +25 -0
  26. package/src/approval-handler.runtime.test.ts +46 -0
  27. package/src/approval-handler.runtime.ts +400 -0
  28. package/src/approval-ids.ts +6 -0
  29. package/src/approval-native.test.ts +329 -0
  30. package/src/approval-native.ts +336 -0
  31. package/src/approval-reactions.test.ts +107 -0
  32. package/src/approval-reactions.ts +158 -0
  33. package/src/auth-precedence.ts +61 -0
  34. package/src/channel-account-paths.ts +92 -0
  35. package/src/channel.account-paths.test.ts +102 -0
  36. package/src/channel.directory.test.ts +601 -0
  37. package/src/channel.resolve.test.ts +38 -0
  38. package/src/channel.runtime.ts +16 -0
  39. package/src/channel.setup.test.ts +269 -0
  40. package/src/channel.ts +570 -0
  41. package/src/cli-metadata.ts +19 -0
  42. package/src/cli.test.ts +1015 -0
  43. package/src/cli.ts +1198 -0
  44. package/src/config-adapter.ts +41 -0
  45. package/src/config-schema.test.ts +90 -0
  46. package/src/config-schema.ts +114 -0
  47. package/src/directory-live.test.ts +200 -0
  48. package/src/directory-live.ts +238 -0
  49. package/src/doctor-contract.ts +287 -0
  50. package/src/doctor.test.ts +440 -0
  51. package/src/doctor.ts +262 -0
  52. package/src/env-vars.ts +92 -0
  53. package/src/exec-approval-resolver.test.ts +68 -0
  54. package/src/exec-approval-resolver.ts +23 -0
  55. package/src/exec-approvals.test.ts +483 -0
  56. package/src/exec-approvals.ts +290 -0
  57. package/src/group-mentions.ts +41 -0
  58. package/src/legacy-crypto-inspector-availability.test.ts +81 -0
  59. package/src/legacy-crypto-inspector-availability.ts +60 -0
  60. package/src/legacy-crypto.test.ts +234 -0
  61. package/src/legacy-crypto.ts +549 -0
  62. package/src/legacy-state.test.ts +86 -0
  63. package/src/legacy-state.ts +156 -0
  64. package/src/matrix/account-config.ts +150 -0
  65. package/src/matrix/accounts.readiness.test.ts +27 -0
  66. package/src/matrix/accounts.test.ts +757 -0
  67. package/src/matrix/accounts.ts +194 -0
  68. package/src/matrix/actions/client.test.ts +215 -0
  69. package/src/matrix/actions/client.ts +31 -0
  70. package/src/matrix/actions/devices.test.ts +114 -0
  71. package/src/matrix/actions/devices.ts +34 -0
  72. package/src/matrix/actions/limits.test.ts +15 -0
  73. package/src/matrix/actions/limits.ts +6 -0
  74. package/src/matrix/actions/messages.test.ts +289 -0
  75. package/src/matrix/actions/messages.ts +123 -0
  76. package/src/matrix/actions/pins.test.ts +74 -0
  77. package/src/matrix/actions/pins.ts +64 -0
  78. package/src/matrix/actions/polls.test.ts +71 -0
  79. package/src/matrix/actions/polls.ts +109 -0
  80. package/src/matrix/actions/profile.test.ts +109 -0
  81. package/src/matrix/actions/profile.ts +37 -0
  82. package/src/matrix/actions/reactions.test.ts +135 -0
  83. package/src/matrix/actions/reactions.ts +59 -0
  84. package/src/matrix/actions/room.test.ts +79 -0
  85. package/src/matrix/actions/room.ts +71 -0
  86. package/src/matrix/actions/summary.test.ts +87 -0
  87. package/src/matrix/actions/summary.ts +88 -0
  88. package/src/matrix/actions/types.ts +82 -0
  89. package/src/matrix/actions/verification.test.ts +105 -0
  90. package/src/matrix/actions/verification.ts +237 -0
  91. package/src/matrix/actions.ts +37 -0
  92. package/src/matrix/active-client.ts +26 -0
  93. package/src/matrix/async-lock.ts +18 -0
  94. package/src/matrix/backup-health.ts +115 -0
  95. package/src/matrix/client/config-runtime-api.ts +14 -0
  96. package/src/matrix/client/config-secret-input.runtime.ts +1 -0
  97. package/src/matrix/client/config.ts +979 -0
  98. package/src/matrix/client/create-client.test.ts +115 -0
  99. package/src/matrix/client/create-client.ts +101 -0
  100. package/src/matrix/client/env-auth.ts +6 -0
  101. package/src/matrix/client/file-sync-store.test.ts +265 -0
  102. package/src/matrix/client/file-sync-store.ts +289 -0
  103. package/src/matrix/client/logging.ts +123 -0
  104. package/src/matrix/client/migration-snapshot.runtime.ts +1 -0
  105. package/src/matrix/client/private-network-host.ts +56 -0
  106. package/src/matrix/client/runtime.ts +4 -0
  107. package/src/matrix/client/shared.test.ts +344 -0
  108. package/src/matrix/client/shared.ts +306 -0
  109. package/src/matrix/client/storage.test.ts +634 -0
  110. package/src/matrix/client/storage.ts +544 -0
  111. package/src/matrix/client/types.ts +50 -0
  112. package/src/matrix/client-bootstrap.test.ts +84 -0
  113. package/src/matrix/client-bootstrap.ts +164 -0
  114. package/src/matrix/client-resolver.test-helpers.ts +147 -0
  115. package/src/matrix/client.test.ts +1521 -0
  116. package/src/matrix/client.ts +23 -0
  117. package/src/matrix/config-paths.ts +31 -0
  118. package/src/matrix/config-update.test.ts +237 -0
  119. package/src/matrix/config-update.ts +291 -0
  120. package/src/matrix/credentials-read.ts +206 -0
  121. package/src/matrix/credentials-write.runtime.ts +26 -0
  122. package/src/matrix/credentials.test.ts +501 -0
  123. package/src/matrix/credentials.ts +95 -0
  124. package/src/matrix/deps.test.ts +74 -0
  125. package/src/matrix/deps.ts +225 -0
  126. package/src/matrix/device-health.test.ts +45 -0
  127. package/src/matrix/device-health.ts +31 -0
  128. package/src/matrix/direct-management.test.ts +350 -0
  129. package/src/matrix/direct-management.ts +347 -0
  130. package/src/matrix/direct-room.test.ts +61 -0
  131. package/src/matrix/direct-room.ts +128 -0
  132. package/src/matrix/draft-stream.test.ts +406 -0
  133. package/src/matrix/draft-stream.ts +216 -0
  134. package/src/matrix/encryption-guidance.ts +27 -0
  135. package/src/matrix/errors.ts +21 -0
  136. package/src/matrix/format.test.ts +340 -0
  137. package/src/matrix/format.ts +428 -0
  138. package/src/matrix/legacy-crypto-inspector.ts +95 -0
  139. package/src/matrix/media-errors.ts +20 -0
  140. package/src/matrix/media-text.ts +169 -0
  141. package/src/matrix/monitor/access-state.test.ts +45 -0
  142. package/src/matrix/monitor/access-state.ts +77 -0
  143. package/src/matrix/monitor/ack-config.test.ts +57 -0
  144. package/src/matrix/monitor/ack-config.ts +26 -0
  145. package/src/matrix/monitor/allowlist.test.ts +45 -0
  146. package/src/matrix/monitor/allowlist.ts +94 -0
  147. package/src/matrix/monitor/auto-join.test.ts +203 -0
  148. package/src/matrix/monitor/auto-join.ts +86 -0
  149. package/src/matrix/monitor/config.test.ts +197 -0
  150. package/src/matrix/monitor/config.ts +303 -0
  151. package/src/matrix/monitor/context-summary.ts +43 -0
  152. package/src/matrix/monitor/direct.test.ts +529 -0
  153. package/src/matrix/monitor/direct.ts +270 -0
  154. package/src/matrix/monitor/events.test.ts +1524 -0
  155. package/src/matrix/monitor/events.ts +213 -0
  156. package/src/matrix/monitor/handler.body-for-agent.test.ts +396 -0
  157. package/src/matrix/monitor/handler.group-history.test.ts +648 -0
  158. package/src/matrix/monitor/handler.media-failure.test.ts +267 -0
  159. package/src/matrix/monitor/handler.test-helpers.ts +308 -0
  160. package/src/matrix/monitor/handler.test.ts +2952 -0
  161. package/src/matrix/monitor/handler.thread-root-media.test.ts +82 -0
  162. package/src/matrix/monitor/handler.ts +1679 -0
  163. package/src/matrix/monitor/inbound-dedupe.test.ts +146 -0
  164. package/src/matrix/monitor/inbound-dedupe.ts +267 -0
  165. package/src/matrix/monitor/index.test.ts +920 -0
  166. package/src/matrix/monitor/index.ts +434 -0
  167. package/src/matrix/monitor/legacy-crypto-restore.test.ts +206 -0
  168. package/src/matrix/monitor/legacy-crypto-restore.ts +139 -0
  169. package/src/matrix/monitor/location.ts +100 -0
  170. package/src/matrix/monitor/media.test.ts +159 -0
  171. package/src/matrix/monitor/media.ts +119 -0
  172. package/src/matrix/monitor/mentions.test.ts +289 -0
  173. package/src/matrix/monitor/mentions.ts +177 -0
  174. package/src/matrix/monitor/reaction-events.test.ts +326 -0
  175. package/src/matrix/monitor/reaction-events.ts +187 -0
  176. package/src/matrix/monitor/recent-invite.test.ts +92 -0
  177. package/src/matrix/monitor/recent-invite.ts +30 -0
  178. package/src/matrix/monitor/replies.test.ts +265 -0
  179. package/src/matrix/monitor/replies.ts +136 -0
  180. package/src/matrix/monitor/reply-context.test.ts +276 -0
  181. package/src/matrix/monitor/reply-context.ts +92 -0
  182. package/src/matrix/monitor/room-history.test.ts +258 -0
  183. package/src/matrix/monitor/room-history.ts +301 -0
  184. package/src/matrix/monitor/room-info.test.ts +201 -0
  185. package/src/matrix/monitor/room-info.ts +126 -0
  186. package/src/matrix/monitor/rooms.test.ts +121 -0
  187. package/src/matrix/monitor/rooms.ts +52 -0
  188. package/src/matrix/monitor/route.test.ts +255 -0
  189. package/src/matrix/monitor/route.ts +178 -0
  190. package/src/matrix/monitor/runtime-api.ts +31 -0
  191. package/src/matrix/monitor/startup-verification.test.ts +294 -0
  192. package/src/matrix/monitor/startup-verification.ts +237 -0
  193. package/src/matrix/monitor/startup.test.ts +257 -0
  194. package/src/matrix/monitor/startup.ts +218 -0
  195. package/src/matrix/monitor/status.ts +111 -0
  196. package/src/matrix/monitor/sync-lifecycle.test.ts +224 -0
  197. package/src/matrix/monitor/sync-lifecycle.ts +91 -0
  198. package/src/matrix/monitor/task-runner.ts +38 -0
  199. package/src/matrix/monitor/thread-context.test.ts +149 -0
  200. package/src/matrix/monitor/thread-context.ts +108 -0
  201. package/src/matrix/monitor/threads.test.ts +68 -0
  202. package/src/matrix/monitor/threads.ts +85 -0
  203. package/src/matrix/monitor/types.ts +30 -0
  204. package/src/matrix/monitor/verification-events.ts +627 -0
  205. package/src/matrix/monitor/verification-utils.test.ts +47 -0
  206. package/src/matrix/monitor/verification-utils.ts +46 -0
  207. package/src/matrix/outbound-media-runtime.ts +1 -0
  208. package/src/matrix/poll-summary.ts +110 -0
  209. package/src/matrix/poll-types.test.ts +205 -0
  210. package/src/matrix/poll-types.ts +433 -0
  211. package/src/matrix/probe.runtime.ts +4 -0
  212. package/src/matrix/probe.test.ts +154 -0
  213. package/src/matrix/probe.ts +96 -0
  214. package/src/matrix/profile.test.ts +154 -0
  215. package/src/matrix/profile.ts +184 -0
  216. package/src/matrix/reaction-common.test.ts +96 -0
  217. package/src/matrix/reaction-common.ts +147 -0
  218. package/src/matrix/sdk/crypto-bootstrap.test.ts +505 -0
  219. package/src/matrix/sdk/crypto-bootstrap.ts +341 -0
  220. package/src/matrix/sdk/crypto-facade.test.ts +197 -0
  221. package/src/matrix/sdk/crypto-facade.ts +207 -0
  222. package/src/matrix/sdk/crypto-node.runtime.test.ts +27 -0
  223. package/src/matrix/sdk/crypto-node.runtime.ts +9 -0
  224. package/src/matrix/sdk/crypto-runtime.ts +11 -0
  225. package/src/matrix/sdk/decrypt-bridge.ts +356 -0
  226. package/src/matrix/sdk/event-helpers.test.ts +60 -0
  227. package/src/matrix/sdk/event-helpers.ts +71 -0
  228. package/src/matrix/sdk/http-client.test.ts +134 -0
  229. package/src/matrix/sdk/http-client.ts +87 -0
  230. package/src/matrix/sdk/idb-persistence-lock.ts +51 -0
  231. package/src/matrix/sdk/idb-persistence.lock-order.test.ts +108 -0
  232. package/src/matrix/sdk/idb-persistence.test-helpers.ts +88 -0
  233. package/src/matrix/sdk/idb-persistence.test.ts +149 -0
  234. package/src/matrix/sdk/idb-persistence.ts +283 -0
  235. package/src/matrix/sdk/logger.test.ts +25 -0
  236. package/src/matrix/sdk/logger.ts +108 -0
  237. package/src/matrix/sdk/read-response-with-limit.ts +19 -0
  238. package/src/matrix/sdk/recovery-key-store.test.ts +385 -0
  239. package/src/matrix/sdk/recovery-key-store.ts +430 -0
  240. package/src/matrix/sdk/transport.test.ts +161 -0
  241. package/src/matrix/sdk/transport.ts +344 -0
  242. package/src/matrix/sdk/types.ts +236 -0
  243. package/src/matrix/sdk/verification-manager.test.ts +509 -0
  244. package/src/matrix/sdk/verification-manager.ts +694 -0
  245. package/src/matrix/sdk/verification-status.ts +23 -0
  246. package/src/matrix/sdk.test.ts +2568 -0
  247. package/src/matrix/sdk.ts +1789 -0
  248. package/src/matrix/send/client.test.ts +174 -0
  249. package/src/matrix/send/client.ts +90 -0
  250. package/src/matrix/send/formatting.ts +189 -0
  251. package/src/matrix/send/media.ts +244 -0
  252. package/src/matrix/send/targets.test.ts +254 -0
  253. package/src/matrix/send/targets.ts +104 -0
  254. package/src/matrix/send/types.ts +134 -0
  255. package/src/matrix/send.test.ts +958 -0
  256. package/src/matrix/send.ts +609 -0
  257. package/src/matrix/session-store-metadata.ts +108 -0
  258. package/src/matrix/startup-abort.ts +44 -0
  259. package/src/matrix/sync-state.ts +27 -0
  260. package/src/matrix/target-ids.ts +102 -0
  261. package/src/matrix/thread-bindings-shared.ts +201 -0
  262. package/src/matrix/thread-bindings.test.ts +673 -0
  263. package/src/matrix/thread-bindings.ts +577 -0
  264. package/src/matrix-migration.runtime.ts +9 -0
  265. package/src/migration-config.test.ts +228 -0
  266. package/src/migration-config.ts +243 -0
  267. package/src/migration-snapshot-backup.ts +117 -0
  268. package/src/migration-snapshot.test.ts +184 -0
  269. package/src/migration-snapshot.ts +55 -0
  270. package/src/onboarding.resolve.test.ts +55 -0
  271. package/src/onboarding.test-harness.ts +158 -0
  272. package/src/onboarding.test.ts +665 -0
  273. package/src/onboarding.ts +773 -0
  274. package/src/outbound.test.ts +173 -0
  275. package/src/outbound.ts +78 -0
  276. package/src/plugin-entry.runtime.js +159 -0
  277. package/src/plugin-entry.runtime.test.ts +108 -0
  278. package/src/plugin-entry.runtime.ts +68 -0
  279. package/src/profile-update.ts +68 -0
  280. package/src/record-shared.ts +3 -0
  281. package/src/resolve-targets.test.ts +178 -0
  282. package/src/resolve-targets.ts +175 -0
  283. package/src/resolver.ts +21 -0
  284. package/src/runtime-api.ts +144 -0
  285. package/src/runtime.ts +7 -0
  286. package/src/secret-contract.ts +174 -0
  287. package/src/session-route.test.ts +315 -0
  288. package/src/session-route.ts +113 -0
  289. package/src/setup-bootstrap.ts +94 -0
  290. package/src/setup-config.ts +222 -0
  291. package/src/setup-contract.ts +89 -0
  292. package/src/setup-core.test.ts +326 -0
  293. package/src/setup-core.ts +50 -0
  294. package/src/setup-surface.ts +4 -0
  295. package/src/startup-maintenance.test.ts +227 -0
  296. package/src/startup-maintenance.ts +114 -0
  297. package/src/storage-paths.ts +92 -0
  298. package/src/test-helpers.ts +42 -0
  299. package/src/test-mocks.ts +55 -0
  300. package/src/test-runtime.ts +72 -0
  301. package/src/test-support/monitor-route-test-support.ts +8 -0
  302. package/src/tool-actions.runtime.ts +1 -0
  303. package/src/tool-actions.test.ts +422 -0
  304. package/src/tool-actions.ts +498 -0
  305. package/src/types.ts +230 -0
  306. package/test-api.ts +2 -0
  307. package/thread-bindings-runtime.ts +4 -0
  308. package/tsconfig.json +16 -0
  309. package/LICENSE +0 -17
  310. package/dist/APEv2Parser-6EMKXRZS.js +0 -15
  311. package/dist/APEv2Parser-6EMKXRZS.js.map +0 -7
  312. package/dist/APEv2Parser-FYYGMFPI.js +0 -15
  313. package/dist/APEv2Parser-FYYGMFPI.js.map +0 -7
  314. package/dist/AiffParser-E6XWRTXM.js +0 -194
  315. package/dist/AiffParser-E6XWRTXM.js.map +0 -7
  316. package/dist/AiffParser-JHSDQA7T.js +0 -194
  317. package/dist/AiffParser-JHSDQA7T.js.map +0 -7
  318. package/dist/AsfParser-TPCQDEJB.js +0 -620
  319. package/dist/AsfParser-TPCQDEJB.js.map +0 -7
  320. package/dist/AsfParser-WSOH2JQY.js +0 -620
  321. package/dist/AsfParser-WSOH2JQY.js.map +0 -7
  322. package/dist/DsdiffParser-CGD3C3TL.js +0 -192
  323. package/dist/DsdiffParser-CGD3C3TL.js.map +0 -7
  324. package/dist/DsdiffParser-EUWJ4YAR.js +0 -192
  325. package/dist/DsdiffParser-EUWJ4YAR.js.map +0 -7
  326. package/dist/DsfParser-3UTIJVNF.js +0 -114
  327. package/dist/DsfParser-3UTIJVNF.js.map +0 -7
  328. package/dist/DsfParser-R6TPBJIY.js +0 -114
  329. package/dist/DsfParser-R6TPBJIY.js.map +0 -7
  330. package/dist/FlacParser-HLLYPJ76.js +0 -16
  331. package/dist/FlacParser-HLLYPJ76.js.map +0 -7
  332. package/dist/FlacParser-VDASGZ3E.js +0 -16
  333. package/dist/FlacParser-VDASGZ3E.js.map +0 -7
  334. package/dist/MP4Parser-64RGJLUM.js +0 -1145
  335. package/dist/MP4Parser-64RGJLUM.js.map +0 -7
  336. package/dist/MP4Parser-SM7HYL3Z.js +0 -1145
  337. package/dist/MP4Parser-SM7HYL3Z.js.map +0 -7
  338. package/dist/MatroskaParser-O6RXAKYA.js +0 -662
  339. package/dist/MatroskaParser-O6RXAKYA.js.map +0 -7
  340. package/dist/MatroskaParser-X7WRZ6D4.js +0 -662
  341. package/dist/MatroskaParser-X7WRZ6D4.js.map +0 -7
  342. package/dist/MpegParser-B6NX6DS3.js +0 -652
  343. package/dist/MpegParser-B6NX6DS3.js.map +0 -7
  344. package/dist/MpegParser-KXQEC6KD.js +0 -652
  345. package/dist/MpegParser-KXQEC6KD.js.map +0 -7
  346. package/dist/MusepackParser-NURI46TG.js +0 -331
  347. package/dist/MusepackParser-NURI46TG.js.map +0 -7
  348. package/dist/MusepackParser-WUBT63DS.js +0 -331
  349. package/dist/MusepackParser-WUBT63DS.js.map +0 -7
  350. package/dist/OggParser-5IYVBXPS.js +0 -448
  351. package/dist/OggParser-5IYVBXPS.js.map +0 -7
  352. package/dist/OggParser-ZY6E5C2P.js +0 -448
  353. package/dist/OggParser-ZY6E5C2P.js.map +0 -7
  354. package/dist/WavPackParser-5KTCSQEU.js +0 -209
  355. package/dist/WavPackParser-5KTCSQEU.js.map +0 -7
  356. package/dist/WavPackParser-RTEHKSJH.js +0 -209
  357. package/dist/WavPackParser-RTEHKSJH.js.map +0 -7
  358. package/dist/WaveParser-3R2NLXGP.js +0 -300
  359. package/dist/WaveParser-3R2NLXGP.js.map +0 -7
  360. package/dist/WaveParser-RZSHVQPZ.js +0 -300
  361. package/dist/WaveParser-RZSHVQPZ.js.map +0 -7
  362. package/dist/auth-presence.js +0 -46
  363. package/dist/auth-presence.js.map +0 -7
  364. package/dist/channel-plugin-api.js +0 -79
  365. package/dist/channel-plugin-api.js.map +0 -7
  366. package/dist/chunk-22WAAZ6I.js +0 -114
  367. package/dist/chunk-22WAAZ6I.js.map +0 -7
  368. package/dist/chunk-2A6HEFSO.js +0 -676
  369. package/dist/chunk-2A6HEFSO.js.map +0 -7
  370. package/dist/chunk-2GFROLI2.js +0 -261
  371. package/dist/chunk-2GFROLI2.js.map +0 -7
  372. package/dist/chunk-2IQWKATM.js +0 -127
  373. package/dist/chunk-2IQWKATM.js.map +0 -7
  374. package/dist/chunk-2KGHUHKU.js +0 -169
  375. package/dist/chunk-2KGHUHKU.js.map +0 -7
  376. package/dist/chunk-2NEQI4K6.js +0 -171
  377. package/dist/chunk-2NEQI4K6.js.map +0 -7
  378. package/dist/chunk-2OSJ3MTW.js +0 -175
  379. package/dist/chunk-2OSJ3MTW.js.map +0 -7
  380. package/dist/chunk-2Q626TDO.js +0 -27
  381. package/dist/chunk-2Q626TDO.js.map +0 -7
  382. package/dist/chunk-2U6OZ7N2.js +0 -155
  383. package/dist/chunk-2U6OZ7N2.js.map +0 -7
  384. package/dist/chunk-2V6Y4CAN.js +0 -25
  385. package/dist/chunk-2V6Y4CAN.js.map +0 -7
  386. package/dist/chunk-2WHRUMOM.js +0 -321
  387. package/dist/chunk-2WHRUMOM.js.map +0 -7
  388. package/dist/chunk-2Z4IOUDZ.js +0 -129
  389. package/dist/chunk-2Z4IOUDZ.js.map +0 -7
  390. package/dist/chunk-2ZEPAW7U.js +0 -154
  391. package/dist/chunk-2ZEPAW7U.js.map +0 -7
  392. package/dist/chunk-2ZI6JK5O.js +0 -63
  393. package/dist/chunk-2ZI6JK5O.js.map +0 -7
  394. package/dist/chunk-34UY6D6X.js +0 -36
  395. package/dist/chunk-34UY6D6X.js.map +0 -7
  396. package/dist/chunk-3GIK7SAA.js +0 -109
  397. package/dist/chunk-3GIK7SAA.js.map +0 -7
  398. package/dist/chunk-3JD6JSJD.js +0 -111
  399. package/dist/chunk-3JD6JSJD.js.map +0 -7
  400. package/dist/chunk-3OXOEMBS.js +0 -123
  401. package/dist/chunk-3OXOEMBS.js.map +0 -7
  402. package/dist/chunk-3R4ATE4Q.js +0 -176
  403. package/dist/chunk-3R4ATE4Q.js.map +0 -7
  404. package/dist/chunk-3TOEIHG5.js +0 -314
  405. package/dist/chunk-3TOEIHG5.js.map +0 -7
  406. package/dist/chunk-3TRKKAVT.js +0 -130
  407. package/dist/chunk-3TRKKAVT.js.map +0 -7
  408. package/dist/chunk-3UFTTK7C.js +0 -418
  409. package/dist/chunk-3UFTTK7C.js.map +0 -7
  410. package/dist/chunk-3XO6AAIC.js +0 -25
  411. package/dist/chunk-3XO6AAIC.js.map +0 -7
  412. package/dist/chunk-427SAQME.js +0 -321
  413. package/dist/chunk-427SAQME.js.map +0 -7
  414. package/dist/chunk-4CFQNJ7F.js +0 -7
  415. package/dist/chunk-4CFQNJ7F.js.map +0 -7
  416. package/dist/chunk-4COI4L2Y.js +0 -31
  417. package/dist/chunk-4COI4L2Y.js.map +0 -7
  418. package/dist/chunk-4EKKDVG3.js +0 -1662
  419. package/dist/chunk-4EKKDVG3.js.map +0 -7
  420. package/dist/chunk-4JVNTZAI.js +0 -80
  421. package/dist/chunk-4JVNTZAI.js.map +0 -7
  422. package/dist/chunk-4L2QI6AY.js +0 -71
  423. package/dist/chunk-4L2QI6AY.js.map +0 -7
  424. package/dist/chunk-4O3BEYYM.js +0 -187
  425. package/dist/chunk-4O3BEYYM.js.map +0 -7
  426. package/dist/chunk-4OXPPDV6.js +0 -676
  427. package/dist/chunk-4OXPPDV6.js.map +0 -7
  428. package/dist/chunk-4QTZHELX.js +0 -51
  429. package/dist/chunk-4QTZHELX.js.map +0 -7
  430. package/dist/chunk-4U42OJMK.js +0 -217
  431. package/dist/chunk-4U42OJMK.js.map +0 -7
  432. package/dist/chunk-4WCKVGQ5.js +0 -193
  433. package/dist/chunk-4WCKVGQ5.js.map +0 -7
  434. package/dist/chunk-4XXERLFH.js +0 -95
  435. package/dist/chunk-4XXERLFH.js.map +0 -7
  436. package/dist/chunk-4Z2N4GW6.js +0 -247
  437. package/dist/chunk-4Z2N4GW6.js.map +0 -7
  438. package/dist/chunk-4ZY2BOQ4.js +0 -123
  439. package/dist/chunk-4ZY2BOQ4.js.map +0 -7
  440. package/dist/chunk-56HN4SH6.js +0 -46
  441. package/dist/chunk-56HN4SH6.js.map +0 -7
  442. package/dist/chunk-57ROEOHB.js +0 -183
  443. package/dist/chunk-57ROEOHB.js.map +0 -7
  444. package/dist/chunk-5APBBTGW.js +0 -7
  445. package/dist/chunk-5APBBTGW.js.map +0 -7
  446. package/dist/chunk-5BQ6LLNU.js +0 -39
  447. package/dist/chunk-5BQ6LLNU.js.map +0 -7
  448. package/dist/chunk-5LNGMBWW.js +0 -93
  449. package/dist/chunk-5LNGMBWW.js.map +0 -7
  450. package/dist/chunk-5XFQSYZ4.js +0 -52
  451. package/dist/chunk-5XFQSYZ4.js.map +0 -7
  452. package/dist/chunk-62N5N4AC.js +0 -241
  453. package/dist/chunk-62N5N4AC.js.map +0 -7
  454. package/dist/chunk-63QTHDJL.js +0 -52
  455. package/dist/chunk-63QTHDJL.js.map +0 -7
  456. package/dist/chunk-65UUVZ6B.js +0 -151
  457. package/dist/chunk-65UUVZ6B.js.map +0 -7
  458. package/dist/chunk-6COVTMAO.js +0 -3586
  459. package/dist/chunk-6COVTMAO.js.map +0 -7
  460. package/dist/chunk-6EYPDJUD.js +0 -34
  461. package/dist/chunk-6EYPDJUD.js.map +0 -7
  462. package/dist/chunk-6HDYPVA4.js +0 -15
  463. package/dist/chunk-6HDYPVA4.js.map +0 -7
  464. package/dist/chunk-6HX3DEXK.js +0 -178
  465. package/dist/chunk-6HX3DEXK.js.map +0 -7
  466. package/dist/chunk-6NO5VEVV.js +0 -18
  467. package/dist/chunk-6NO5VEVV.js.map +0 -7
  468. package/dist/chunk-6OP3FK5F.js +0 -266
  469. package/dist/chunk-6OP3FK5F.js.map +0 -7
  470. package/dist/chunk-6PZGDVLR.js +0 -465
  471. package/dist/chunk-6PZGDVLR.js.map +0 -7
  472. package/dist/chunk-6RBDFNSX.js +0 -88
  473. package/dist/chunk-6RBDFNSX.js.map +0 -7
  474. package/dist/chunk-6SOGH3TW.js +0 -163
  475. package/dist/chunk-6SOGH3TW.js.map +0 -7
  476. package/dist/chunk-6TWWCETB.js +0 -70
  477. package/dist/chunk-6TWWCETB.js.map +0 -7
  478. package/dist/chunk-6WFHPMUF.js +0 -17
  479. package/dist/chunk-6WFHPMUF.js.map +0 -7
  480. package/dist/chunk-72TGY3LX.js +0 -104
  481. package/dist/chunk-72TGY3LX.js.map +0 -7
  482. package/dist/chunk-76IE55K7.js +0 -392
  483. package/dist/chunk-76IE55K7.js.map +0 -7
  484. package/dist/chunk-77BEEAPD.js +0 -86
  485. package/dist/chunk-77BEEAPD.js.map +0 -7
  486. package/dist/chunk-77JJ6QJK.js +0 -50
  487. package/dist/chunk-77JJ6QJK.js.map +0 -7
  488. package/dist/chunk-7BIUNV33.js +0 -62
  489. package/dist/chunk-7BIUNV33.js.map +0 -7
  490. package/dist/chunk-7F3242AO.js +0 -86
  491. package/dist/chunk-7F3242AO.js.map +0 -7
  492. package/dist/chunk-7FLQSTPG.js +0 -57
  493. package/dist/chunk-7FLQSTPG.js.map +0 -7
  494. package/dist/chunk-7L37R42D.js +0 -52
  495. package/dist/chunk-7L37R42D.js.map +0 -7
  496. package/dist/chunk-7MP46JBP.js +0 -177
  497. package/dist/chunk-7MP46JBP.js.map +0 -7
  498. package/dist/chunk-7MVZYR2T.js +0 -87
  499. package/dist/chunk-7MVZYR2T.js.map +0 -7
  500. package/dist/chunk-7N7ISMPG.js +0 -50
  501. package/dist/chunk-7N7ISMPG.js.map +0 -7
  502. package/dist/chunk-7S7LQQPX.js +0 -127
  503. package/dist/chunk-7S7LQQPX.js.map +0 -7
  504. package/dist/chunk-7TTNY5FK.js +0 -21
  505. package/dist/chunk-7TTNY5FK.js.map +0 -7
  506. package/dist/chunk-7W73QCTR.js +0 -244
  507. package/dist/chunk-7W73QCTR.js.map +0 -7
  508. package/dist/chunk-7XXLU33Y.js +0 -76
  509. package/dist/chunk-7XXLU33Y.js.map +0 -7
  510. package/dist/chunk-7ZP3KYVO.js +0 -104
  511. package/dist/chunk-7ZP3KYVO.js.map +0 -7
  512. package/dist/chunk-AAO7BQEV.js +0 -258
  513. package/dist/chunk-AAO7BQEV.js.map +0 -7
  514. package/dist/chunk-AH4MLRYT.js +0 -91
  515. package/dist/chunk-AH4MLRYT.js.map +0 -7
  516. package/dist/chunk-AHKR32FH.js +0 -7
  517. package/dist/chunk-AHKR32FH.js.map +0 -7
  518. package/dist/chunk-ALKRFDAW.js +0 -94
  519. package/dist/chunk-ALKRFDAW.js.map +0 -7
  520. package/dist/chunk-AQQGAE7N.js +0 -12
  521. package/dist/chunk-AQQGAE7N.js.map +0 -7
  522. package/dist/chunk-ARGF232V.js +0 -32
  523. package/dist/chunk-ARGF232V.js.map +0 -7
  524. package/dist/chunk-ATCJOK3K.js +0 -24
  525. package/dist/chunk-ATCJOK3K.js.map +0 -7
  526. package/dist/chunk-AUUABFHL.js +0 -124
  527. package/dist/chunk-AUUABFHL.js.map +0 -7
  528. package/dist/chunk-AWW3YUGJ.js +0 -193
  529. package/dist/chunk-AWW3YUGJ.js.map +0 -7
  530. package/dist/chunk-AX7VEEWJ.js +0 -158
  531. package/dist/chunk-AX7VEEWJ.js.map +0 -7
  532. package/dist/chunk-B3NTODO7.js +0 -57
  533. package/dist/chunk-B3NTODO7.js.map +0 -7
  534. package/dist/chunk-BAX7Q6GR.js +0 -55
  535. package/dist/chunk-BAX7Q6GR.js.map +0 -7
  536. package/dist/chunk-BBM6BR3Z.js +0 -28
  537. package/dist/chunk-BBM6BR3Z.js.map +0 -7
  538. package/dist/chunk-BHXZMHSX.js +0 -109
  539. package/dist/chunk-BHXZMHSX.js.map +0 -7
  540. package/dist/chunk-BIUXDLVY.js +0 -62
  541. package/dist/chunk-BIUXDLVY.js.map +0 -7
  542. package/dist/chunk-BM7J2W36.js +0 -86
  543. package/dist/chunk-BM7J2W36.js.map +0 -7
  544. package/dist/chunk-BMFZL2P4.js +0 -97
  545. package/dist/chunk-BMFZL2P4.js.map +0 -7
  546. package/dist/chunk-BQXEXK4H.js +0 -114
  547. package/dist/chunk-BQXEXK4H.js.map +0 -7
  548. package/dist/chunk-BU2CTWBG.js +0 -30
  549. package/dist/chunk-BU2CTWBG.js.map +0 -7
  550. package/dist/chunk-BVKSCLF7.js +0 -195
  551. package/dist/chunk-BVKSCLF7.js.map +0 -7
  552. package/dist/chunk-BWA3D22L.js +0 -88
  553. package/dist/chunk-BWA3D22L.js.map +0 -7
  554. package/dist/chunk-CE24RSPL.js +0 -506
  555. package/dist/chunk-CE24RSPL.js.map +0 -7
  556. package/dist/chunk-CEB5S2Z5.js +0 -127
  557. package/dist/chunk-CEB5S2Z5.js.map +0 -7
  558. package/dist/chunk-CEKNTCJD.js +0 -177
  559. package/dist/chunk-CEKNTCJD.js.map +0 -7
  560. package/dist/chunk-CETZGSCP.js +0 -71
  561. package/dist/chunk-CETZGSCP.js.map +0 -7
  562. package/dist/chunk-CGBWMONK.js +0 -412
  563. package/dist/chunk-CGBWMONK.js.map +0 -7
  564. package/dist/chunk-CGFDIH77.js +0 -94
  565. package/dist/chunk-CGFDIH77.js.map +0 -7
  566. package/dist/chunk-CPLEC5LJ.js +0 -26
  567. package/dist/chunk-CPLEC5LJ.js.map +0 -7
  568. package/dist/chunk-CPNIXMGX.js +0 -127
  569. package/dist/chunk-CPNIXMGX.js.map +0 -7
  570. package/dist/chunk-CSJO73LD.js +0 -84
  571. package/dist/chunk-CSJO73LD.js.map +0 -7
  572. package/dist/chunk-CTKBDSL6.js +0 -81
  573. package/dist/chunk-CTKBDSL6.js.map +0 -7
  574. package/dist/chunk-CY6WHUCW.js +0 -54
  575. package/dist/chunk-CY6WHUCW.js.map +0 -7
  576. package/dist/chunk-D4GYYYMW.js +0 -155
  577. package/dist/chunk-D4GYYYMW.js.map +0 -7
  578. package/dist/chunk-D64CZG54.js +0 -78
  579. package/dist/chunk-D64CZG54.js.map +0 -7
  580. package/dist/chunk-D7Q6Z74D.js +0 -123
  581. package/dist/chunk-D7Q6Z74D.js.map +0 -7
  582. package/dist/chunk-DSGPDHF2.js +0 -737
  583. package/dist/chunk-DSGPDHF2.js.map +0 -7
  584. package/dist/chunk-DZIM4OWK.js +0 -17
  585. package/dist/chunk-DZIM4OWK.js.map +0 -7
  586. package/dist/chunk-E3GC4V5V.js +0 -30
  587. package/dist/chunk-E3GC4V5V.js.map +0 -7
  588. package/dist/chunk-E5HPDHCW.js +0 -34
  589. package/dist/chunk-E5HPDHCW.js.map +0 -7
  590. package/dist/chunk-E75BJJZ2.js +0 -635
  591. package/dist/chunk-E75BJJZ2.js.map +0 -7
  592. package/dist/chunk-EBXHW7ZO.js +0 -108
  593. package/dist/chunk-EBXHW7ZO.js.map +0 -7
  594. package/dist/chunk-EE4DHUUZ.js +0 -472
  595. package/dist/chunk-EE4DHUUZ.js.map +0 -7
  596. package/dist/chunk-EHELTAAD.js +0 -198
  597. package/dist/chunk-EHELTAAD.js.map +0 -7
  598. package/dist/chunk-EKXPSI7Z.js +0 -135
  599. package/dist/chunk-EKXPSI7Z.js.map +0 -7
  600. package/dist/chunk-EO35SCFP.js +0 -7
  601. package/dist/chunk-EO35SCFP.js.map +0 -7
  602. package/dist/chunk-ER2XTD2S.js +0 -271
  603. package/dist/chunk-ER2XTD2S.js.map +0 -7
  604. package/dist/chunk-ERCH75SH.js +0 -292
  605. package/dist/chunk-ERCH75SH.js.map +0 -7
  606. package/dist/chunk-ERXO3674.js +0 -54
  607. package/dist/chunk-ERXO3674.js.map +0 -7
  608. package/dist/chunk-EVFWZGFL.js +0 -235
  609. package/dist/chunk-EVFWZGFL.js.map +0 -7
  610. package/dist/chunk-EVPBRKMZ.js +0 -45
  611. package/dist/chunk-EVPBRKMZ.js.map +0 -7
  612. package/dist/chunk-F43CC2X2.js +0 -49
  613. package/dist/chunk-F43CC2X2.js.map +0 -7
  614. package/dist/chunk-F64TXVJJ.js +0 -158
  615. package/dist/chunk-F64TXVJJ.js.map +0 -7
  616. package/dist/chunk-F6AFJHWV.js +0 -45
  617. package/dist/chunk-F6AFJHWV.js.map +0 -7
  618. package/dist/chunk-F6APWSAA.js +0 -51
  619. package/dist/chunk-F6APWSAA.js.map +0 -7
  620. package/dist/chunk-F7LNS7G3.js +0 -235
  621. package/dist/chunk-F7LNS7G3.js.map +0 -7
  622. package/dist/chunk-FCNWR7ZX.js +0 -16352
  623. package/dist/chunk-FCNWR7ZX.js.map +0 -7
  624. package/dist/chunk-FFCG5NRU.js +0 -87
  625. package/dist/chunk-FFCG5NRU.js.map +0 -7
  626. package/dist/chunk-FG4NVFKM.js +0 -455
  627. package/dist/chunk-FG4NVFKM.js.map +0 -7
  628. package/dist/chunk-FHNEN6IR.js +0 -14
  629. package/dist/chunk-FHNEN6IR.js.map +0 -7
  630. package/dist/chunk-FJFC6CRR.js +0 -446
  631. package/dist/chunk-FJFC6CRR.js.map +0 -7
  632. package/dist/chunk-FK6RGYBB.js +0 -46
  633. package/dist/chunk-FK6RGYBB.js.map +0 -7
  634. package/dist/chunk-FMY6KXK6.js +0 -251
  635. package/dist/chunk-FMY6KXK6.js.map +0 -7
  636. package/dist/chunk-FPH56SCM.js +0 -21
  637. package/dist/chunk-FPH56SCM.js.map +0 -7
  638. package/dist/chunk-FQ4R7IOX.js +0 -32
  639. package/dist/chunk-FQ4R7IOX.js.map +0 -7
  640. package/dist/chunk-FQPYAPJJ.js +0 -124
  641. package/dist/chunk-FQPYAPJJ.js.map +0 -7
  642. package/dist/chunk-FQTLJO4W.js +0 -335
  643. package/dist/chunk-FQTLJO4W.js.map +0 -7
  644. package/dist/chunk-FVLJSB2W.js +0 -124
  645. package/dist/chunk-FVLJSB2W.js.map +0 -7
  646. package/dist/chunk-FVSH4Z6T.js +0 -173
  647. package/dist/chunk-FVSH4Z6T.js.map +0 -7
  648. package/dist/chunk-FVWBLEAD.js +0 -44
  649. package/dist/chunk-FVWBLEAD.js.map +0 -7
  650. package/dist/chunk-FYRKBNTI.js +0 -18
  651. package/dist/chunk-FYRKBNTI.js.map +0 -7
  652. package/dist/chunk-FYSARMGS.js +0 -93
  653. package/dist/chunk-FYSARMGS.js.map +0 -7
  654. package/dist/chunk-FZJOJ6P4.js +0 -28
  655. package/dist/chunk-FZJOJ6P4.js.map +0 -7
  656. package/dist/chunk-G46GHNDU.js +0 -4890
  657. package/dist/chunk-G46GHNDU.js.map +0 -7
  658. package/dist/chunk-G4TIS2SC.js +0 -56
  659. package/dist/chunk-G4TIS2SC.js.map +0 -7
  660. package/dist/chunk-GD6L3SLC.js +0 -30
  661. package/dist/chunk-GD6L3SLC.js.map +0 -7
  662. package/dist/chunk-GGWS7NQP.js +0 -247
  663. package/dist/chunk-GGWS7NQP.js.map +0 -7
  664. package/dist/chunk-GI2ZANRY.js +0 -24
  665. package/dist/chunk-GI2ZANRY.js.map +0 -7
  666. package/dist/chunk-GK3XVKXT.js +0 -737
  667. package/dist/chunk-GK3XVKXT.js.map +0 -7
  668. package/dist/chunk-GKOWCDQV.js +0 -699
  669. package/dist/chunk-GKOWCDQV.js.map +0 -7
  670. package/dist/chunk-GLLRCKKE.js +0 -26
  671. package/dist/chunk-GLLRCKKE.js.map +0 -7
  672. package/dist/chunk-GNYG6I36.js +0 -175
  673. package/dist/chunk-GNYG6I36.js.map +0 -7
  674. package/dist/chunk-GRBJYAYF.js +0 -129
  675. package/dist/chunk-GRBJYAYF.js.map +0 -7
  676. package/dist/chunk-GVYGUH2V.js +0 -7
  677. package/dist/chunk-GVYGUH2V.js.map +0 -7
  678. package/dist/chunk-GXDQGBA2.js +0 -106
  679. package/dist/chunk-GXDQGBA2.js.map +0 -7
  680. package/dist/chunk-GZAGAWSU.js +0 -28
  681. package/dist/chunk-GZAGAWSU.js.map +0 -7
  682. package/dist/chunk-H23E72SB.js +0 -163
  683. package/dist/chunk-H23E72SB.js.map +0 -7
  684. package/dist/chunk-H2HY73I6.js +0 -122
  685. package/dist/chunk-H2HY73I6.js.map +0 -7
  686. package/dist/chunk-H5MLA6PA.js +0 -29
  687. package/dist/chunk-H5MLA6PA.js.map +0 -7
  688. package/dist/chunk-H6YVV7GE.js +0 -22
  689. package/dist/chunk-H6YVV7GE.js.map +0 -7
  690. package/dist/chunk-H7KAUMBC.js +0 -635
  691. package/dist/chunk-H7KAUMBC.js.map +0 -7
  692. package/dist/chunk-HDPICD3P.js +0 -4890
  693. package/dist/chunk-HDPICD3P.js.map +0 -7
  694. package/dist/chunk-HGHU3TVL.js +0 -174
  695. package/dist/chunk-HGHU3TVL.js.map +0 -7
  696. package/dist/chunk-HJ5E2JRL.js +0 -88
  697. package/dist/chunk-HJ5E2JRL.js.map +0 -7
  698. package/dist/chunk-HJW3CKZL.js +0 -94
  699. package/dist/chunk-HJW3CKZL.js.map +0 -7
  700. package/dist/chunk-HKF5EBER.js +0 -418
  701. package/dist/chunk-HKF5EBER.js.map +0 -7
  702. package/dist/chunk-HLUR35G5.js +0 -30
  703. package/dist/chunk-HLUR35G5.js.map +0 -7
  704. package/dist/chunk-HNIW2NZU.js +0 -120
  705. package/dist/chunk-HNIW2NZU.js.map +0 -7
  706. package/dist/chunk-HP5HMWOM.js +0 -123
  707. package/dist/chunk-HP5HMWOM.js.map +0 -7
  708. package/dist/chunk-HQSHS6IB.js +0 -88
  709. package/dist/chunk-HQSHS6IB.js.map +0 -7
  710. package/dist/chunk-HSXRCP25.js +0 -171
  711. package/dist/chunk-HSXRCP25.js.map +0 -7
  712. package/dist/chunk-HTV3R73W.js +0 -51
  713. package/dist/chunk-HTV3R73W.js.map +0 -7
  714. package/dist/chunk-I26OPZLO.js +0 -28
  715. package/dist/chunk-I26OPZLO.js.map +0 -7
  716. package/dist/chunk-I7JJQ4BQ.js +0 -30
  717. package/dist/chunk-I7JJQ4BQ.js.map +0 -7
  718. package/dist/chunk-IJ6Y4W7F.js +0 -392
  719. package/dist/chunk-IJ6Y4W7F.js.map +0 -7
  720. package/dist/chunk-IJCMYMZB.js +0 -239
  721. package/dist/chunk-IJCMYMZB.js.map +0 -7
  722. package/dist/chunk-IJH4NOQ4.js +0 -18
  723. package/dist/chunk-IJH4NOQ4.js.map +0 -7
  724. package/dist/chunk-IMHRZQRH.js +0 -76
  725. package/dist/chunk-IMHRZQRH.js.map +0 -7
  726. package/dist/chunk-INNENDEE.js +0 -472
  727. package/dist/chunk-INNENDEE.js.map +0 -7
  728. package/dist/chunk-IOTLSMEQ.js +0 -177
  729. package/dist/chunk-IOTLSMEQ.js.map +0 -7
  730. package/dist/chunk-IQYYEHSM.js +0 -300
  731. package/dist/chunk-IQYYEHSM.js.map +0 -7
  732. package/dist/chunk-IRA5NJ4Q.js +0 -21
  733. package/dist/chunk-IRA5NJ4Q.js.map +0 -7
  734. package/dist/chunk-IU7EXXK7.js +0 -1662
  735. package/dist/chunk-IU7EXXK7.js.map +0 -7
  736. package/dist/chunk-IUXAKDAY.js +0 -102
  737. package/dist/chunk-IUXAKDAY.js.map +0 -7
  738. package/dist/chunk-JB6ZQEVR.js +0 -465
  739. package/dist/chunk-JB6ZQEVR.js.map +0 -7
  740. package/dist/chunk-JCWNMWNY.js +0 -102
  741. package/dist/chunk-JCWNMWNY.js.map +0 -7
  742. package/dist/chunk-JGIZPU2Y.js +0 -39
  743. package/dist/chunk-JGIZPU2Y.js.map +0 -7
  744. package/dist/chunk-JIU4FXA7.js +0 -485
  745. package/dist/chunk-JIU4FXA7.js.map +0 -7
  746. package/dist/chunk-JMYIFYY5.js +0 -233
  747. package/dist/chunk-JMYIFYY5.js.map +0 -7
  748. package/dist/chunk-JSZBX2TA.js +0 -5853
  749. package/dist/chunk-JSZBX2TA.js.map +0 -7
  750. package/dist/chunk-JU2Y33DB.js +0 -60
  751. package/dist/chunk-JU2Y33DB.js.map +0 -7
  752. package/dist/chunk-JVLRI4RU.js +0 -62
  753. package/dist/chunk-JVLRI4RU.js.map +0 -7
  754. package/dist/chunk-JZ3AVNZC.js +0 -44117
  755. package/dist/chunk-JZ3AVNZC.js.map +0 -7
  756. package/dist/chunk-K3HEWOHN.js +0 -30
  757. package/dist/chunk-K3HEWOHN.js.map +0 -7
  758. package/dist/chunk-K5EK4WZV.js +0 -7
  759. package/dist/chunk-K5EK4WZV.js.map +0 -7
  760. package/dist/chunk-KAWXMSYC.js +0 -58
  761. package/dist/chunk-KAWXMSYC.js.map +0 -7
  762. package/dist/chunk-KEGPHS4C.js +0 -80
  763. package/dist/chunk-KEGPHS4C.js.map +0 -7
  764. package/dist/chunk-KHFWQ334.js +0 -138
  765. package/dist/chunk-KHFWQ334.js.map +0 -7
  766. package/dist/chunk-KJW6JLM6.js +0 -95
  767. package/dist/chunk-KJW6JLM6.js.map +0 -7
  768. package/dist/chunk-KSEANSJE.js +0 -40
  769. package/dist/chunk-KSEANSJE.js.map +0 -7
  770. package/dist/chunk-KVU54E6W.js +0 -63
  771. package/dist/chunk-KVU54E6W.js.map +0 -7
  772. package/dist/chunk-KXXVR3DC.js +0 -244
  773. package/dist/chunk-KXXVR3DC.js.map +0 -7
  774. package/dist/chunk-L5OUVMHK.js +0 -174
  775. package/dist/chunk-L5OUVMHK.js.map +0 -7
  776. package/dist/chunk-L5T6XUDP.js +0 -412
  777. package/dist/chunk-L5T6XUDP.js.map +0 -7
  778. package/dist/chunk-LIFXTQ4U.js +0 -7287
  779. package/dist/chunk-LIFXTQ4U.js.map +0 -7
  780. package/dist/chunk-LIVQ7GIO.js +0 -86
  781. package/dist/chunk-LIVQ7GIO.js.map +0 -7
  782. package/dist/chunk-LMD5UTKM.js +0 -169
  783. package/dist/chunk-LMD5UTKM.js.map +0 -7
  784. package/dist/chunk-LO4F6E3N.js +0 -163
  785. package/dist/chunk-LO4F6E3N.js.map +0 -7
  786. package/dist/chunk-LSVKDUNM.js +0 -151
  787. package/dist/chunk-LSVKDUNM.js.map +0 -7
  788. package/dist/chunk-LTXNC6JX.js +0 -27
  789. package/dist/chunk-LTXNC6JX.js.map +0 -7
  790. package/dist/chunk-LUGTGPT6.js +0 -138
  791. package/dist/chunk-LUGTGPT6.js.map +0 -7
  792. package/dist/chunk-LVMK2GPM.js +0 -18
  793. package/dist/chunk-LVMK2GPM.js.map +0 -7
  794. package/dist/chunk-LXVPETLK.js +0 -1405
  795. package/dist/chunk-LXVPETLK.js.map +0 -7
  796. package/dist/chunk-LZNW24OB.js +0 -78
  797. package/dist/chunk-LZNW24OB.js.map +0 -7
  798. package/dist/chunk-LZQFDJNW.js +0 -300
  799. package/dist/chunk-LZQFDJNW.js.map +0 -7
  800. package/dist/chunk-M4VQPIF4.js +0 -5853
  801. package/dist/chunk-M4VQPIF4.js.map +0 -7
  802. package/dist/chunk-M64QE4QC.js +0 -64
  803. package/dist/chunk-M64QE4QC.js.map +0 -7
  804. package/dist/chunk-MAF6PSCJ.js +0 -44
  805. package/dist/chunk-MAF6PSCJ.js.map +0 -7
  806. package/dist/chunk-MBIX6Z7U.js +0 -80
  807. package/dist/chunk-MBIX6Z7U.js.map +0 -7
  808. package/dist/chunk-MDLLXMC3.js +0 -183
  809. package/dist/chunk-MDLLXMC3.js.map +0 -7
  810. package/dist/chunk-MEI5HTWV.js +0 -127
  811. package/dist/chunk-MEI5HTWV.js.map +0 -7
  812. package/dist/chunk-MH74AJ3A.js +0 -82
  813. package/dist/chunk-MH74AJ3A.js.map +0 -7
  814. package/dist/chunk-MIFIM4PI.js +0 -163
  815. package/dist/chunk-MIFIM4PI.js.map +0 -7
  816. package/dist/chunk-MISZB5QJ.js +0 -22
  817. package/dist/chunk-MISZB5QJ.js.map +0 -7
  818. package/dist/chunk-MJ27XQYG.js +0 -125
  819. package/dist/chunk-MJ27XQYG.js.map +0 -7
  820. package/dist/chunk-MJ2GW6SU.js +0 -163
  821. package/dist/chunk-MJ2GW6SU.js.map +0 -7
  822. package/dist/chunk-MLQY5SKR.js +0 -52
  823. package/dist/chunk-MLQY5SKR.js.map +0 -7
  824. package/dist/chunk-MTMHGC3G.js +0 -39
  825. package/dist/chunk-MTMHGC3G.js.map +0 -7
  826. package/dist/chunk-MWBAW3YV.js +0 -244
  827. package/dist/chunk-MWBAW3YV.js.map +0 -7
  828. package/dist/chunk-MYSK3SIM.js +0 -55
  829. package/dist/chunk-MYSK3SIM.js.map +0 -7
  830. package/dist/chunk-MZGGB2YT.js +0 -50
  831. package/dist/chunk-MZGGB2YT.js.map +0 -7
  832. package/dist/chunk-N46MIZXB.js +0 -154
  833. package/dist/chunk-N46MIZXB.js.map +0 -7
  834. package/dist/chunk-N53537P6.js +0 -31
  835. package/dist/chunk-N53537P6.js.map +0 -7
  836. package/dist/chunk-N5CTFOLX.js +0 -40
  837. package/dist/chunk-N5CTFOLX.js.map +0 -7
  838. package/dist/chunk-N5SNGZJV.js +0 -217
  839. package/dist/chunk-N5SNGZJV.js.map +0 -7
  840. package/dist/chunk-NGCTBYQ3.js +0 -181
  841. package/dist/chunk-NGCTBYQ3.js.map +0 -7
  842. package/dist/chunk-NIFG55CE.js +0 -52
  843. package/dist/chunk-NIFG55CE.js.map +0 -7
  844. package/dist/chunk-NJ63ALPX.js +0 -7
  845. package/dist/chunk-NJ63ALPX.js.map +0 -7
  846. package/dist/chunk-NMUX7SGU.js +0 -676
  847. package/dist/chunk-NMUX7SGU.js.map +0 -7
  848. package/dist/chunk-NO7GMLNU.js +0 -292
  849. package/dist/chunk-NO7GMLNU.js.map +0 -7
  850. package/dist/chunk-NTOGVX2Y.js +0 -92
  851. package/dist/chunk-NTOGVX2Y.js.map +0 -7
  852. package/dist/chunk-NZVHE4IT.js +0 -3101
  853. package/dist/chunk-NZVHE4IT.js.map +0 -7
  854. package/dist/chunk-O5IVKDX7.js +0 -30
  855. package/dist/chunk-O5IVKDX7.js.map +0 -7
  856. package/dist/chunk-O7ORICEC.js +0 -82
  857. package/dist/chunk-O7ORICEC.js.map +0 -7
  858. package/dist/chunk-OBMBAM3N.js +0 -73
  859. package/dist/chunk-OBMBAM3N.js.map +0 -7
  860. package/dist/chunk-OFWMLQMU.js +0 -7287
  861. package/dist/chunk-OFWMLQMU.js.map +0 -7
  862. package/dist/chunk-OJ3ZUKBI.js +0 -73
  863. package/dist/chunk-OJ3ZUKBI.js.map +0 -7
  864. package/dist/chunk-OJJBD5K3.js +0 -45
  865. package/dist/chunk-OJJBD5K3.js.map +0 -7
  866. package/dist/chunk-OJTHE4B7.js +0 -50
  867. package/dist/chunk-OJTHE4B7.js.map +0 -7
  868. package/dist/chunk-OKDOVX4B.js +0 -699
  869. package/dist/chunk-OKDOVX4B.js.map +0 -7
  870. package/dist/chunk-OOYPYBTA.js +0 -446
  871. package/dist/chunk-OOYPYBTA.js.map +0 -7
  872. package/dist/chunk-OQP4W4AR.js +0 -105
  873. package/dist/chunk-OQP4W4AR.js.map +0 -7
  874. package/dist/chunk-OVMDMCZ5.js +0 -241
  875. package/dist/chunk-OVMDMCZ5.js.map +0 -7
  876. package/dist/chunk-OVTT2EKA.js +0 -516
  877. package/dist/chunk-OVTT2EKA.js.map +0 -7
  878. package/dist/chunk-OVU43GJK.js +0 -63
  879. package/dist/chunk-OVU43GJK.js.map +0 -7
  880. package/dist/chunk-P3TMARA6.js +0 -18
  881. package/dist/chunk-P3TMARA6.js.map +0 -7
  882. package/dist/chunk-P5N63LBS.js +0 -94
  883. package/dist/chunk-P5N63LBS.js.map +0 -7
  884. package/dist/chunk-PARITZ7F.js +0 -28
  885. package/dist/chunk-PARITZ7F.js.map +0 -7
  886. package/dist/chunk-PBQK4KY4.js +0 -195
  887. package/dist/chunk-PBQK4KY4.js.map +0 -7
  888. package/dist/chunk-PLMOTQ42.js +0 -335
  889. package/dist/chunk-PLMOTQ42.js.map +0 -7
  890. package/dist/chunk-PSL2AHIA.js +0 -27
  891. package/dist/chunk-PSL2AHIA.js.map +0 -7
  892. package/dist/chunk-Q5QT7JBM.js +0 -92
  893. package/dist/chunk-Q5QT7JBM.js.map +0 -7
  894. package/dist/chunk-Q6H5OV2R.js +0 -180
  895. package/dist/chunk-Q6H5OV2R.js.map +0 -7
  896. package/dist/chunk-Q7WA5DCR.js +0 -62
  897. package/dist/chunk-Q7WA5DCR.js.map +0 -7
  898. package/dist/chunk-QAR5POXD.js +0 -472
  899. package/dist/chunk-QAR5POXD.js.map +0 -7
  900. package/dist/chunk-QATEENP2.js +0 -7
  901. package/dist/chunk-QATEENP2.js.map +0 -7
  902. package/dist/chunk-QDT24CIA.js +0 -485
  903. package/dist/chunk-QDT24CIA.js.map +0 -7
  904. package/dist/chunk-QI3NB7D5.js +0 -455
  905. package/dist/chunk-QI3NB7D5.js.map +0 -7
  906. package/dist/chunk-QIDAVXSX.js +0 -106
  907. package/dist/chunk-QIDAVXSX.js.map +0 -7
  908. package/dist/chunk-QKIGQVP2.js +0 -104
  909. package/dist/chunk-QKIGQVP2.js.map +0 -7
  910. package/dist/chunk-QNJENPK2.js +0 -81
  911. package/dist/chunk-QNJENPK2.js.map +0 -7
  912. package/dist/chunk-R5S76YR5.js +0 -12
  913. package/dist/chunk-R5S76YR5.js.map +0 -7
  914. package/dist/chunk-R7ZBOXPS.js +0 -163
  915. package/dist/chunk-R7ZBOXPS.js.map +0 -7
  916. package/dist/chunk-RAL3KX76.js +0 -239
  917. package/dist/chunk-RAL3KX76.js.map +0 -7
  918. package/dist/chunk-REVXXWAS.js +0 -31
  919. package/dist/chunk-REVXXWAS.js.map +0 -7
  920. package/dist/chunk-RFH4HRZP.js +0 -94
  921. package/dist/chunk-RFH4HRZP.js.map +0 -7
  922. package/dist/chunk-RHITG64O.js +0 -50
  923. package/dist/chunk-RHITG64O.js.map +0 -7
  924. package/dist/chunk-RK5HZFP6.js +0 -111
  925. package/dist/chunk-RK5HZFP6.js.map +0 -7
  926. package/dist/chunk-RNGAGYCL.js +0 -49
  927. package/dist/chunk-RNGAGYCL.js.map +0 -7
  928. package/dist/chunk-RPCVN3JA.js +0 -261
  929. package/dist/chunk-RPCVN3JA.js.map +0 -7
  930. package/dist/chunk-RQ26XXFS.js +0 -45
  931. package/dist/chunk-RQ26XXFS.js.map +0 -7
  932. package/dist/chunk-RQQE5DDT.js +0 -193
  933. package/dist/chunk-RQQE5DDT.js.map +0 -7
  934. package/dist/chunk-RSA7PKZH.js +0 -187
  935. package/dist/chunk-RSA7PKZH.js.map +0 -7
  936. package/dist/chunk-RTSINQ4T.js +0 -78
  937. package/dist/chunk-RTSINQ4T.js.map +0 -7
  938. package/dist/chunk-RVOD3ESA.js +0 -38
  939. package/dist/chunk-RVOD3ESA.js.map +0 -7
  940. package/dist/chunk-SAOUP24A.js +0 -70
  941. package/dist/chunk-SAOUP24A.js.map +0 -7
  942. package/dist/chunk-SFZL2TCV.js +0 -55
  943. package/dist/chunk-SFZL2TCV.js.map +0 -7
  944. package/dist/chunk-SH6Y4CGQ.js +0 -175
  945. package/dist/chunk-SH6Y4CGQ.js.map +0 -7
  946. package/dist/chunk-SHBAAFFH.js +0 -74
  947. package/dist/chunk-SHBAAFFH.js.map +0 -7
  948. package/dist/chunk-SJPFUXBV.js +0 -45
  949. package/dist/chunk-SJPFUXBV.js.map +0 -7
  950. package/dist/chunk-SLIUQWAR.js +0 -58
  951. package/dist/chunk-SLIUQWAR.js.map +0 -7
  952. package/dist/chunk-SPNSM6SB.js +0 -36
  953. package/dist/chunk-SPNSM6SB.js.map +0 -7
  954. package/dist/chunk-SQUHLLK5.js +0 -125
  955. package/dist/chunk-SQUHLLK5.js.map +0 -7
  956. package/dist/chunk-SSEX66OL.js +0 -39
  957. package/dist/chunk-SSEX66OL.js.map +0 -7
  958. package/dist/chunk-SWWK35VQ.js +0 -84
  959. package/dist/chunk-SWWK35VQ.js.map +0 -7
  960. package/dist/chunk-SX2LOHOX.js +0 -251
  961. package/dist/chunk-SX2LOHOX.js.map +0 -7
  962. package/dist/chunk-T72EMFTX.js +0 -74
  963. package/dist/chunk-T72EMFTX.js.map +0 -7
  964. package/dist/chunk-TA2QJPPG.js +0 -169
  965. package/dist/chunk-TA2QJPPG.js.map +0 -7
  966. package/dist/chunk-TC5ZVFV6.js +0 -292
  967. package/dist/chunk-TC5ZVFV6.js.map +0 -7
  968. package/dist/chunk-TFD7ZIYD.js +0 -105
  969. package/dist/chunk-TFD7ZIYD.js.map +0 -7
  970. package/dist/chunk-TFEETDNY.js +0 -78
  971. package/dist/chunk-TFEETDNY.js.map +0 -7
  972. package/dist/chunk-TH6ONRWT.js +0 -516
  973. package/dist/chunk-TH6ONRWT.js.map +0 -7
  974. package/dist/chunk-THM2QV25.js +0 -108
  975. package/dist/chunk-THM2QV25.js.map +0 -7
  976. package/dist/chunk-TMQMQ67T.js +0 -81
  977. package/dist/chunk-TMQMQ67T.js.map +0 -7
  978. package/dist/chunk-TPYWUZOR.js +0 -178
  979. package/dist/chunk-TPYWUZOR.js.map +0 -7
  980. package/dist/chunk-TRWT2N6Z.js +0 -15
  981. package/dist/chunk-TRWT2N6Z.js.map +0 -7
  982. package/dist/chunk-TTXEM54Y.js +0 -76
  983. package/dist/chunk-TTXEM54Y.js.map +0 -7
  984. package/dist/chunk-U2O4LE6S.js +0 -22
  985. package/dist/chunk-U2O4LE6S.js.map +0 -7
  986. package/dist/chunk-U44IVNP2.js +0 -91
  987. package/dist/chunk-U44IVNP2.js.map +0 -7
  988. package/dist/chunk-U4LVIY5F.js +0 -1405
  989. package/dist/chunk-U4LVIY5F.js.map +0 -7
  990. package/dist/chunk-U767LCSG.js +0 -78
  991. package/dist/chunk-U767LCSG.js.map +0 -7
  992. package/dist/chunk-U7GKLHU6.js +0 -120
  993. package/dist/chunk-U7GKLHU6.js.map +0 -7
  994. package/dist/chunk-UAB5P5QO.js +0 -60
  995. package/dist/chunk-UAB5P5QO.js.map +0 -7
  996. package/dist/chunk-UDDWLWKZ.js +0 -82
  997. package/dist/chunk-UDDWLWKZ.js.map +0 -7
  998. package/dist/chunk-UEHPJQBL.js +0 -38
  999. package/dist/chunk-UEHPJQBL.js.map +0 -7
  1000. package/dist/chunk-UIBV6IGR.js +0 -31
  1001. package/dist/chunk-UIBV6IGR.js.map +0 -7
  1002. package/dist/chunk-UIYFRUET.js +0 -16352
  1003. package/dist/chunk-UIYFRUET.js.map +0 -7
  1004. package/dist/chunk-UJS3TIVS.js +0 -52
  1005. package/dist/chunk-UJS3TIVS.js.map +0 -7
  1006. package/dist/chunk-UMMPB6FL.js +0 -506
  1007. package/dist/chunk-UMMPB6FL.js.map +0 -7
  1008. package/dist/chunk-UP42ACP7.js +0 -27
  1009. package/dist/chunk-UP42ACP7.js.map +0 -7
  1010. package/dist/chunk-UPEF7ETP.js +0 -92
  1011. package/dist/chunk-UPEF7ETP.js.map +0 -7
  1012. package/dist/chunk-UU5PSBSI.js +0 -176
  1013. package/dist/chunk-UU5PSBSI.js.map +0 -7
  1014. package/dist/chunk-UV63XYFU.js +0 -173
  1015. package/dist/chunk-UV63XYFU.js.map +0 -7
  1016. package/dist/chunk-UWPHOAOC.js +0 -29
  1017. package/dist/chunk-UWPHOAOC.js.map +0 -7
  1018. package/dist/chunk-UXDDOSJC.js +0 -52
  1019. package/dist/chunk-UXDDOSJC.js.map +0 -7
  1020. package/dist/chunk-V3VAOMCO.js +0 -465
  1021. package/dist/chunk-V3VAOMCO.js.map +0 -7
  1022. package/dist/chunk-VA7ENH2S.js +0 -38
  1023. package/dist/chunk-VA7ENH2S.js.map +0 -7
  1024. package/dist/chunk-VBDLTKI2.js +0 -130
  1025. package/dist/chunk-VBDLTKI2.js.map +0 -7
  1026. package/dist/chunk-VCWIKEJ7.js +0 -7
  1027. package/dist/chunk-VCWIKEJ7.js.map +0 -7
  1028. package/dist/chunk-VFPDFLVE.js +0 -516
  1029. package/dist/chunk-VFPDFLVE.js.map +0 -7
  1030. package/dist/chunk-VHG4FNIJ.js +0 -93
  1031. package/dist/chunk-VHG4FNIJ.js.map +0 -7
  1032. package/dist/chunk-VKOO6MIZ.js +0 -51
  1033. package/dist/chunk-VKOO6MIZ.js.map +0 -7
  1034. package/dist/chunk-VKXKRZG7.js +0 -62
  1035. package/dist/chunk-VKXKRZG7.js.map +0 -7
  1036. package/dist/chunk-VPQICZQR.js +0 -93
  1037. package/dist/chunk-VPQICZQR.js.map +0 -7
  1038. package/dist/chunk-VRBJNFPL.js +0 -114
  1039. package/dist/chunk-VRBJNFPL.js.map +0 -7
  1040. package/dist/chunk-VUOLPEUZ.js +0 -7
  1041. package/dist/chunk-VUOLPEUZ.js.map +0 -7
  1042. package/dist/chunk-VUU5KFH3.js +0 -38
  1043. package/dist/chunk-VUU5KFH3.js.map +0 -7
  1044. package/dist/chunk-VVBL5CFF.js +0 -7
  1045. package/dist/chunk-VVBL5CFF.js.map +0 -7
  1046. package/dist/chunk-VYZEQ6KY.js +0 -22
  1047. package/dist/chunk-VYZEQ6KY.js.map +0 -7
  1048. package/dist/chunk-W6SOBS7M.js +0 -138
  1049. package/dist/chunk-W6SOBS7M.js.map +0 -7
  1050. package/dist/chunk-WBPQVWSU.js +0 -198
  1051. package/dist/chunk-WBPQVWSU.js.map +0 -7
  1052. package/dist/chunk-WDOKKRTE.js +0 -7
  1053. package/dist/chunk-WDOKKRTE.js.map +0 -7
  1054. package/dist/chunk-WGXXKFN5.js +0 -7
  1055. package/dist/chunk-WGXXKFN5.js.map +0 -7
  1056. package/dist/chunk-WHPUUP3J.js +0 -25
  1057. package/dist/chunk-WHPUUP3J.js.map +0 -7
  1058. package/dist/chunk-WS6HWBKT.js +0 -30
  1059. package/dist/chunk-WS6HWBKT.js.map +0 -7
  1060. package/dist/chunk-XF7LD6VV.js +0 -122
  1061. package/dist/chunk-XF7LD6VV.js.map +0 -7
  1062. package/dist/chunk-XFTXM3RE.js +0 -64
  1063. package/dist/chunk-XFTXM3RE.js.map +0 -7
  1064. package/dist/chunk-XJABPO2T.js +0 -235
  1065. package/dist/chunk-XJABPO2T.js.map +0 -7
  1066. package/dist/chunk-XK6VF3H7.js +0 -3586
  1067. package/dist/chunk-XK6VF3H7.js.map +0 -7
  1068. package/dist/chunk-XOZPOHLG.js +0 -233
  1069. package/dist/chunk-XOZPOHLG.js.map +0 -7
  1070. package/dist/chunk-XQYIIPOJ.js +0 -266
  1071. package/dist/chunk-XQYIIPOJ.js.map +0 -7
  1072. package/dist/chunk-XR7DPSNX.js +0 -195
  1073. package/dist/chunk-XR7DPSNX.js.map +0 -7
  1074. package/dist/chunk-XYH4JC3U.js +0 -7
  1075. package/dist/chunk-XYH4JC3U.js.map +0 -7
  1076. package/dist/chunk-XZSAN55E.js +0 -58
  1077. package/dist/chunk-XZSAN55E.js.map +0 -7
  1078. package/dist/chunk-Y3KJR4OG.js +0 -64
  1079. package/dist/chunk-Y3KJR4OG.js.map +0 -7
  1080. package/dist/chunk-Y4JKH7FF.js +0 -45
  1081. package/dist/chunk-Y4JKH7FF.js.map +0 -7
  1082. package/dist/chunk-Y6CJN4ID.js +0 -31
  1083. package/dist/chunk-Y6CJN4ID.js.map +0 -7
  1084. package/dist/chunk-YABGJU5M.js +0 -271
  1085. package/dist/chunk-YABGJU5M.js.map +0 -7
  1086. package/dist/chunk-YB5UCHLN.js +0 -314
  1087. package/dist/chunk-YB5UCHLN.js.map +0 -7
  1088. package/dist/chunk-YEJH7ZC2.js +0 -34
  1089. package/dist/chunk-YEJH7ZC2.js.map +0 -7
  1090. package/dist/chunk-YF5DYD3X.js +0 -97
  1091. package/dist/chunk-YF5DYD3X.js.map +0 -7
  1092. package/dist/chunk-YFTE4H54.js +0 -44117
  1093. package/dist/chunk-YFTE4H54.js.map +0 -7
  1094. package/dist/chunk-YGVQZCE7.js +0 -30
  1095. package/dist/chunk-YGVQZCE7.js.map +0 -7
  1096. package/dist/chunk-YNHADHHS.js +0 -138
  1097. package/dist/chunk-YNHADHHS.js.map +0 -7
  1098. package/dist/chunk-YNJYMD43.js +0 -392
  1099. package/dist/chunk-YNJYMD43.js.map +0 -7
  1100. package/dist/chunk-YNYEQGVN.js +0 -251
  1101. package/dist/chunk-YNYEQGVN.js.map +0 -7
  1102. package/dist/chunk-YOAMBAM2.js +0 -70
  1103. package/dist/chunk-YOAMBAM2.js.map +0 -7
  1104. package/dist/chunk-YUPBD27Z.js +0 -70
  1105. package/dist/chunk-YUPBD27Z.js.map +0 -7
  1106. package/dist/chunk-YWE5AQPZ.js +0 -258
  1107. package/dist/chunk-YWE5AQPZ.js.map +0 -7
  1108. package/dist/chunk-YWHH3MB6.js +0 -1405
  1109. package/dist/chunk-YWHH3MB6.js.map +0 -7
  1110. package/dist/chunk-YXJ52FD5.js +0 -271
  1111. package/dist/chunk-YXJ52FD5.js.map +0 -7
  1112. package/dist/chunk-YZ6F5N7R.js +0 -455
  1113. package/dist/chunk-YZ6F5N7R.js.map +0 -7
  1114. package/dist/chunk-YZGORRQN.js +0 -3101
  1115. package/dist/chunk-YZGORRQN.js.map +0 -7
  1116. package/dist/chunk-Z6IVJ6ZW.js +0 -30
  1117. package/dist/chunk-Z6IVJ6ZW.js.map +0 -7
  1118. package/dist/chunk-ZFC44XJJ.js +0 -86
  1119. package/dist/chunk-ZFC44XJJ.js.map +0 -7
  1120. package/dist/chunk-ZFGRQIB6.js +0 -38
  1121. package/dist/chunk-ZFGRQIB6.js.map +0 -7
  1122. package/dist/chunk-ZGAUVPAB.js +0 -14
  1123. package/dist/chunk-ZGAUVPAB.js.map +0 -7
  1124. package/dist/chunk-ZGCATLM5.js +0 -18
  1125. package/dist/chunk-ZGCATLM5.js.map +0 -7
  1126. package/dist/chunk-ZJDJC5TP.js +0 -82
  1127. package/dist/chunk-ZJDJC5TP.js.map +0 -7
  1128. package/dist/chunk-ZJGZNPDK.js +0 -171
  1129. package/dist/chunk-ZJGZNPDK.js.map +0 -7
  1130. package/dist/chunk-ZJHBJWZX.js +0 -699
  1131. package/dist/chunk-ZJHBJWZX.js.map +0 -7
  1132. package/dist/chunk-ZNOTD65D.js +0 -95
  1133. package/dist/chunk-ZNOTD65D.js.map +0 -7
  1134. package/dist/chunk-ZQ2QIFXW.js +0 -122
  1135. package/dist/chunk-ZQ2QIFXW.js.map +0 -7
  1136. package/dist/chunk-ZRMXPQGY.js +0 -241
  1137. package/dist/chunk-ZRMXPQGY.js.map +0 -7
  1138. package/dist/chunk-ZSOPE7DO.js +0 -92
  1139. package/dist/chunk-ZSOPE7DO.js.map +0 -7
  1140. package/dist/chunk-ZVEE5IDC.js +0 -3101
  1141. package/dist/chunk-ZVEE5IDC.js.map +0 -7
  1142. package/dist/chunk-ZY247PXY.js +0 -135
  1143. package/dist/chunk-ZY247PXY.js.map +0 -7
  1144. package/dist/cli-metadata.js +0 -12
  1145. package/dist/cli-metadata.js.map +0 -7
  1146. package/dist/contract-api.js +0 -104
  1147. package/dist/contract-api.js.map +0 -7
  1148. package/dist/dist-DVBXHDB4.js +0 -549
  1149. package/dist/dist-DVBXHDB4.js.map +0 -7
  1150. package/dist/dist-F3K7S5SS.js +0 -549
  1151. package/dist/dist-F3K7S5SS.js.map +0 -7
  1152. package/dist/helper-api.js +0 -51
  1153. package/dist/helper-api.js.map +0 -7
  1154. package/dist/index.js +0 -70
  1155. package/dist/index.js.map +0 -7
  1156. package/dist/magic-string.es-ITIPPYGW.js +0 -1315
  1157. package/dist/magic-string.es-ITIPPYGW.js.map +0 -7
  1158. package/dist/magic-string.es-V5NOGTUV.js +0 -1315
  1159. package/dist/magic-string.es-V5NOGTUV.js.map +0 -7
  1160. package/dist/openclaw.plugin.json +0 -23
  1161. package/dist/package.json +0 -59
  1162. package/dist/plugin-entry.handlers.runtime-JLRK5XTV.js +0 -20
  1163. package/dist/plugin-entry.handlers.runtime-JLRK5XTV.js.map +0 -7
  1164. package/dist/plugin-entry.handlers.runtime-POD4CSHM.js +0 -20
  1165. package/dist/plugin-entry.handlers.runtime-POD4CSHM.js.map +0 -7
  1166. package/dist/plugin-entry.handlers.runtime-YOSG6V6U.js +0 -20
  1167. package/dist/plugin-entry.handlers.runtime-YOSG6V6U.js.map +0 -7
  1168. package/dist/runtime-api.js +0 -104
  1169. package/dist/runtime-api.js.map +0 -7
  1170. package/dist/rust-crypto-7KS7OJ3F.js +0 -5323
  1171. package/dist/rust-crypto-7KS7OJ3F.js.map +0 -7
  1172. package/dist/rust-crypto-H35BXWUU.js +0 -5323
  1173. package/dist/rust-crypto-H35BXWUU.js.map +0 -7
  1174. package/dist/secret-contract-api.js +0 -18
  1175. package/dist/secret-contract-api.js.map +0 -7
  1176. package/dist/setup-entry.js +0 -22
  1177. package/dist/setup-entry.js.map +0 -7
  1178. package/dist/src/account-selection.js +0 -19
  1179. package/dist/src/account-selection.js.map +0 -7
  1180. package/dist/src/actions.js +0 -24
  1181. package/dist/src/actions.js.map +0 -7
  1182. package/dist/src/approval-auth.js +0 -27
  1183. package/dist/src/approval-auth.js.map +0 -7
  1184. package/dist/src/approval-handler.runtime.js +0 -378
  1185. package/dist/src/approval-handler.runtime.js.map +0 -7
  1186. package/dist/src/approval-ids.js +0 -9
  1187. package/dist/src/approval-ids.js.map +0 -7
  1188. package/dist/src/approval-native.js +0 -28
  1189. package/dist/src/approval-native.js.map +0 -7
  1190. package/dist/src/approval-reactions.js +0 -20
  1191. package/dist/src/approval-reactions.js.map +0 -7
  1192. package/dist/src/auth-precedence.js +0 -8
  1193. package/dist/src/auth-precedence.js.map +0 -7
  1194. package/dist/src/channel-account-paths.js +0 -11
  1195. package/dist/src/channel-account-paths.js.map +0 -7
  1196. package/dist/src/channel.js +0 -74
  1197. package/dist/src/channel.js.map +0 -7
  1198. package/dist/src/channel.runtime.js +0 -82
  1199. package/dist/src/channel.runtime.js.map +0 -7
  1200. package/dist/src/cli-metadata.js +0 -8
  1201. package/dist/src/cli-metadata.js.map +0 -7
  1202. package/dist/src/cli.js +0 -936
  1203. package/dist/src/cli.js.map +0 -7
  1204. package/dist/src/config-adapter.js +0 -26
  1205. package/dist/src/config-adapter.js.map +0 -7
  1206. package/dist/src/config-schema.js +0 -8
  1207. package/dist/src/config-schema.js.map +0 -7
  1208. package/dist/src/directory-live.js +0 -35
  1209. package/dist/src/directory-live.js.map +0 -7
  1210. package/dist/src/doctor-contract.js +0 -11
  1211. package/dist/src/doctor-contract.js.map +0 -7
  1212. package/dist/src/doctor.js +0 -42
  1213. package/dist/src/doctor.js.map +0 -7
  1214. package/dist/src/env-vars.js +0 -12
  1215. package/dist/src/env-vars.js.map +0 -7
  1216. package/dist/src/exec-approval-resolver.js +0 -10
  1217. package/dist/src/exec-approval-resolver.js.map +0 -7
  1218. package/dist/src/exec-approvals.js +0 -51
  1219. package/dist/src/exec-approvals.js.map +0 -7
  1220. package/dist/src/group-mentions.js +0 -28
  1221. package/dist/src/group-mentions.js.map +0 -7
  1222. package/dist/src/legacy-crypto-inspector-availability.js +0 -8
  1223. package/dist/src/legacy-crypto-inspector-availability.js.map +0 -7
  1224. package/dist/src/legacy-crypto.js +0 -26
  1225. package/dist/src/legacy-crypto.js.map +0 -7
  1226. package/dist/src/legacy-state.js +0 -24
  1227. package/dist/src/legacy-state.js.map +0 -7
  1228. package/dist/src/matrix/account-config.js +0 -16
  1229. package/dist/src/matrix/account-config.js.map +0 -7
  1230. package/dist/src/matrix/accounts.js +0 -31
  1231. package/dist/src/matrix/accounts.js.map +0 -7
  1232. package/dist/src/matrix/actions/client.js +0 -40
  1233. package/dist/src/matrix/actions/client.js.map +0 -7
  1234. package/dist/src/matrix/actions/devices.js +0 -42
  1235. package/dist/src/matrix/actions/devices.js.map +0 -7
  1236. package/dist/src/matrix/actions/limits.js +0 -8
  1237. package/dist/src/matrix/actions/limits.js.map +0 -7
  1238. package/dist/src/matrix/actions/messages.js +0 -49
  1239. package/dist/src/matrix/actions/messages.js.map +0 -7
  1240. package/dist/src/matrix/actions/pins.js +0 -46
  1241. package/dist/src/matrix/actions/pins.js.map +0 -7
  1242. package/dist/src/matrix/actions/polls.js +0 -37
  1243. package/dist/src/matrix/actions/polls.js.map +0 -7
  1244. package/dist/src/matrix/actions/profile.js +0 -38
  1245. package/dist/src/matrix/actions/profile.js.map +0 -7
  1246. package/dist/src/matrix/actions/reactions.js +0 -40
  1247. package/dist/src/matrix/actions/reactions.js.map +0 -7
  1248. package/dist/src/matrix/actions/room.js +0 -40
  1249. package/dist/src/matrix/actions/room.js.map +0 -7
  1250. package/dist/src/matrix/actions/summary.js +0 -19
  1251. package/dist/src/matrix/actions/summary.js.map +0 -7
  1252. package/dist/src/matrix/actions/types.js +0 -13
  1253. package/dist/src/matrix/actions/types.js.map +0 -7
  1254. package/dist/src/matrix/actions/verification.js +0 -77
  1255. package/dist/src/matrix/actions/verification.js.map +0 -7
  1256. package/dist/src/matrix/actions.js +0 -126
  1257. package/dist/src/matrix/actions.js.map +0 -7
  1258. package/dist/src/matrix/active-client.js +0 -10
  1259. package/dist/src/matrix/active-client.js.map +0 -7
  1260. package/dist/src/matrix/async-lock.js +0 -8
  1261. package/dist/src/matrix/async-lock.js.map +0 -7
  1262. package/dist/src/matrix/backup-health.js +0 -10
  1263. package/dist/src/matrix/backup-health.js.map +0 -7
  1264. package/dist/src/matrix/client/config-runtime-api.js +0 -24
  1265. package/dist/src/matrix/client/config-runtime-api.js.map +0 -7
  1266. package/dist/src/matrix/client/config-secret-input.runtime.js +0 -11
  1267. package/dist/src/matrix/client/config-secret-input.runtime.js.map +0 -7
  1268. package/dist/src/matrix/client/config.js +0 -42
  1269. package/dist/src/matrix/client/config.js.map +0 -7
  1270. package/dist/src/matrix/client/create-client.js +0 -20
  1271. package/dist/src/matrix/client/create-client.js.map +0 -7
  1272. package/dist/src/matrix/client/env-auth.js +0 -26
  1273. package/dist/src/matrix/client/env-auth.js.map +0 -7
  1274. package/dist/src/matrix/client/file-sync-store.js +0 -23
  1275. package/dist/src/matrix/client/file-sync-store.js.map +0 -7
  1276. package/dist/src/matrix/client/logging.js +0 -17
  1277. package/dist/src/matrix/client/logging.js.map +0 -7
  1278. package/dist/src/matrix/client/migration-snapshot.runtime.js +0 -13
  1279. package/dist/src/matrix/client/migration-snapshot.runtime.js.map +0 -7
  1280. package/dist/src/matrix/client/private-network-host.js +0 -8
  1281. package/dist/src/matrix/client/private-network-host.js.map +0 -7
  1282. package/dist/src/matrix/client/runtime.js +0 -8
  1283. package/dist/src/matrix/client/runtime.js.map +0 -7
  1284. package/dist/src/matrix/client/shared.js +0 -34
  1285. package/dist/src/matrix/client/shared.js.map +0 -7
  1286. package/dist/src/matrix/client/storage.js +0 -26
  1287. package/dist/src/matrix/client/storage.js.map +0 -7
  1288. package/dist/src/matrix/client/types.js +0 -7
  1289. package/dist/src/matrix/client/types.js.map +0 -7
  1290. package/dist/src/matrix/client-bootstrap.js +0 -15
  1291. package/dist/src/matrix/client-bootstrap.js.map +0 -7
  1292. package/dist/src/matrix/client-resolver.test-helpers.js +0 -122
  1293. package/dist/src/matrix/client-resolver.test-helpers.js.map +0 -7
  1294. package/dist/src/matrix/client.js +0 -63
  1295. package/dist/src/matrix/client.js.map +0 -7
  1296. package/dist/src/matrix/config-paths.js +0 -12
  1297. package/dist/src/matrix/config-paths.js.map +0 -7
  1298. package/dist/src/matrix/config-update.js +0 -17
  1299. package/dist/src/matrix/config-update.js.map +0 -7
  1300. package/dist/src/matrix/credentials-read.js +0 -22
  1301. package/dist/src/matrix/credentials-read.js.map +0 -7
  1302. package/dist/src/matrix/credentials-write.runtime.js +0 -24
  1303. package/dist/src/matrix/credentials-write.runtime.js.map +0 -7
  1304. package/dist/src/matrix/credentials.js +0 -90
  1305. package/dist/src/matrix/credentials.js.map +0 -7
  1306. package/dist/src/matrix/deps.js +0 -12
  1307. package/dist/src/matrix/deps.js.map +0 -7
  1308. package/dist/src/matrix/device-health.js +0 -10
  1309. package/dist/src/matrix/device-health.js.map +0 -7
  1310. package/dist/src/matrix/direct-management.js +0 -18
  1311. package/dist/src/matrix/direct-management.js.map +0 -7
  1312. package/dist/src/matrix/direct-room.js +0 -18
  1313. package/dist/src/matrix/direct-room.js.map +0 -7
  1314. package/dist/src/matrix/draft-stream.js +0 -33
  1315. package/dist/src/matrix/draft-stream.js.map +0 -7
  1316. package/dist/src/matrix/encryption-guidance.js +0 -17
  1317. package/dist/src/matrix/encryption-guidance.js.map +0 -7
  1318. package/dist/src/matrix/errors.js +0 -12
  1319. package/dist/src/matrix/errors.js.map +0 -7
  1320. package/dist/src/matrix/format.js +0 -13
  1321. package/dist/src/matrix/format.js.map +0 -7
  1322. package/dist/src/matrix/legacy-crypto-inspector.js +0 -72
  1323. package/dist/src/matrix/legacy-crypto-inspector.js.map +0 -7
  1324. package/dist/src/matrix/media-errors.js +0 -12
  1325. package/dist/src/matrix/media-errors.js.map +0 -7
  1326. package/dist/src/matrix/media-text.js +0 -22
  1327. package/dist/src/matrix/media-text.js.map +0 -7
  1328. package/dist/src/matrix/monitor/access-state.js +0 -9
  1329. package/dist/src/matrix/monitor/access-state.js.map +0 -7
  1330. package/dist/src/matrix/monitor/ack-config.js +0 -10
  1331. package/dist/src/matrix/monitor/ack-config.js.map +0 -7
  1332. package/dist/src/matrix/monitor/allowlist.js +0 -12
  1333. package/dist/src/matrix/monitor/allowlist.js.map +0 -7
  1334. package/dist/src/matrix/monitor/auto-join.js +0 -9
  1335. package/dist/src/matrix/monitor/auto-join.js.map +0 -7
  1336. package/dist/src/matrix/monitor/config.js +0 -37
  1337. package/dist/src/matrix/monitor/config.js.map +0 -7
  1338. package/dist/src/matrix/monitor/context-summary.js +0 -13
  1339. package/dist/src/matrix/monitor/context-summary.js.map +0 -7
  1340. package/dist/src/matrix/monitor/direct.js +0 -13
  1341. package/dist/src/matrix/monitor/direct.js.map +0 -7
  1342. package/dist/src/matrix/monitor/events.js +0 -20
  1343. package/dist/src/matrix/monitor/events.js.map +0 -7
  1344. package/dist/src/matrix/monitor/handler.js +0 -76
  1345. package/dist/src/matrix/monitor/handler.js.map +0 -7
  1346. package/dist/src/matrix/monitor/handler.test-helpers.js +0 -268
  1347. package/dist/src/matrix/monitor/handler.test-helpers.js.map +0 -7
  1348. package/dist/src/matrix/monitor/inbound-dedupe.js +0 -17
  1349. package/dist/src/matrix/monitor/inbound-dedupe.js.map +0 -7
  1350. package/dist/src/matrix/monitor/index.js +0 -502
  1351. package/dist/src/matrix/monitor/index.js.map +0 -7
  1352. package/dist/src/matrix/monitor/legacy-crypto-restore.js +0 -99
  1353. package/dist/src/matrix/monitor/legacy-crypto-restore.js.map +0 -7
  1354. package/dist/src/matrix/monitor/location.js +0 -11
  1355. package/dist/src/matrix/monitor/location.js.map +0 -7
  1356. package/dist/src/matrix/monitor/media.js +0 -10
  1357. package/dist/src/matrix/monitor/media.js.map +0 -7
  1358. package/dist/src/matrix/monitor/mentions.js +0 -9
  1359. package/dist/src/matrix/monitor/mentions.js.map +0 -7
  1360. package/dist/src/matrix/monitor/reaction-events.js +0 -38
  1361. package/dist/src/matrix/monitor/reaction-events.js.map +0 -7
  1362. package/dist/src/matrix/monitor/recent-invite.js +0 -10
  1363. package/dist/src/matrix/monitor/recent-invite.js.map +0 -7
  1364. package/dist/src/matrix/monitor/replies.js +0 -33
  1365. package/dist/src/matrix/monitor/replies.js.map +0 -7
  1366. package/dist/src/matrix/monitor/reply-context.js +0 -14
  1367. package/dist/src/matrix/monitor/reply-context.js.map +0 -7
  1368. package/dist/src/matrix/monitor/room-history.js +0 -10
  1369. package/dist/src/matrix/monitor/room-history.js.map +0 -7
  1370. package/dist/src/matrix/monitor/room-info.js +0 -9
  1371. package/dist/src/matrix/monitor/room-info.js.map +0 -7
  1372. package/dist/src/matrix/monitor/rooms.js +0 -9
  1373. package/dist/src/matrix/monitor/rooms.js.map +0 -7
  1374. package/dist/src/matrix/monitor/route.js +0 -12
  1375. package/dist/src/matrix/monitor/route.js.map +0 -7
  1376. package/dist/src/matrix/monitor/runtime-api.js +0 -40
  1377. package/dist/src/matrix/monitor/runtime-api.js.map +0 -7
  1378. package/dist/src/matrix/monitor/startup-verification.js +0 -174
  1379. package/dist/src/matrix/monitor/startup-verification.js.map +0 -7
  1380. package/dist/src/matrix/monitor/startup.js +0 -9
  1381. package/dist/src/matrix/monitor/startup.js.map +0 -7
  1382. package/dist/src/matrix/monitor/status.js +0 -10
  1383. package/dist/src/matrix/monitor/status.js.map +0 -7
  1384. package/dist/src/matrix/monitor/sync-lifecycle.js +0 -9
  1385. package/dist/src/matrix/monitor/sync-lifecycle.js.map +0 -7
  1386. package/dist/src/matrix/monitor/task-runner.js +0 -8
  1387. package/dist/src/matrix/monitor/task-runner.js.map +0 -7
  1388. package/dist/src/matrix/monitor/thread-context.js +0 -14
  1389. package/dist/src/matrix/monitor/thread-context.js.map +0 -7
  1390. package/dist/src/matrix/monitor/threads.js +0 -16
  1391. package/dist/src/matrix/monitor/threads.js.map +0 -7
  1392. package/dist/src/matrix/monitor/types.js +0 -11
  1393. package/dist/src/matrix/monitor/types.js.map +0 -7
  1394. package/dist/src/matrix/monitor/verification-events.js +0 -13
  1395. package/dist/src/matrix/monitor/verification-events.js.map +0 -7
  1396. package/dist/src/matrix/monitor/verification-utils.js +0 -16
  1397. package/dist/src/matrix/monitor/verification-utils.js.map +0 -7
  1398. package/dist/src/matrix/outbound-media-runtime.js +0 -9
  1399. package/dist/src/matrix/outbound-media-runtime.js.map +0 -7
  1400. package/dist/src/matrix/poll-summary.js +0 -14
  1401. package/dist/src/matrix/poll-summary.js.map +0 -7
  1402. package/dist/src/matrix/poll-types.js +0 -55
  1403. package/dist/src/matrix/poll-types.js.map +0 -7
  1404. package/dist/src/matrix/probe.js +0 -9
  1405. package/dist/src/matrix/probe.js.map +0 -7
  1406. package/dist/src/matrix/probe.runtime.js +0 -30
  1407. package/dist/src/matrix/probe.runtime.js.map +0 -7
  1408. package/dist/src/matrix/profile.js +0 -16
  1409. package/dist/src/matrix/profile.js.map +0 -7
  1410. package/dist/src/matrix/reaction-common.js +0 -26
  1411. package/dist/src/matrix/reaction-common.js.map +0 -7
  1412. package/dist/src/matrix/sdk/crypto-bootstrap.js +0 -15
  1413. package/dist/src/matrix/sdk/crypto-bootstrap.js.map +0 -7
  1414. package/dist/src/matrix/sdk/crypto-facade.js +0 -8
  1415. package/dist/src/matrix/sdk/crypto-facade.js.map +0 -7
  1416. package/dist/src/matrix/sdk/crypto-node.runtime.js +0 -14
  1417. package/dist/src/matrix/sdk/crypto-node.runtime.js.map +0 -7
  1418. package/dist/src/matrix/sdk/crypto-runtime.js +0 -84
  1419. package/dist/src/matrix/sdk/crypto-runtime.js.map +0 -7
  1420. package/dist/src/matrix/sdk/decrypt-bridge.js +0 -11
  1421. package/dist/src/matrix/sdk/decrypt-bridge.js.map +0 -7
  1422. package/dist/src/matrix/sdk/event-helpers.js +0 -12
  1423. package/dist/src/matrix/sdk/event-helpers.js.map +0 -7
  1424. package/dist/src/matrix/sdk/http-client.js +0 -13
  1425. package/dist/src/matrix/sdk/http-client.js.map +0 -7
  1426. package/dist/src/matrix/sdk/idb-persistence-lock.js +0 -12
  1427. package/dist/src/matrix/sdk/idb-persistence-lock.js.map +0 -7
  1428. package/dist/src/matrix/sdk/idb-persistence.js +0 -13
  1429. package/dist/src/matrix/sdk/idb-persistence.js.map +0 -7
  1430. package/dist/src/matrix/sdk/idb-persistence.test-helpers.js +0 -83
  1431. package/dist/src/matrix/sdk/idb-persistence.test-helpers.js.map +0 -7
  1432. package/dist/src/matrix/sdk/logger.js +0 -15
  1433. package/dist/src/matrix/sdk/logger.js.map +0 -7
  1434. package/dist/src/matrix/sdk/read-response-with-limit.js +0 -8
  1435. package/dist/src/matrix/sdk/read-response-with-limit.js.map +0 -7
  1436. package/dist/src/matrix/sdk/recovery-key-store.js +0 -14
  1437. package/dist/src/matrix/sdk/recovery-key-store.js.map +0 -7
  1438. package/dist/src/matrix/sdk/transport.js +0 -13
  1439. package/dist/src/matrix/sdk/transport.js.map +0 -7
  1440. package/dist/src/matrix/sdk/types.js +0 -7
  1441. package/dist/src/matrix/sdk/types.js.map +0 -7
  1442. package/dist/src/matrix/sdk/verification-manager.js +0 -11
  1443. package/dist/src/matrix/sdk/verification-manager.js.map +0 -7
  1444. package/dist/src/matrix/sdk/verification-status.js +0 -12
  1445. package/dist/src/matrix/sdk/verification-status.js.map +0 -7
  1446. package/dist/src/matrix/sdk.js +0 -1375
  1447. package/dist/src/matrix/sdk.js.map +0 -7
  1448. package/dist/src/matrix/send/client.js +0 -14
  1449. package/dist/src/matrix/send/client.js.map +0 -7
  1450. package/dist/src/matrix/send/formatting.js +0 -29
  1451. package/dist/src/matrix/send/formatting.js.map +0 -7
  1452. package/dist/src/matrix/send/media.js +0 -26
  1453. package/dist/src/matrix/send/media.js.map +0 -7
  1454. package/dist/src/matrix/send/targets.js +0 -15
  1455. package/dist/src/matrix/send/targets.js.map +0 -7
  1456. package/dist/src/matrix/send/types.js +0 -17
  1457. package/dist/src/matrix/send/types.js.map +0 -7
  1458. package/dist/src/matrix/send.js +0 -51
  1459. package/dist/src/matrix/send.js.map +0 -7
  1460. package/dist/src/matrix/session-store-metadata.js +0 -15
  1461. package/dist/src/matrix/session-store-metadata.js.map +0 -7
  1462. package/dist/src/matrix/startup-abort.js +0 -14
  1463. package/dist/src/matrix/startup-abort.js.map +0 -7
  1464. package/dist/src/matrix/sync-state.js +0 -12
  1465. package/dist/src/matrix/sync-state.js.map +0 -7
  1466. package/dist/src/matrix/target-ids.js +0 -20
  1467. package/dist/src/matrix/target-ids.js.map +0 -7
  1468. package/dist/src/matrix/thread-bindings-shared.js +0 -34
  1469. package/dist/src/matrix/thread-bindings-shared.js.map +0 -7
  1470. package/dist/src/matrix/thread-bindings.js +0 -49
  1471. package/dist/src/matrix/thread-bindings.js.map +0 -7
  1472. package/dist/src/matrix-migration.runtime.js +0 -45
  1473. package/dist/src/matrix-migration.runtime.js.map +0 -7
  1474. package/dist/src/migration-config.js +0 -29
  1475. package/dist/src/migration-config.js.map +0 -7
  1476. package/dist/src/migration-snapshot-backup.js +0 -12
  1477. package/dist/src/migration-snapshot-backup.js.map +0 -7
  1478. package/dist/src/migration-snapshot.js +0 -38
  1479. package/dist/src/migration-snapshot.js.map +0 -7
  1480. package/dist/src/onboarding.js +0 -43
  1481. package/dist/src/onboarding.js.map +0 -7
  1482. package/dist/src/onboarding.test-harness.js +0 -124
  1483. package/dist/src/onboarding.test-harness.js.map +0 -7
  1484. package/dist/src/outbound.js +0 -33
  1485. package/dist/src/outbound.js.map +0 -7
  1486. package/dist/src/plugin-entry.runtime.js +0 -15
  1487. package/dist/src/plugin-entry.runtime.js.map +0 -7
  1488. package/dist/src/profile-update.js +0 -41
  1489. package/dist/src/profile-update.js.map +0 -7
  1490. package/dist/src/record-shared.js +0 -8
  1491. package/dist/src/record-shared.js.map +0 -7
  1492. package/dist/src/resolve-targets.js +0 -34
  1493. package/dist/src/resolve-targets.js.map +0 -7
  1494. package/dist/src/resolver.js +0 -8
  1495. package/dist/src/resolver.js.map +0 -7
  1496. package/dist/src/runtime-api.js +0 -120
  1497. package/dist/src/runtime-api.js.map +0 -7
  1498. package/dist/src/runtime.js +0 -10
  1499. package/dist/src/runtime.js.map +0 -7
  1500. package/dist/src/secret-contract.js +0 -13
  1501. package/dist/src/secret-contract.js.map +0 -7
  1502. package/dist/src/session-route.js +0 -25
  1503. package/dist/src/session-route.js.map +0 -7
  1504. package/dist/src/setup-bootstrap.js +0 -124
  1505. package/dist/src/setup-bootstrap.js.map +0 -7
  1506. package/dist/src/setup-config.js +0 -28
  1507. package/dist/src/setup-config.js.map +0 -7
  1508. package/dist/src/setup-contract.js +0 -16
  1509. package/dist/src/setup-contract.js.map +0 -7
  1510. package/dist/src/setup-core.js +0 -25
  1511. package/dist/src/setup-core.js.map +0 -7
  1512. package/dist/src/setup-surface.js +0 -45
  1513. package/dist/src/setup-surface.js.map +0 -7
  1514. package/dist/src/startup-maintenance.js +0 -29
  1515. package/dist/src/startup-maintenance.js.map +0 -7
  1516. package/dist/src/storage-paths.js +0 -24
  1517. package/dist/src/storage-paths.js.map +0 -7
  1518. package/dist/src/test-helpers.js +0 -49
  1519. package/dist/src/test-helpers.js.map +0 -7
  1520. package/dist/src/test-mocks.js +0 -40
  1521. package/dist/src/test-mocks.js.map +0 -7
  1522. package/dist/src/test-runtime.js +0 -65
  1523. package/dist/src/test-runtime.js.map +0 -7
  1524. package/dist/src/tool-actions.js +0 -68
  1525. package/dist/src/tool-actions.js.map +0 -7
  1526. package/dist/src/tool-actions.runtime.js +0 -73
  1527. package/dist/src/tool-actions.runtime.js.map +0 -7
  1528. package/dist/src/types.js +0 -7
  1529. package/dist/src/types.js.map +0 -7
  1530. package/dist/test-api.js +0 -82
  1531. package/dist/test-api.js.map +0 -7
  1532. package/dist/thread-bindings-runtime.js +0 -15
  1533. package/dist/thread-bindings-runtime.js.map +0 -7
@@ -0,0 +1,2568 @@
1
+ import "fake-indexeddb/auto";
2
+ import { EventEmitter } from "node:events";
3
+ import fs from "node:fs";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
7
+
8
+ function requestUrl(input: RequestInfo | URL | undefined): string {
9
+ if (!input) {
10
+ return "";
11
+ }
12
+ if (typeof input === "string") {
13
+ return input;
14
+ }
15
+ if (input instanceof URL) {
16
+ return input.toString();
17
+ }
18
+ return input.url;
19
+ }
20
+
21
+ class FakeMatrixEvent extends EventEmitter {
22
+ private readonly roomId: string;
23
+ private readonly eventId: string;
24
+ private readonly sender: string;
25
+ private readonly type: string;
26
+ private readonly ts: number;
27
+ private readonly content: Record<string, unknown>;
28
+ private readonly stateKey?: string;
29
+ private readonly unsigned?: {
30
+ age?: number;
31
+ redacted_because?: unknown;
32
+ };
33
+ private readonly decryptionFailure: boolean;
34
+
35
+ constructor(params: {
36
+ roomId: string;
37
+ eventId: string;
38
+ sender: string;
39
+ type: string;
40
+ ts: number;
41
+ content: Record<string, unknown>;
42
+ stateKey?: string;
43
+ unsigned?: {
44
+ age?: number;
45
+ redacted_because?: unknown;
46
+ };
47
+ decryptionFailure?: boolean;
48
+ }) {
49
+ super();
50
+ this.roomId = params.roomId;
51
+ this.eventId = params.eventId;
52
+ this.sender = params.sender;
53
+ this.type = params.type;
54
+ this.ts = params.ts;
55
+ this.content = params.content;
56
+ this.stateKey = params.stateKey;
57
+ this.unsigned = params.unsigned;
58
+ this.decryptionFailure = params.decryptionFailure === true;
59
+ }
60
+
61
+ getRoomId(): string {
62
+ return this.roomId;
63
+ }
64
+
65
+ getId(): string {
66
+ return this.eventId;
67
+ }
68
+
69
+ getSender(): string {
70
+ return this.sender;
71
+ }
72
+
73
+ getType(): string {
74
+ return this.type;
75
+ }
76
+
77
+ getTs(): number {
78
+ return this.ts;
79
+ }
80
+
81
+ getContent(): Record<string, unknown> {
82
+ return this.content;
83
+ }
84
+
85
+ getUnsigned(): { age?: number; redacted_because?: unknown } {
86
+ return this.unsigned ?? {};
87
+ }
88
+
89
+ getStateKey(): string | undefined {
90
+ return this.stateKey;
91
+ }
92
+
93
+ isDecryptionFailure(): boolean {
94
+ return this.decryptionFailure;
95
+ }
96
+ }
97
+
98
+ type MatrixJsClientStub = {
99
+ emit: (eventName: string | symbol, ...args: unknown[]) => boolean;
100
+ on: (eventName: string | symbol, listener: (...args: unknown[]) => void) => MatrixJsClientStub;
101
+ startClient: ReturnType<typeof vi.fn>;
102
+ stopClient: ReturnType<typeof vi.fn>;
103
+ initRustCrypto: ReturnType<typeof vi.fn>;
104
+ getUserId: ReturnType<typeof vi.fn>;
105
+ getDeviceId: ReturnType<typeof vi.fn>;
106
+ getJoinedRooms: ReturnType<typeof vi.fn>;
107
+ getJoinedRoomMembers: ReturnType<typeof vi.fn>;
108
+ getStateEvent: ReturnType<typeof vi.fn>;
109
+ getAccountData: ReturnType<typeof vi.fn>;
110
+ setAccountData: ReturnType<typeof vi.fn>;
111
+ getRoomIdForAlias: ReturnType<typeof vi.fn>;
112
+ sendMessage: ReturnType<typeof vi.fn>;
113
+ sendEvent: ReturnType<typeof vi.fn>;
114
+ sendStateEvent: ReturnType<typeof vi.fn>;
115
+ redactEvent: ReturnType<typeof vi.fn>;
116
+ getProfileInfo: ReturnType<typeof vi.fn>;
117
+ joinRoom: ReturnType<typeof vi.fn>;
118
+ mxcUrlToHttp: ReturnType<typeof vi.fn>;
119
+ uploadContent: ReturnType<typeof vi.fn>;
120
+ fetchRoomEvent: ReturnType<typeof vi.fn>;
121
+ getEventMapper: ReturnType<typeof vi.fn>;
122
+ sendTyping: ReturnType<typeof vi.fn>;
123
+ getRoom: ReturnType<typeof vi.fn>;
124
+ getRooms: ReturnType<typeof vi.fn>;
125
+ getCrypto: ReturnType<typeof vi.fn>;
126
+ decryptEventIfNeeded: ReturnType<typeof vi.fn>;
127
+ relations: ReturnType<typeof vi.fn>;
128
+ };
129
+
130
+ function createMatrixJsClientStub(): MatrixJsClientStub {
131
+ const client = new EventEmitter() as unknown as MatrixJsClientStub;
132
+ client.startClient = vi.fn(async () => {
133
+ queueMicrotask(() => {
134
+ client.emit("sync", "PREPARED", null, undefined);
135
+ });
136
+ });
137
+ client.stopClient = vi.fn();
138
+ client.initRustCrypto = vi.fn(async () => {});
139
+ client.getUserId = vi.fn(() => "@bot:example.org");
140
+ client.getDeviceId = vi.fn(() => "DEVICE123");
141
+ client.getJoinedRooms = vi.fn(async () => ({ joined_rooms: [] }));
142
+ client.getJoinedRoomMembers = vi.fn(async () => ({ joined: {} }));
143
+ client.getStateEvent = vi.fn(async () => ({}));
144
+ client.getAccountData = vi.fn(() => undefined);
145
+ client.setAccountData = vi.fn(async () => {});
146
+ client.getRoomIdForAlias = vi.fn(async () => ({ room_id: "!resolved:example.org" }));
147
+ client.sendMessage = vi.fn(async () => ({ event_id: "$sent" }));
148
+ client.sendEvent = vi.fn(async () => ({ event_id: "$sent-event" }));
149
+ client.sendStateEvent = vi.fn(async () => ({ event_id: "$state" }));
150
+ client.redactEvent = vi.fn(async () => ({ event_id: "$redact" }));
151
+ client.getProfileInfo = vi.fn(async () => ({}));
152
+ client.joinRoom = vi.fn(async () => ({}));
153
+ client.mxcUrlToHttp = vi.fn(() => null);
154
+ client.uploadContent = vi.fn(async () => ({ content_uri: "mxc://example/file" }));
155
+ client.fetchRoomEvent = vi.fn(async () => ({}));
156
+ client.getEventMapper = vi.fn(
157
+ () =>
158
+ (
159
+ raw: Partial<{
160
+ room_id: string;
161
+ event_id: string;
162
+ sender: string;
163
+ type: string;
164
+ origin_server_ts: number;
165
+ content: Record<string, unknown>;
166
+ state_key?: string;
167
+ unsigned?: { age?: number; redacted_because?: unknown };
168
+ }>,
169
+ ) =>
170
+ new FakeMatrixEvent({
171
+ roomId: raw.room_id ?? "!mapped:example.org",
172
+ eventId: raw.event_id ?? "$mapped",
173
+ sender: raw.sender ?? "@mapped:example.org",
174
+ type: raw.type ?? "m.room.message",
175
+ ts: raw.origin_server_ts ?? Date.now(),
176
+ content: raw.content ?? {},
177
+ stateKey: raw.state_key,
178
+ unsigned: raw.unsigned,
179
+ }),
180
+ );
181
+ client.sendTyping = vi.fn(async () => {});
182
+ client.getRoom = vi.fn(() => ({ hasEncryptionStateEvent: () => false }));
183
+ client.getRooms = vi.fn(() => []);
184
+ client.getCrypto = vi.fn(() => undefined);
185
+ client.decryptEventIfNeeded = vi.fn(async () => {});
186
+ client.relations = vi.fn(async () => ({
187
+ originalEvent: null,
188
+ events: [],
189
+ nextBatch: null,
190
+ prevBatch: null,
191
+ }));
192
+ return client;
193
+ }
194
+
195
+ let matrixJsClient = createMatrixJsClientStub();
196
+ let lastCreateClientOpts: Record<string, unknown> | null = null;
197
+
198
+ vi.mock("matrix-js-sdk/lib/matrix.js", async () => {
199
+ const actual = await vi.importActual<typeof import("@archipelagolab/lobi-js-sdk/lib/matrix.js")>(
200
+ "matrix-js-sdk/lib/matrix.js",
201
+ );
202
+ return {
203
+ ...actual,
204
+ ClientEvent: {
205
+ Event: "event",
206
+ Room: "Room",
207
+ Sync: "sync",
208
+ SyncUnexpectedError: "sync.unexpectedError",
209
+ },
210
+ MatrixEventEvent: { Decrypted: "decrypted" },
211
+ createClient: vi.fn((opts: Record<string, unknown>) => {
212
+ lastCreateClientOpts = opts;
213
+ return matrixJsClient;
214
+ }),
215
+ };
216
+ });
217
+
218
+ const { encodeRecoveryKey } = await import("@archipelagolab/lobi-js-sdk/lib/crypto-api/recovery-key.js");
219
+ const { MatrixClient } = await import("./sdk.js");
220
+
221
+ describe("MatrixClient request hardening", () => {
222
+ beforeEach(() => {
223
+ matrixJsClient = createMatrixJsClientStub();
224
+ lastCreateClientOpts = null;
225
+ vi.useRealTimers();
226
+ vi.unstubAllGlobals();
227
+ });
228
+
229
+ afterEach(() => {
230
+ vi.useRealTimers();
231
+ vi.unstubAllGlobals();
232
+ });
233
+
234
+ it("blocks absolute endpoints unless explicitly allowed", async () => {
235
+ const fetchMock = vi.fn(async () => {
236
+ return new Response("{}", {
237
+ status: 200,
238
+ headers: { "content-type": "application/json" },
239
+ });
240
+ });
241
+ vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);
242
+
243
+ const client = new MatrixClient("https://matrix.example.org", "token");
244
+ await expect(client.doRequest("GET", "https://matrix.example.org/start")).rejects.toThrow(
245
+ "Absolute Matrix endpoint is blocked by default",
246
+ );
247
+ expect(fetchMock).not.toHaveBeenCalled();
248
+ });
249
+
250
+ it("injects a guarded fetchFn into matrix-js-sdk", () => {
251
+ const client = new MatrixClient("https://matrix.example.org", "token", {
252
+ ssrfPolicy: { allowPrivateNetwork: true },
253
+ });
254
+ expect(client).toBeInstanceOf(MatrixClient);
255
+
256
+ expect(lastCreateClientOpts).toMatchObject({
257
+ baseUrl: "https://matrix.example.org",
258
+ accessToken: "token",
259
+ });
260
+ expect(lastCreateClientOpts?.fetchFn).toEqual(expect.any(Function));
261
+ });
262
+
263
+ it("prefers authenticated client media downloads", async () => {
264
+ const payload = Buffer.from([1, 2, 3, 4]);
265
+ const fetchMock = vi.fn<(input: RequestInfo | URL, init?: RequestInit) => Promise<Response>>(
266
+ async () => new Response(payload, { status: 200 }),
267
+ );
268
+ vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);
269
+
270
+ const client = new MatrixClient("http://127.0.0.1:8008", "token", {
271
+ ssrfPolicy: { allowPrivateNetwork: true },
272
+ });
273
+ await expect(client.downloadContent("mxc://example.org/media")).resolves.toEqual(payload);
274
+
275
+ expect(fetchMock).toHaveBeenCalledTimes(1);
276
+ const firstInput = (fetchMock.mock.calls as Array<[RequestInfo | URL]>)[0]?.[0];
277
+ const firstUrl = requestUrl(firstInput);
278
+ expect(firstUrl).toContain("/_lobi/client/v1/media/download/example.org/media");
279
+ });
280
+
281
+ it("falls back to legacy media downloads for older homeservers", async () => {
282
+ const payload = Buffer.from([5, 6, 7, 8]);
283
+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
284
+ const url = requestUrl(input);
285
+ if (url.includes("/_lobi/client/v1/media/download/")) {
286
+ return new Response(
287
+ JSON.stringify({
288
+ errcode: "M_UNRECOGNIZED",
289
+ error: "Unrecognized request",
290
+ }),
291
+ {
292
+ status: 404,
293
+ headers: { "content-type": "application/json" },
294
+ },
295
+ );
296
+ }
297
+ return new Response(payload, { status: 200 });
298
+ });
299
+ vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);
300
+
301
+ const client = new MatrixClient("http://127.0.0.1:8008", "token", {
302
+ ssrfPolicy: { allowPrivateNetwork: true },
303
+ });
304
+ await expect(client.downloadContent("mxc://example.org/media")).resolves.toEqual(payload);
305
+
306
+ expect(fetchMock).toHaveBeenCalledTimes(2);
307
+ const [firstCall, secondCall] = fetchMock.mock.calls as Array<[RequestInfo | URL]>;
308
+ const firstInput = firstCall?.[0];
309
+ const secondInput = secondCall?.[0];
310
+ const firstUrl = requestUrl(firstInput);
311
+ const secondUrl = requestUrl(secondInput);
312
+ expect(firstUrl).toContain("/_lobi/client/v1/media/download/example.org/media");
313
+ expect(secondUrl).toContain("/_lobi/media/v3/download/example.org/media");
314
+ });
315
+
316
+ it("decrypts encrypted room events returned by getEvent", async () => {
317
+ const client = new MatrixClient("https://matrix.example.org", "token");
318
+ matrixJsClient.fetchRoomEvent = vi.fn(async () => ({
319
+ room_id: "!room:example.org",
320
+ event_id: "$poll",
321
+ sender: "@alice:example.org",
322
+ type: "m.room.encrypted",
323
+ origin_server_ts: 1,
324
+ content: {},
325
+ }));
326
+ matrixJsClient.decryptEventIfNeeded = vi.fn(async (event: FakeMatrixEvent) => {
327
+ event.emit(
328
+ "decrypted",
329
+ new FakeMatrixEvent({
330
+ roomId: "!room:example.org",
331
+ eventId: "$poll",
332
+ sender: "@alice:example.org",
333
+ type: "m.poll.start",
334
+ ts: 1,
335
+ content: {
336
+ "m.poll.start": {
337
+ question: { "m.text": "Lunch?" },
338
+ answers: [{ id: "a1", "m.text": "Pizza" }],
339
+ },
340
+ },
341
+ }),
342
+ );
343
+ });
344
+
345
+ const event = await client.getEvent("!room:example.org", "$poll");
346
+
347
+ expect(matrixJsClient.decryptEventIfNeeded).toHaveBeenCalledTimes(1);
348
+ expect(event).toMatchObject({
349
+ event_id: "$poll",
350
+ type: "m.poll.start",
351
+ sender: "@alice:example.org",
352
+ });
353
+ });
354
+
355
+ it("serializes outbound sends per room across message and event sends", async () => {
356
+ const client = new MatrixClient("https://matrix.example.org", "token");
357
+ let releaseFirst: (() => void) | undefined;
358
+ const started: string[] = [];
359
+ matrixJsClient.sendMessage = vi.fn(async () => {
360
+ started.push("message");
361
+ await new Promise<void>((resolve) => {
362
+ releaseFirst = resolve;
363
+ });
364
+ return { event_id: "$message" };
365
+ });
366
+ matrixJsClient.sendEvent = vi.fn(async () => {
367
+ started.push("event");
368
+ return { event_id: "$event" };
369
+ });
370
+
371
+ const first = client.sendMessage("!room:example.org", {
372
+ msgtype: "m.text",
373
+ body: "hello",
374
+ });
375
+ const second = client.sendEvent("!room:example.org", "m.reaction", {
376
+ "m.relates_to": { event_id: "$target", key: "👍", rel_type: "m.annotation" },
377
+ });
378
+
379
+ await Promise.resolve();
380
+ await Promise.resolve();
381
+ expect(started).toEqual(["message"]);
382
+ expect(matrixJsClient.sendEvent).not.toHaveBeenCalled();
383
+
384
+ releaseFirst?.();
385
+
386
+ await expect(first).resolves.toBe("$message");
387
+ await expect(second).resolves.toBe("$event");
388
+ expect(started).toEqual(["message", "event"]);
389
+ });
390
+
391
+ it("does not serialize sends across different rooms", async () => {
392
+ const client = new MatrixClient("https://matrix.example.org", "token");
393
+ let releaseFirst: (() => void) | undefined;
394
+ const started: string[] = [];
395
+ matrixJsClient.sendMessage = vi.fn(async (roomId: string) => {
396
+ started.push(roomId);
397
+ if (roomId === "!room-a:example.org") {
398
+ await new Promise<void>((resolve) => {
399
+ releaseFirst = resolve;
400
+ });
401
+ }
402
+ return { event_id: `$${roomId}` };
403
+ });
404
+
405
+ const first = client.sendMessage("!room-a:example.org", {
406
+ msgtype: "m.text",
407
+ body: "a",
408
+ });
409
+ const second = client.sendMessage("!room-b:example.org", {
410
+ msgtype: "m.text",
411
+ body: "b",
412
+ });
413
+
414
+ await Promise.resolve();
415
+ await Promise.resolve();
416
+ expect(started).toEqual(["!room-a:example.org", "!room-b:example.org"]);
417
+
418
+ releaseFirst?.();
419
+
420
+ await expect(first).resolves.toBe("$!room-a:example.org");
421
+ await expect(second).resolves.toBe("$!room-b:example.org");
422
+ });
423
+
424
+ it("maps relations pages back to raw events", async () => {
425
+ const client = new MatrixClient("https://matrix.example.org", "token");
426
+ matrixJsClient.relations = vi.fn(async () => ({
427
+ originalEvent: new FakeMatrixEvent({
428
+ roomId: "!room:example.org",
429
+ eventId: "$poll",
430
+ sender: "@alice:example.org",
431
+ type: "m.poll.start",
432
+ ts: 1,
433
+ content: {
434
+ "m.poll.start": {
435
+ question: { "m.text": "Lunch?" },
436
+ answers: [{ id: "a1", "m.text": "Pizza" }],
437
+ },
438
+ },
439
+ }),
440
+ events: [
441
+ new FakeMatrixEvent({
442
+ roomId: "!room:example.org",
443
+ eventId: "$vote",
444
+ sender: "@bob:example.org",
445
+ type: "m.poll.response",
446
+ ts: 2,
447
+ content: {
448
+ "m.poll.response": { answers: ["a1"] },
449
+ "m.relates_to": { rel_type: "m.reference", event_id: "$poll" },
450
+ },
451
+ }),
452
+ ],
453
+ nextBatch: null,
454
+ prevBatch: null,
455
+ }));
456
+
457
+ const page = await client.getRelations("!room:example.org", "$poll", "m.reference");
458
+
459
+ expect(page.originalEvent).toMatchObject({ event_id: "$poll", type: "m.poll.start" });
460
+ expect(page.events).toEqual([
461
+ expect.objectContaining({
462
+ event_id: "$vote",
463
+ type: "m.poll.response",
464
+ sender: "@bob:example.org",
465
+ }),
466
+ ]);
467
+ });
468
+
469
+ it("blocks cross-protocol redirects when absolute endpoints are allowed", async () => {
470
+ const fetchMock = vi.fn(async () => {
471
+ return new Response("", {
472
+ status: 302,
473
+ headers: {
474
+ location: "https://127.0.0.2:8008/next",
475
+ },
476
+ });
477
+ });
478
+ vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);
479
+
480
+ const client = new MatrixClient("http://127.0.0.1:8008", "token", {
481
+ ssrfPolicy: { allowPrivateNetwork: true },
482
+ });
483
+
484
+ await expect(
485
+ client.doRequest("GET", "http://127.0.0.1:8008/start", undefined, undefined, {
486
+ allowAbsoluteEndpoint: true,
487
+ }),
488
+ ).rejects.toThrow("Blocked cross-protocol redirect");
489
+ });
490
+
491
+ it("strips authorization when redirect crosses origin", async () => {
492
+ const calls: Array<{ url: string; headers: Headers }> = [];
493
+ const fetchMock = vi.fn(async (url: URL | string, init?: RequestInit) => {
494
+ calls.push({
495
+ url: String(url),
496
+ headers: new Headers(init?.headers),
497
+ });
498
+ if (calls.length === 1) {
499
+ return new Response("", {
500
+ status: 302,
501
+ headers: { location: "http://127.0.0.2:8008/next" },
502
+ });
503
+ }
504
+ return new Response("{}", {
505
+ status: 200,
506
+ headers: { "content-type": "application/json" },
507
+ });
508
+ });
509
+ vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);
510
+
511
+ const client = new MatrixClient("http://127.0.0.1:8008", "token", {
512
+ ssrfPolicy: { allowPrivateNetwork: true },
513
+ });
514
+ await client.doRequest("GET", "http://127.0.0.1:8008/start", undefined, undefined, {
515
+ allowAbsoluteEndpoint: true,
516
+ });
517
+
518
+ expect(calls).toHaveLength(2);
519
+ expect(calls[0]?.url).toBe("http://127.0.0.1:8008/start");
520
+ expect(calls[0]?.headers.get("authorization")).toBe("Bearer token");
521
+ expect(calls[1]?.url).toBe("http://127.0.0.2:8008/next");
522
+ expect(calls[1]?.headers.get("authorization")).toBeNull();
523
+ });
524
+
525
+ it("aborts requests after timeout", async () => {
526
+ vi.useFakeTimers();
527
+ const fetchMock = vi.fn((_: URL | string, init?: RequestInit) => {
528
+ return new Promise<Response>((_, reject) => {
529
+ init?.signal?.addEventListener("abort", () => {
530
+ reject(new Error("aborted"));
531
+ });
532
+ });
533
+ });
534
+ vi.stubGlobal("fetch", fetchMock as unknown as typeof fetch);
535
+
536
+ const client = new MatrixClient("http://127.0.0.1:8008", "token", {
537
+ localTimeoutMs: 25,
538
+ ssrfPolicy: { allowPrivateNetwork: true },
539
+ });
540
+
541
+ const pending = client.doRequest("GET", "/_lobi/client/v3/account/whoami");
542
+ const assertion = expect(pending).rejects.toThrow("aborted");
543
+ await vi.advanceTimersByTimeAsync(30);
544
+
545
+ await assertion;
546
+ });
547
+
548
+ it("wires the sync store into the SDK and flushes it on shutdown", async () => {
549
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-matrix-sdk-store-"));
550
+ const storagePath = path.join(tempDir, "bot-storage.json");
551
+
552
+ try {
553
+ const client = new MatrixClient("https://matrix.example.org", "token", {
554
+ storagePath,
555
+ });
556
+
557
+ const store = lastCreateClientOpts?.store as { flush: () => Promise<void> } | undefined;
558
+ expect(store).toBeTruthy();
559
+ const flushSpy = vi.spyOn(store!, "flush").mockResolvedValue();
560
+
561
+ await client.stopAndPersist();
562
+
563
+ expect(flushSpy).toHaveBeenCalledTimes(1);
564
+ expect(matrixJsClient.stopClient).toHaveBeenCalledTimes(1);
565
+ } finally {
566
+ fs.rmSync(tempDir, { recursive: true, force: true });
567
+ }
568
+ });
569
+ });
570
+
571
+ describe("MatrixClient event bridge", () => {
572
+ beforeEach(() => {
573
+ matrixJsClient = createMatrixJsClientStub();
574
+ lastCreateClientOpts = null;
575
+ });
576
+
577
+ afterEach(() => {
578
+ vi.useRealTimers();
579
+ vi.restoreAllMocks();
580
+ });
581
+
582
+ it("emits room.message only after encrypted events decrypt", async () => {
583
+ const client = new MatrixClient("https://matrix.example.org", "token");
584
+ const messageEvents: Array<{ roomId: string; type: string }> = [];
585
+
586
+ client.on("room.message", (roomId, event) => {
587
+ messageEvents.push({ roomId, type: event.type });
588
+ });
589
+
590
+ await client.start();
591
+
592
+ const encrypted = new FakeMatrixEvent({
593
+ roomId: "!room:example.org",
594
+ eventId: "$event",
595
+ sender: "@alice:example.org",
596
+ type: "m.room.encrypted",
597
+ ts: Date.now(),
598
+ content: {},
599
+ });
600
+ const decrypted = new FakeMatrixEvent({
601
+ roomId: "!room:example.org",
602
+ eventId: "$event",
603
+ sender: "@alice:example.org",
604
+ type: "m.room.message",
605
+ ts: Date.now(),
606
+ content: {
607
+ msgtype: "m.text",
608
+ body: "hello",
609
+ },
610
+ });
611
+
612
+ matrixJsClient.emit("event", encrypted);
613
+ expect(messageEvents).toHaveLength(0);
614
+
615
+ encrypted.emit("decrypted", decrypted);
616
+ // Simulate a second normal event emission from the SDK after decryption.
617
+ matrixJsClient.emit("event", decrypted);
618
+ expect(messageEvents).toEqual([
619
+ {
620
+ roomId: "!room:example.org",
621
+ type: "m.room.message",
622
+ },
623
+ ]);
624
+ });
625
+
626
+ it("emits room.failed_decryption when decrypting fails", async () => {
627
+ const client = new MatrixClient("https://matrix.example.org", "token");
628
+ const failed: string[] = [];
629
+ const delivered: string[] = [];
630
+
631
+ client.on("room.failed_decryption", (_roomId, _event, error) => {
632
+ failed.push(error.message);
633
+ });
634
+ client.on("room.message", (_roomId, event) => {
635
+ delivered.push(event.type);
636
+ });
637
+
638
+ await client.start();
639
+
640
+ const encrypted = new FakeMatrixEvent({
641
+ roomId: "!room:example.org",
642
+ eventId: "$event",
643
+ sender: "@alice:example.org",
644
+ type: "m.room.encrypted",
645
+ ts: Date.now(),
646
+ content: {},
647
+ });
648
+ const decrypted = new FakeMatrixEvent({
649
+ roomId: "!room:example.org",
650
+ eventId: "$event",
651
+ sender: "@alice:example.org",
652
+ type: "m.room.message",
653
+ ts: Date.now(),
654
+ content: {
655
+ msgtype: "m.text",
656
+ body: "hello",
657
+ },
658
+ });
659
+
660
+ matrixJsClient.emit("event", encrypted);
661
+ encrypted.emit("decrypted", decrypted, new Error("decrypt failed"));
662
+
663
+ expect(failed).toEqual(["decrypt failed"]);
664
+ expect(delivered).toHaveLength(0);
665
+ });
666
+
667
+ it("retries failed decryption and emits room.message after late key availability", async () => {
668
+ vi.useFakeTimers();
669
+ const client = new MatrixClient("https://matrix.example.org", "token");
670
+ const failed: string[] = [];
671
+ const delivered: string[] = [];
672
+
673
+ client.on("room.failed_decryption", (_roomId, _event, error) => {
674
+ failed.push(error.message);
675
+ });
676
+ client.on("room.message", (_roomId, event) => {
677
+ delivered.push(event.type);
678
+ });
679
+
680
+ const encrypted = new FakeMatrixEvent({
681
+ roomId: "!room:example.org",
682
+ eventId: "$event",
683
+ sender: "@alice:example.org",
684
+ type: "m.room.encrypted",
685
+ ts: Date.now(),
686
+ content: {},
687
+ decryptionFailure: true,
688
+ });
689
+ const decrypted = new FakeMatrixEvent({
690
+ roomId: "!room:example.org",
691
+ eventId: "$event",
692
+ sender: "@alice:example.org",
693
+ type: "m.room.message",
694
+ ts: Date.now(),
695
+ content: {
696
+ msgtype: "m.text",
697
+ body: "hello",
698
+ },
699
+ });
700
+
701
+ matrixJsClient.decryptEventIfNeeded = vi.fn(async () => {
702
+ encrypted.emit("decrypted", decrypted);
703
+ });
704
+
705
+ await client.start();
706
+ matrixJsClient.emit("event", encrypted);
707
+ encrypted.emit("decrypted", encrypted, new Error("missing room key"));
708
+
709
+ expect(failed).toEqual(["missing room key"]);
710
+ expect(delivered).toHaveLength(0);
711
+
712
+ await vi.advanceTimersByTimeAsync(1_600);
713
+
714
+ expect(matrixJsClient.decryptEventIfNeeded).toHaveBeenCalledTimes(1);
715
+ expect(failed).toEqual(["missing room key"]);
716
+ expect(delivered).toEqual(["m.room.message"]);
717
+ });
718
+
719
+ it("can drain pending decrypt retries after sync stops", async () => {
720
+ vi.useFakeTimers();
721
+ const client = new MatrixClient("https://matrix.example.org", "token");
722
+ const delivered: string[] = [];
723
+
724
+ client.on("room.message", (_roomId, event) => {
725
+ delivered.push(event.type);
726
+ });
727
+
728
+ const encrypted = new FakeMatrixEvent({
729
+ roomId: "!room:example.org",
730
+ eventId: "$event",
731
+ sender: "@alice:example.org",
732
+ type: "m.room.encrypted",
733
+ ts: Date.now(),
734
+ content: {},
735
+ decryptionFailure: true,
736
+ });
737
+ const decrypted = new FakeMatrixEvent({
738
+ roomId: "!room:example.org",
739
+ eventId: "$event",
740
+ sender: "@alice:example.org",
741
+ type: "m.room.message",
742
+ ts: Date.now(),
743
+ content: {
744
+ msgtype: "m.text",
745
+ body: "hello",
746
+ },
747
+ });
748
+
749
+ matrixJsClient.decryptEventIfNeeded = vi.fn(async () => {
750
+ encrypted.emit("decrypted", decrypted);
751
+ });
752
+
753
+ await client.start();
754
+ matrixJsClient.emit("event", encrypted);
755
+ encrypted.emit("decrypted", encrypted, new Error("missing room key"));
756
+
757
+ client.stopSyncWithoutPersist();
758
+ await client.drainPendingDecryptions("test shutdown");
759
+
760
+ expect(matrixJsClient.stopClient).toHaveBeenCalledTimes(1);
761
+ expect(matrixJsClient.decryptEventIfNeeded).toHaveBeenCalledTimes(1);
762
+ expect(delivered).toEqual(["m.room.message"]);
763
+ });
764
+
765
+ it("retries failed decryptions immediately on crypto key update signals", async () => {
766
+ vi.useFakeTimers();
767
+ const client = new MatrixClient("https://matrix.example.org", "token", {
768
+ encryption: true,
769
+ });
770
+ const failed: string[] = [];
771
+ const delivered: string[] = [];
772
+ const cryptoListeners = new Map<string, (...args: unknown[]) => void>();
773
+
774
+ matrixJsClient.getCrypto = vi.fn(() => ({
775
+ on: vi.fn((eventName: string, listener: (...args: unknown[]) => void) => {
776
+ cryptoListeners.set(eventName, listener);
777
+ }),
778
+ bootstrapCrossSigning: vi.fn(async () => {}),
779
+ bootstrapSecretStorage: vi.fn(async () => {}),
780
+ requestOwnUserVerification: vi.fn(async () => null),
781
+ }));
782
+
783
+ client.on("room.failed_decryption", (_roomId, _event, error) => {
784
+ failed.push(error.message);
785
+ });
786
+ client.on("room.message", (_roomId, event) => {
787
+ delivered.push(event.type);
788
+ });
789
+
790
+ const encrypted = new FakeMatrixEvent({
791
+ roomId: "!room:example.org",
792
+ eventId: "$event",
793
+ sender: "@alice:example.org",
794
+ type: "m.room.encrypted",
795
+ ts: Date.now(),
796
+ content: {},
797
+ decryptionFailure: true,
798
+ });
799
+ const decrypted = new FakeMatrixEvent({
800
+ roomId: "!room:example.org",
801
+ eventId: "$event",
802
+ sender: "@alice:example.org",
803
+ type: "m.room.message",
804
+ ts: Date.now(),
805
+ content: {
806
+ msgtype: "m.text",
807
+ body: "hello",
808
+ },
809
+ });
810
+ matrixJsClient.decryptEventIfNeeded = vi.fn(async () => {
811
+ encrypted.emit("decrypted", decrypted);
812
+ });
813
+
814
+ await client.start();
815
+ matrixJsClient.emit("event", encrypted);
816
+ encrypted.emit("decrypted", encrypted, new Error("missing room key"));
817
+
818
+ expect(failed).toEqual(["missing room key"]);
819
+ expect(delivered).toHaveLength(0);
820
+
821
+ const trigger = cryptoListeners.get("crypto.keyBackupDecryptionKeyCached");
822
+ expect(trigger).toBeTypeOf("function");
823
+ trigger?.();
824
+ await Promise.resolve();
825
+
826
+ expect(matrixJsClient.decryptEventIfNeeded).toHaveBeenCalledTimes(1);
827
+ expect(delivered).toEqual(["m.room.message"]);
828
+ });
829
+
830
+ it("stops decryption retries after hitting retry cap", async () => {
831
+ vi.useFakeTimers();
832
+ const client = new MatrixClient("https://matrix.example.org", "token");
833
+ const failed: string[] = [];
834
+
835
+ client.on("room.failed_decryption", (_roomId, _event, error) => {
836
+ failed.push(error.message);
837
+ });
838
+
839
+ const encrypted = new FakeMatrixEvent({
840
+ roomId: "!room:example.org",
841
+ eventId: "$event",
842
+ sender: "@alice:example.org",
843
+ type: "m.room.encrypted",
844
+ ts: Date.now(),
845
+ content: {},
846
+ decryptionFailure: true,
847
+ });
848
+
849
+ matrixJsClient.decryptEventIfNeeded = vi.fn(async () => {
850
+ throw new Error("still missing key");
851
+ });
852
+
853
+ await client.start();
854
+ matrixJsClient.emit("event", encrypted);
855
+ encrypted.emit("decrypted", encrypted, new Error("missing room key"));
856
+
857
+ expect(failed).toEqual(["missing room key"]);
858
+
859
+ await vi.advanceTimersByTimeAsync(200_000);
860
+ expect(matrixJsClient.decryptEventIfNeeded).toHaveBeenCalledTimes(8);
861
+
862
+ await vi.advanceTimersByTimeAsync(200_000);
863
+ expect(matrixJsClient.decryptEventIfNeeded).toHaveBeenCalledTimes(8);
864
+ });
865
+
866
+ it("does not start duplicate retries when crypto signals fire while retry is in-flight", async () => {
867
+ vi.useFakeTimers();
868
+ const client = new MatrixClient("https://matrix.example.org", "token", {
869
+ encryption: true,
870
+ });
871
+ const delivered: string[] = [];
872
+ const cryptoListeners = new Map<string, (...args: unknown[]) => void>();
873
+
874
+ matrixJsClient.getCrypto = vi.fn(() => ({
875
+ on: vi.fn((eventName: string, listener: (...args: unknown[]) => void) => {
876
+ cryptoListeners.set(eventName, listener);
877
+ }),
878
+ bootstrapCrossSigning: vi.fn(async () => {}),
879
+ bootstrapSecretStorage: vi.fn(async () => {}),
880
+ requestOwnUserVerification: vi.fn(async () => null),
881
+ }));
882
+
883
+ client.on("room.message", (_roomId, event) => {
884
+ delivered.push(event.type);
885
+ });
886
+
887
+ const encrypted = new FakeMatrixEvent({
888
+ roomId: "!room:example.org",
889
+ eventId: "$event",
890
+ sender: "@alice:example.org",
891
+ type: "m.room.encrypted",
892
+ ts: Date.now(),
893
+ content: {},
894
+ decryptionFailure: true,
895
+ });
896
+ const decrypted = new FakeMatrixEvent({
897
+ roomId: "!room:example.org",
898
+ eventId: "$event",
899
+ sender: "@alice:example.org",
900
+ type: "m.room.message",
901
+ ts: Date.now(),
902
+ content: {
903
+ msgtype: "m.text",
904
+ body: "hello",
905
+ },
906
+ });
907
+
908
+ const releaseRetryRef: { current?: () => void } = {};
909
+ matrixJsClient.decryptEventIfNeeded = vi.fn(
910
+ async () =>
911
+ await new Promise<void>((resolve) => {
912
+ releaseRetryRef.current = () => {
913
+ encrypted.emit("decrypted", decrypted);
914
+ resolve();
915
+ };
916
+ }),
917
+ );
918
+
919
+ await client.start();
920
+ matrixJsClient.emit("event", encrypted);
921
+ encrypted.emit("decrypted", encrypted, new Error("missing room key"));
922
+
923
+ const trigger = cryptoListeners.get("crypto.keyBackupDecryptionKeyCached");
924
+ expect(trigger).toBeTypeOf("function");
925
+ trigger?.();
926
+ trigger?.();
927
+ await Promise.resolve();
928
+
929
+ expect(matrixJsClient.decryptEventIfNeeded).toHaveBeenCalledTimes(1);
930
+ releaseRetryRef.current?.();
931
+ await Promise.resolve();
932
+ expect(delivered).toEqual(["m.room.message"]);
933
+ });
934
+
935
+ it("emits room.invite when a membership invite targets the current user", async () => {
936
+ const client = new MatrixClient("https://matrix.example.org", "token");
937
+ const invites: string[] = [];
938
+
939
+ client.on("room.invite", (roomId) => {
940
+ invites.push(roomId);
941
+ });
942
+
943
+ await client.start();
944
+
945
+ const inviteMembership = new FakeMatrixEvent({
946
+ roomId: "!room:example.org",
947
+ eventId: "$invite",
948
+ sender: "@alice:example.org",
949
+ type: "m.room.member",
950
+ ts: Date.now(),
951
+ stateKey: "@bot:example.org",
952
+ content: {
953
+ membership: "invite",
954
+ },
955
+ });
956
+
957
+ matrixJsClient.emit("event", inviteMembership);
958
+
959
+ expect(invites).toEqual(["!room:example.org"]);
960
+ });
961
+
962
+ it("emits room.invite when SDK emits Room event with invite membership", async () => {
963
+ const client = new MatrixClient("https://matrix.example.org", "token");
964
+ const invites: string[] = [];
965
+ client.on("room.invite", (roomId) => {
966
+ invites.push(roomId);
967
+ });
968
+
969
+ await client.start();
970
+
971
+ matrixJsClient.emit("Room", {
972
+ roomId: "!invite:example.org",
973
+ getMyMembership: () => "invite",
974
+ });
975
+
976
+ expect(invites).toEqual(["!invite:example.org"]);
977
+ });
978
+
979
+ it("waits for a ready sync state before resolving startup", async () => {
980
+ let releaseSyncReady: (() => void) | undefined;
981
+ matrixJsClient.startClient = vi.fn(async () => {
982
+ await new Promise<void>((resolve) => {
983
+ releaseSyncReady = () => {
984
+ matrixJsClient.emit("sync", "PREPARED", null, undefined);
985
+ resolve();
986
+ };
987
+ });
988
+ });
989
+
990
+ const client = new MatrixClient("https://matrix.example.org", "token");
991
+ let resolved = false;
992
+ const startPromise = client.start().then(() => {
993
+ resolved = true;
994
+ });
995
+
996
+ await vi.waitFor(() => {
997
+ expect(releaseSyncReady).toEqual(expect.any(Function));
998
+ });
999
+ expect(resolved).toBe(false);
1000
+
1001
+ releaseSyncReady?.();
1002
+ await startPromise;
1003
+
1004
+ expect(resolved).toBe(true);
1005
+ });
1006
+
1007
+ it("rejects startup when sync reports an unexpected error before ready", async () => {
1008
+ matrixJsClient.startClient = vi.fn(async () => {
1009
+ const timer = setTimeout(() => {
1010
+ matrixJsClient.emit("sync.unexpectedError", new Error("sync exploded"));
1011
+ }, 0);
1012
+ timer.unref?.();
1013
+ });
1014
+
1015
+ const client = new MatrixClient("https://matrix.example.org", "token");
1016
+
1017
+ await expect(client.start()).rejects.toThrow("sync exploded");
1018
+ });
1019
+
1020
+ it("allows transient startup ERROR to recover into PREPARED", async () => {
1021
+ matrixJsClient.startClient = vi.fn(async () => {
1022
+ queueMicrotask(() => {
1023
+ matrixJsClient.emit("sync", "ERROR", null, new Error("temporary outage"));
1024
+ queueMicrotask(() => {
1025
+ matrixJsClient.emit("sync", "PREPARED", "ERROR", undefined);
1026
+ });
1027
+ });
1028
+ });
1029
+
1030
+ const client = new MatrixClient("https://matrix.example.org", "token");
1031
+
1032
+ await expect(client.start()).resolves.toBeUndefined();
1033
+ });
1034
+
1035
+ it("aborts startup when the readiness wait is canceled", async () => {
1036
+ matrixJsClient.startClient = vi.fn(async () => {});
1037
+
1038
+ const abortController = new AbortController();
1039
+ const client = new MatrixClient("https://matrix.example.org", "token");
1040
+ const startPromise = client.start({ abortSignal: abortController.signal });
1041
+
1042
+ abortController.abort();
1043
+
1044
+ await expect(startPromise).rejects.toMatchObject({
1045
+ message: "Matrix startup aborted",
1046
+ name: "AbortError",
1047
+ });
1048
+ });
1049
+
1050
+ it("aborts before post-ready startup work when shutdown races ready sync", async () => {
1051
+ matrixJsClient.startClient = vi.fn(async () => {
1052
+ queueMicrotask(() => {
1053
+ matrixJsClient.emit("sync", "PREPARED", null, undefined);
1054
+ });
1055
+ });
1056
+
1057
+ const abortController = new AbortController();
1058
+ const client = new MatrixClient("https://matrix.example.org", "token");
1059
+ const bootstrapCryptoSpy = vi.spyOn(
1060
+ client as unknown as { bootstrapCryptoIfNeeded: () => Promise<void> },
1061
+ "bootstrapCryptoIfNeeded",
1062
+ );
1063
+ bootstrapCryptoSpy.mockImplementation(async () => {});
1064
+
1065
+ client.on("sync.state", (state) => {
1066
+ if (state === "PREPARED") {
1067
+ abortController.abort();
1068
+ }
1069
+ });
1070
+
1071
+ await expect(client.start({ abortSignal: abortController.signal })).rejects.toMatchObject({
1072
+ message: "Matrix startup aborted",
1073
+ name: "AbortError",
1074
+ });
1075
+ expect(bootstrapCryptoSpy).not.toHaveBeenCalled();
1076
+ });
1077
+
1078
+ it("times out startup when no ready sync state arrives", async () => {
1079
+ vi.useFakeTimers();
1080
+ matrixJsClient.startClient = vi.fn(async () => {});
1081
+
1082
+ const client = new MatrixClient("https://matrix.example.org", "token");
1083
+ const startPromise = client.start();
1084
+ const startExpectation = expect(startPromise).rejects.toThrow(
1085
+ "Matrix client did not reach a ready sync state within 30000ms",
1086
+ );
1087
+
1088
+ await vi.advanceTimersByTimeAsync(30_000);
1089
+
1090
+ await startExpectation;
1091
+ });
1092
+
1093
+ it("clears stale sync state before a restarted sync session waits for fresh readiness", async () => {
1094
+ matrixJsClient.startClient = vi
1095
+ .fn(async () => {
1096
+ queueMicrotask(() => {
1097
+ matrixJsClient.emit("sync", "PREPARED", null, undefined);
1098
+ });
1099
+ })
1100
+ .mockImplementationOnce(async () => {
1101
+ queueMicrotask(() => {
1102
+ matrixJsClient.emit("sync", "PREPARED", null, undefined);
1103
+ });
1104
+ })
1105
+ .mockImplementationOnce(async () => {});
1106
+
1107
+ const client = new MatrixClient("https://matrix.example.org", "token");
1108
+
1109
+ await client.start();
1110
+ client.stopSyncWithoutPersist();
1111
+
1112
+ vi.useFakeTimers();
1113
+ const restartPromise = client.start();
1114
+ const restartExpectation = expect(restartPromise).rejects.toThrow(
1115
+ "Matrix client did not reach a ready sync state within 30000ms",
1116
+ );
1117
+
1118
+ await vi.advanceTimersByTimeAsync(30_000);
1119
+
1120
+ await restartExpectation;
1121
+ });
1122
+
1123
+ it("replays outstanding invite rooms at startup", async () => {
1124
+ matrixJsClient.getRooms = vi.fn(() => [
1125
+ {
1126
+ roomId: "!pending:example.org",
1127
+ getMyMembership: () => "invite",
1128
+ },
1129
+ {
1130
+ roomId: "!joined:example.org",
1131
+ getMyMembership: () => "join",
1132
+ },
1133
+ ]);
1134
+
1135
+ const client = new MatrixClient("https://matrix.example.org", "token");
1136
+ const invites: string[] = [];
1137
+ client.on("room.invite", (roomId) => {
1138
+ invites.push(roomId);
1139
+ });
1140
+
1141
+ await client.start();
1142
+
1143
+ expect(invites).toEqual(["!pending:example.org"]);
1144
+ });
1145
+ });
1146
+
1147
+ describe("MatrixClient crypto bootstrapping", () => {
1148
+ beforeEach(() => {
1149
+ matrixJsClient = createMatrixJsClientStub();
1150
+ lastCreateClientOpts = null;
1151
+ });
1152
+
1153
+ afterEach(() => {
1154
+ vi.useRealTimers();
1155
+ vi.restoreAllMocks();
1156
+ });
1157
+
1158
+ it("passes cryptoDatabasePrefix into initRustCrypto", async () => {
1159
+ matrixJsClient.getCrypto = vi.fn(() => undefined);
1160
+
1161
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1162
+ encryption: true,
1163
+ cryptoDatabasePrefix: "openclaw-matrix-test",
1164
+ });
1165
+
1166
+ await client.start();
1167
+
1168
+ expect(matrixJsClient.initRustCrypto).toHaveBeenCalledWith({
1169
+ cryptoDatabasePrefix: "openclaw-matrix-test",
1170
+ });
1171
+ });
1172
+
1173
+ it("bootstraps cross-signing with setupNewCrossSigning enabled", async () => {
1174
+ const bootstrapCrossSigning = vi.fn(async () => {});
1175
+ matrixJsClient.getCrypto = vi.fn(() => ({
1176
+ on: vi.fn(),
1177
+ bootstrapCrossSigning,
1178
+ bootstrapSecretStorage: vi.fn(async () => {}),
1179
+ requestOwnUserVerification: vi.fn(async () => null),
1180
+ }));
1181
+
1182
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1183
+ encryption: true,
1184
+ });
1185
+
1186
+ await client.start();
1187
+
1188
+ expect(bootstrapCrossSigning).toHaveBeenCalledWith(
1189
+ expect.objectContaining({
1190
+ authUploadDeviceSigningKeys: expect.any(Function),
1191
+ }),
1192
+ );
1193
+ });
1194
+
1195
+ it("retries bootstrap with forced reset when initial publish/verification is incomplete", async () => {
1196
+ matrixJsClient.getCrypto = vi.fn(() => ({ on: vi.fn() }));
1197
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1198
+ encryption: true,
1199
+ password: "secret-password", // pragma: allowlist secret
1200
+ });
1201
+ const bootstrapSpy = vi
1202
+ .fn()
1203
+ .mockResolvedValueOnce({
1204
+ crossSigningReady: false,
1205
+ crossSigningPublished: false,
1206
+ ownDeviceVerified: false,
1207
+ })
1208
+ .mockResolvedValueOnce({
1209
+ crossSigningReady: true,
1210
+ crossSigningPublished: true,
1211
+ ownDeviceVerified: true,
1212
+ });
1213
+ await (
1214
+ client as unknown as {
1215
+ ensureCryptoSupportInitialized: () => Promise<void>;
1216
+ }
1217
+ ).ensureCryptoSupportInitialized();
1218
+ (
1219
+ client as unknown as {
1220
+ cryptoBootstrapper: { bootstrap: typeof bootstrapSpy };
1221
+ }
1222
+ ).cryptoBootstrapper.bootstrap = bootstrapSpy;
1223
+
1224
+ await client.start();
1225
+
1226
+ expect(bootstrapSpy).toHaveBeenCalledTimes(2);
1227
+ expect((bootstrapSpy.mock.calls as unknown[][])[1]?.[1] ?? {}).toEqual({
1228
+ forceResetCrossSigning: true,
1229
+ allowSecretStorageRecreateWithoutRecoveryKey: true,
1230
+ strict: true,
1231
+ });
1232
+ });
1233
+
1234
+ it("does not force-reset bootstrap when the device is already signed by its owner", async () => {
1235
+ matrixJsClient.getCrypto = vi.fn(() => ({ on: vi.fn() }));
1236
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1237
+ encryption: true,
1238
+ password: "secret-password", // pragma: allowlist secret
1239
+ });
1240
+ const bootstrapSpy = vi.fn().mockResolvedValue({
1241
+ crossSigningReady: false,
1242
+ crossSigningPublished: false,
1243
+ ownDeviceVerified: true,
1244
+ });
1245
+ await (
1246
+ client as unknown as {
1247
+ ensureCryptoSupportInitialized: () => Promise<void>;
1248
+ }
1249
+ ).ensureCryptoSupportInitialized();
1250
+ (
1251
+ client as unknown as {
1252
+ cryptoBootstrapper: { bootstrap: typeof bootstrapSpy };
1253
+ }
1254
+ ).cryptoBootstrapper.bootstrap = bootstrapSpy;
1255
+ vi.spyOn(client, "getOwnDeviceVerificationStatus").mockResolvedValue({
1256
+ encryptionEnabled: true,
1257
+ userId: "@bot:example.org",
1258
+ deviceId: "DEVICE123",
1259
+ verified: true,
1260
+ localVerified: true,
1261
+ crossSigningVerified: false,
1262
+ signedByOwner: true,
1263
+ recoveryKeyStored: false,
1264
+ recoveryKeyCreatedAt: null,
1265
+ recoveryKeyId: null,
1266
+ backupVersion: null,
1267
+ backup: {
1268
+ serverVersion: null,
1269
+ activeVersion: null,
1270
+ trusted: null,
1271
+ matchesDecryptionKey: null,
1272
+ decryptionKeyCached: false,
1273
+ keyLoadAttempted: false,
1274
+ keyLoadError: null,
1275
+ },
1276
+ });
1277
+
1278
+ await client.start();
1279
+
1280
+ expect(bootstrapSpy).toHaveBeenCalledTimes(1);
1281
+ expect((bootstrapSpy.mock.calls as unknown[][])[0]?.[1] ?? {}).toEqual({
1282
+ allowAutomaticCrossSigningReset: false,
1283
+ });
1284
+ });
1285
+
1286
+ it("does not force-reset bootstrap when password is unavailable", async () => {
1287
+ matrixJsClient.getCrypto = vi.fn(() => ({ on: vi.fn() }));
1288
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1289
+ encryption: true,
1290
+ });
1291
+ const bootstrapSpy = vi.fn().mockResolvedValue({
1292
+ crossSigningReady: false,
1293
+ crossSigningPublished: false,
1294
+ ownDeviceVerified: false,
1295
+ });
1296
+ await (
1297
+ client as unknown as {
1298
+ ensureCryptoSupportInitialized: () => Promise<void>;
1299
+ }
1300
+ ).ensureCryptoSupportInitialized();
1301
+ (
1302
+ client as unknown as {
1303
+ cryptoBootstrapper: { bootstrap: typeof bootstrapSpy };
1304
+ }
1305
+ ).cryptoBootstrapper.bootstrap = bootstrapSpy;
1306
+
1307
+ await client.start();
1308
+
1309
+ expect(bootstrapSpy).toHaveBeenCalledTimes(1);
1310
+ });
1311
+
1312
+ it("provides secret storage callbacks and resolves stored recovery key", async () => {
1313
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "matrix-sdk-test-"));
1314
+ const recoveryKeyPath = path.join(tmpDir, "recovery-key.json");
1315
+ const privateKeyBase64 = Buffer.from([1, 2, 3, 4]).toString("base64");
1316
+ fs.writeFileSync(
1317
+ recoveryKeyPath,
1318
+ JSON.stringify({
1319
+ version: 1,
1320
+ createdAt: new Date().toISOString(),
1321
+ keyId: "SSSSKEY",
1322
+ privateKeyBase64,
1323
+ }),
1324
+ "utf8",
1325
+ );
1326
+
1327
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1328
+ encryption: true,
1329
+ recoveryKeyPath,
1330
+ });
1331
+ expect(client).toBeInstanceOf(MatrixClient);
1332
+
1333
+ const callbacks = (lastCreateClientOpts?.cryptoCallbacks ?? null) as {
1334
+ getSecretStorageKey?: (
1335
+ params: { keys: Record<string, unknown> },
1336
+ name: string,
1337
+ ) => Promise<[string, Uint8Array] | null>;
1338
+ } | null;
1339
+ expect(callbacks?.getSecretStorageKey).toBeTypeOf("function");
1340
+
1341
+ const resolved = await callbacks?.getSecretStorageKey?.(
1342
+ { keys: { SSSSKEY: { algorithm: "m.secret_storage.v1.aes-hmac-sha2" } } },
1343
+ "m.cross_signing.master",
1344
+ );
1345
+ expect(resolved?.[0]).toBe("SSSSKEY");
1346
+ expect(Array.from(resolved?.[1] ?? [])).toEqual([1, 2, 3, 4]);
1347
+ });
1348
+
1349
+ it("provides a matrix-js-sdk logger to createClient", () => {
1350
+ const client = new MatrixClient("https://matrix.example.org", "token");
1351
+ expect(client).toBeInstanceOf(MatrixClient);
1352
+ const logger = (lastCreateClientOpts?.logger ?? null) as {
1353
+ debug?: (...args: unknown[]) => void;
1354
+ getChild?: (namespace: string) => unknown;
1355
+ } | null;
1356
+ expect(logger).not.toBeNull();
1357
+ expect(logger?.debug).toBeTypeOf("function");
1358
+ expect(logger?.getChild).toBeTypeOf("function");
1359
+ });
1360
+
1361
+ it("schedules periodic crypto snapshot persistence with fake timers", async () => {
1362
+ vi.useFakeTimers();
1363
+ const databasesSpy = vi.spyOn(indexedDB, "databases").mockResolvedValue([]);
1364
+
1365
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1366
+ encryption: true,
1367
+ idbSnapshotPath: path.join(os.tmpdir(), "matrix-idb-interval.json"),
1368
+ cryptoDatabasePrefix: "openclaw-matrix-interval",
1369
+ });
1370
+
1371
+ await client.start();
1372
+ const callsAfterStart = databasesSpy.mock.calls.length;
1373
+
1374
+ await vi.advanceTimersByTimeAsync(60_000);
1375
+ await vi.waitFor(() => {
1376
+ expect(databasesSpy.mock.calls.length).toBeGreaterThan(callsAfterStart);
1377
+ });
1378
+
1379
+ client.stop();
1380
+ const callsAfterStop = databasesSpy.mock.calls.length;
1381
+ await vi.advanceTimersByTimeAsync(120_000);
1382
+ expect(databasesSpy.mock.calls.length).toBe(callsAfterStop);
1383
+ });
1384
+
1385
+ it("reports own verification status when crypto marks device as verified", async () => {
1386
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
1387
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
1388
+ matrixJsClient.getCrypto = vi.fn(() => ({
1389
+ on: vi.fn(),
1390
+ bootstrapCrossSigning: vi.fn(async () => {}),
1391
+ bootstrapSecretStorage: vi.fn(async () => {}),
1392
+ requestOwnUserVerification: vi.fn(async () => null),
1393
+ getDeviceVerificationStatus: vi.fn(async () => ({
1394
+ isVerified: () => true,
1395
+ localVerified: true,
1396
+ crossSigningVerified: true,
1397
+ signedByOwner: true,
1398
+ })),
1399
+ }));
1400
+
1401
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1402
+ encryption: true,
1403
+ });
1404
+ await client.start();
1405
+
1406
+ const status = await client.getOwnDeviceVerificationStatus();
1407
+ expect(status.encryptionEnabled).toBe(true);
1408
+ expect(status.verified).toBe(true);
1409
+ expect(status.userId).toBe("@bot:example.org");
1410
+ expect(status.deviceId).toBe("DEVICE123");
1411
+ });
1412
+
1413
+ it("does not treat local-only trust as owner verification", async () => {
1414
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
1415
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
1416
+ matrixJsClient.getCrypto = vi.fn(() => ({
1417
+ on: vi.fn(),
1418
+ bootstrapCrossSigning: vi.fn(async () => {}),
1419
+ bootstrapSecretStorage: vi.fn(async () => {}),
1420
+ requestOwnUserVerification: vi.fn(async () => null),
1421
+ getDeviceVerificationStatus: vi.fn(async () => ({
1422
+ isVerified: () => true,
1423
+ localVerified: true,
1424
+ crossSigningVerified: false,
1425
+ signedByOwner: false,
1426
+ })),
1427
+ }));
1428
+
1429
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1430
+ encryption: true,
1431
+ });
1432
+ await client.start();
1433
+
1434
+ const status = await client.getOwnDeviceVerificationStatus();
1435
+ expect(status.localVerified).toBe(true);
1436
+ expect(status.crossSigningVerified).toBe(false);
1437
+ expect(status.signedByOwner).toBe(false);
1438
+ expect(status.verified).toBe(false);
1439
+ });
1440
+
1441
+ it("verifies with a provided recovery key and reports success", async () => {
1442
+ const encoded = encodeRecoveryKey(new Uint8Array(Array.from({ length: 32 }, (_, i) => i + 1)));
1443
+ expect(encoded).toBeTypeOf("string");
1444
+
1445
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
1446
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
1447
+ const bootstrapSecretStorage = vi.fn(async () => {});
1448
+ const bootstrapCrossSigning = vi.fn(async () => {});
1449
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
1450
+ const getSecretStorageStatus = vi.fn(async () => ({
1451
+ ready: true,
1452
+ defaultKeyId: "SSSSKEY",
1453
+ secretStorageKeyValidityMap: { SSSSKEY: true },
1454
+ }));
1455
+ const getDeviceVerificationStatus = vi.fn(async () => ({
1456
+ isVerified: () => true,
1457
+ localVerified: true,
1458
+ crossSigningVerified: true,
1459
+ signedByOwner: true,
1460
+ }));
1461
+ matrixJsClient.getCrypto = vi.fn(() => ({
1462
+ on: vi.fn(),
1463
+ bootstrapCrossSigning,
1464
+ bootstrapSecretStorage,
1465
+ requestOwnUserVerification: vi.fn(async () => null),
1466
+ getSecretStorageStatus,
1467
+ getDeviceVerificationStatus,
1468
+ checkKeyBackupAndEnable,
1469
+ }));
1470
+
1471
+ const recoveryDir = fs.mkdtempSync(path.join(os.tmpdir(), "matrix-sdk-verify-key-"));
1472
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1473
+ encryption: true,
1474
+ recoveryKeyPath: path.join(recoveryDir, "recovery-key.json"),
1475
+ });
1476
+
1477
+ const result = await client.verifyWithRecoveryKey(encoded as string);
1478
+ expect(result.success).toBe(true);
1479
+ expect(result.verified).toBe(true);
1480
+ expect(result.recoveryKeyStored).toBe(true);
1481
+ expect(result.deviceId).toBe("DEVICE123");
1482
+ expect(matrixJsClient.startClient).toHaveBeenCalledTimes(1);
1483
+ expect(bootstrapSecretStorage).toHaveBeenCalled();
1484
+ expect(bootstrapCrossSigning).toHaveBeenCalled();
1485
+ expect(checkKeyBackupAndEnable).toHaveBeenCalledTimes(1);
1486
+ });
1487
+
1488
+ it("fails recovery-key verification when the device is only locally trusted", async () => {
1489
+ const encoded = encodeRecoveryKey(new Uint8Array(Array.from({ length: 32 }, (_, i) => i + 1)));
1490
+
1491
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
1492
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
1493
+ matrixJsClient.getCrypto = vi.fn(() => ({
1494
+ on: vi.fn(),
1495
+ bootstrapCrossSigning: vi.fn(async () => {}),
1496
+ bootstrapSecretStorage: vi.fn(async () => {}),
1497
+ requestOwnUserVerification: vi.fn(async () => null),
1498
+ getSecretStorageStatus: vi.fn(async () => ({
1499
+ ready: true,
1500
+ defaultKeyId: "SSSSKEY",
1501
+ secretStorageKeyValidityMap: { SSSSKEY: true },
1502
+ })),
1503
+ getDeviceVerificationStatus: vi.fn(async () => ({
1504
+ isVerified: () => true,
1505
+ localVerified: true,
1506
+ crossSigningVerified: false,
1507
+ signedByOwner: false,
1508
+ })),
1509
+ }));
1510
+
1511
+ const recoveryDir = fs.mkdtempSync(path.join(os.tmpdir(), "matrix-sdk-verify-local-only-"));
1512
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1513
+ encryption: true,
1514
+ recoveryKeyPath: path.join(recoveryDir, "recovery-key.json"),
1515
+ });
1516
+ await client.start();
1517
+
1518
+ const result = await client.verifyWithRecoveryKey(encoded as string);
1519
+ expect(result.success).toBe(false);
1520
+ expect(result.verified).toBe(false);
1521
+ expect(result.error).toContain("not verified by its owner");
1522
+ });
1523
+
1524
+ it("fails recovery-key verification when backup remains untrusted after device verification", async () => {
1525
+ const encoded = encodeRecoveryKey(new Uint8Array(Array.from({ length: 32 }, (_, i) => i + 1)));
1526
+
1527
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
1528
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
1529
+ matrixJsClient.getCrypto = vi.fn(() => ({
1530
+ on: vi.fn(),
1531
+ bootstrapCrossSigning: vi.fn(async () => {}),
1532
+ bootstrapSecretStorage: vi.fn(async () => {}),
1533
+ requestOwnUserVerification: vi.fn(async () => null),
1534
+ getSecretStorageStatus: vi.fn(async () => ({
1535
+ ready: true,
1536
+ defaultKeyId: "SSSSKEY",
1537
+ secretStorageKeyValidityMap: { SSSSKEY: true },
1538
+ })),
1539
+ getDeviceVerificationStatus: vi.fn(async () => ({
1540
+ isVerified: () => true,
1541
+ localVerified: true,
1542
+ crossSigningVerified: true,
1543
+ signedByOwner: true,
1544
+ })),
1545
+ checkKeyBackupAndEnable: vi.fn(async () => {}),
1546
+ getActiveSessionBackupVersion: vi.fn(async () => "11"),
1547
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
1548
+ getKeyBackupInfo: vi.fn(async () => ({
1549
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1550
+ auth_data: {},
1551
+ version: "11",
1552
+ })),
1553
+ isKeyBackupTrusted: vi.fn(async () => ({
1554
+ trusted: false,
1555
+ matchesDecryptionKey: true,
1556
+ })),
1557
+ }));
1558
+
1559
+ const recoveryDir = fs.mkdtempSync(path.join(os.tmpdir(), "matrix-sdk-verify-untrusted-"));
1560
+ const recoveryKeyPath = path.join(recoveryDir, "recovery-key.json");
1561
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1562
+ encryption: true,
1563
+ recoveryKeyPath,
1564
+ });
1565
+
1566
+ const result = await client.verifyWithRecoveryKey(encoded as string);
1567
+ expect(result.success).toBe(false);
1568
+ expect(result.verified).toBe(true);
1569
+ expect(result.error).toContain("backup signature chain is not trusted");
1570
+ expect(result.recoveryKeyStored).toBe(false);
1571
+ expect(fs.existsSync(recoveryKeyPath)).toBe(false);
1572
+ });
1573
+
1574
+ it("does not overwrite the stored recovery key when recovery-key verification fails", async () => {
1575
+ const previousEncoded = encodeRecoveryKey(
1576
+ new Uint8Array(Array.from({ length: 32 }, (_, i) => i + 5)),
1577
+ );
1578
+ const attemptedEncoded = encodeRecoveryKey(
1579
+ new Uint8Array(Array.from({ length: 32 }, (_, i) => i + 55)),
1580
+ );
1581
+
1582
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
1583
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
1584
+ matrixJsClient.getCrypto = vi.fn(() => ({
1585
+ on: vi.fn(),
1586
+ bootstrapCrossSigning: vi.fn(async () => {
1587
+ throw new Error("secret storage rejected recovery key");
1588
+ }),
1589
+ bootstrapSecretStorage: vi.fn(async () => {}),
1590
+ requestOwnUserVerification: vi.fn(async () => null),
1591
+ getSecretStorageStatus: vi.fn(async () => ({
1592
+ ready: true,
1593
+ defaultKeyId: "SSSSKEY",
1594
+ secretStorageKeyValidityMap: { SSSSKEY: true },
1595
+ })),
1596
+ getDeviceVerificationStatus: vi.fn(async () => ({
1597
+ isVerified: () => false,
1598
+ localVerified: false,
1599
+ crossSigningVerified: false,
1600
+ signedByOwner: false,
1601
+ })),
1602
+ }));
1603
+
1604
+ const recoveryDir = fs.mkdtempSync(path.join(os.tmpdir(), "matrix-sdk-verify-preserve-"));
1605
+ const recoveryKeyPath = path.join(recoveryDir, "recovery-key.json");
1606
+ fs.writeFileSync(
1607
+ recoveryKeyPath,
1608
+ JSON.stringify({
1609
+ version: 1,
1610
+ createdAt: new Date().toISOString(),
1611
+ keyId: "SSSSKEY",
1612
+ encodedPrivateKey: previousEncoded,
1613
+ privateKeyBase64: Buffer.from(
1614
+ new Uint8Array(Array.from({ length: 32 }, (_, i) => i + 5)),
1615
+ ).toString("base64"),
1616
+ }),
1617
+ "utf8",
1618
+ );
1619
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1620
+ encryption: true,
1621
+ recoveryKeyPath,
1622
+ });
1623
+
1624
+ const result = await client.verifyWithRecoveryKey(attemptedEncoded as string);
1625
+
1626
+ expect(result.success).toBe(false);
1627
+ expect(result.error).toContain("not verified by its owner");
1628
+ const persisted = JSON.parse(fs.readFileSync(recoveryKeyPath, "utf8")) as {
1629
+ encodedPrivateKey?: string;
1630
+ };
1631
+ expect(persisted.encodedPrivateKey).toBe(previousEncoded);
1632
+ });
1633
+
1634
+ it("reports detailed room-key backup health", async () => {
1635
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
1636
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
1637
+ matrixJsClient.getCrypto = vi.fn(() => ({
1638
+ on: vi.fn(),
1639
+ getActiveSessionBackupVersion: vi.fn(async () => "11"),
1640
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1, 2, 3])),
1641
+ getKeyBackupInfo: vi.fn(async () => ({
1642
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1643
+ auth_data: {},
1644
+ version: "11",
1645
+ })),
1646
+ isKeyBackupTrusted: vi.fn(async () => ({
1647
+ trusted: true,
1648
+ matchesDecryptionKey: true,
1649
+ })),
1650
+ getDeviceVerificationStatus: vi.fn(async () => ({
1651
+ isVerified: () => true,
1652
+ localVerified: true,
1653
+ crossSigningVerified: true,
1654
+ signedByOwner: true,
1655
+ })),
1656
+ }));
1657
+
1658
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1659
+ encryption: true,
1660
+ });
1661
+ vi.spyOn(client, "doRequest").mockResolvedValue({ version: "11" });
1662
+
1663
+ const status = await client.getOwnDeviceVerificationStatus();
1664
+ expect(status.backupVersion).toBe("11");
1665
+ expect(status.backup).toEqual({
1666
+ serverVersion: "11",
1667
+ activeVersion: "11",
1668
+ trusted: true,
1669
+ matchesDecryptionKey: true,
1670
+ decryptionKeyCached: true,
1671
+ keyLoadAttempted: false,
1672
+ keyLoadError: null,
1673
+ });
1674
+ });
1675
+
1676
+ it("tries loading backup keys from secret storage when key is missing from cache", async () => {
1677
+ const getActiveSessionBackupVersion = vi
1678
+ .fn()
1679
+ .mockResolvedValueOnce(null)
1680
+ .mockResolvedValueOnce("9");
1681
+ const getSessionBackupPrivateKey = vi
1682
+ .fn()
1683
+ .mockResolvedValueOnce(null)
1684
+ .mockResolvedValueOnce(new Uint8Array([1]));
1685
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi.fn(async () => {});
1686
+ matrixJsClient.getCrypto = vi.fn(() => ({
1687
+ on: vi.fn(),
1688
+ getActiveSessionBackupVersion,
1689
+ getSessionBackupPrivateKey,
1690
+ loadSessionBackupPrivateKeyFromSecretStorage,
1691
+ getKeyBackupInfo: vi.fn(async () => ({
1692
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1693
+ auth_data: {},
1694
+ version: "9",
1695
+ })),
1696
+ isKeyBackupTrusted: vi.fn(async () => ({
1697
+ trusted: true,
1698
+ matchesDecryptionKey: true,
1699
+ })),
1700
+ }));
1701
+
1702
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1703
+ encryption: true,
1704
+ });
1705
+
1706
+ const backup = await client.getRoomKeyBackupStatus();
1707
+ expect(backup).toMatchObject({
1708
+ serverVersion: "9",
1709
+ activeVersion: "9",
1710
+ trusted: true,
1711
+ matchesDecryptionKey: true,
1712
+ decryptionKeyCached: true,
1713
+ keyLoadAttempted: true,
1714
+ keyLoadError: null,
1715
+ });
1716
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
1717
+ });
1718
+
1719
+ it("reloads backup keys from secret storage when the cached key mismatches the active backup", async () => {
1720
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi.fn(async () => {});
1721
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
1722
+ const isKeyBackupTrusted = vi
1723
+ .fn()
1724
+ .mockResolvedValueOnce({
1725
+ trusted: true,
1726
+ matchesDecryptionKey: false,
1727
+ })
1728
+ .mockResolvedValueOnce({
1729
+ trusted: true,
1730
+ matchesDecryptionKey: true,
1731
+ });
1732
+ matrixJsClient.getCrypto = vi.fn(() => ({
1733
+ on: vi.fn(),
1734
+ getActiveSessionBackupVersion: vi.fn(async () => "49262"),
1735
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
1736
+ loadSessionBackupPrivateKeyFromSecretStorage,
1737
+ checkKeyBackupAndEnable,
1738
+ getKeyBackupInfo: vi.fn(async () => ({
1739
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1740
+ auth_data: {},
1741
+ version: "49262",
1742
+ })),
1743
+ isKeyBackupTrusted,
1744
+ }));
1745
+
1746
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1747
+ encryption: true,
1748
+ });
1749
+
1750
+ const backup = await client.getRoomKeyBackupStatus();
1751
+ expect(backup).toMatchObject({
1752
+ serverVersion: "49262",
1753
+ activeVersion: "49262",
1754
+ trusted: true,
1755
+ matchesDecryptionKey: true,
1756
+ decryptionKeyCached: true,
1757
+ keyLoadAttempted: true,
1758
+ keyLoadError: null,
1759
+ });
1760
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
1761
+ expect(checkKeyBackupAndEnable).toHaveBeenCalledTimes(1);
1762
+ });
1763
+
1764
+ it("reports why backup key loading failed during status checks", async () => {
1765
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi.fn(async () => {
1766
+ throw new Error("secret storage key is not available");
1767
+ });
1768
+ matrixJsClient.getCrypto = vi.fn(() => ({
1769
+ on: vi.fn(),
1770
+ getActiveSessionBackupVersion: vi.fn(async () => null),
1771
+ getSessionBackupPrivateKey: vi.fn(async () => null),
1772
+ loadSessionBackupPrivateKeyFromSecretStorage,
1773
+ getKeyBackupInfo: vi.fn(async () => ({
1774
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1775
+ auth_data: {},
1776
+ version: "9",
1777
+ })),
1778
+ isKeyBackupTrusted: vi.fn(async () => ({
1779
+ trusted: true,
1780
+ matchesDecryptionKey: false,
1781
+ })),
1782
+ }));
1783
+
1784
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1785
+ encryption: true,
1786
+ });
1787
+
1788
+ const backup = await client.getRoomKeyBackupStatus();
1789
+ expect(backup.keyLoadAttempted).toBe(true);
1790
+ expect(backup.keyLoadError).toContain("secret storage key is not available");
1791
+ expect(backup.decryptionKeyCached).toBe(false);
1792
+ });
1793
+
1794
+ it("restores room keys from backup after loading key from secret storage", async () => {
1795
+ const getActiveSessionBackupVersion = vi
1796
+ .fn()
1797
+ .mockResolvedValueOnce(null)
1798
+ .mockResolvedValueOnce("9")
1799
+ .mockResolvedValue("9");
1800
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi.fn(async () => {});
1801
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
1802
+ const restoreKeyBackup = vi.fn(async () => ({ imported: 4, total: 10 }));
1803
+ const crypto = {
1804
+ on: vi.fn(),
1805
+ getActiveSessionBackupVersion,
1806
+ loadSessionBackupPrivateKeyFromSecretStorage,
1807
+ checkKeyBackupAndEnable,
1808
+ restoreKeyBackup,
1809
+ getSessionBackupPrivateKey: vi
1810
+ .fn()
1811
+ .mockResolvedValueOnce(null)
1812
+ .mockResolvedValue(new Uint8Array([1])),
1813
+ getKeyBackupInfo: vi.fn(async () => ({
1814
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1815
+ auth_data: {},
1816
+ version: "9",
1817
+ })),
1818
+ isKeyBackupTrusted: vi.fn(async () => ({
1819
+ trusted: true,
1820
+ matchesDecryptionKey: true,
1821
+ })),
1822
+ };
1823
+ matrixJsClient.getCrypto = vi.fn(() => crypto);
1824
+
1825
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1826
+ encryption: true,
1827
+ });
1828
+ vi.spyOn(client, "doRequest").mockResolvedValue({ version: "9" });
1829
+
1830
+ const result = await client.restoreRoomKeyBackup();
1831
+ expect(result.success).toBe(true);
1832
+ expect(result.backupVersion).toBe("9");
1833
+ expect(result.imported).toBe(4);
1834
+ expect(result.total).toBe(10);
1835
+ expect(result.loadedFromSecretStorage).toBe(true);
1836
+ expect(matrixJsClient.startClient).toHaveBeenCalledTimes(1);
1837
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
1838
+ expect(checkKeyBackupAndEnable).toHaveBeenCalledTimes(1);
1839
+ expect(restoreKeyBackup).toHaveBeenCalledTimes(1);
1840
+ });
1841
+
1842
+ it("activates backup after loading the key from secret storage before restore", async () => {
1843
+ const getActiveSessionBackupVersion = vi
1844
+ .fn()
1845
+ .mockResolvedValueOnce(null)
1846
+ .mockResolvedValueOnce("5256")
1847
+ .mockResolvedValue("5256");
1848
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi.fn(async () => {});
1849
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
1850
+ const restoreKeyBackup = vi.fn(async () => ({ imported: 0, total: 0 }));
1851
+ const crypto = {
1852
+ on: vi.fn(),
1853
+ getActiveSessionBackupVersion,
1854
+ getSessionBackupPrivateKey: vi
1855
+ .fn()
1856
+ .mockResolvedValueOnce(null)
1857
+ .mockResolvedValue(new Uint8Array([1])),
1858
+ loadSessionBackupPrivateKeyFromSecretStorage,
1859
+ checkKeyBackupAndEnable,
1860
+ restoreKeyBackup,
1861
+ getKeyBackupInfo: vi.fn(async () => ({
1862
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1863
+ auth_data: {},
1864
+ version: "5256",
1865
+ })),
1866
+ isKeyBackupTrusted: vi.fn(async () => ({
1867
+ trusted: true,
1868
+ matchesDecryptionKey: true,
1869
+ })),
1870
+ };
1871
+ matrixJsClient.getCrypto = vi.fn(() => crypto);
1872
+
1873
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1874
+ encryption: true,
1875
+ });
1876
+ vi.spyOn(client, "doRequest").mockResolvedValue({ version: "5256" });
1877
+
1878
+ const result = await client.restoreRoomKeyBackup();
1879
+ expect(result.success).toBe(true);
1880
+ expect(result.backupVersion).toBe("5256");
1881
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
1882
+ expect(checkKeyBackupAndEnable).toHaveBeenCalledTimes(1);
1883
+ expect(restoreKeyBackup).toHaveBeenCalledTimes(1);
1884
+ });
1885
+
1886
+ it("fails restore when backup key cannot be loaded on this device", async () => {
1887
+ matrixJsClient.getCrypto = vi.fn(() => ({
1888
+ on: vi.fn(),
1889
+ getActiveSessionBackupVersion: vi.fn(async () => null),
1890
+ getSessionBackupPrivateKey: vi.fn(async () => null),
1891
+ getKeyBackupInfo: vi.fn(async () => ({
1892
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1893
+ auth_data: {},
1894
+ version: "3",
1895
+ })),
1896
+ isKeyBackupTrusted: vi.fn(async () => ({
1897
+ trusted: true,
1898
+ matchesDecryptionKey: false,
1899
+ })),
1900
+ }));
1901
+
1902
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1903
+ encryption: true,
1904
+ });
1905
+ vi.spyOn(client, "doRequest").mockResolvedValue({ version: "3" });
1906
+
1907
+ const result = await client.restoreRoomKeyBackup();
1908
+ expect(result.success).toBe(false);
1909
+ expect(result.error).toContain("backup decryption key could not be loaded from secret storage");
1910
+ expect(result.backupVersion).toBe("3");
1911
+ expect(result.backup.matchesDecryptionKey).toBe(false);
1912
+ });
1913
+
1914
+ it("reloads the matching backup key before restore when the cached key mismatches", async () => {
1915
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi.fn(async () => {});
1916
+ const restoreKeyBackup = vi.fn(async () => ({ imported: 6, total: 9 }));
1917
+ const isKeyBackupTrusted = vi
1918
+ .fn()
1919
+ .mockResolvedValueOnce({
1920
+ trusted: true,
1921
+ matchesDecryptionKey: false,
1922
+ })
1923
+ .mockResolvedValueOnce({
1924
+ trusted: true,
1925
+ matchesDecryptionKey: true,
1926
+ })
1927
+ .mockResolvedValueOnce({
1928
+ trusted: true,
1929
+ matchesDecryptionKey: true,
1930
+ });
1931
+ matrixJsClient.getCrypto = vi.fn(() => ({
1932
+ on: vi.fn(),
1933
+ getActiveSessionBackupVersion: vi.fn(async () => "49262"),
1934
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
1935
+ loadSessionBackupPrivateKeyFromSecretStorage,
1936
+ checkKeyBackupAndEnable: vi.fn(async () => {}),
1937
+ restoreKeyBackup,
1938
+ getKeyBackupInfo: vi.fn(async () => ({
1939
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1940
+ auth_data: {},
1941
+ version: "49262",
1942
+ })),
1943
+ isKeyBackupTrusted,
1944
+ }));
1945
+
1946
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1947
+ encryption: true,
1948
+ });
1949
+
1950
+ const result = await client.restoreRoomKeyBackup();
1951
+
1952
+ expect(result.success).toBe(true);
1953
+ expect(result.backupVersion).toBe("49262");
1954
+ expect(result.imported).toBe(6);
1955
+ expect(result.total).toBe(9);
1956
+ expect(result.loadedFromSecretStorage).toBe(true);
1957
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
1958
+ expect(restoreKeyBackup).toHaveBeenCalledTimes(1);
1959
+ });
1960
+
1961
+ it("resets the current room-key backup and creates a fresh trusted version", async () => {
1962
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
1963
+ const bootstrapSecretStorage = vi.fn(async () => {});
1964
+ matrixJsClient.getCrypto = vi.fn(() => ({
1965
+ on: vi.fn(),
1966
+ bootstrapSecretStorage,
1967
+ checkKeyBackupAndEnable,
1968
+ getActiveSessionBackupVersion: vi.fn(async () => "21869"),
1969
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
1970
+ getKeyBackupInfo: vi.fn(async () => ({
1971
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
1972
+ auth_data: {},
1973
+ version: "21869",
1974
+ })),
1975
+ isKeyBackupTrusted: vi.fn(async () => ({
1976
+ trusted: true,
1977
+ matchesDecryptionKey: true,
1978
+ })),
1979
+ }));
1980
+
1981
+ const client = new MatrixClient("https://matrix.example.org", "token", {
1982
+ encryption: true,
1983
+ });
1984
+ vi.spyOn(client, "doRequest").mockImplementation(async (method, endpoint) => {
1985
+ if (method === "GET" && endpoint.includes("/room_keys/version")) {
1986
+ return { version: "21868" };
1987
+ }
1988
+ if (method === "DELETE" && endpoint.includes("/room_keys/version/21868")) {
1989
+ return {};
1990
+ }
1991
+ return {};
1992
+ });
1993
+
1994
+ const result = await client.resetRoomKeyBackup();
1995
+
1996
+ expect(result.success).toBe(true);
1997
+ expect(result.previousVersion).toBe("21868");
1998
+ expect(result.deletedVersion).toBe("21868");
1999
+ expect(result.createdVersion).toBe("21869");
2000
+ expect(bootstrapSecretStorage).toHaveBeenCalledWith(
2001
+ expect.objectContaining({ setupNewKeyBackup: true }),
2002
+ );
2003
+ expect(checkKeyBackupAndEnable).toHaveBeenCalledTimes(1);
2004
+ });
2005
+
2006
+ it("reloads the new backup decryption key after reset when the old cached key mismatches", async () => {
2007
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
2008
+ const bootstrapSecretStorage = vi.fn(async () => {});
2009
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi.fn(async () => {});
2010
+ const isKeyBackupTrusted = vi
2011
+ .fn()
2012
+ .mockResolvedValueOnce({
2013
+ trusted: true,
2014
+ matchesDecryptionKey: false,
2015
+ })
2016
+ .mockResolvedValueOnce({
2017
+ trusted: true,
2018
+ matchesDecryptionKey: true,
2019
+ });
2020
+ matrixJsClient.getCrypto = vi.fn(() => ({
2021
+ on: vi.fn(),
2022
+ bootstrapSecretStorage,
2023
+ checkKeyBackupAndEnable,
2024
+ loadSessionBackupPrivateKeyFromSecretStorage,
2025
+ getActiveSessionBackupVersion: vi.fn(async () => "49262"),
2026
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
2027
+ getKeyBackupInfo: vi.fn(async () => ({
2028
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2029
+ auth_data: {},
2030
+ version: "49262",
2031
+ })),
2032
+ isKeyBackupTrusted,
2033
+ }));
2034
+
2035
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2036
+ encryption: true,
2037
+ });
2038
+ vi.spyOn(client, "doRequest").mockImplementation(async (method, endpoint) => {
2039
+ if (method === "GET" && endpoint.includes("/room_keys/version")) {
2040
+ return { version: "22245" };
2041
+ }
2042
+ if (method === "DELETE" && endpoint.includes("/room_keys/version/22245")) {
2043
+ return {};
2044
+ }
2045
+ return {};
2046
+ });
2047
+
2048
+ const result = await client.resetRoomKeyBackup();
2049
+
2050
+ expect(result.success).toBe(true);
2051
+ expect(result.createdVersion).toBe("49262");
2052
+ expect(result.backup.matchesDecryptionKey).toBe(true);
2053
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
2054
+ expect(checkKeyBackupAndEnable).toHaveBeenCalledTimes(2);
2055
+ });
2056
+
2057
+ it("fails reset when the recreated backup still does not match the local decryption key", async () => {
2058
+ matrixJsClient.getCrypto = vi.fn(() => ({
2059
+ on: vi.fn(),
2060
+ bootstrapSecretStorage: vi.fn(async () => {}),
2061
+ checkKeyBackupAndEnable: vi.fn(async () => {}),
2062
+ getActiveSessionBackupVersion: vi.fn(async () => "21868"),
2063
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
2064
+ getKeyBackupInfo: vi.fn(async () => ({
2065
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2066
+ auth_data: {},
2067
+ version: "21868",
2068
+ })),
2069
+ isKeyBackupTrusted: vi.fn(async () => ({
2070
+ trusted: true,
2071
+ matchesDecryptionKey: false,
2072
+ })),
2073
+ }));
2074
+
2075
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2076
+ encryption: true,
2077
+ });
2078
+ vi.spyOn(client, "doRequest").mockImplementation(async (method, endpoint) => {
2079
+ if (method === "GET" && endpoint.includes("/room_keys/version")) {
2080
+ return { version: "21868" };
2081
+ }
2082
+ if (method === "DELETE" && endpoint.includes("/room_keys/version/21868")) {
2083
+ return {};
2084
+ }
2085
+ return {};
2086
+ });
2087
+
2088
+ const result = await client.resetRoomKeyBackup();
2089
+
2090
+ expect(result.success).toBe(false);
2091
+ expect(result.error).toContain("does not have the matching backup decryption key");
2092
+ expect(result.createdVersion).toBe("21868");
2093
+ expect(result.backup.matchesDecryptionKey).toBe(false);
2094
+ });
2095
+
2096
+ it("forces SSSS recreation when backup-secret access fails with bad MAC before reset", async () => {
2097
+ // Simulates the state after a cross-signing bootstrap that recreated SSSS but left the
2098
+ // old m.megolm_backup.v1 SSSS entry (encrypted with the old key) on the homeserver.
2099
+ // The reset preflight now probes backup-secret access directly, so a missing cached
2100
+ // key plus a repairable secret-storage load failure should force SSSS recreation.
2101
+ const bootstrapSecretStorage = vi.fn(async () => {});
2102
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
2103
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi
2104
+ .fn()
2105
+ .mockRejectedValueOnce(new Error("Error decrypting secret m.megolm_backup.v1: bad MAC"));
2106
+ const getSessionBackupPrivateKey = vi
2107
+ .fn()
2108
+ .mockResolvedValueOnce(null)
2109
+ .mockResolvedValue(new Uint8Array([1]));
2110
+ const getSecretStorageStatus = vi.fn(async () => ({
2111
+ ready: true,
2112
+ defaultKeyId: "key-new",
2113
+ }));
2114
+ matrixJsClient.getCrypto = vi.fn(() => ({
2115
+ on: vi.fn(),
2116
+ bootstrapSecretStorage,
2117
+ checkKeyBackupAndEnable,
2118
+ loadSessionBackupPrivateKeyFromSecretStorage,
2119
+ getSessionBackupPrivateKey,
2120
+ getSecretStorageStatus,
2121
+ getActiveSessionBackupVersion: vi.fn(async () => "22000"),
2122
+ getKeyBackupInfo: vi.fn(async () => ({
2123
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2124
+ auth_data: {},
2125
+ version: "22000",
2126
+ })),
2127
+ isKeyBackupTrusted: vi.fn(async () => ({
2128
+ trusted: true,
2129
+ matchesDecryptionKey: true,
2130
+ })),
2131
+ }));
2132
+
2133
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2134
+ encryption: true,
2135
+ });
2136
+ vi.spyOn(client, "doRequest").mockImplementation(async (method, endpoint) => {
2137
+ if (method === "GET" && endpoint.includes("/room_keys/version")) {
2138
+ return { version: "21999" };
2139
+ }
2140
+ if (method === "DELETE" && endpoint.includes("/room_keys/version/21999")) {
2141
+ return {};
2142
+ }
2143
+ return {};
2144
+ });
2145
+
2146
+ const result = await client.resetRoomKeyBackup();
2147
+
2148
+ expect(result.success).toBe(true);
2149
+ expect(result.createdVersion).toBe("22000");
2150
+ // bootstrapSecretStorage must have been called with setupNewSecretStorage: true
2151
+ // because the pre-reset bad MAC status triggered forceNewSecretStorage.
2152
+ expect(bootstrapSecretStorage).toHaveBeenCalledWith(
2153
+ expect.objectContaining({
2154
+ setupNewKeyBackup: true,
2155
+ setupNewSecretStorage: true,
2156
+ }),
2157
+ );
2158
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
2159
+ });
2160
+
2161
+ it("forces SSSS recreation when backup-secret access is broken even without a current server backup", async () => {
2162
+ const bootstrapSecretStorage = vi.fn(async () => {});
2163
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
2164
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi
2165
+ .fn()
2166
+ .mockRejectedValueOnce(new Error("Error decrypting secret m.megolm_backup.v1: bad MAC"));
2167
+ const getSessionBackupPrivateKey = vi
2168
+ .fn()
2169
+ .mockResolvedValueOnce(null)
2170
+ .mockResolvedValue(new Uint8Array([1]));
2171
+ const getActiveSessionBackupVersion = vi
2172
+ .fn()
2173
+ .mockResolvedValueOnce(null)
2174
+ .mockResolvedValue("22001");
2175
+ matrixJsClient.getCrypto = vi.fn(() => ({
2176
+ on: vi.fn(),
2177
+ bootstrapSecretStorage,
2178
+ checkKeyBackupAndEnable,
2179
+ loadSessionBackupPrivateKeyFromSecretStorage,
2180
+ getActiveSessionBackupVersion,
2181
+ getSessionBackupPrivateKey,
2182
+ getKeyBackupInfo: vi.fn(async () => ({
2183
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2184
+ auth_data: {},
2185
+ version: "22001",
2186
+ })),
2187
+ isKeyBackupTrusted: vi.fn(async () => ({
2188
+ trusted: true,
2189
+ matchesDecryptionKey: true,
2190
+ })),
2191
+ }));
2192
+
2193
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2194
+ encryption: true,
2195
+ });
2196
+ const doRequest = vi.spyOn(client, "doRequest").mockImplementation(async (method, endpoint) => {
2197
+ if (method === "GET" && endpoint.includes("/room_keys/version")) {
2198
+ return {};
2199
+ }
2200
+ return {};
2201
+ });
2202
+
2203
+ const result = await client.resetRoomKeyBackup();
2204
+
2205
+ expect(result.success).toBe(true);
2206
+ expect(result.previousVersion).toBe(null);
2207
+ expect(result.deletedVersion).toBe(null);
2208
+ expect(result.createdVersion).toBe("22001");
2209
+ expect(bootstrapSecretStorage).toHaveBeenCalledWith(
2210
+ expect.objectContaining({
2211
+ setupNewKeyBackup: true,
2212
+ setupNewSecretStorage: true,
2213
+ }),
2214
+ );
2215
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
2216
+ expect(doRequest).not.toHaveBeenCalledWith(
2217
+ "DELETE",
2218
+ expect.stringContaining("/room_keys/version/"),
2219
+ );
2220
+ });
2221
+
2222
+ it("forces SSSS recreation when backup-secret access returns a falsey callback error before reset", async () => {
2223
+ const bootstrapSecretStorage = vi.fn(async () => {});
2224
+ const checkKeyBackupAndEnable = vi.fn(async () => {});
2225
+ const loadSessionBackupPrivateKeyFromSecretStorage = vi
2226
+ .fn()
2227
+ .mockRejectedValueOnce(new Error("getSecretStorageKey callback returned falsey"));
2228
+ const getSessionBackupPrivateKey = vi
2229
+ .fn()
2230
+ .mockResolvedValueOnce(null)
2231
+ .mockResolvedValue(new Uint8Array([1]));
2232
+ matrixJsClient.getCrypto = vi.fn(() => ({
2233
+ on: vi.fn(),
2234
+ bootstrapSecretStorage,
2235
+ checkKeyBackupAndEnable,
2236
+ loadSessionBackupPrivateKeyFromSecretStorage,
2237
+ getActiveSessionBackupVersion: vi.fn(async () => "22002"),
2238
+ getSessionBackupPrivateKey,
2239
+ getKeyBackupInfo: vi.fn(async () => ({
2240
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2241
+ auth_data: {},
2242
+ version: "22002",
2243
+ })),
2244
+ isKeyBackupTrusted: vi.fn(async () => ({
2245
+ trusted: true,
2246
+ matchesDecryptionKey: true,
2247
+ })),
2248
+ }));
2249
+
2250
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2251
+ encryption: true,
2252
+ });
2253
+ vi.spyOn(client, "doRequest").mockImplementation(async (method, endpoint) => {
2254
+ if (method === "GET" && endpoint.includes("/room_keys/version")) {
2255
+ return { version: "22000" };
2256
+ }
2257
+ if (method === "DELETE" && endpoint.includes("/room_keys/version/22000")) {
2258
+ return {};
2259
+ }
2260
+ return {};
2261
+ });
2262
+
2263
+ const result = await client.resetRoomKeyBackup();
2264
+
2265
+ expect(result.success).toBe(true);
2266
+ expect(result.createdVersion).toBe("22002");
2267
+ expect(bootstrapSecretStorage).toHaveBeenCalledWith(
2268
+ expect.objectContaining({
2269
+ setupNewKeyBackup: true,
2270
+ setupNewSecretStorage: true,
2271
+ }),
2272
+ );
2273
+ expect(loadSessionBackupPrivateKeyFromSecretStorage).toHaveBeenCalledTimes(1);
2274
+ });
2275
+
2276
+ it("reports bootstrap failure when cross-signing keys are not published", async () => {
2277
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
2278
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
2279
+ matrixJsClient.getCrypto = vi.fn(() => ({
2280
+ on: vi.fn(),
2281
+ bootstrapCrossSigning: vi.fn(async () => {}),
2282
+ bootstrapSecretStorage: vi.fn(async () => {}),
2283
+ requestOwnUserVerification: vi.fn(async () => null),
2284
+ isCrossSigningReady: vi.fn(async () => false),
2285
+ userHasCrossSigningKeys: vi.fn(async () => false),
2286
+ getDeviceVerificationStatus: vi.fn(async () => ({
2287
+ isVerified: () => true,
2288
+ localVerified: true,
2289
+ crossSigningVerified: true,
2290
+ signedByOwner: true,
2291
+ })),
2292
+ }));
2293
+
2294
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2295
+ encryption: true,
2296
+ });
2297
+ vi.spyOn(client, "getOwnCrossSigningPublicationStatus").mockResolvedValue({
2298
+ userId: "@bot:example.org",
2299
+ masterKeyPublished: false,
2300
+ selfSigningKeyPublished: false,
2301
+ userSigningKeyPublished: false,
2302
+ published: false,
2303
+ });
2304
+
2305
+ const result = await client.bootstrapOwnDeviceVerification();
2306
+ expect(result.success).toBe(false);
2307
+ expect(result.error).toContain(
2308
+ "Cross-signing bootstrap finished but server keys are still not published",
2309
+ );
2310
+ expect(matrixJsClient.startClient).toHaveBeenCalledTimes(1);
2311
+ });
2312
+
2313
+ it("reports bootstrap success when own device is verified and keys are published", async () => {
2314
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
2315
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
2316
+ matrixJsClient.getCrypto = vi.fn(() => ({
2317
+ on: vi.fn(),
2318
+ bootstrapCrossSigning: vi.fn(async () => {}),
2319
+ bootstrapSecretStorage: vi.fn(async () => {}),
2320
+ requestOwnUserVerification: vi.fn(async () => null),
2321
+ isCrossSigningReady: vi.fn(async () => true),
2322
+ userHasCrossSigningKeys: vi.fn(async () => true),
2323
+ getDeviceVerificationStatus: vi.fn(async () => ({
2324
+ isVerified: () => true,
2325
+ localVerified: true,
2326
+ crossSigningVerified: true,
2327
+ signedByOwner: true,
2328
+ })),
2329
+ getActiveSessionBackupVersion: vi.fn(async () => "9"),
2330
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
2331
+ getKeyBackupInfo: vi.fn(async () => ({
2332
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2333
+ auth_data: {},
2334
+ version: "9",
2335
+ })),
2336
+ isKeyBackupTrusted: vi.fn(async () => ({
2337
+ trusted: true,
2338
+ matchesDecryptionKey: true,
2339
+ })),
2340
+ }));
2341
+
2342
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2343
+ encryption: true,
2344
+ });
2345
+ vi.spyOn(client, "getOwnCrossSigningPublicationStatus").mockResolvedValue({
2346
+ userId: "@bot:example.org",
2347
+ masterKeyPublished: true,
2348
+ selfSigningKeyPublished: true,
2349
+ userSigningKeyPublished: true,
2350
+ published: true,
2351
+ });
2352
+ vi.spyOn(client, "doRequest").mockResolvedValue({ version: "9" });
2353
+
2354
+ const result = await client.bootstrapOwnDeviceVerification();
2355
+ expect(result.success).toBe(true);
2356
+ expect(result.verification.verified).toBe(true);
2357
+ expect(result.crossSigning.published).toBe(true);
2358
+ expect(result.cryptoBootstrap).not.toBeNull();
2359
+ });
2360
+
2361
+ it("reports bootstrap failure when the device is only locally trusted", async () => {
2362
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
2363
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
2364
+ matrixJsClient.getCrypto = vi.fn(() => ({
2365
+ on: vi.fn(),
2366
+ bootstrapCrossSigning: vi.fn(async () => {}),
2367
+ bootstrapSecretStorage: vi.fn(async () => {}),
2368
+ requestOwnUserVerification: vi.fn(async () => null),
2369
+ isCrossSigningReady: vi.fn(async () => true),
2370
+ userHasCrossSigningKeys: vi.fn(async () => true),
2371
+ getDeviceVerificationStatus: vi.fn(async () => ({
2372
+ isVerified: () => true,
2373
+ localVerified: true,
2374
+ crossSigningVerified: false,
2375
+ signedByOwner: false,
2376
+ })),
2377
+ }));
2378
+
2379
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2380
+ encryption: true,
2381
+ });
2382
+ vi.spyOn(client, "getOwnCrossSigningPublicationStatus").mockResolvedValue({
2383
+ userId: "@bot:example.org",
2384
+ masterKeyPublished: true,
2385
+ selfSigningKeyPublished: true,
2386
+ userSigningKeyPublished: true,
2387
+ published: true,
2388
+ });
2389
+
2390
+ const result = await client.bootstrapOwnDeviceVerification();
2391
+ expect(result.success).toBe(false);
2392
+ expect(result.verification.localVerified).toBe(true);
2393
+ expect(result.verification.signedByOwner).toBe(false);
2394
+ expect(result.error).toContain("not verified by its owner after bootstrap");
2395
+ });
2396
+
2397
+ it("creates a key backup during bootstrap when none exists on the server", async () => {
2398
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
2399
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
2400
+ const bootstrapSecretStorage = vi.fn(async () => {});
2401
+ matrixJsClient.getCrypto = vi.fn(() => ({
2402
+ on: vi.fn(),
2403
+ bootstrapCrossSigning: vi.fn(async () => {}),
2404
+ bootstrapSecretStorage,
2405
+ requestOwnUserVerification: vi.fn(async () => null),
2406
+ isCrossSigningReady: vi.fn(async () => true),
2407
+ userHasCrossSigningKeys: vi.fn(async () => true),
2408
+ getDeviceVerificationStatus: vi.fn(async () => ({
2409
+ isVerified: () => true,
2410
+ localVerified: true,
2411
+ crossSigningVerified: true,
2412
+ signedByOwner: true,
2413
+ })),
2414
+ getActiveSessionBackupVersion: vi.fn(async () => "7"),
2415
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
2416
+ getKeyBackupInfo: vi.fn(async () => ({
2417
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2418
+ auth_data: {},
2419
+ version: "7",
2420
+ })),
2421
+ isKeyBackupTrusted: vi.fn(async () => ({
2422
+ trusted: true,
2423
+ matchesDecryptionKey: true,
2424
+ })),
2425
+ }));
2426
+
2427
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2428
+ encryption: true,
2429
+ });
2430
+ vi.spyOn(client, "getOwnCrossSigningPublicationStatus").mockResolvedValue({
2431
+ userId: "@bot:example.org",
2432
+ masterKeyPublished: true,
2433
+ selfSigningKeyPublished: true,
2434
+ userSigningKeyPublished: true,
2435
+ published: true,
2436
+ });
2437
+ let backupChecks = 0;
2438
+ vi.spyOn(client, "doRequest").mockImplementation(async (_method, endpoint) => {
2439
+ if (endpoint.includes("/room_keys/version")) {
2440
+ backupChecks += 1;
2441
+ return backupChecks >= 2 ? { version: "7" } : {};
2442
+ }
2443
+ return {};
2444
+ });
2445
+
2446
+ const result = await client.bootstrapOwnDeviceVerification();
2447
+
2448
+ expect(result.success).toBe(true);
2449
+ expect(result.verification.backupVersion).toBe("7");
2450
+ expect(bootstrapSecretStorage).toHaveBeenCalledWith(
2451
+ expect.objectContaining({ setupNewKeyBackup: true }),
2452
+ );
2453
+ });
2454
+
2455
+ it("does not recreate key backup during bootstrap when one already exists", async () => {
2456
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
2457
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
2458
+ const bootstrapSecretStorage = vi.fn(async () => {});
2459
+ matrixJsClient.getCrypto = vi.fn(() => ({
2460
+ on: vi.fn(),
2461
+ bootstrapCrossSigning: vi.fn(async () => {}),
2462
+ bootstrapSecretStorage,
2463
+ requestOwnUserVerification: vi.fn(async () => null),
2464
+ isCrossSigningReady: vi.fn(async () => true),
2465
+ userHasCrossSigningKeys: vi.fn(async () => true),
2466
+ getDeviceVerificationStatus: vi.fn(async () => ({
2467
+ isVerified: () => true,
2468
+ localVerified: true,
2469
+ crossSigningVerified: true,
2470
+ signedByOwner: true,
2471
+ })),
2472
+ getActiveSessionBackupVersion: vi.fn(async () => "9"),
2473
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
2474
+ getKeyBackupInfo: vi.fn(async () => ({
2475
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2476
+ auth_data: {},
2477
+ version: "9",
2478
+ })),
2479
+ isKeyBackupTrusted: vi.fn(async () => ({
2480
+ trusted: true,
2481
+ matchesDecryptionKey: true,
2482
+ })),
2483
+ }));
2484
+
2485
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2486
+ encryption: true,
2487
+ });
2488
+ vi.spyOn(client, "getOwnCrossSigningPublicationStatus").mockResolvedValue({
2489
+ userId: "@bot:example.org",
2490
+ masterKeyPublished: true,
2491
+ selfSigningKeyPublished: true,
2492
+ userSigningKeyPublished: true,
2493
+ published: true,
2494
+ });
2495
+ vi.spyOn(client, "doRequest").mockImplementation(async (_method, endpoint) => {
2496
+ if (endpoint.includes("/room_keys/version")) {
2497
+ return { version: "9" };
2498
+ }
2499
+ return {};
2500
+ });
2501
+
2502
+ const result = await client.bootstrapOwnDeviceVerification();
2503
+
2504
+ expect(result.success).toBe(true);
2505
+ expect(result.verification.backupVersion).toBe("9");
2506
+ const bootstrapSecretStorageCalls = bootstrapSecretStorage.mock.calls as Array<unknown[]>;
2507
+ expect(
2508
+ bootstrapSecretStorageCalls.some((call) =>
2509
+ Boolean((call[0] as { setupNewKeyBackup?: boolean })?.setupNewKeyBackup),
2510
+ ),
2511
+ ).toBe(false);
2512
+ });
2513
+
2514
+ it("does not report bootstrap errors when final verification state is healthy", async () => {
2515
+ const encoded = encodeRecoveryKey(new Uint8Array(Array.from({ length: 32 }, (_, i) => i + 90)));
2516
+ matrixJsClient.getUserId = vi.fn(() => "@bot:example.org");
2517
+ matrixJsClient.getDeviceId = vi.fn(() => "DEVICE123");
2518
+ matrixJsClient.getCrypto = vi.fn(() => ({
2519
+ on: vi.fn(),
2520
+ bootstrapCrossSigning: vi.fn(async () => {}),
2521
+ bootstrapSecretStorage: vi.fn(async () => {}),
2522
+ requestOwnUserVerification: vi.fn(async () => null),
2523
+ isCrossSigningReady: vi.fn(async () => true),
2524
+ userHasCrossSigningKeys: vi.fn(async () => true),
2525
+ getSecretStorageStatus: vi.fn(async () => ({
2526
+ ready: true,
2527
+ defaultKeyId: "SSSSKEY",
2528
+ secretStorageKeyValidityMap: { SSSSKEY: true },
2529
+ })),
2530
+ getDeviceVerificationStatus: vi.fn(async () => ({
2531
+ isVerified: () => true,
2532
+ localVerified: true,
2533
+ crossSigningVerified: true,
2534
+ signedByOwner: true,
2535
+ })),
2536
+ getActiveSessionBackupVersion: vi.fn(async () => "12"),
2537
+ getSessionBackupPrivateKey: vi.fn(async () => new Uint8Array([1])),
2538
+ getKeyBackupInfo: vi.fn(async () => ({
2539
+ algorithm: "m.megolm_backup.v1.curve25519-aes-sha2",
2540
+ auth_data: {},
2541
+ version: "12",
2542
+ })),
2543
+ isKeyBackupTrusted: vi.fn(async () => ({
2544
+ trusted: true,
2545
+ matchesDecryptionKey: true,
2546
+ })),
2547
+ }));
2548
+
2549
+ const client = new MatrixClient("https://matrix.example.org", "token", {
2550
+ encryption: true,
2551
+ });
2552
+ vi.spyOn(client, "getOwnCrossSigningPublicationStatus").mockResolvedValue({
2553
+ userId: "@bot:example.org",
2554
+ masterKeyPublished: true,
2555
+ selfSigningKeyPublished: true,
2556
+ userSigningKeyPublished: true,
2557
+ published: true,
2558
+ });
2559
+ vi.spyOn(client, "doRequest").mockResolvedValue({ version: "12" });
2560
+
2561
+ const result = await client.bootstrapOwnDeviceVerification({
2562
+ recoveryKey: encoded as string,
2563
+ });
2564
+
2565
+ expect(result.success).toBe(true);
2566
+ expect(result.error).toBeUndefined();
2567
+ });
2568
+ });