@archipelagolab/lobi 1.0.0 → 1.0.5
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.
- package/LICENSE +13 -17
- package/README.md +136 -0
- package/dist/APEv2Parser-6EMKXRZS.js +15 -0
- package/dist/APEv2Parser-6EMKXRZS.js.map +7 -0
- package/dist/AiffParser-E6XWRTXM.js +194 -0
- package/dist/AiffParser-E6XWRTXM.js.map +7 -0
- package/dist/AsfParser-WSOH2JQY.js +620 -0
- package/dist/AsfParser-WSOH2JQY.js.map +7 -0
- package/dist/DsdiffParser-EUWJ4YAR.js +192 -0
- package/dist/DsdiffParser-EUWJ4YAR.js.map +7 -0
- package/dist/DsfParser-R6TPBJIY.js +114 -0
- package/dist/DsfParser-R6TPBJIY.js.map +7 -0
- package/dist/FlacParser-VDASGZ3E.js +16 -0
- package/dist/FlacParser-VDASGZ3E.js.map +7 -0
- package/dist/MP4Parser-64RGJLUM.js +1145 -0
- package/dist/MP4Parser-64RGJLUM.js.map +7 -0
- package/dist/MatroskaParser-O6RXAKYA.js +662 -0
- package/dist/MatroskaParser-O6RXAKYA.js.map +7 -0
- package/dist/MpegParser-B6NX6DS3.js +652 -0
- package/dist/MpegParser-B6NX6DS3.js.map +7 -0
- package/dist/MusepackParser-WUBT63DS.js +331 -0
- package/dist/MusepackParser-WUBT63DS.js.map +7 -0
- package/dist/OggParser-ZY6E5C2P.js +448 -0
- package/dist/OggParser-ZY6E5C2P.js.map +7 -0
- package/dist/WavPackParser-5KTCSQEU.js +209 -0
- package/dist/WavPackParser-5KTCSQEU.js.map +7 -0
- package/dist/WaveParser-RZSHVQPZ.js +300 -0
- package/dist/WaveParser-RZSHVQPZ.js.map +7 -0
- package/dist/auth-presence.js +46 -0
- package/dist/auth-presence.js.map +7 -0
- package/dist/channel-plugin-api.js +79 -0
- package/dist/channel-plugin-api.js.map +7 -0
- package/dist/chunk-22WAAZ6I.js +114 -0
- package/dist/chunk-22WAAZ6I.js.map +7 -0
- package/dist/chunk-2A6HEFSO.js +676 -0
- package/dist/chunk-2A6HEFSO.js.map +7 -0
- package/dist/chunk-2KGHUHKU.js +169 -0
- package/dist/chunk-2KGHUHKU.js.map +7 -0
- package/dist/chunk-2NEQI4K6.js +171 -0
- package/dist/chunk-2NEQI4K6.js.map +7 -0
- package/dist/chunk-2OSJ3MTW.js +175 -0
- package/dist/chunk-2OSJ3MTW.js.map +7 -0
- package/dist/chunk-2Q626TDO.js +27 -0
- package/dist/chunk-2Q626TDO.js.map +7 -0
- package/dist/chunk-2U6OZ7N2.js +155 -0
- package/dist/chunk-2U6OZ7N2.js.map +7 -0
- package/dist/chunk-2Z4IOUDZ.js +129 -0
- package/dist/chunk-2Z4IOUDZ.js.map +7 -0
- package/dist/chunk-2ZEPAW7U.js +154 -0
- package/dist/chunk-2ZEPAW7U.js.map +7 -0
- package/dist/chunk-2ZI6JK5O.js +63 -0
- package/dist/chunk-2ZI6JK5O.js.map +7 -0
- package/dist/chunk-34UY6D6X.js +36 -0
- package/dist/chunk-34UY6D6X.js.map +7 -0
- package/dist/chunk-3JD6JSJD.js +111 -0
- package/dist/chunk-3JD6JSJD.js.map +7 -0
- package/dist/chunk-3TOEIHG5.js +314 -0
- package/dist/chunk-3TOEIHG5.js.map +7 -0
- package/dist/chunk-3TRKKAVT.js +130 -0
- package/dist/chunk-3TRKKAVT.js.map +7 -0
- package/dist/chunk-3UFTTK7C.js +418 -0
- package/dist/chunk-3UFTTK7C.js.map +7 -0
- package/dist/chunk-3XO6AAIC.js +25 -0
- package/dist/chunk-3XO6AAIC.js.map +7 -0
- package/dist/chunk-427SAQME.js +321 -0
- package/dist/chunk-427SAQME.js.map +7 -0
- package/dist/chunk-4JVNTZAI.js +80 -0
- package/dist/chunk-4JVNTZAI.js.map +7 -0
- package/dist/chunk-4O3BEYYM.js +187 -0
- package/dist/chunk-4O3BEYYM.js.map +7 -0
- package/dist/chunk-4Z2N4GW6.js +247 -0
- package/dist/chunk-4Z2N4GW6.js.map +7 -0
- package/dist/chunk-56HN4SH6.js +46 -0
- package/dist/chunk-56HN4SH6.js.map +7 -0
- package/dist/chunk-5APBBTGW.js +7 -0
- package/dist/chunk-5APBBTGW.js.map +7 -0
- package/dist/chunk-5LNGMBWW.js +93 -0
- package/dist/chunk-5LNGMBWW.js.map +7 -0
- package/dist/chunk-5XFQSYZ4.js +52 -0
- package/dist/chunk-5XFQSYZ4.js.map +7 -0
- package/dist/chunk-62N5N4AC.js +241 -0
- package/dist/chunk-62N5N4AC.js.map +7 -0
- package/dist/chunk-6HX3DEXK.js +178 -0
- package/dist/chunk-6HX3DEXK.js.map +7 -0
- package/dist/chunk-6NO5VEVV.js +18 -0
- package/dist/chunk-6NO5VEVV.js.map +7 -0
- package/dist/chunk-6PZGDVLR.js +465 -0
- package/dist/chunk-6PZGDVLR.js.map +7 -0
- package/dist/chunk-6SOGH3TW.js +163 -0
- package/dist/chunk-6SOGH3TW.js.map +7 -0
- package/dist/chunk-72TGY3LX.js +104 -0
- package/dist/chunk-72TGY3LX.js.map +7 -0
- package/dist/chunk-76IE55K7.js +392 -0
- package/dist/chunk-76IE55K7.js.map +7 -0
- package/dist/chunk-7F3242AO.js +86 -0
- package/dist/chunk-7F3242AO.js.map +7 -0
- package/dist/chunk-7FLQSTPG.js +57 -0
- package/dist/chunk-7FLQSTPG.js.map +7 -0
- package/dist/chunk-7MP46JBP.js +177 -0
- package/dist/chunk-7MP46JBP.js.map +7 -0
- package/dist/chunk-7MVZYR2T.js +87 -0
- package/dist/chunk-7MVZYR2T.js.map +7 -0
- package/dist/chunk-7N7ISMPG.js +50 -0
- package/dist/chunk-7N7ISMPG.js.map +7 -0
- package/dist/chunk-7S7LQQPX.js +127 -0
- package/dist/chunk-7S7LQQPX.js.map +7 -0
- package/dist/chunk-7TTNY5FK.js +21 -0
- package/dist/chunk-7TTNY5FK.js.map +7 -0
- package/dist/chunk-7W73QCTR.js +244 -0
- package/dist/chunk-7W73QCTR.js.map +7 -0
- package/dist/chunk-7XXLU33Y.js +76 -0
- package/dist/chunk-7XXLU33Y.js.map +7 -0
- package/dist/chunk-AAO7BQEV.js +258 -0
- package/dist/chunk-AAO7BQEV.js.map +7 -0
- package/dist/chunk-AH4MLRYT.js +91 -0
- package/dist/chunk-AH4MLRYT.js.map +7 -0
- package/dist/chunk-AHKR32FH.js +7 -0
- package/dist/chunk-AHKR32FH.js.map +7 -0
- package/dist/chunk-ALKRFDAW.js +94 -0
- package/dist/chunk-ALKRFDAW.js.map +7 -0
- package/dist/chunk-AQQGAE7N.js +12 -0
- package/dist/chunk-AQQGAE7N.js.map +7 -0
- package/dist/chunk-AWW3YUGJ.js +193 -0
- package/dist/chunk-AWW3YUGJ.js.map +7 -0
- package/dist/chunk-AX7VEEWJ.js +158 -0
- package/dist/chunk-AX7VEEWJ.js.map +7 -0
- package/dist/chunk-BAX7Q6GR.js +55 -0
- package/dist/chunk-BAX7Q6GR.js.map +7 -0
- package/dist/chunk-BBM6BR3Z.js +28 -0
- package/dist/chunk-BBM6BR3Z.js.map +7 -0
- package/dist/chunk-BHXZMHSX.js +109 -0
- package/dist/chunk-BHXZMHSX.js.map +7 -0
- package/dist/chunk-BIUXDLVY.js +62 -0
- package/dist/chunk-BIUXDLVY.js.map +7 -0
- package/dist/chunk-BMFZL2P4.js +97 -0
- package/dist/chunk-BMFZL2P4.js.map +7 -0
- package/dist/chunk-BQXEXK4H.js +114 -0
- package/dist/chunk-BQXEXK4H.js.map +7 -0
- package/dist/chunk-BU2CTWBG.js +30 -0
- package/dist/chunk-BU2CTWBG.js.map +7 -0
- package/dist/chunk-BVKSCLF7.js +195 -0
- package/dist/chunk-BVKSCLF7.js.map +7 -0
- package/dist/chunk-BWA3D22L.js +88 -0
- package/dist/chunk-BWA3D22L.js.map +7 -0
- package/dist/chunk-CE24RSPL.js +506 -0
- package/dist/chunk-CE24RSPL.js.map +7 -0
- package/dist/chunk-CETZGSCP.js +71 -0
- package/dist/chunk-CETZGSCP.js.map +7 -0
- package/dist/chunk-CGBWMONK.js +412 -0
- package/dist/chunk-CGBWMONK.js.map +7 -0
- package/dist/chunk-CPNIXMGX.js +127 -0
- package/dist/chunk-CPNIXMGX.js.map +7 -0
- package/dist/chunk-CSJO73LD.js +84 -0
- package/dist/chunk-CSJO73LD.js.map +7 -0
- package/dist/chunk-CTKBDSL6.js +81 -0
- package/dist/chunk-CTKBDSL6.js.map +7 -0
- package/dist/chunk-CY6WHUCW.js +54 -0
- package/dist/chunk-CY6WHUCW.js.map +7 -0
- package/dist/chunk-D7Q6Z74D.js +123 -0
- package/dist/chunk-D7Q6Z74D.js.map +7 -0
- package/dist/chunk-DZIM4OWK.js +17 -0
- package/dist/chunk-DZIM4OWK.js.map +7 -0
- package/dist/chunk-E3GC4V5V.js +30 -0
- package/dist/chunk-E3GC4V5V.js.map +7 -0
- package/dist/chunk-E5HPDHCW.js +34 -0
- package/dist/chunk-E5HPDHCW.js.map +7 -0
- package/dist/chunk-E75BJJZ2.js +635 -0
- package/dist/chunk-E75BJJZ2.js.map +7 -0
- package/dist/chunk-EE4DHUUZ.js +472 -0
- package/dist/chunk-EE4DHUUZ.js.map +7 -0
- package/dist/chunk-EHELTAAD.js +198 -0
- package/dist/chunk-EHELTAAD.js.map +7 -0
- package/dist/chunk-EKXPSI7Z.js +135 -0
- package/dist/chunk-EKXPSI7Z.js.map +7 -0
- package/dist/chunk-ERCH75SH.js +292 -0
- package/dist/chunk-ERCH75SH.js.map +7 -0
- package/dist/chunk-EVFWZGFL.js +235 -0
- package/dist/chunk-EVFWZGFL.js.map +7 -0
- package/dist/chunk-EVPBRKMZ.js +45 -0
- package/dist/chunk-EVPBRKMZ.js.map +7 -0
- package/dist/chunk-F6AFJHWV.js +45 -0
- package/dist/chunk-F6AFJHWV.js.map +7 -0
- package/dist/chunk-FG4NVFKM.js +455 -0
- package/dist/chunk-FG4NVFKM.js.map +7 -0
- package/dist/chunk-FHNEN6IR.js +14 -0
- package/dist/chunk-FHNEN6IR.js.map +7 -0
- package/dist/chunk-FQ4R7IOX.js +32 -0
- package/dist/chunk-FQ4R7IOX.js.map +7 -0
- package/dist/chunk-FQPYAPJJ.js +124 -0
- package/dist/chunk-FQPYAPJJ.js.map +7 -0
- package/dist/chunk-FQTLJO4W.js +335 -0
- package/dist/chunk-FQTLJO4W.js.map +7 -0
- package/dist/chunk-FVLJSB2W.js +124 -0
- package/dist/chunk-FVLJSB2W.js.map +7 -0
- package/dist/chunk-FYRKBNTI.js +18 -0
- package/dist/chunk-FYRKBNTI.js.map +7 -0
- package/dist/chunk-GD6L3SLC.js +30 -0
- package/dist/chunk-GD6L3SLC.js.map +7 -0
- package/dist/chunk-GI2ZANRY.js +24 -0
- package/dist/chunk-GI2ZANRY.js.map +7 -0
- package/dist/chunk-GK3XVKXT.js +737 -0
- package/dist/chunk-GK3XVKXT.js.map +7 -0
- package/dist/chunk-GKOWCDQV.js +699 -0
- package/dist/chunk-GKOWCDQV.js.map +7 -0
- package/dist/chunk-GLLRCKKE.js +26 -0
- package/dist/chunk-GLLRCKKE.js.map +7 -0
- package/dist/chunk-GNYG6I36.js +175 -0
- package/dist/chunk-GNYG6I36.js.map +7 -0
- package/dist/chunk-GVYGUH2V.js +7 -0
- package/dist/chunk-GVYGUH2V.js.map +7 -0
- package/dist/chunk-GZAGAWSU.js +28 -0
- package/dist/chunk-GZAGAWSU.js.map +7 -0
- package/dist/chunk-H23E72SB.js +163 -0
- package/dist/chunk-H23E72SB.js.map +7 -0
- package/dist/chunk-H6YVV7GE.js +22 -0
- package/dist/chunk-H6YVV7GE.js.map +7 -0
- package/dist/chunk-HDPICD3P.js +4890 -0
- package/dist/chunk-HDPICD3P.js.map +7 -0
- package/dist/chunk-HP5HMWOM.js +123 -0
- package/dist/chunk-HP5HMWOM.js.map +7 -0
- package/dist/chunk-HQSHS6IB.js +88 -0
- package/dist/chunk-HQSHS6IB.js.map +7 -0
- package/dist/chunk-HTV3R73W.js +51 -0
- package/dist/chunk-HTV3R73W.js.map +7 -0
- package/dist/chunk-IJCMYMZB.js +239 -0
- package/dist/chunk-IJCMYMZB.js.map +7 -0
- package/dist/chunk-INNENDEE.js +472 -0
- package/dist/chunk-INNENDEE.js.map +7 -0
- package/dist/chunk-IOTLSMEQ.js +177 -0
- package/dist/chunk-IOTLSMEQ.js.map +7 -0
- package/dist/chunk-IQYYEHSM.js +300 -0
- package/dist/chunk-IQYYEHSM.js.map +7 -0
- package/dist/chunk-IRA5NJ4Q.js +21 -0
- package/dist/chunk-IRA5NJ4Q.js.map +7 -0
- package/dist/chunk-IU7EXXK7.js +1662 -0
- package/dist/chunk-IU7EXXK7.js.map +7 -0
- package/dist/chunk-IUXAKDAY.js +102 -0
- package/dist/chunk-IUXAKDAY.js.map +7 -0
- package/dist/chunk-JMYIFYY5.js +233 -0
- package/dist/chunk-JMYIFYY5.js.map +7 -0
- package/dist/chunk-JSZBX2TA.js +5853 -0
- package/dist/chunk-JSZBX2TA.js.map +7 -0
- package/dist/chunk-KHFWQ334.js +138 -0
- package/dist/chunk-KHFWQ334.js.map +7 -0
- package/dist/chunk-KJW6JLM6.js +95 -0
- package/dist/chunk-KJW6JLM6.js.map +7 -0
- package/dist/chunk-KSEANSJE.js +40 -0
- package/dist/chunk-KSEANSJE.js.map +7 -0
- package/dist/chunk-KVU54E6W.js +63 -0
- package/dist/chunk-KVU54E6W.js.map +7 -0
- package/dist/chunk-L5OUVMHK.js +174 -0
- package/dist/chunk-L5OUVMHK.js.map +7 -0
- package/dist/chunk-LIVQ7GIO.js +86 -0
- package/dist/chunk-LIVQ7GIO.js.map +7 -0
- package/dist/chunk-LO4F6E3N.js +163 -0
- package/dist/chunk-LO4F6E3N.js.map +7 -0
- package/dist/chunk-LSVKDUNM.js +151 -0
- package/dist/chunk-LSVKDUNM.js.map +7 -0
- package/dist/chunk-LVMK2GPM.js +18 -0
- package/dist/chunk-LVMK2GPM.js.map +7 -0
- package/dist/chunk-LXVPETLK.js +1405 -0
- package/dist/chunk-LXVPETLK.js.map +7 -0
- package/dist/chunk-LZNW24OB.js +78 -0
- package/dist/chunk-LZNW24OB.js.map +7 -0
- package/dist/chunk-MAF6PSCJ.js +44 -0
- package/dist/chunk-MAF6PSCJ.js.map +7 -0
- package/dist/chunk-MBIX6Z7U.js +80 -0
- package/dist/chunk-MBIX6Z7U.js.map +7 -0
- package/dist/chunk-MDLLXMC3.js +183 -0
- package/dist/chunk-MDLLXMC3.js.map +7 -0
- package/dist/chunk-MEI5HTWV.js +127 -0
- package/dist/chunk-MEI5HTWV.js.map +7 -0
- package/dist/chunk-MH74AJ3A.js +82 -0
- package/dist/chunk-MH74AJ3A.js.map +7 -0
- package/dist/chunk-MIFIM4PI.js +163 -0
- package/dist/chunk-MIFIM4PI.js.map +7 -0
- package/dist/chunk-MISZB5QJ.js +22 -0
- package/dist/chunk-MISZB5QJ.js.map +7 -0
- package/dist/chunk-MJ27XQYG.js +125 -0
- package/dist/chunk-MJ27XQYG.js.map +7 -0
- package/dist/chunk-MLQY5SKR.js +52 -0
- package/dist/chunk-MLQY5SKR.js.map +7 -0
- package/dist/chunk-MTMHGC3G.js +39 -0
- package/dist/chunk-MTMHGC3G.js.map +7 -0
- package/dist/chunk-MWBAW3YV.js +244 -0
- package/dist/chunk-MWBAW3YV.js.map +7 -0
- package/dist/chunk-MZGGB2YT.js +50 -0
- package/dist/chunk-MZGGB2YT.js.map +7 -0
- package/dist/chunk-N5SNGZJV.js +217 -0
- package/dist/chunk-N5SNGZJV.js.map +7 -0
- package/dist/chunk-NGCTBYQ3.js +181 -0
- package/dist/chunk-NGCTBYQ3.js.map +7 -0
- package/dist/chunk-NMUX7SGU.js +676 -0
- package/dist/chunk-NMUX7SGU.js.map +7 -0
- package/dist/chunk-NO7GMLNU.js +292 -0
- package/dist/chunk-NO7GMLNU.js.map +7 -0
- package/dist/chunk-NTOGVX2Y.js +92 -0
- package/dist/chunk-NTOGVX2Y.js.map +7 -0
- package/dist/chunk-O5IVKDX7.js +30 -0
- package/dist/chunk-O5IVKDX7.js.map +7 -0
- package/dist/chunk-OFWMLQMU.js +7287 -0
- package/dist/chunk-OFWMLQMU.js.map +7 -0
- package/dist/chunk-OJ3ZUKBI.js +73 -0
- package/dist/chunk-OJ3ZUKBI.js.map +7 -0
- package/dist/chunk-OJTHE4B7.js +50 -0
- package/dist/chunk-OJTHE4B7.js.map +7 -0
- package/dist/chunk-OOYPYBTA.js +446 -0
- package/dist/chunk-OOYPYBTA.js.map +7 -0
- package/dist/chunk-OQP4W4AR.js +105 -0
- package/dist/chunk-OQP4W4AR.js.map +7 -0
- package/dist/chunk-OVTT2EKA.js +516 -0
- package/dist/chunk-OVTT2EKA.js.map +7 -0
- package/dist/chunk-P5N63LBS.js +94 -0
- package/dist/chunk-P5N63LBS.js.map +7 -0
- package/dist/chunk-PARITZ7F.js +28 -0
- package/dist/chunk-PARITZ7F.js.map +7 -0
- package/dist/chunk-PBQK4KY4.js +195 -0
- package/dist/chunk-PBQK4KY4.js.map +7 -0
- package/dist/chunk-PSL2AHIA.js +27 -0
- package/dist/chunk-PSL2AHIA.js.map +7 -0
- package/dist/chunk-Q5QT7JBM.js +92 -0
- package/dist/chunk-Q5QT7JBM.js.map +7 -0
- package/dist/chunk-Q7WA5DCR.js +62 -0
- package/dist/chunk-Q7WA5DCR.js.map +7 -0
- package/dist/chunk-QATEENP2.js +7 -0
- package/dist/chunk-QATEENP2.js.map +7 -0
- package/dist/chunk-QDT24CIA.js +485 -0
- package/dist/chunk-QDT24CIA.js.map +7 -0
- package/dist/chunk-QI3NB7D5.js +455 -0
- package/dist/chunk-QI3NB7D5.js.map +7 -0
- package/dist/chunk-QIDAVXSX.js +106 -0
- package/dist/chunk-QIDAVXSX.js.map +7 -0
- package/dist/chunk-QKIGQVP2.js +104 -0
- package/dist/chunk-QKIGQVP2.js.map +7 -0
- package/dist/chunk-QNJENPK2.js +81 -0
- package/dist/chunk-QNJENPK2.js.map +7 -0
- package/dist/chunk-REVXXWAS.js +31 -0
- package/dist/chunk-REVXXWAS.js.map +7 -0
- package/dist/chunk-RFH4HRZP.js +94 -0
- package/dist/chunk-RFH4HRZP.js.map +7 -0
- package/dist/chunk-RNGAGYCL.js +49 -0
- package/dist/chunk-RNGAGYCL.js.map +7 -0
- package/dist/chunk-RPCVN3JA.js +261 -0
- package/dist/chunk-RPCVN3JA.js.map +7 -0
- package/dist/chunk-RQQE5DDT.js +193 -0
- package/dist/chunk-RQQE5DDT.js.map +7 -0
- package/dist/chunk-RVOD3ESA.js +38 -0
- package/dist/chunk-RVOD3ESA.js.map +7 -0
- package/dist/chunk-SAOUP24A.js +70 -0
- package/dist/chunk-SAOUP24A.js.map +7 -0
- package/dist/chunk-SFZL2TCV.js +55 -0
- package/dist/chunk-SFZL2TCV.js.map +7 -0
- package/dist/chunk-SJPFUXBV.js +45 -0
- package/dist/chunk-SJPFUXBV.js.map +7 -0
- package/dist/chunk-SLIUQWAR.js +58 -0
- package/dist/chunk-SLIUQWAR.js.map +7 -0
- package/dist/chunk-SSEX66OL.js +39 -0
- package/dist/chunk-SSEX66OL.js.map +7 -0
- package/dist/chunk-SX2LOHOX.js +251 -0
- package/dist/chunk-SX2LOHOX.js.map +7 -0
- package/dist/chunk-T72EMFTX.js +74 -0
- package/dist/chunk-T72EMFTX.js.map +7 -0
- package/dist/chunk-TA2QJPPG.js +169 -0
- package/dist/chunk-TA2QJPPG.js.map +7 -0
- package/dist/chunk-TFEETDNY.js +78 -0
- package/dist/chunk-TFEETDNY.js.map +7 -0
- package/dist/chunk-THM2QV25.js +108 -0
- package/dist/chunk-THM2QV25.js.map +7 -0
- package/dist/chunk-TRWT2N6Z.js +15 -0
- package/dist/chunk-TRWT2N6Z.js.map +7 -0
- package/dist/chunk-TTXEM54Y.js +76 -0
- package/dist/chunk-TTXEM54Y.js.map +7 -0
- package/dist/chunk-U4LVIY5F.js +1405 -0
- package/dist/chunk-U4LVIY5F.js.map +7 -0
- package/dist/chunk-U767LCSG.js +78 -0
- package/dist/chunk-U767LCSG.js.map +7 -0
- package/dist/chunk-U7GKLHU6.js +120 -0
- package/dist/chunk-U7GKLHU6.js.map +7 -0
- package/dist/chunk-UAB5P5QO.js +60 -0
- package/dist/chunk-UAB5P5QO.js.map +7 -0
- package/dist/chunk-UEHPJQBL.js +38 -0
- package/dist/chunk-UEHPJQBL.js.map +7 -0
- package/dist/chunk-UIBV6IGR.js +31 -0
- package/dist/chunk-UIBV6IGR.js.map +7 -0
- package/dist/chunk-UIYFRUET.js +16352 -0
- package/dist/chunk-UIYFRUET.js.map +7 -0
- package/dist/chunk-UJS3TIVS.js +52 -0
- package/dist/chunk-UJS3TIVS.js.map +7 -0
- package/dist/chunk-UU5PSBSI.js +176 -0
- package/dist/chunk-UU5PSBSI.js.map +7 -0
- package/dist/chunk-UV63XYFU.js +173 -0
- package/dist/chunk-UV63XYFU.js.map +7 -0
- package/dist/chunk-UWPHOAOC.js +29 -0
- package/dist/chunk-UWPHOAOC.js.map +7 -0
- package/dist/chunk-UXDDOSJC.js +52 -0
- package/dist/chunk-UXDDOSJC.js.map +7 -0
- package/dist/chunk-V3VAOMCO.js +465 -0
- package/dist/chunk-V3VAOMCO.js.map +7 -0
- package/dist/chunk-VA7ENH2S.js +38 -0
- package/dist/chunk-VA7ENH2S.js.map +7 -0
- package/dist/chunk-VFPDFLVE.js +516 -0
- package/dist/chunk-VFPDFLVE.js.map +7 -0
- package/dist/chunk-VHG4FNIJ.js +93 -0
- package/dist/chunk-VHG4FNIJ.js.map +7 -0
- package/dist/chunk-VKOO6MIZ.js +51 -0
- package/dist/chunk-VKOO6MIZ.js.map +7 -0
- package/dist/chunk-VKXKRZG7.js +62 -0
- package/dist/chunk-VKXKRZG7.js.map +7 -0
- package/dist/chunk-VUOLPEUZ.js +7 -0
- package/dist/chunk-VUOLPEUZ.js.map +7 -0
- package/dist/chunk-W6SOBS7M.js +138 -0
- package/dist/chunk-W6SOBS7M.js.map +7 -0
- package/dist/chunk-WDOKKRTE.js +7 -0
- package/dist/chunk-WDOKKRTE.js.map +7 -0
- package/dist/chunk-WGXXKFN5.js +7 -0
- package/dist/chunk-WGXXKFN5.js.map +7 -0
- package/dist/chunk-WHPUUP3J.js +25 -0
- package/dist/chunk-WHPUUP3J.js.map +7 -0
- package/dist/chunk-XF7LD6VV.js +122 -0
- package/dist/chunk-XF7LD6VV.js.map +7 -0
- package/dist/chunk-XFTXM3RE.js +64 -0
- package/dist/chunk-XFTXM3RE.js.map +7 -0
- package/dist/chunk-XJABPO2T.js +235 -0
- package/dist/chunk-XJABPO2T.js.map +7 -0
- package/dist/chunk-XK6VF3H7.js +3586 -0
- package/dist/chunk-XK6VF3H7.js.map +7 -0
- package/dist/chunk-XQYIIPOJ.js +266 -0
- package/dist/chunk-XQYIIPOJ.js.map +7 -0
- package/dist/chunk-XZSAN55E.js +58 -0
- package/dist/chunk-XZSAN55E.js.map +7 -0
- package/dist/chunk-Y3KJR4OG.js +64 -0
- package/dist/chunk-Y3KJR4OG.js.map +7 -0
- package/dist/chunk-Y4JKH7FF.js +45 -0
- package/dist/chunk-Y4JKH7FF.js.map +7 -0
- package/dist/chunk-Y6CJN4ID.js +31 -0
- package/dist/chunk-Y6CJN4ID.js.map +7 -0
- package/dist/chunk-YABGJU5M.js +271 -0
- package/dist/chunk-YABGJU5M.js.map +7 -0
- package/dist/chunk-YEJH7ZC2.js +34 -0
- package/dist/chunk-YEJH7ZC2.js.map +7 -0
- package/dist/chunk-YFTE4H54.js +44117 -0
- package/dist/chunk-YFTE4H54.js.map +7 -0
- package/dist/chunk-YNJYMD43.js +392 -0
- package/dist/chunk-YNJYMD43.js.map +7 -0
- package/dist/chunk-YNYEQGVN.js +251 -0
- package/dist/chunk-YNYEQGVN.js.map +7 -0
- package/dist/chunk-YUPBD27Z.js +70 -0
- package/dist/chunk-YUPBD27Z.js.map +7 -0
- package/dist/chunk-YXJ52FD5.js +271 -0
- package/dist/chunk-YXJ52FD5.js.map +7 -0
- package/dist/chunk-YZGORRQN.js +3101 -0
- package/dist/chunk-YZGORRQN.js.map +7 -0
- package/dist/chunk-Z6IVJ6ZW.js +30 -0
- package/dist/chunk-Z6IVJ6ZW.js.map +7 -0
- package/dist/chunk-ZFC44XJJ.js +86 -0
- package/dist/chunk-ZFC44XJJ.js.map +7 -0
- package/dist/chunk-ZJDJC5TP.js +82 -0
- package/dist/chunk-ZJDJC5TP.js.map +7 -0
- package/dist/chunk-ZJGZNPDK.js +171 -0
- package/dist/chunk-ZJGZNPDK.js.map +7 -0
- package/dist/chunk-ZJHBJWZX.js +699 -0
- package/dist/chunk-ZJHBJWZX.js.map +7 -0
- package/dist/chunk-ZNOTD65D.js +95 -0
- package/dist/chunk-ZNOTD65D.js.map +7 -0
- package/dist/chunk-ZQ2QIFXW.js +122 -0
- package/dist/chunk-ZQ2QIFXW.js.map +7 -0
- package/dist/chunk-ZRMXPQGY.js +241 -0
- package/dist/chunk-ZRMXPQGY.js.map +7 -0
- package/dist/chunk-ZVEE5IDC.js +3101 -0
- package/dist/chunk-ZVEE5IDC.js.map +7 -0
- package/dist/cli-metadata.js +12 -0
- package/dist/cli-metadata.js.map +7 -0
- package/dist/contract-api.js +104 -0
- package/dist/contract-api.js.map +7 -0
- package/dist/dist-F3K7S5SS.js +549 -0
- package/dist/dist-F3K7S5SS.js.map +7 -0
- package/dist/helper-api.js +51 -0
- package/dist/helper-api.js.map +7 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +7 -0
- package/dist/magic-string.es-V5NOGTUV.js +1315 -0
- package/dist/magic-string.es-V5NOGTUV.js.map +7 -0
- package/dist/openclaw.plugin.json +23 -0
- package/dist/package.json +59 -0
- package/dist/plugin-entry.handlers.runtime-POD4CSHM.js +20 -0
- package/dist/plugin-entry.handlers.runtime-POD4CSHM.js.map +7 -0
- package/dist/plugin-entry.handlers.runtime-YOSG6V6U.js +20 -0
- package/dist/plugin-entry.handlers.runtime-YOSG6V6U.js.map +7 -0
- package/dist/runtime-api.js +104 -0
- package/dist/runtime-api.js.map +7 -0
- package/dist/rust-crypto-H35BXWUU.js +5323 -0
- package/dist/rust-crypto-H35BXWUU.js.map +7 -0
- package/dist/secret-contract-api.js +18 -0
- package/dist/secret-contract-api.js.map +7 -0
- package/dist/setup-entry.js +23 -0
- package/dist/setup-entry.js.map +7 -0
- package/dist/src/account-selection.js +19 -0
- package/dist/src/account-selection.js.map +7 -0
- package/dist/src/actions.js +24 -0
- package/dist/src/actions.js.map +7 -0
- package/dist/src/approval-auth.js +27 -0
- package/dist/src/approval-auth.js.map +7 -0
- package/dist/src/approval-handler.runtime.js +378 -0
- package/dist/src/approval-handler.runtime.js.map +7 -0
- package/dist/src/approval-ids.js +9 -0
- package/dist/src/approval-ids.js.map +7 -0
- package/dist/src/approval-native.js +28 -0
- package/dist/src/approval-native.js.map +7 -0
- package/dist/src/approval-reactions.js +20 -0
- package/dist/src/approval-reactions.js.map +7 -0
- package/dist/src/auth-precedence.js +8 -0
- package/dist/src/auth-precedence.js.map +7 -0
- package/dist/src/channel-account-paths.js +11 -0
- package/dist/src/channel-account-paths.js.map +7 -0
- package/dist/src/channel.js +74 -0
- package/dist/src/channel.js.map +7 -0
- package/dist/src/channel.runtime.js +82 -0
- package/dist/src/channel.runtime.js.map +7 -0
- package/dist/src/cli-metadata.js +8 -0
- package/dist/src/cli-metadata.js.map +7 -0
- package/dist/src/cli.js +936 -0
- package/dist/src/cli.js.map +7 -0
- package/dist/src/config-adapter.js +26 -0
- package/dist/src/config-adapter.js.map +7 -0
- package/dist/src/config-schema.js +8 -0
- package/dist/src/config-schema.js.map +7 -0
- package/dist/src/directory-live.js +35 -0
- package/dist/src/directory-live.js.map +7 -0
- package/dist/src/doctor-contract.js +11 -0
- package/dist/src/doctor-contract.js.map +7 -0
- package/dist/src/doctor.js +42 -0
- package/dist/src/doctor.js.map +7 -0
- package/dist/src/env-vars.js +12 -0
- package/dist/src/env-vars.js.map +7 -0
- package/dist/src/exec-approval-resolver.js +10 -0
- package/dist/src/exec-approval-resolver.js.map +7 -0
- package/dist/src/exec-approvals.js +51 -0
- package/dist/src/exec-approvals.js.map +7 -0
- package/dist/src/group-mentions.js +28 -0
- package/dist/src/group-mentions.js.map +7 -0
- package/dist/src/legacy-crypto-inspector-availability.js +8 -0
- package/dist/src/legacy-crypto-inspector-availability.js.map +7 -0
- package/dist/src/legacy-crypto.js +26 -0
- package/dist/src/legacy-crypto.js.map +7 -0
- package/dist/src/legacy-state.js +24 -0
- package/dist/src/legacy-state.js.map +7 -0
- package/dist/src/matrix/account-config.js +16 -0
- package/dist/src/matrix/account-config.js.map +7 -0
- package/dist/src/matrix/accounts.js +31 -0
- package/dist/src/matrix/accounts.js.map +7 -0
- package/dist/src/matrix/actions/client.js +40 -0
- package/dist/src/matrix/actions/client.js.map +7 -0
- package/dist/src/matrix/actions/devices.js +42 -0
- package/dist/src/matrix/actions/devices.js.map +7 -0
- package/dist/src/matrix/actions/limits.js +8 -0
- package/dist/src/matrix/actions/limits.js.map +7 -0
- package/dist/src/matrix/actions/messages.js +49 -0
- package/dist/src/matrix/actions/messages.js.map +7 -0
- package/dist/src/matrix/actions/pins.js +46 -0
- package/dist/src/matrix/actions/pins.js.map +7 -0
- package/dist/src/matrix/actions/polls.js +37 -0
- package/dist/src/matrix/actions/polls.js.map +7 -0
- package/dist/src/matrix/actions/profile.js +38 -0
- package/dist/src/matrix/actions/profile.js.map +7 -0
- package/dist/src/matrix/actions/reactions.js +40 -0
- package/dist/src/matrix/actions/reactions.js.map +7 -0
- package/dist/src/matrix/actions/room.js +40 -0
- package/dist/src/matrix/actions/room.js.map +7 -0
- package/dist/src/matrix/actions/summary.js +19 -0
- package/dist/src/matrix/actions/summary.js.map +7 -0
- package/dist/src/matrix/actions/types.js +13 -0
- package/dist/src/matrix/actions/types.js.map +7 -0
- package/dist/src/matrix/actions/verification.js +77 -0
- package/dist/src/matrix/actions/verification.js.map +7 -0
- package/dist/src/matrix/actions.js +126 -0
- package/dist/src/matrix/actions.js.map +7 -0
- package/dist/src/matrix/active-client.js +10 -0
- package/dist/src/matrix/active-client.js.map +7 -0
- package/dist/src/matrix/async-lock.js +8 -0
- package/dist/src/matrix/async-lock.js.map +7 -0
- package/dist/src/matrix/backup-health.js +10 -0
- package/dist/src/matrix/backup-health.js.map +7 -0
- package/dist/src/matrix/client/config-runtime-api.js +24 -0
- package/dist/src/matrix/client/config-runtime-api.js.map +7 -0
- package/dist/src/matrix/client/config-secret-input.runtime.js +11 -0
- package/dist/src/matrix/client/config-secret-input.runtime.js.map +7 -0
- package/dist/src/matrix/client/config.js +42 -0
- package/dist/src/matrix/client/config.js.map +7 -0
- package/dist/src/matrix/client/create-client.js +20 -0
- package/dist/src/matrix/client/create-client.js.map +7 -0
- package/dist/src/matrix/client/env-auth.js +26 -0
- package/dist/src/matrix/client/env-auth.js.map +7 -0
- package/dist/src/matrix/client/file-sync-store.js +23 -0
- package/dist/src/matrix/client/file-sync-store.js.map +7 -0
- package/dist/src/matrix/client/logging.js +17 -0
- package/dist/src/matrix/client/logging.js.map +7 -0
- package/dist/src/matrix/client/migration-snapshot.runtime.js +13 -0
- package/dist/src/matrix/client/migration-snapshot.runtime.js.map +7 -0
- package/dist/src/matrix/client/private-network-host.js +8 -0
- package/dist/src/matrix/client/private-network-host.js.map +7 -0
- package/dist/src/matrix/client/runtime.js +8 -0
- package/dist/src/matrix/client/runtime.js.map +7 -0
- package/dist/src/matrix/client/shared.js +34 -0
- package/dist/src/matrix/client/shared.js.map +7 -0
- package/dist/src/matrix/client/storage.js +26 -0
- package/dist/src/matrix/client/storage.js.map +7 -0
- package/dist/src/matrix/client/types.js +7 -0
- package/dist/src/matrix/client/types.js.map +7 -0
- package/dist/src/matrix/client-bootstrap.js +15 -0
- package/dist/src/matrix/client-bootstrap.js.map +7 -0
- package/dist/src/matrix/client-resolver.test-helpers.js +122 -0
- package/dist/src/matrix/client-resolver.test-helpers.js.map +7 -0
- package/dist/src/matrix/client.js +63 -0
- package/dist/src/matrix/client.js.map +7 -0
- package/dist/src/matrix/config-paths.js +12 -0
- package/dist/src/matrix/config-paths.js.map +7 -0
- package/dist/src/matrix/config-update.js +17 -0
- package/dist/src/matrix/config-update.js.map +7 -0
- package/dist/src/matrix/credentials-read.js +22 -0
- package/dist/src/matrix/credentials-read.js.map +7 -0
- package/dist/src/matrix/credentials-write.runtime.js +24 -0
- package/dist/src/matrix/credentials-write.runtime.js.map +7 -0
- package/dist/src/matrix/credentials.js +90 -0
- package/dist/src/matrix/credentials.js.map +7 -0
- package/dist/src/matrix/deps.js +12 -0
- package/dist/src/matrix/deps.js.map +7 -0
- package/dist/src/matrix/device-health.js +10 -0
- package/dist/src/matrix/device-health.js.map +7 -0
- package/dist/src/matrix/direct-management.js +18 -0
- package/dist/src/matrix/direct-management.js.map +7 -0
- package/dist/src/matrix/direct-room.js +18 -0
- package/dist/src/matrix/direct-room.js.map +7 -0
- package/dist/src/matrix/draft-stream.js +33 -0
- package/dist/src/matrix/draft-stream.js.map +7 -0
- package/dist/src/matrix/encryption-guidance.js +17 -0
- package/dist/src/matrix/encryption-guidance.js.map +7 -0
- package/dist/src/matrix/errors.js +12 -0
- package/dist/src/matrix/errors.js.map +7 -0
- package/dist/src/matrix/format.js +13 -0
- package/dist/src/matrix/format.js.map +7 -0
- package/dist/src/matrix/legacy-crypto-inspector.js +73 -0
- package/dist/src/matrix/legacy-crypto-inspector.js.map +7 -0
- package/dist/src/matrix/media-errors.js +12 -0
- package/dist/src/matrix/media-errors.js.map +7 -0
- package/dist/src/matrix/media-text.js +22 -0
- package/dist/src/matrix/media-text.js.map +7 -0
- package/dist/src/matrix/monitor/access-state.js +9 -0
- package/dist/src/matrix/monitor/access-state.js.map +7 -0
- package/dist/src/matrix/monitor/ack-config.js +10 -0
- package/dist/src/matrix/monitor/ack-config.js.map +7 -0
- package/dist/src/matrix/monitor/allowlist.js +12 -0
- package/dist/src/matrix/monitor/allowlist.js.map +7 -0
- package/dist/src/matrix/monitor/auto-join.js +9 -0
- package/dist/src/matrix/monitor/auto-join.js.map +7 -0
- package/dist/src/matrix/monitor/config.js +37 -0
- package/dist/src/matrix/monitor/config.js.map +7 -0
- package/dist/src/matrix/monitor/context-summary.js +13 -0
- package/dist/src/matrix/monitor/context-summary.js.map +7 -0
- package/dist/src/matrix/monitor/direct.js +13 -0
- package/dist/src/matrix/monitor/direct.js.map +7 -0
- package/dist/src/matrix/monitor/events.js +20 -0
- package/dist/src/matrix/monitor/events.js.map +7 -0
- package/dist/src/matrix/monitor/handler.js +76 -0
- package/dist/src/matrix/monitor/handler.js.map +7 -0
- package/dist/src/matrix/monitor/handler.test-helpers.js +268 -0
- package/dist/src/matrix/monitor/handler.test-helpers.js.map +7 -0
- package/dist/src/matrix/monitor/inbound-dedupe.js +17 -0
- package/dist/src/matrix/monitor/inbound-dedupe.js.map +7 -0
- package/dist/src/matrix/monitor/index.js +502 -0
- package/dist/src/matrix/monitor/index.js.map +7 -0
- package/dist/src/matrix/monitor/legacy-crypto-restore.js +99 -0
- package/dist/src/matrix/monitor/legacy-crypto-restore.js.map +7 -0
- package/dist/src/matrix/monitor/location.js +11 -0
- package/dist/src/matrix/monitor/location.js.map +7 -0
- package/dist/src/matrix/monitor/media.js +10 -0
- package/dist/src/matrix/monitor/media.js.map +7 -0
- package/dist/src/matrix/monitor/mentions.js +9 -0
- package/dist/src/matrix/monitor/mentions.js.map +7 -0
- package/dist/src/matrix/monitor/reaction-events.js +38 -0
- package/dist/src/matrix/monitor/reaction-events.js.map +7 -0
- package/dist/src/matrix/monitor/recent-invite.js +10 -0
- package/dist/src/matrix/monitor/recent-invite.js.map +7 -0
- package/dist/src/matrix/monitor/replies.js +33 -0
- package/dist/src/matrix/monitor/replies.js.map +7 -0
- package/dist/src/matrix/monitor/reply-context.js +14 -0
- package/dist/src/matrix/monitor/reply-context.js.map +7 -0
- package/dist/src/matrix/monitor/room-history.js +10 -0
- package/dist/src/matrix/monitor/room-history.js.map +7 -0
- package/dist/src/matrix/monitor/room-info.js +9 -0
- package/dist/src/matrix/monitor/room-info.js.map +7 -0
- package/dist/src/matrix/monitor/rooms.js +9 -0
- package/dist/src/matrix/monitor/rooms.js.map +7 -0
- package/dist/src/matrix/monitor/route.js +12 -0
- package/dist/src/matrix/monitor/route.js.map +7 -0
- package/dist/src/matrix/monitor/runtime-api.js +40 -0
- package/dist/src/matrix/monitor/runtime-api.js.map +7 -0
- package/dist/src/matrix/monitor/startup-verification.js +174 -0
- package/dist/src/matrix/monitor/startup-verification.js.map +7 -0
- package/dist/src/matrix/monitor/startup.js +9 -0
- package/dist/src/matrix/monitor/startup.js.map +7 -0
- package/dist/src/matrix/monitor/status.js +10 -0
- package/dist/src/matrix/monitor/status.js.map +7 -0
- package/dist/src/matrix/monitor/sync-lifecycle.js +9 -0
- package/dist/src/matrix/monitor/sync-lifecycle.js.map +7 -0
- package/dist/src/matrix/monitor/task-runner.js +8 -0
- package/dist/src/matrix/monitor/task-runner.js.map +7 -0
- package/dist/src/matrix/monitor/thread-context.js +14 -0
- package/dist/src/matrix/monitor/thread-context.js.map +7 -0
- package/dist/src/matrix/monitor/threads.js +16 -0
- package/dist/src/matrix/monitor/threads.js.map +7 -0
- package/dist/src/matrix/monitor/types.js +11 -0
- package/dist/src/matrix/monitor/types.js.map +7 -0
- package/dist/src/matrix/monitor/verification-events.js +13 -0
- package/dist/src/matrix/monitor/verification-events.js.map +7 -0
- package/dist/src/matrix/monitor/verification-utils.js +16 -0
- package/dist/src/matrix/monitor/verification-utils.js.map +7 -0
- package/dist/src/matrix/outbound-media-runtime.js +9 -0
- package/dist/src/matrix/outbound-media-runtime.js.map +7 -0
- package/dist/src/matrix/poll-summary.js +14 -0
- package/dist/src/matrix/poll-summary.js.map +7 -0
- package/dist/src/matrix/poll-types.js +55 -0
- package/dist/src/matrix/poll-types.js.map +7 -0
- package/dist/src/matrix/probe.js +9 -0
- package/dist/src/matrix/probe.js.map +7 -0
- package/dist/src/matrix/probe.runtime.js +30 -0
- package/dist/src/matrix/probe.runtime.js.map +7 -0
- package/dist/src/matrix/profile.js +16 -0
- package/dist/src/matrix/profile.js.map +7 -0
- package/dist/src/matrix/reaction-common.js +26 -0
- package/dist/src/matrix/reaction-common.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-bootstrap.js +15 -0
- package/dist/src/matrix/sdk/crypto-bootstrap.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-facade.js +8 -0
- package/dist/src/matrix/sdk/crypto-facade.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-node.runtime.js +15 -0
- package/dist/src/matrix/sdk/crypto-node.runtime.js.map +7 -0
- package/dist/src/matrix/sdk/crypto-runtime.js +84 -0
- package/dist/src/matrix/sdk/crypto-runtime.js.map +7 -0
- package/dist/src/matrix/sdk/decrypt-bridge.js +11 -0
- package/dist/src/matrix/sdk/decrypt-bridge.js.map +7 -0
- package/dist/src/matrix/sdk/event-helpers.js +12 -0
- package/dist/src/matrix/sdk/event-helpers.js.map +7 -0
- package/dist/src/matrix/sdk/http-client.js +13 -0
- package/dist/src/matrix/sdk/http-client.js.map +7 -0
- package/dist/src/matrix/sdk/idb-persistence-lock.js +12 -0
- package/dist/src/matrix/sdk/idb-persistence-lock.js.map +7 -0
- package/dist/src/matrix/sdk/idb-persistence.js +13 -0
- package/dist/src/matrix/sdk/idb-persistence.js.map +7 -0
- package/dist/src/matrix/sdk/idb-persistence.test-helpers.js +83 -0
- package/dist/src/matrix/sdk/idb-persistence.test-helpers.js.map +7 -0
- package/dist/src/matrix/sdk/logger.js +15 -0
- package/dist/src/matrix/sdk/logger.js.map +7 -0
- package/dist/src/matrix/sdk/read-response-with-limit.js +8 -0
- package/dist/src/matrix/sdk/read-response-with-limit.js.map +7 -0
- package/dist/src/matrix/sdk/recovery-key-store.js +14 -0
- package/dist/src/matrix/sdk/recovery-key-store.js.map +7 -0
- package/dist/src/matrix/sdk/transport.js +13 -0
- package/dist/src/matrix/sdk/transport.js.map +7 -0
- package/dist/src/matrix/sdk/types.js +7 -0
- package/dist/src/matrix/sdk/types.js.map +7 -0
- package/dist/src/matrix/sdk/verification-manager.js +11 -0
- package/dist/src/matrix/sdk/verification-manager.js.map +7 -0
- package/dist/src/matrix/sdk/verification-status.js +12 -0
- package/dist/src/matrix/sdk/verification-status.js.map +7 -0
- package/dist/src/matrix/sdk.js +1375 -0
- package/dist/src/matrix/sdk.js.map +7 -0
- package/dist/src/matrix/send/client.js +14 -0
- package/dist/src/matrix/send/client.js.map +7 -0
- package/dist/src/matrix/send/formatting.js +29 -0
- package/dist/src/matrix/send/formatting.js.map +7 -0
- package/dist/src/matrix/send/media.js +26 -0
- package/dist/src/matrix/send/media.js.map +7 -0
- package/dist/src/matrix/send/targets.js +15 -0
- package/dist/src/matrix/send/targets.js.map +7 -0
- package/dist/src/matrix/send/types.js +17 -0
- package/dist/src/matrix/send/types.js.map +7 -0
- package/dist/src/matrix/send.js +51 -0
- package/dist/src/matrix/send.js.map +7 -0
- package/dist/src/matrix/session-store-metadata.js +15 -0
- package/dist/src/matrix/session-store-metadata.js.map +7 -0
- package/dist/src/matrix/startup-abort.js +14 -0
- package/dist/src/matrix/startup-abort.js.map +7 -0
- package/dist/src/matrix/sync-state.js +12 -0
- package/dist/src/matrix/sync-state.js.map +7 -0
- package/dist/src/matrix/target-ids.js +20 -0
- package/dist/src/matrix/target-ids.js.map +7 -0
- package/dist/src/matrix/thread-bindings-shared.js +34 -0
- package/dist/src/matrix/thread-bindings-shared.js.map +7 -0
- package/dist/src/matrix/thread-bindings.js +49 -0
- package/dist/src/matrix/thread-bindings.js.map +7 -0
- package/dist/src/matrix-migration.runtime.js +45 -0
- package/dist/src/matrix-migration.runtime.js.map +7 -0
- package/dist/src/migration-config.js +29 -0
- package/dist/src/migration-config.js.map +7 -0
- package/dist/src/migration-snapshot-backup.js +12 -0
- package/dist/src/migration-snapshot-backup.js.map +7 -0
- package/dist/src/migration-snapshot.js +38 -0
- package/dist/src/migration-snapshot.js.map +7 -0
- package/dist/src/onboarding.js +43 -0
- package/dist/src/onboarding.js.map +7 -0
- package/dist/src/onboarding.test-harness.js +124 -0
- package/dist/src/onboarding.test-harness.js.map +7 -0
- package/dist/src/outbound.js +33 -0
- package/dist/src/outbound.js.map +7 -0
- package/dist/src/plugin-entry.runtime.js +15 -0
- package/dist/src/plugin-entry.runtime.js.map +7 -0
- package/dist/src/profile-update.js +41 -0
- package/dist/src/profile-update.js.map +7 -0
- package/dist/src/record-shared.js +8 -0
- package/dist/src/record-shared.js.map +7 -0
- package/dist/src/resolve-targets.js +34 -0
- package/dist/src/resolve-targets.js.map +7 -0
- package/dist/src/resolver.js +8 -0
- package/dist/src/resolver.js.map +7 -0
- package/dist/src/runtime-api.js +120 -0
- package/dist/src/runtime-api.js.map +7 -0
- package/dist/src/runtime.js +10 -0
- package/dist/src/runtime.js.map +7 -0
- package/dist/src/secret-contract.js +13 -0
- package/dist/src/secret-contract.js.map +7 -0
- package/dist/src/session-route.js +25 -0
- package/dist/src/session-route.js.map +7 -0
- package/dist/src/setup-bootstrap.js +124 -0
- package/dist/src/setup-bootstrap.js.map +7 -0
- package/dist/src/setup-config.js +28 -0
- package/dist/src/setup-config.js.map +7 -0
- package/dist/src/setup-contract.js +16 -0
- package/dist/src/setup-contract.js.map +7 -0
- package/dist/src/setup-core.js +25 -0
- package/dist/src/setup-core.js.map +7 -0
- package/dist/src/setup-surface.js +45 -0
- package/dist/src/setup-surface.js.map +7 -0
- package/dist/src/startup-maintenance.js +29 -0
- package/dist/src/startup-maintenance.js.map +7 -0
- package/dist/src/storage-paths.js +24 -0
- package/dist/src/storage-paths.js.map +7 -0
- package/dist/src/test-helpers.js +49 -0
- package/dist/src/test-helpers.js.map +7 -0
- package/dist/src/test-mocks.js +40 -0
- package/dist/src/test-mocks.js.map +7 -0
- package/dist/src/test-runtime.js +65 -0
- package/dist/src/test-runtime.js.map +7 -0
- package/dist/src/tool-actions.js +68 -0
- package/dist/src/tool-actions.js.map +7 -0
- package/dist/src/tool-actions.runtime.js +73 -0
- package/dist/src/tool-actions.runtime.js.map +7 -0
- package/dist/src/types.js +7 -0
- package/dist/src/types.js.map +7 -0
- package/dist/test-api.js +82 -0
- package/dist/test-api.js.map +7 -0
- package/dist/thread-bindings-runtime.js +15 -0
- package/dist/thread-bindings-runtime.js.map +7 -0
- package/package.json +12 -6
- package/CHANGELOG.md +0 -164
- package/ENDOFFILE +0 -0
- package/EOF +0 -0
- package/SPEC-SUPPORT.md +0 -116
- package/YAMLEND +0 -0
- package/api.ts +0 -18
- package/archipelagolab-lobi-1.0.0.tgz +0 -0
- package/auth-presence.ts +0 -56
- package/channel-plugin-api.ts +0 -3
- package/cli-metadata.ts +0 -11
- package/contract-api.ts +0 -17
- package/docs/CHECKLIST.md +0 -83
- package/docs/FORK_SDK_GUIDE.md +0 -279
- package/helper-api.ts +0 -3
- package/index.test.ts +0 -61
- package/index.ts +0 -65
- package/plugin-entry.handlers.runtime.ts +0 -1
- package/runtime-api.ts +0 -54
- package/runtime-heavy-api.ts +0 -1
- package/scripts/migrate-to-lobi.sh +0 -72
- package/secret-contract-api.ts +0 -5
- package/setup-entry.ts +0 -13
- package/src/account-selection.test.ts +0 -124
- package/src/account-selection.ts +0 -226
- package/src/actions.account-propagation.test.ts +0 -251
- package/src/actions.test.ts +0 -251
- package/src/actions.ts +0 -336
- package/src/approval-auth.test.ts +0 -23
- package/src/approval-auth.ts +0 -25
- package/src/approval-handler.runtime.test.ts +0 -46
- package/src/approval-handler.runtime.ts +0 -400
- package/src/approval-ids.ts +0 -6
- package/src/approval-native.test.ts +0 -329
- package/src/approval-native.ts +0 -336
- package/src/approval-reactions.test.ts +0 -107
- package/src/approval-reactions.ts +0 -158
- package/src/auth-precedence.ts +0 -61
- package/src/channel-account-paths.ts +0 -92
- package/src/channel.account-paths.test.ts +0 -102
- package/src/channel.directory.test.ts +0 -601
- package/src/channel.resolve.test.ts +0 -38
- package/src/channel.runtime.ts +0 -16
- package/src/channel.setup.test.ts +0 -269
- package/src/channel.ts +0 -570
- package/src/cli-metadata.ts +0 -19
- package/src/cli.test.ts +0 -1015
- package/src/cli.ts +0 -1198
- package/src/config-adapter.ts +0 -41
- package/src/config-schema.test.ts +0 -90
- package/src/config-schema.ts +0 -114
- package/src/directory-live.test.ts +0 -200
- package/src/directory-live.ts +0 -238
- package/src/doctor-contract.ts +0 -287
- package/src/doctor.test.ts +0 -440
- package/src/doctor.ts +0 -262
- package/src/env-vars.ts +0 -92
- package/src/exec-approval-resolver.test.ts +0 -68
- package/src/exec-approval-resolver.ts +0 -23
- package/src/exec-approvals.test.ts +0 -483
- package/src/exec-approvals.ts +0 -290
- package/src/group-mentions.ts +0 -41
- package/src/legacy-crypto-inspector-availability.test.ts +0 -81
- package/src/legacy-crypto-inspector-availability.ts +0 -60
- package/src/legacy-crypto.test.ts +0 -234
- package/src/legacy-crypto.ts +0 -549
- package/src/legacy-state.test.ts +0 -86
- package/src/legacy-state.ts +0 -156
- package/src/matrix/account-config.ts +0 -150
- package/src/matrix/accounts.readiness.test.ts +0 -27
- package/src/matrix/accounts.test.ts +0 -757
- package/src/matrix/accounts.ts +0 -194
- package/src/matrix/actions/client.test.ts +0 -215
- package/src/matrix/actions/client.ts +0 -31
- package/src/matrix/actions/devices.test.ts +0 -114
- package/src/matrix/actions/devices.ts +0 -34
- package/src/matrix/actions/limits.test.ts +0 -15
- package/src/matrix/actions/limits.ts +0 -6
- package/src/matrix/actions/messages.test.ts +0 -289
- package/src/matrix/actions/messages.ts +0 -123
- package/src/matrix/actions/pins.test.ts +0 -74
- package/src/matrix/actions/pins.ts +0 -64
- package/src/matrix/actions/polls.test.ts +0 -71
- package/src/matrix/actions/polls.ts +0 -109
- package/src/matrix/actions/profile.test.ts +0 -109
- package/src/matrix/actions/profile.ts +0 -37
- package/src/matrix/actions/reactions.test.ts +0 -135
- package/src/matrix/actions/reactions.ts +0 -59
- package/src/matrix/actions/room.test.ts +0 -79
- package/src/matrix/actions/room.ts +0 -71
- package/src/matrix/actions/summary.test.ts +0 -87
- package/src/matrix/actions/summary.ts +0 -88
- package/src/matrix/actions/types.ts +0 -82
- package/src/matrix/actions/verification.test.ts +0 -105
- package/src/matrix/actions/verification.ts +0 -237
- package/src/matrix/actions.ts +0 -37
- package/src/matrix/active-client.ts +0 -26
- package/src/matrix/async-lock.ts +0 -18
- package/src/matrix/backup-health.ts +0 -115
- package/src/matrix/client/config-runtime-api.ts +0 -14
- package/src/matrix/client/config-secret-input.runtime.ts +0 -1
- package/src/matrix/client/config.ts +0 -982
- package/src/matrix/client/create-client.test.ts +0 -115
- package/src/matrix/client/create-client.ts +0 -101
- package/src/matrix/client/env-auth.ts +0 -6
- package/src/matrix/client/file-sync-store.test.ts +0 -265
- package/src/matrix/client/file-sync-store.ts +0 -289
- package/src/matrix/client/logging.ts +0 -123
- package/src/matrix/client/migration-snapshot.runtime.ts +0 -1
- package/src/matrix/client/private-network-host.ts +0 -56
- package/src/matrix/client/runtime.ts +0 -4
- package/src/matrix/client/shared.test.ts +0 -344
- package/src/matrix/client/shared.ts +0 -306
- package/src/matrix/client/storage.test.ts +0 -634
- package/src/matrix/client/storage.ts +0 -544
- package/src/matrix/client/types.ts +0 -50
- package/src/matrix/client-bootstrap.test.ts +0 -84
- package/src/matrix/client-bootstrap.ts +0 -164
- package/src/matrix/client-resolver.test-helpers.ts +0 -147
- package/src/matrix/client.test.ts +0 -1521
- package/src/matrix/client.ts +0 -23
- package/src/matrix/config-paths.ts +0 -31
- package/src/matrix/config-update.test.ts +0 -237
- package/src/matrix/config-update.ts +0 -291
- package/src/matrix/credentials-read.ts +0 -206
- package/src/matrix/credentials-write.runtime.ts +0 -26
- package/src/matrix/credentials.test.ts +0 -501
- package/src/matrix/credentials.ts +0 -95
- package/src/matrix/deps.test.ts +0 -74
- package/src/matrix/deps.ts +0 -225
- package/src/matrix/device-health.test.ts +0 -45
- package/src/matrix/device-health.ts +0 -31
- package/src/matrix/direct-management.test.ts +0 -350
- package/src/matrix/direct-management.ts +0 -347
- package/src/matrix/direct-room.test.ts +0 -61
- package/src/matrix/direct-room.ts +0 -128
- package/src/matrix/draft-stream.test.ts +0 -406
- package/src/matrix/draft-stream.ts +0 -216
- package/src/matrix/encryption-guidance.ts +0 -27
- package/src/matrix/errors.ts +0 -21
- package/src/matrix/format.test.ts +0 -340
- package/src/matrix/format.ts +0 -428
- package/src/matrix/legacy-crypto-inspector.ts +0 -95
- package/src/matrix/media-errors.ts +0 -20
- package/src/matrix/media-text.ts +0 -169
- package/src/matrix/monitor/access-state.test.ts +0 -45
- package/src/matrix/monitor/access-state.ts +0 -77
- package/src/matrix/monitor/ack-config.test.ts +0 -57
- package/src/matrix/monitor/ack-config.ts +0 -26
- package/src/matrix/monitor/allowlist.test.ts +0 -45
- package/src/matrix/monitor/allowlist.ts +0 -94
- package/src/matrix/monitor/auto-join.test.ts +0 -203
- package/src/matrix/monitor/auto-join.ts +0 -86
- package/src/matrix/monitor/config.test.ts +0 -197
- package/src/matrix/monitor/config.ts +0 -303
- package/src/matrix/monitor/context-summary.ts +0 -43
- package/src/matrix/monitor/direct.test.ts +0 -529
- package/src/matrix/monitor/direct.ts +0 -270
- package/src/matrix/monitor/events.test.ts +0 -1524
- package/src/matrix/monitor/events.ts +0 -213
- package/src/matrix/monitor/handler.body-for-agent.test.ts +0 -396
- package/src/matrix/monitor/handler.group-history.test.ts +0 -648
- package/src/matrix/monitor/handler.media-failure.test.ts +0 -267
- package/src/matrix/monitor/handler.test-helpers.ts +0 -308
- package/src/matrix/monitor/handler.test.ts +0 -2952
- package/src/matrix/monitor/handler.thread-root-media.test.ts +0 -82
- package/src/matrix/monitor/handler.ts +0 -1679
- package/src/matrix/monitor/inbound-dedupe.test.ts +0 -146
- package/src/matrix/monitor/inbound-dedupe.ts +0 -267
- package/src/matrix/monitor/index.test.ts +0 -920
- package/src/matrix/monitor/index.ts +0 -434
- package/src/matrix/monitor/legacy-crypto-restore.test.ts +0 -206
- package/src/matrix/monitor/legacy-crypto-restore.ts +0 -139
- package/src/matrix/monitor/location.ts +0 -100
- package/src/matrix/monitor/media.test.ts +0 -159
- package/src/matrix/monitor/media.ts +0 -119
- package/src/matrix/monitor/mentions.test.ts +0 -289
- package/src/matrix/monitor/mentions.ts +0 -177
- package/src/matrix/monitor/reaction-events.test.ts +0 -326
- package/src/matrix/monitor/reaction-events.ts +0 -187
- package/src/matrix/monitor/recent-invite.test.ts +0 -92
- package/src/matrix/monitor/recent-invite.ts +0 -30
- package/src/matrix/monitor/replies.test.ts +0 -265
- package/src/matrix/monitor/replies.ts +0 -136
- package/src/matrix/monitor/reply-context.test.ts +0 -276
- package/src/matrix/monitor/reply-context.ts +0 -92
- package/src/matrix/monitor/room-history.test.ts +0 -258
- package/src/matrix/monitor/room-history.ts +0 -301
- package/src/matrix/monitor/room-info.test.ts +0 -201
- package/src/matrix/monitor/room-info.ts +0 -126
- package/src/matrix/monitor/rooms.test.ts +0 -121
- package/src/matrix/monitor/rooms.ts +0 -52
- package/src/matrix/monitor/route.test.ts +0 -255
- package/src/matrix/monitor/route.ts +0 -178
- package/src/matrix/monitor/runtime-api.ts +0 -31
- package/src/matrix/monitor/startup-verification.test.ts +0 -294
- package/src/matrix/monitor/startup-verification.ts +0 -237
- package/src/matrix/monitor/startup.test.ts +0 -257
- package/src/matrix/monitor/startup.ts +0 -218
- package/src/matrix/monitor/status.ts +0 -111
- package/src/matrix/monitor/sync-lifecycle.test.ts +0 -224
- package/src/matrix/monitor/sync-lifecycle.ts +0 -91
- package/src/matrix/monitor/task-runner.ts +0 -38
- package/src/matrix/monitor/thread-context.test.ts +0 -149
- package/src/matrix/monitor/thread-context.ts +0 -108
- package/src/matrix/monitor/threads.test.ts +0 -68
- package/src/matrix/monitor/threads.ts +0 -85
- package/src/matrix/monitor/types.ts +0 -30
- package/src/matrix/monitor/verification-events.ts +0 -627
- package/src/matrix/monitor/verification-utils.test.ts +0 -47
- package/src/matrix/monitor/verification-utils.ts +0 -46
- package/src/matrix/outbound-media-runtime.ts +0 -1
- package/src/matrix/poll-summary.ts +0 -110
- package/src/matrix/poll-types.test.ts +0 -205
- package/src/matrix/poll-types.ts +0 -433
- package/src/matrix/probe.runtime.ts +0 -4
- package/src/matrix/probe.test.ts +0 -154
- package/src/matrix/probe.ts +0 -96
- package/src/matrix/profile.test.ts +0 -154
- package/src/matrix/profile.ts +0 -184
- package/src/matrix/reaction-common.test.ts +0 -96
- package/src/matrix/reaction-common.ts +0 -147
- package/src/matrix/sdk/crypto-bootstrap.test.ts +0 -505
- package/src/matrix/sdk/crypto-bootstrap.ts +0 -341
- package/src/matrix/sdk/crypto-facade.test.ts +0 -197
- package/src/matrix/sdk/crypto-facade.ts +0 -207
- package/src/matrix/sdk/crypto-node.runtime.test.ts +0 -27
- package/src/matrix/sdk/crypto-node.runtime.ts +0 -9
- package/src/matrix/sdk/crypto-runtime.ts +0 -11
- package/src/matrix/sdk/decrypt-bridge.ts +0 -356
- package/src/matrix/sdk/event-helpers.test.ts +0 -60
- package/src/matrix/sdk/event-helpers.ts +0 -71
- package/src/matrix/sdk/http-client.test.ts +0 -134
- package/src/matrix/sdk/http-client.ts +0 -87
- package/src/matrix/sdk/idb-persistence-lock.ts +0 -51
- package/src/matrix/sdk/idb-persistence.lock-order.test.ts +0 -108
- package/src/matrix/sdk/idb-persistence.test-helpers.ts +0 -88
- package/src/matrix/sdk/idb-persistence.test.ts +0 -149
- package/src/matrix/sdk/idb-persistence.ts +0 -283
- package/src/matrix/sdk/logger.test.ts +0 -25
- package/src/matrix/sdk/logger.ts +0 -108
- package/src/matrix/sdk/read-response-with-limit.ts +0 -19
- package/src/matrix/sdk/recovery-key-store.test.ts +0 -385
- package/src/matrix/sdk/recovery-key-store.ts +0 -430
- package/src/matrix/sdk/transport.test.ts +0 -161
- package/src/matrix/sdk/transport.ts +0 -344
- package/src/matrix/sdk/types.ts +0 -236
- package/src/matrix/sdk/verification-manager.test.ts +0 -509
- package/src/matrix/sdk/verification-manager.ts +0 -694
- package/src/matrix/sdk/verification-status.ts +0 -23
- package/src/matrix/sdk.test.ts +0 -2568
- package/src/matrix/sdk.ts +0 -1789
- package/src/matrix/send/client.test.ts +0 -174
- package/src/matrix/send/client.ts +0 -90
- package/src/matrix/send/formatting.ts +0 -189
- package/src/matrix/send/media.ts +0 -244
- package/src/matrix/send/targets.test.ts +0 -254
- package/src/matrix/send/targets.ts +0 -104
- package/src/matrix/send/types.ts +0 -134
- package/src/matrix/send.test.ts +0 -958
- package/src/matrix/send.ts +0 -609
- package/src/matrix/session-store-metadata.ts +0 -108
- package/src/matrix/startup-abort.ts +0 -44
- package/src/matrix/sync-state.ts +0 -27
- package/src/matrix/target-ids.ts +0 -102
- package/src/matrix/thread-bindings-shared.ts +0 -201
- package/src/matrix/thread-bindings.test.ts +0 -673
- package/src/matrix/thread-bindings.ts +0 -577
- package/src/matrix-migration.runtime.ts +0 -9
- package/src/migration-config.test.ts +0 -228
- package/src/migration-config.ts +0 -243
- package/src/migration-snapshot-backup.ts +0 -117
- package/src/migration-snapshot.test.ts +0 -184
- package/src/migration-snapshot.ts +0 -55
- package/src/onboarding.resolve.test.ts +0 -55
- package/src/onboarding.test-harness.ts +0 -158
- package/src/onboarding.test.ts +0 -665
- package/src/onboarding.ts +0 -773
- package/src/outbound.test.ts +0 -173
- package/src/outbound.ts +0 -78
- package/src/plugin-entry.runtime.js +0 -159
- package/src/plugin-entry.runtime.test.ts +0 -108
- package/src/plugin-entry.runtime.ts +0 -68
- package/src/profile-update.ts +0 -68
- package/src/record-shared.ts +0 -3
- package/src/resolve-targets.test.ts +0 -178
- package/src/resolve-targets.ts +0 -175
- package/src/resolver.ts +0 -21
- package/src/runtime-api.ts +0 -144
- package/src/runtime.ts +0 -7
- package/src/secret-contract.ts +0 -174
- package/src/session-route.test.ts +0 -315
- package/src/session-route.ts +0 -113
- package/src/setup-bootstrap.ts +0 -94
- package/src/setup-config.ts +0 -222
- package/src/setup-contract.ts +0 -89
- package/src/setup-core.test.ts +0 -326
- package/src/setup-core.ts +0 -50
- package/src/setup-surface.ts +0 -4
- package/src/startup-maintenance.test.ts +0 -227
- package/src/startup-maintenance.ts +0 -114
- package/src/storage-paths.ts +0 -92
- package/src/test-helpers.ts +0 -42
- package/src/test-mocks.ts +0 -55
- package/src/test-runtime.ts +0 -72
- package/src/test-support/monitor-route-test-support.ts +0 -8
- package/src/tool-actions.runtime.ts +0 -1
- package/src/tool-actions.test.ts +0 -422
- package/src/tool-actions.ts +0 -498
- package/src/types.ts +0 -230
- package/test-api.ts +0 -2
- package/thread-bindings-runtime.ts +0 -4
- package/tsconfig.json +0 -16
|
@@ -0,0 +1,1375 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VerificationMethod
|
|
3
|
+
} from "../../chunk-6NO5VEVV.js";
|
|
4
|
+
import {
|
|
5
|
+
MatrixRecoveryKeyStore,
|
|
6
|
+
isRepairableSecretStorageAccessError
|
|
7
|
+
} from "../../chunk-FQTLJO4W.js";
|
|
8
|
+
import {
|
|
9
|
+
MATRIX_IDB_PERSIST_INTERVAL_MS
|
|
10
|
+
} from "../../chunk-CY6WHUCW.js";
|
|
11
|
+
import {
|
|
12
|
+
isMatrixReadySyncState,
|
|
13
|
+
isMatrixTerminalSyncState
|
|
14
|
+
} from "../../chunk-MISZB5QJ.js";
|
|
15
|
+
import {
|
|
16
|
+
FileBackedMatrixSyncStore,
|
|
17
|
+
createClient
|
|
18
|
+
} from "../../chunk-OFWMLQMU.js";
|
|
19
|
+
import {
|
|
20
|
+
ClientEvent,
|
|
21
|
+
Preset
|
|
22
|
+
} from "../../chunk-YFTE4H54.js";
|
|
23
|
+
import "../../chunk-MAF6PSCJ.js";
|
|
24
|
+
import "../../chunk-4O3BEYYM.js";
|
|
25
|
+
import "../../chunk-FQ4R7IOX.js";
|
|
26
|
+
import "../../chunk-PSL2AHIA.js";
|
|
27
|
+
import {
|
|
28
|
+
createMatrixJsSdkClientLogger
|
|
29
|
+
} from "../../chunk-MJ27XQYG.js";
|
|
30
|
+
import "../../chunk-CGBWMONK.js";
|
|
31
|
+
import {
|
|
32
|
+
resolveMatrixRoomKeyBackupReadinessError
|
|
33
|
+
} from "../../chunk-HQSHS6IB.js";
|
|
34
|
+
import {
|
|
35
|
+
formatMatrixErrorMessage,
|
|
36
|
+
formatMatrixErrorReason,
|
|
37
|
+
isMatrixNotFoundError
|
|
38
|
+
} from "../../chunk-UWPHOAOC.js";
|
|
39
|
+
import "../../chunk-D7Q6Z74D.js";
|
|
40
|
+
import {
|
|
41
|
+
MatrixAuthedHttpClient
|
|
42
|
+
} from "../../chunk-SAOUP24A.js";
|
|
43
|
+
import {
|
|
44
|
+
createMatrixGuardedFetch
|
|
45
|
+
} from "../../chunk-XQYIIPOJ.js";
|
|
46
|
+
import "../../chunk-FYRKBNTI.js";
|
|
47
|
+
import {
|
|
48
|
+
matrixEventToRaw,
|
|
49
|
+
parseMxc
|
|
50
|
+
} from "../../chunk-YUPBD27Z.js";
|
|
51
|
+
import "../../chunk-Z6IVJ6ZW.js";
|
|
52
|
+
import {
|
|
53
|
+
createMatrixStartupAbortError,
|
|
54
|
+
throwIfMatrixStartupAborted
|
|
55
|
+
} from "../../chunk-UXDDOSJC.js";
|
|
56
|
+
import {
|
|
57
|
+
ConsoleLogger,
|
|
58
|
+
LogService,
|
|
59
|
+
noop
|
|
60
|
+
} from "../../chunk-BMFZL2P4.js";
|
|
61
|
+
import "../../chunk-L5OUVMHK.js";
|
|
62
|
+
import "../../chunk-3UFTTK7C.js";
|
|
63
|
+
import "../../chunk-FHNEN6IR.js";
|
|
64
|
+
import "../../chunk-UU5PSBSI.js";
|
|
65
|
+
import "../../chunk-AQQGAE7N.js";
|
|
66
|
+
import "../../chunk-SSEX66OL.js";
|
|
67
|
+
import "../../chunk-BWA3D22L.js";
|
|
68
|
+
import "../../chunk-MH74AJ3A.js";
|
|
69
|
+
import {
|
|
70
|
+
init_shims
|
|
71
|
+
} from "../../chunk-7FLQSTPG.js";
|
|
72
|
+
|
|
73
|
+
// src/matrix/sdk.ts
|
|
74
|
+
init_shims();
|
|
75
|
+
import { EventEmitter } from "node:events";
|
|
76
|
+
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
77
|
+
import { normalizeNullableString } from "openclaw/plugin-sdk/text-runtime";
|
|
78
|
+
var MATRIX_INITIAL_CRYPTO_BOOTSTRAP_OPTIONS = {
|
|
79
|
+
allowAutomaticCrossSigningReset: false
|
|
80
|
+
};
|
|
81
|
+
var MATRIX_AUTOMATIC_REPAIR_BOOTSTRAP_OPTIONS = {
|
|
82
|
+
forceResetCrossSigning: true,
|
|
83
|
+
allowSecretStorageRecreateWithoutRecoveryKey: true,
|
|
84
|
+
strict: true
|
|
85
|
+
};
|
|
86
|
+
function createMatrixExplicitBootstrapOptions(params) {
|
|
87
|
+
return {
|
|
88
|
+
forceResetCrossSigning: params?.forceResetCrossSigning === true,
|
|
89
|
+
allowSecretStorageRecreateWithoutRecoveryKey: true,
|
|
90
|
+
strict: true
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
var loadedMatrixCryptoRuntime = null;
|
|
94
|
+
var matrixCryptoRuntimePromise = null;
|
|
95
|
+
async function loadMatrixCryptoRuntime() {
|
|
96
|
+
matrixCryptoRuntimePromise ??= import("./sdk/crypto-runtime.js").then((runtime) => {
|
|
97
|
+
loadedMatrixCryptoRuntime = runtime;
|
|
98
|
+
return runtime;
|
|
99
|
+
});
|
|
100
|
+
return await matrixCryptoRuntimePromise;
|
|
101
|
+
}
|
|
102
|
+
var normalizeOptionalString = normalizeNullableString;
|
|
103
|
+
function isUnsupportedAuthenticatedMediaEndpointError(err) {
|
|
104
|
+
const statusCode = err?.statusCode;
|
|
105
|
+
if (statusCode === 404 || statusCode === 405 || statusCode === 501) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
const message = formatMatrixErrorReason(err);
|
|
109
|
+
return message.includes("m_unrecognized") || message.includes("unrecognized request") || message.includes("method not allowed") || message.includes("not implemented");
|
|
110
|
+
}
|
|
111
|
+
var MatrixClient = class {
|
|
112
|
+
constructor(homeserver, accessToken, opts = {}) {
|
|
113
|
+
this.emitter = new EventEmitter();
|
|
114
|
+
this.bridgeRegistered = false;
|
|
115
|
+
this.started = false;
|
|
116
|
+
this.cryptoBootstrapped = false;
|
|
117
|
+
this.dmRoomIds = /* @__PURE__ */ new Set();
|
|
118
|
+
this.cryptoInitialized = false;
|
|
119
|
+
this.sendQueue = new KeyedAsyncQueue();
|
|
120
|
+
this.stopPersistPromise = null;
|
|
121
|
+
this.verificationSummaryListenerBound = false;
|
|
122
|
+
this.currentSyncState = null;
|
|
123
|
+
this.dms = {
|
|
124
|
+
update: async () => {
|
|
125
|
+
return await this.refreshDmCache();
|
|
126
|
+
},
|
|
127
|
+
isDm: (roomId) => this.dmRoomIds.has(roomId)
|
|
128
|
+
};
|
|
129
|
+
this.idbPersistTimer = null;
|
|
130
|
+
this.httpClient = new MatrixAuthedHttpClient({
|
|
131
|
+
homeserver,
|
|
132
|
+
accessToken,
|
|
133
|
+
ssrfPolicy: opts.ssrfPolicy,
|
|
134
|
+
dispatcherPolicy: opts.dispatcherPolicy
|
|
135
|
+
});
|
|
136
|
+
this.localTimeoutMs = Math.max(1, opts.localTimeoutMs ?? 6e4);
|
|
137
|
+
this.initialSyncLimit = opts.initialSyncLimit;
|
|
138
|
+
this.encryptionEnabled = opts.encryption === true;
|
|
139
|
+
this.password = opts.password;
|
|
140
|
+
this.syncStore = opts.storagePath ? new FileBackedMatrixSyncStore(opts.storagePath) : void 0;
|
|
141
|
+
this.idbSnapshotPath = opts.idbSnapshotPath;
|
|
142
|
+
this.cryptoDatabasePrefix = opts.cryptoDatabasePrefix;
|
|
143
|
+
this.selfUserId = opts.userId?.trim() || null;
|
|
144
|
+
this.autoBootstrapCrypto = opts.autoBootstrapCrypto !== false;
|
|
145
|
+
this.recoveryKeyStore = new MatrixRecoveryKeyStore(opts.recoveryKeyPath);
|
|
146
|
+
const cryptoCallbacks = this.encryptionEnabled ? this.recoveryKeyStore.buildCryptoCallbacks() : void 0;
|
|
147
|
+
this.client = createClient({
|
|
148
|
+
baseUrl: homeserver,
|
|
149
|
+
accessToken,
|
|
150
|
+
userId: opts.userId,
|
|
151
|
+
deviceId: opts.deviceId,
|
|
152
|
+
logger: createMatrixJsSdkClientLogger("MatrixClient"),
|
|
153
|
+
localTimeoutMs: this.localTimeoutMs,
|
|
154
|
+
fetchFn: createMatrixGuardedFetch({
|
|
155
|
+
ssrfPolicy: opts.ssrfPolicy,
|
|
156
|
+
dispatcherPolicy: opts.dispatcherPolicy
|
|
157
|
+
}),
|
|
158
|
+
store: this.syncStore,
|
|
159
|
+
cryptoCallbacks,
|
|
160
|
+
verificationMethods: [
|
|
161
|
+
VerificationMethod.Sas,
|
|
162
|
+
VerificationMethod.ShowQrCode,
|
|
163
|
+
VerificationMethod.ScanQrCode,
|
|
164
|
+
VerificationMethod.Reciprocate
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
on(eventName, listener) {
|
|
169
|
+
this.emitter.on(eventName, listener);
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
off(eventName, listener) {
|
|
173
|
+
this.emitter.off(eventName, listener);
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
176
|
+
async ensureCryptoSupportInitialized() {
|
|
177
|
+
if (this.decryptBridge && (!this.encryptionEnabled || this.verificationManager && this.cryptoBootstrapper && this.crypto)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const runtime = await loadMatrixCryptoRuntime();
|
|
181
|
+
this.decryptBridge ??= new runtime.MatrixDecryptBridge({
|
|
182
|
+
client: this.client,
|
|
183
|
+
toRaw: (event) => matrixEventToRaw(event),
|
|
184
|
+
emitDecryptedEvent: (roomId, event) => {
|
|
185
|
+
this.emitter.emit("room.decrypted_event", roomId, event);
|
|
186
|
+
},
|
|
187
|
+
emitMessage: (roomId, event) => {
|
|
188
|
+
this.emitter.emit("room.message", roomId, event);
|
|
189
|
+
},
|
|
190
|
+
emitFailedDecryption: (roomId, event, error) => {
|
|
191
|
+
this.emitter.emit("room.failed_decryption", roomId, event, error);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
if (!this.encryptionEnabled) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
this.verificationManager ??= new runtime.MatrixVerificationManager();
|
|
198
|
+
this.cryptoBootstrapper ??= new runtime.MatrixCryptoBootstrapper({
|
|
199
|
+
getUserId: () => this.getUserId(),
|
|
200
|
+
getPassword: () => this.password,
|
|
201
|
+
getDeviceId: () => this.client.getDeviceId(),
|
|
202
|
+
verificationManager: this.verificationManager,
|
|
203
|
+
recoveryKeyStore: this.recoveryKeyStore,
|
|
204
|
+
decryptBridge: this.decryptBridge
|
|
205
|
+
});
|
|
206
|
+
if (!this.crypto) {
|
|
207
|
+
this.crypto = runtime.createMatrixCryptoFacade({
|
|
208
|
+
client: this.client,
|
|
209
|
+
verificationManager: this.verificationManager,
|
|
210
|
+
recoveryKeyStore: this.recoveryKeyStore,
|
|
211
|
+
getRoomStateEvent: (roomId, eventType, stateKey = "") => this.getRoomStateEvent(roomId, eventType, stateKey),
|
|
212
|
+
downloadContent: (mxcUrl) => this.downloadContent(mxcUrl)
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (!this.verificationSummaryListenerBound) {
|
|
216
|
+
this.verificationSummaryListenerBound = true;
|
|
217
|
+
this.verificationManager.onSummaryChanged((summary) => {
|
|
218
|
+
this.emitter.emit("verification.summary", summary);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async start(opts = {}) {
|
|
223
|
+
await this.startSyncSession({
|
|
224
|
+
bootstrapCrypto: true,
|
|
225
|
+
abortSignal: opts.abortSignal,
|
|
226
|
+
readyTimeoutMs: opts.readyTimeoutMs
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
async waitForInitialSyncReady(params = {}) {
|
|
230
|
+
const timeoutMs = params.timeoutMs ?? 3e4;
|
|
231
|
+
if (isMatrixReadySyncState(this.currentSyncState)) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (isMatrixTerminalSyncState(this.currentSyncState)) {
|
|
235
|
+
throw new Error(`Matrix sync entered ${this.currentSyncState} during startup`);
|
|
236
|
+
}
|
|
237
|
+
await new Promise((resolve, reject) => {
|
|
238
|
+
let settled = false;
|
|
239
|
+
let timeoutId;
|
|
240
|
+
const abortSignal = params.abortSignal;
|
|
241
|
+
const cleanup = () => {
|
|
242
|
+
this.off("sync.state", onSyncState);
|
|
243
|
+
this.off("sync.unexpected_error", onUnexpectedError);
|
|
244
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
245
|
+
if (timeoutId) {
|
|
246
|
+
clearTimeout(timeoutId);
|
|
247
|
+
timeoutId = void 0;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
const settleResolve = () => {
|
|
251
|
+
if (settled) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
settled = true;
|
|
255
|
+
cleanup();
|
|
256
|
+
resolve();
|
|
257
|
+
};
|
|
258
|
+
const settleReject = (error) => {
|
|
259
|
+
if (settled) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
settled = true;
|
|
263
|
+
cleanup();
|
|
264
|
+
reject(error);
|
|
265
|
+
};
|
|
266
|
+
const onSyncState = (state, _prevState, error) => {
|
|
267
|
+
if (isMatrixReadySyncState(state)) {
|
|
268
|
+
settleResolve();
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (isMatrixTerminalSyncState(state)) {
|
|
272
|
+
settleReject(
|
|
273
|
+
new Error(
|
|
274
|
+
error instanceof Error && error.message ? error.message : `Matrix sync entered ${state} during startup`
|
|
275
|
+
)
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const onUnexpectedError = (error) => {
|
|
280
|
+
settleReject(error);
|
|
281
|
+
};
|
|
282
|
+
const onAbort = () => {
|
|
283
|
+
settleReject(createMatrixStartupAbortError());
|
|
284
|
+
};
|
|
285
|
+
this.on("sync.state", onSyncState);
|
|
286
|
+
this.on("sync.unexpected_error", onUnexpectedError);
|
|
287
|
+
if (abortSignal?.aborted) {
|
|
288
|
+
onAbort();
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
292
|
+
timeoutId = setTimeout(() => {
|
|
293
|
+
settleReject(
|
|
294
|
+
new Error(`Matrix client did not reach a ready sync state within ${timeoutMs}ms`)
|
|
295
|
+
);
|
|
296
|
+
}, timeoutMs);
|
|
297
|
+
timeoutId.unref?.();
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
async startSyncSession(opts) {
|
|
301
|
+
if (this.started) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
throwIfMatrixStartupAborted(opts.abortSignal);
|
|
305
|
+
await this.ensureCryptoSupportInitialized();
|
|
306
|
+
throwIfMatrixStartupAborted(opts.abortSignal);
|
|
307
|
+
this.registerBridge();
|
|
308
|
+
await this.initializeCryptoIfNeeded(opts.abortSignal);
|
|
309
|
+
await this.client.startClient({
|
|
310
|
+
initialSyncLimit: this.initialSyncLimit
|
|
311
|
+
});
|
|
312
|
+
await this.waitForInitialSyncReady({
|
|
313
|
+
abortSignal: opts.abortSignal,
|
|
314
|
+
timeoutMs: opts.readyTimeoutMs
|
|
315
|
+
});
|
|
316
|
+
throwIfMatrixStartupAborted(opts.abortSignal);
|
|
317
|
+
if (opts.bootstrapCrypto && this.autoBootstrapCrypto) {
|
|
318
|
+
await this.bootstrapCryptoIfNeeded(opts.abortSignal);
|
|
319
|
+
}
|
|
320
|
+
throwIfMatrixStartupAborted(opts.abortSignal);
|
|
321
|
+
this.started = true;
|
|
322
|
+
this.emitOutstandingInviteEvents();
|
|
323
|
+
await this.refreshDmCache().catch(noop);
|
|
324
|
+
}
|
|
325
|
+
async prepareForOneOff() {
|
|
326
|
+
if (!this.encryptionEnabled) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
await this.ensureCryptoSupportInitialized();
|
|
330
|
+
await this.initializeCryptoIfNeeded();
|
|
331
|
+
if (!this.crypto) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
try {
|
|
335
|
+
const joinedRooms = await this.getJoinedRooms();
|
|
336
|
+
await this.crypto.prepare(joinedRooms);
|
|
337
|
+
} catch {
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
hasPersistedSyncState() {
|
|
341
|
+
return this.syncStore?.hasSavedSyncFromCleanShutdown() === true;
|
|
342
|
+
}
|
|
343
|
+
async ensureStartedForCryptoControlPlane() {
|
|
344
|
+
if (this.started) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
await this.startSyncSession({ bootstrapCrypto: false });
|
|
348
|
+
}
|
|
349
|
+
stopSyncWithoutPersist() {
|
|
350
|
+
if (this.idbPersistTimer) {
|
|
351
|
+
clearInterval(this.idbPersistTimer);
|
|
352
|
+
this.idbPersistTimer = null;
|
|
353
|
+
}
|
|
354
|
+
this.currentSyncState = null;
|
|
355
|
+
this.client.stopClient();
|
|
356
|
+
this.started = false;
|
|
357
|
+
}
|
|
358
|
+
async drainPendingDecryptions(reason = "matrix client shutdown") {
|
|
359
|
+
await this.decryptBridge?.drainPendingDecryptions(reason);
|
|
360
|
+
}
|
|
361
|
+
stop() {
|
|
362
|
+
this.stopSyncWithoutPersist();
|
|
363
|
+
this.decryptBridge?.stop();
|
|
364
|
+
this.syncStore?.markCleanShutdown();
|
|
365
|
+
if (loadedMatrixCryptoRuntime) {
|
|
366
|
+
const { persistIdbToDisk } = loadedMatrixCryptoRuntime;
|
|
367
|
+
this.stopPersistPromise = Promise.all([
|
|
368
|
+
persistIdbToDisk({
|
|
369
|
+
snapshotPath: this.idbSnapshotPath,
|
|
370
|
+
databasePrefix: this.cryptoDatabasePrefix
|
|
371
|
+
}).catch(noop),
|
|
372
|
+
this.syncStore?.flush().catch(noop)
|
|
373
|
+
]).then(() => void 0);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
this.stopPersistPromise = loadMatrixCryptoRuntime().then(async ({ persistIdbToDisk }) => {
|
|
377
|
+
await Promise.all([
|
|
378
|
+
persistIdbToDisk({
|
|
379
|
+
snapshotPath: this.idbSnapshotPath,
|
|
380
|
+
databasePrefix: this.cryptoDatabasePrefix
|
|
381
|
+
}).catch(noop),
|
|
382
|
+
this.syncStore?.flush().catch(noop)
|
|
383
|
+
]);
|
|
384
|
+
}).catch(noop).then(() => void 0);
|
|
385
|
+
}
|
|
386
|
+
async stopAndPersist() {
|
|
387
|
+
this.stop();
|
|
388
|
+
await this.stopPersistPromise;
|
|
389
|
+
}
|
|
390
|
+
async bootstrapCryptoIfNeeded(abortSignal) {
|
|
391
|
+
if (!this.encryptionEnabled || !this.cryptoInitialized || this.cryptoBootstrapped) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
395
|
+
await this.ensureCryptoSupportInitialized();
|
|
396
|
+
const crypto = this.client.getCrypto();
|
|
397
|
+
if (!crypto) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const cryptoBootstrapper = this.cryptoBootstrapper;
|
|
401
|
+
if (!cryptoBootstrapper) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
const initial = await cryptoBootstrapper.bootstrap(
|
|
405
|
+
crypto,
|
|
406
|
+
MATRIX_INITIAL_CRYPTO_BOOTSTRAP_OPTIONS
|
|
407
|
+
);
|
|
408
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
409
|
+
if (!initial.crossSigningPublished || initial.ownDeviceVerified === false) {
|
|
410
|
+
const status = await this.getOwnDeviceVerificationStatus();
|
|
411
|
+
if (status.signedByOwner) {
|
|
412
|
+
LogService.warn(
|
|
413
|
+
"MatrixClientLite",
|
|
414
|
+
"Cross-signing/bootstrap is incomplete for an already owner-signed device; skipping automatic reset and preserving the current identity. Restore the recovery key or run an explicit verification bootstrap if repair is needed."
|
|
415
|
+
);
|
|
416
|
+
} else if (this.password?.trim()) {
|
|
417
|
+
try {
|
|
418
|
+
const repaired = await cryptoBootstrapper.bootstrap(
|
|
419
|
+
crypto,
|
|
420
|
+
MATRIX_AUTOMATIC_REPAIR_BOOTSTRAP_OPTIONS
|
|
421
|
+
);
|
|
422
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
423
|
+
if (repaired.crossSigningPublished && repaired.ownDeviceVerified !== false) {
|
|
424
|
+
LogService.info(
|
|
425
|
+
"MatrixClientLite",
|
|
426
|
+
"Cross-signing/bootstrap recovered after forced reset"
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
} catch (err) {
|
|
430
|
+
LogService.warn(
|
|
431
|
+
"MatrixClientLite",
|
|
432
|
+
"Failed to recover cross-signing/bootstrap with forced reset:",
|
|
433
|
+
err
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
LogService.warn(
|
|
438
|
+
"MatrixClientLite",
|
|
439
|
+
"Cross-signing/bootstrap incomplete and no password is configured for UIA fallback"
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
this.cryptoBootstrapped = true;
|
|
444
|
+
}
|
|
445
|
+
async initializeCryptoIfNeeded(abortSignal) {
|
|
446
|
+
if (!this.encryptionEnabled || this.cryptoInitialized) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
450
|
+
const { persistIdbToDisk, restoreIdbFromDisk } = await loadMatrixCryptoRuntime();
|
|
451
|
+
await restoreIdbFromDisk(this.idbSnapshotPath);
|
|
452
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
453
|
+
try {
|
|
454
|
+
await this.client.initRustCrypto({
|
|
455
|
+
cryptoDatabasePrefix: this.cryptoDatabasePrefix
|
|
456
|
+
});
|
|
457
|
+
this.cryptoInitialized = true;
|
|
458
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
459
|
+
await persistIdbToDisk({
|
|
460
|
+
snapshotPath: this.idbSnapshotPath,
|
|
461
|
+
databasePrefix: this.cryptoDatabasePrefix
|
|
462
|
+
});
|
|
463
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
464
|
+
this.idbPersistTimer = setInterval(() => {
|
|
465
|
+
persistIdbToDisk({
|
|
466
|
+
snapshotPath: this.idbSnapshotPath,
|
|
467
|
+
databasePrefix: this.cryptoDatabasePrefix
|
|
468
|
+
}).catch(noop);
|
|
469
|
+
}, MATRIX_IDB_PERSIST_INTERVAL_MS);
|
|
470
|
+
} catch (err) {
|
|
471
|
+
LogService.warn("MatrixClientLite", "Failed to initialize rust crypto:", err);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
async getUserId() {
|
|
475
|
+
const fromClient = this.client.getUserId();
|
|
476
|
+
if (fromClient) {
|
|
477
|
+
this.selfUserId = fromClient;
|
|
478
|
+
return fromClient;
|
|
479
|
+
}
|
|
480
|
+
if (this.selfUserId) {
|
|
481
|
+
return this.selfUserId;
|
|
482
|
+
}
|
|
483
|
+
const whoami = await this.doRequest("GET", "/_lobi/client/v3/account/whoami");
|
|
484
|
+
const resolved = whoami.user_id?.trim();
|
|
485
|
+
if (!resolved) {
|
|
486
|
+
throw new Error("Matrix whoami did not return user_id");
|
|
487
|
+
}
|
|
488
|
+
this.selfUserId = resolved;
|
|
489
|
+
return resolved;
|
|
490
|
+
}
|
|
491
|
+
async getJoinedRooms() {
|
|
492
|
+
const joined = await this.client.getJoinedRooms();
|
|
493
|
+
return Array.isArray(joined.joined_rooms) ? joined.joined_rooms : [];
|
|
494
|
+
}
|
|
495
|
+
async getJoinedRoomMembers(roomId) {
|
|
496
|
+
const members = await this.client.getJoinedRoomMembers(roomId);
|
|
497
|
+
const joined = members?.joined;
|
|
498
|
+
if (!joined || typeof joined !== "object") {
|
|
499
|
+
return [];
|
|
500
|
+
}
|
|
501
|
+
return Object.keys(joined);
|
|
502
|
+
}
|
|
503
|
+
async getRoomStateEvent(roomId, eventType, stateKey = "") {
|
|
504
|
+
const state = await this.client.getStateEvent(roomId, eventType, stateKey);
|
|
505
|
+
return state ?? {};
|
|
506
|
+
}
|
|
507
|
+
async getAccountData(eventType) {
|
|
508
|
+
const event = this.client.getAccountData(eventType);
|
|
509
|
+
return event?.getContent() ?? void 0;
|
|
510
|
+
}
|
|
511
|
+
async setAccountData(eventType, content) {
|
|
512
|
+
await this.client.setAccountData(eventType, content);
|
|
513
|
+
await this.refreshDmCache().catch(noop);
|
|
514
|
+
}
|
|
515
|
+
async resolveRoom(aliasOrRoomId) {
|
|
516
|
+
if (aliasOrRoomId.startsWith("!")) {
|
|
517
|
+
return aliasOrRoomId;
|
|
518
|
+
}
|
|
519
|
+
if (!aliasOrRoomId.startsWith("#")) {
|
|
520
|
+
return aliasOrRoomId;
|
|
521
|
+
}
|
|
522
|
+
try {
|
|
523
|
+
const resolved = await this.client.getRoomIdForAlias(aliasOrRoomId);
|
|
524
|
+
return resolved.room_id ?? null;
|
|
525
|
+
} catch {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
async createDirectRoom(remoteUserId, opts = {}) {
|
|
530
|
+
const initialState = opts.encrypted ? [
|
|
531
|
+
{
|
|
532
|
+
type: "m.room.encryption",
|
|
533
|
+
state_key: "",
|
|
534
|
+
content: {
|
|
535
|
+
algorithm: "m.megolm.v1.aes-sha2"
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
] : void 0;
|
|
539
|
+
const result = await this.client.createRoom({
|
|
540
|
+
invite: [remoteUserId],
|
|
541
|
+
is_direct: true,
|
|
542
|
+
preset: Preset.TrustedPrivateChat,
|
|
543
|
+
initial_state: initialState
|
|
544
|
+
});
|
|
545
|
+
return result.room_id;
|
|
546
|
+
}
|
|
547
|
+
async sendMessage(roomId, content) {
|
|
548
|
+
return await this.runSerializedRoomSend(roomId, async () => {
|
|
549
|
+
const sent = await this.client.sendMessage(roomId, content);
|
|
550
|
+
return sent.event_id;
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
async sendEvent(roomId, eventType, content) {
|
|
554
|
+
return await this.runSerializedRoomSend(roomId, async () => {
|
|
555
|
+
const sent = await this.client.sendEvent(roomId, eventType, content);
|
|
556
|
+
return sent.event_id;
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
// Keep outbound room events ordered when multiple plugin paths emit
|
|
560
|
+
// messages/reactions/polls into the same Matrix room concurrently.
|
|
561
|
+
async runSerializedRoomSend(roomId, task) {
|
|
562
|
+
return await this.sendQueue.enqueue(roomId, task);
|
|
563
|
+
}
|
|
564
|
+
async sendStateEvent(roomId, eventType, stateKey, content) {
|
|
565
|
+
const sent = await this.client.sendStateEvent(
|
|
566
|
+
roomId,
|
|
567
|
+
eventType,
|
|
568
|
+
content,
|
|
569
|
+
stateKey
|
|
570
|
+
);
|
|
571
|
+
return sent.event_id;
|
|
572
|
+
}
|
|
573
|
+
async redactEvent(roomId, eventId, reason) {
|
|
574
|
+
const sent = await this.client.redactEvent(
|
|
575
|
+
roomId,
|
|
576
|
+
eventId,
|
|
577
|
+
void 0,
|
|
578
|
+
reason?.trim() ? { reason } : void 0
|
|
579
|
+
);
|
|
580
|
+
return sent.event_id;
|
|
581
|
+
}
|
|
582
|
+
async doRequest(method, endpoint, qs, body, opts) {
|
|
583
|
+
return await this.httpClient.requestJson({
|
|
584
|
+
method,
|
|
585
|
+
endpoint,
|
|
586
|
+
qs,
|
|
587
|
+
body,
|
|
588
|
+
timeoutMs: this.localTimeoutMs,
|
|
589
|
+
allowAbsoluteEndpoint: opts?.allowAbsoluteEndpoint
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
async getUserProfile(userId) {
|
|
593
|
+
return await this.client.getProfileInfo(userId);
|
|
594
|
+
}
|
|
595
|
+
async setDisplayName(displayName) {
|
|
596
|
+
await this.client.setDisplayName(displayName);
|
|
597
|
+
}
|
|
598
|
+
async setAvatarUrl(avatarUrl) {
|
|
599
|
+
await this.client.setAvatarUrl(avatarUrl);
|
|
600
|
+
}
|
|
601
|
+
async joinRoom(roomId) {
|
|
602
|
+
await this.client.joinRoom(roomId);
|
|
603
|
+
}
|
|
604
|
+
mxcToHttp(mxcUrl) {
|
|
605
|
+
return this.client.mxcUrlToHttp(mxcUrl, void 0, void 0, void 0, true, false, true);
|
|
606
|
+
}
|
|
607
|
+
async downloadContent(mxcUrl, opts = {}) {
|
|
608
|
+
const parsed = parseMxc(mxcUrl);
|
|
609
|
+
if (!parsed) {
|
|
610
|
+
throw new Error(`Invalid Matrix content URI: ${mxcUrl}`);
|
|
611
|
+
}
|
|
612
|
+
const encodedServer = encodeURIComponent(parsed.server);
|
|
613
|
+
const encodedMediaId = encodeURIComponent(parsed.mediaId);
|
|
614
|
+
const request = async (endpoint) => await this.httpClient.requestRaw({
|
|
615
|
+
method: "GET",
|
|
616
|
+
endpoint,
|
|
617
|
+
qs: { allow_remote: opts.allowRemote ?? true },
|
|
618
|
+
timeoutMs: this.localTimeoutMs,
|
|
619
|
+
maxBytes: opts.maxBytes,
|
|
620
|
+
readIdleTimeoutMs: opts.readIdleTimeoutMs
|
|
621
|
+
});
|
|
622
|
+
const authenticatedEndpoint = `/_lobi/client/v1/media/download/${encodedServer}/${encodedMediaId}`;
|
|
623
|
+
try {
|
|
624
|
+
return await request(authenticatedEndpoint);
|
|
625
|
+
} catch (err) {
|
|
626
|
+
if (!isUnsupportedAuthenticatedMediaEndpointError(err)) {
|
|
627
|
+
throw err;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
const legacyEndpoint = `/_lobi/media/v3/download/${encodedServer}/${encodedMediaId}`;
|
|
631
|
+
return await request(legacyEndpoint);
|
|
632
|
+
}
|
|
633
|
+
async uploadContent(file, contentType, filename) {
|
|
634
|
+
const uploaded = await this.client.uploadContent(new Uint8Array(file), {
|
|
635
|
+
type: contentType || "application/octet-stream",
|
|
636
|
+
name: filename,
|
|
637
|
+
includeFilename: Boolean(filename)
|
|
638
|
+
});
|
|
639
|
+
return uploaded.content_uri;
|
|
640
|
+
}
|
|
641
|
+
async getEvent(roomId, eventId) {
|
|
642
|
+
const rawEvent = await this.client.fetchRoomEvent(roomId, eventId);
|
|
643
|
+
if (rawEvent.type !== "m.room.encrypted") {
|
|
644
|
+
return rawEvent;
|
|
645
|
+
}
|
|
646
|
+
const mapper = this.client.getEventMapper();
|
|
647
|
+
const event = mapper(rawEvent);
|
|
648
|
+
let decryptedEvent;
|
|
649
|
+
const onDecrypted = (candidate) => {
|
|
650
|
+
decryptedEvent = candidate;
|
|
651
|
+
};
|
|
652
|
+
event.once("Event.decrypted", onDecrypted);
|
|
653
|
+
try {
|
|
654
|
+
await this.client.decryptEventIfNeeded(event);
|
|
655
|
+
} finally {
|
|
656
|
+
event.off("Event.decrypted", onDecrypted);
|
|
657
|
+
}
|
|
658
|
+
return matrixEventToRaw(decryptedEvent ?? event);
|
|
659
|
+
}
|
|
660
|
+
async getRelations(roomId, eventId, relationType, eventType, opts = {}) {
|
|
661
|
+
const result = await this.client.relations(roomId, eventId, relationType, eventType, opts);
|
|
662
|
+
return {
|
|
663
|
+
originalEvent: result.originalEvent ? matrixEventToRaw(result.originalEvent) : null,
|
|
664
|
+
events: result.events.map((event) => matrixEventToRaw(event)),
|
|
665
|
+
nextBatch: result.nextBatch ?? null,
|
|
666
|
+
prevBatch: result.prevBatch ?? null
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
async hydrateEvents(roomId, events) {
|
|
670
|
+
if (events.length === 0) {
|
|
671
|
+
return [];
|
|
672
|
+
}
|
|
673
|
+
const mapper = this.client.getEventMapper();
|
|
674
|
+
const mappedEvents = events.map(
|
|
675
|
+
(event) => mapper({
|
|
676
|
+
room_id: roomId,
|
|
677
|
+
...event
|
|
678
|
+
})
|
|
679
|
+
);
|
|
680
|
+
await Promise.all(mappedEvents.map((event) => this.client.decryptEventIfNeeded(event)));
|
|
681
|
+
return mappedEvents.map((event) => matrixEventToRaw(event));
|
|
682
|
+
}
|
|
683
|
+
async setTyping(roomId, typing, timeoutMs) {
|
|
684
|
+
await this.client.sendTyping(roomId, typing, timeoutMs);
|
|
685
|
+
}
|
|
686
|
+
async sendReadReceipt(roomId, eventId) {
|
|
687
|
+
await this.httpClient.requestJson({
|
|
688
|
+
method: "POST",
|
|
689
|
+
endpoint: `/_lobi/client/v3/rooms/${encodeURIComponent(roomId)}/receipt/m.read/${encodeURIComponent(
|
|
690
|
+
eventId
|
|
691
|
+
)}`,
|
|
692
|
+
body: {},
|
|
693
|
+
timeoutMs: this.localTimeoutMs
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
async getRoomKeyBackupStatus() {
|
|
697
|
+
if (!this.encryptionEnabled) {
|
|
698
|
+
return {
|
|
699
|
+
serverVersion: null,
|
|
700
|
+
activeVersion: null,
|
|
701
|
+
trusted: null,
|
|
702
|
+
matchesDecryptionKey: null,
|
|
703
|
+
decryptionKeyCached: null,
|
|
704
|
+
keyLoadAttempted: false,
|
|
705
|
+
keyLoadError: null
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
const crypto = this.client.getCrypto();
|
|
709
|
+
const serverVersionFallback = await this.resolveRoomKeyBackupVersion();
|
|
710
|
+
if (!crypto) {
|
|
711
|
+
return {
|
|
712
|
+
serverVersion: serverVersionFallback,
|
|
713
|
+
activeVersion: null,
|
|
714
|
+
trusted: null,
|
|
715
|
+
matchesDecryptionKey: null,
|
|
716
|
+
decryptionKeyCached: null,
|
|
717
|
+
keyLoadAttempted: false,
|
|
718
|
+
keyLoadError: null
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
let { activeVersion, decryptionKeyCached } = await this.resolveRoomKeyBackupLocalState(crypto);
|
|
722
|
+
let { serverVersion, trusted, matchesDecryptionKey } = await this.resolveRoomKeyBackupTrustState(crypto, serverVersionFallback);
|
|
723
|
+
const shouldLoadBackupKey = Boolean(serverVersion) && (decryptionKeyCached === false || matchesDecryptionKey === false);
|
|
724
|
+
const shouldActivateBackup = Boolean(serverVersion) && !activeVersion;
|
|
725
|
+
let keyLoadAttempted = false;
|
|
726
|
+
let keyLoadError = null;
|
|
727
|
+
if (serverVersion && (shouldLoadBackupKey || shouldActivateBackup)) {
|
|
728
|
+
if (shouldLoadBackupKey) {
|
|
729
|
+
if (typeof crypto.loadSessionBackupPrivateKeyFromSecretStorage === "function") {
|
|
730
|
+
keyLoadAttempted = true;
|
|
731
|
+
try {
|
|
732
|
+
await crypto.loadSessionBackupPrivateKeyFromSecretStorage();
|
|
733
|
+
} catch (err) {
|
|
734
|
+
keyLoadError = formatMatrixErrorMessage(err);
|
|
735
|
+
}
|
|
736
|
+
} else {
|
|
737
|
+
keyLoadError = "Matrix crypto backend does not support loading backup keys from secret storage";
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
if (!keyLoadError) {
|
|
741
|
+
await this.enableTrustedRoomKeyBackupIfPossible(crypto);
|
|
742
|
+
}
|
|
743
|
+
({ activeVersion, decryptionKeyCached } = await this.resolveRoomKeyBackupLocalState(crypto));
|
|
744
|
+
({ serverVersion, trusted, matchesDecryptionKey } = await this.resolveRoomKeyBackupTrustState(
|
|
745
|
+
crypto,
|
|
746
|
+
serverVersion
|
|
747
|
+
));
|
|
748
|
+
}
|
|
749
|
+
return {
|
|
750
|
+
serverVersion,
|
|
751
|
+
activeVersion,
|
|
752
|
+
trusted,
|
|
753
|
+
matchesDecryptionKey,
|
|
754
|
+
decryptionKeyCached,
|
|
755
|
+
keyLoadAttempted,
|
|
756
|
+
keyLoadError
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
async getOwnDeviceVerificationStatus() {
|
|
760
|
+
const recoveryKey = this.recoveryKeyStore.getRecoveryKeySummary();
|
|
761
|
+
const userId = this.client.getUserId() ?? this.selfUserId ?? null;
|
|
762
|
+
const deviceId = this.client.getDeviceId()?.trim() || null;
|
|
763
|
+
const backup = await this.getRoomKeyBackupStatus();
|
|
764
|
+
if (!this.encryptionEnabled) {
|
|
765
|
+
return {
|
|
766
|
+
encryptionEnabled: false,
|
|
767
|
+
userId,
|
|
768
|
+
deviceId,
|
|
769
|
+
verified: false,
|
|
770
|
+
localVerified: false,
|
|
771
|
+
crossSigningVerified: false,
|
|
772
|
+
signedByOwner: false,
|
|
773
|
+
recoveryKeyStored: Boolean(recoveryKey),
|
|
774
|
+
recoveryKeyCreatedAt: recoveryKey?.createdAt ?? null,
|
|
775
|
+
recoveryKeyId: recoveryKey?.keyId ?? null,
|
|
776
|
+
backupVersion: backup.serverVersion,
|
|
777
|
+
backup
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
const crypto = this.client.getCrypto();
|
|
781
|
+
let deviceStatus = null;
|
|
782
|
+
if (crypto && userId && deviceId && typeof crypto.getDeviceVerificationStatus === "function") {
|
|
783
|
+
deviceStatus = await crypto.getDeviceVerificationStatus(userId, deviceId).catch(() => null);
|
|
784
|
+
}
|
|
785
|
+
const { isMatrixDeviceOwnerVerified } = await loadMatrixCryptoRuntime();
|
|
786
|
+
return {
|
|
787
|
+
encryptionEnabled: true,
|
|
788
|
+
userId,
|
|
789
|
+
deviceId,
|
|
790
|
+
verified: isMatrixDeviceOwnerVerified(deviceStatus),
|
|
791
|
+
localVerified: deviceStatus?.localVerified === true,
|
|
792
|
+
crossSigningVerified: deviceStatus?.crossSigningVerified === true,
|
|
793
|
+
signedByOwner: deviceStatus?.signedByOwner === true,
|
|
794
|
+
recoveryKeyStored: Boolean(recoveryKey),
|
|
795
|
+
recoveryKeyCreatedAt: recoveryKey?.createdAt ?? null,
|
|
796
|
+
recoveryKeyId: recoveryKey?.keyId ?? null,
|
|
797
|
+
backupVersion: backup.serverVersion,
|
|
798
|
+
backup
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
async verifyWithRecoveryKey(rawRecoveryKey) {
|
|
802
|
+
const fail = async (error) => ({
|
|
803
|
+
success: false,
|
|
804
|
+
error,
|
|
805
|
+
...await this.getOwnDeviceVerificationStatus()
|
|
806
|
+
});
|
|
807
|
+
if (!this.encryptionEnabled) {
|
|
808
|
+
return await fail("Matrix encryption is disabled for this client");
|
|
809
|
+
}
|
|
810
|
+
await this.ensureStartedForCryptoControlPlane();
|
|
811
|
+
await this.ensureCryptoSupportInitialized();
|
|
812
|
+
const crypto = this.client.getCrypto();
|
|
813
|
+
if (!crypto) {
|
|
814
|
+
return await fail("Matrix crypto is not available (start client with encryption enabled)");
|
|
815
|
+
}
|
|
816
|
+
const trimmedRecoveryKey = rawRecoveryKey.trim();
|
|
817
|
+
if (!trimmedRecoveryKey) {
|
|
818
|
+
return await fail("Matrix recovery key is required");
|
|
819
|
+
}
|
|
820
|
+
try {
|
|
821
|
+
this.recoveryKeyStore.stageEncodedRecoveryKey({
|
|
822
|
+
encodedPrivateKey: trimmedRecoveryKey,
|
|
823
|
+
keyId: await this.resolveDefaultSecretStorageKeyId(crypto)
|
|
824
|
+
});
|
|
825
|
+
} catch (err) {
|
|
826
|
+
return await fail(formatMatrixErrorMessage(err));
|
|
827
|
+
}
|
|
828
|
+
try {
|
|
829
|
+
const cryptoBootstrapper = this.cryptoBootstrapper;
|
|
830
|
+
if (!cryptoBootstrapper) {
|
|
831
|
+
return await fail("Matrix crypto bootstrapper is not available");
|
|
832
|
+
}
|
|
833
|
+
await cryptoBootstrapper.bootstrap(crypto, {
|
|
834
|
+
allowAutomaticCrossSigningReset: false
|
|
835
|
+
});
|
|
836
|
+
await this.enableTrustedRoomKeyBackupIfPossible(crypto);
|
|
837
|
+
const status = await this.getOwnDeviceVerificationStatus();
|
|
838
|
+
if (!status.verified) {
|
|
839
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
840
|
+
return {
|
|
841
|
+
success: false,
|
|
842
|
+
error: "Matrix device is still not verified by its owner after applying the recovery key. Ensure cross-signing is available and the device is signed.",
|
|
843
|
+
...status
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
const backupError = resolveMatrixRoomKeyBackupReadinessError(status.backup, {
|
|
847
|
+
requireServerBackup: false
|
|
848
|
+
});
|
|
849
|
+
if (backupError) {
|
|
850
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
851
|
+
return {
|
|
852
|
+
success: false,
|
|
853
|
+
error: backupError,
|
|
854
|
+
...status
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
this.recoveryKeyStore.commitStagedRecoveryKey({
|
|
858
|
+
keyId: await this.resolveDefaultSecretStorageKeyId(crypto)
|
|
859
|
+
});
|
|
860
|
+
const committedStatus = await this.getOwnDeviceVerificationStatus();
|
|
861
|
+
return {
|
|
862
|
+
success: true,
|
|
863
|
+
verifiedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
864
|
+
...committedStatus
|
|
865
|
+
};
|
|
866
|
+
} catch (err) {
|
|
867
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
868
|
+
return await fail(formatMatrixErrorMessage(err));
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
async restoreRoomKeyBackup(params = {}) {
|
|
872
|
+
let loadedFromSecretStorage = false;
|
|
873
|
+
const fail = async (error) => {
|
|
874
|
+
const backup = await this.getRoomKeyBackupStatus();
|
|
875
|
+
return {
|
|
876
|
+
success: false,
|
|
877
|
+
error,
|
|
878
|
+
backupVersion: backup.serverVersion,
|
|
879
|
+
imported: 0,
|
|
880
|
+
total: 0,
|
|
881
|
+
loadedFromSecretStorage,
|
|
882
|
+
backup
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
if (!this.encryptionEnabled) {
|
|
886
|
+
return await fail("Matrix encryption is disabled for this client");
|
|
887
|
+
}
|
|
888
|
+
await this.ensureStartedForCryptoControlPlane();
|
|
889
|
+
const crypto = this.client.getCrypto();
|
|
890
|
+
if (!crypto) {
|
|
891
|
+
return await fail("Matrix crypto is not available (start client with encryption enabled)");
|
|
892
|
+
}
|
|
893
|
+
try {
|
|
894
|
+
const rawRecoveryKey = params.recoveryKey?.trim();
|
|
895
|
+
if (rawRecoveryKey) {
|
|
896
|
+
this.recoveryKeyStore.stageEncodedRecoveryKey({
|
|
897
|
+
encodedPrivateKey: rawRecoveryKey,
|
|
898
|
+
keyId: await this.resolveDefaultSecretStorageKeyId(crypto)
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
const backup = await this.getRoomKeyBackupStatus();
|
|
902
|
+
loadedFromSecretStorage = backup.keyLoadAttempted && !backup.keyLoadError;
|
|
903
|
+
const backupError = resolveMatrixRoomKeyBackupReadinessError(backup, {
|
|
904
|
+
requireServerBackup: true
|
|
905
|
+
});
|
|
906
|
+
if (backupError) {
|
|
907
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
908
|
+
return await fail(backupError);
|
|
909
|
+
}
|
|
910
|
+
if (typeof crypto.restoreKeyBackup !== "function") {
|
|
911
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
912
|
+
return await fail("Matrix crypto backend does not support full key backup restore");
|
|
913
|
+
}
|
|
914
|
+
const restore = await crypto.restoreKeyBackup();
|
|
915
|
+
if (rawRecoveryKey) {
|
|
916
|
+
this.recoveryKeyStore.commitStagedRecoveryKey({
|
|
917
|
+
keyId: await this.resolveDefaultSecretStorageKeyId(crypto)
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
const finalBackup = await this.getRoomKeyBackupStatus();
|
|
921
|
+
return {
|
|
922
|
+
success: true,
|
|
923
|
+
backupVersion: backup.serverVersion,
|
|
924
|
+
imported: typeof restore.imported === "number" ? restore.imported : 0,
|
|
925
|
+
total: typeof restore.total === "number" ? restore.total : 0,
|
|
926
|
+
loadedFromSecretStorage,
|
|
927
|
+
restoredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
928
|
+
backup: finalBackup
|
|
929
|
+
};
|
|
930
|
+
} catch (err) {
|
|
931
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
932
|
+
return await fail(formatMatrixErrorMessage(err));
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
async resetRoomKeyBackup() {
|
|
936
|
+
let previousVersion = null;
|
|
937
|
+
let deletedVersion = null;
|
|
938
|
+
const fail = async (error) => {
|
|
939
|
+
const backup = await this.getRoomKeyBackupStatus();
|
|
940
|
+
return {
|
|
941
|
+
success: false,
|
|
942
|
+
error,
|
|
943
|
+
previousVersion,
|
|
944
|
+
deletedVersion,
|
|
945
|
+
createdVersion: backup.serverVersion,
|
|
946
|
+
backup
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
if (!this.encryptionEnabled) {
|
|
950
|
+
return await fail("Matrix encryption is disabled for this client");
|
|
951
|
+
}
|
|
952
|
+
await this.ensureStartedForCryptoControlPlane();
|
|
953
|
+
const crypto = this.client.getCrypto();
|
|
954
|
+
if (!crypto) {
|
|
955
|
+
return await fail("Matrix crypto is not available (start client with encryption enabled)");
|
|
956
|
+
}
|
|
957
|
+
previousVersion = await this.resolveRoomKeyBackupVersion();
|
|
958
|
+
const forceNewSecretStorage = await this.shouldForceSecretStorageRecreationForBackupReset(crypto);
|
|
959
|
+
try {
|
|
960
|
+
if (previousVersion) {
|
|
961
|
+
try {
|
|
962
|
+
await this.doRequest(
|
|
963
|
+
"DELETE",
|
|
964
|
+
`/_lobi/client/v3/room_keys/version/${encodeURIComponent(previousVersion)}`
|
|
965
|
+
);
|
|
966
|
+
} catch (err) {
|
|
967
|
+
if (!isMatrixNotFoundError(err)) {
|
|
968
|
+
throw err;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
deletedVersion = previousVersion;
|
|
972
|
+
}
|
|
973
|
+
await this.recoveryKeyStore.bootstrapSecretStorageWithRecoveryKey(crypto, {
|
|
974
|
+
setupNewKeyBackup: true,
|
|
975
|
+
// Force SSSS recreation when the existing SSSS key is broken (bad MAC), so
|
|
976
|
+
// the new backup key is written into a fresh SSSS consistent with recovery_key.json.
|
|
977
|
+
forceNewSecretStorage,
|
|
978
|
+
// Also allow recreation if bootstrapSecretStorage itself surfaces a repairable
|
|
979
|
+
// error (e.g. bad MAC from a different SSSS entry).
|
|
980
|
+
allowSecretStorageRecreateWithoutRecoveryKey: true
|
|
981
|
+
});
|
|
982
|
+
await this.enableTrustedRoomKeyBackupIfPossible(crypto);
|
|
983
|
+
const backup = await this.getRoomKeyBackupStatus();
|
|
984
|
+
const createdVersion = backup.serverVersion;
|
|
985
|
+
if (!createdVersion) {
|
|
986
|
+
return await fail("Matrix room key backup is still missing after reset.");
|
|
987
|
+
}
|
|
988
|
+
if (backup.activeVersion !== createdVersion) {
|
|
989
|
+
return await fail(
|
|
990
|
+
"Matrix room key backup was recreated on the server but is not active on this device."
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
if (backup.decryptionKeyCached === false) {
|
|
994
|
+
return await fail(
|
|
995
|
+
"Matrix room key backup was recreated but its decryption key is not cached on this device."
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
if (backup.matchesDecryptionKey === false) {
|
|
999
|
+
return await fail(
|
|
1000
|
+
"Matrix room key backup was recreated but this device does not have the matching backup decryption key."
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
1003
|
+
if (backup.trusted === false) {
|
|
1004
|
+
return await fail(
|
|
1005
|
+
"Matrix room key backup was recreated but is not trusted on this device."
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
return {
|
|
1009
|
+
success: true,
|
|
1010
|
+
previousVersion,
|
|
1011
|
+
deletedVersion,
|
|
1012
|
+
createdVersion,
|
|
1013
|
+
resetAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1014
|
+
backup
|
|
1015
|
+
};
|
|
1016
|
+
} catch (err) {
|
|
1017
|
+
return await fail(formatMatrixErrorMessage(err));
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
async getOwnCrossSigningPublicationStatus() {
|
|
1021
|
+
const userId = this.client.getUserId() ?? this.selfUserId ?? null;
|
|
1022
|
+
if (!userId) {
|
|
1023
|
+
return {
|
|
1024
|
+
userId: null,
|
|
1025
|
+
masterKeyPublished: false,
|
|
1026
|
+
selfSigningKeyPublished: false,
|
|
1027
|
+
userSigningKeyPublished: false,
|
|
1028
|
+
published: false
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
try {
|
|
1032
|
+
const response = await this.doRequest("POST", "/_lobi/client/v3/keys/query", void 0, {
|
|
1033
|
+
device_keys: { [userId]: [] }
|
|
1034
|
+
});
|
|
1035
|
+
const masterKeyPublished = Boolean(response.master_keys?.[userId]);
|
|
1036
|
+
const selfSigningKeyPublished = Boolean(response.self_signing_keys?.[userId]);
|
|
1037
|
+
const userSigningKeyPublished = Boolean(response.user_signing_keys?.[userId]);
|
|
1038
|
+
return {
|
|
1039
|
+
userId,
|
|
1040
|
+
masterKeyPublished,
|
|
1041
|
+
selfSigningKeyPublished,
|
|
1042
|
+
userSigningKeyPublished,
|
|
1043
|
+
published: masterKeyPublished && selfSigningKeyPublished && userSigningKeyPublished
|
|
1044
|
+
};
|
|
1045
|
+
} catch {
|
|
1046
|
+
return {
|
|
1047
|
+
userId,
|
|
1048
|
+
masterKeyPublished: false,
|
|
1049
|
+
selfSigningKeyPublished: false,
|
|
1050
|
+
userSigningKeyPublished: false,
|
|
1051
|
+
published: false
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
async bootstrapOwnDeviceVerification(params) {
|
|
1056
|
+
const pendingVerifications = async () => this.crypto ? (await this.crypto.listVerifications()).length : 0;
|
|
1057
|
+
if (!this.encryptionEnabled) {
|
|
1058
|
+
return {
|
|
1059
|
+
success: false,
|
|
1060
|
+
error: "Matrix encryption is disabled for this client",
|
|
1061
|
+
verification: await this.getOwnDeviceVerificationStatus(),
|
|
1062
|
+
crossSigning: await this.getOwnCrossSigningPublicationStatus(),
|
|
1063
|
+
pendingVerifications: await pendingVerifications(),
|
|
1064
|
+
cryptoBootstrap: null
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
let bootstrapError;
|
|
1068
|
+
let bootstrapSummary = null;
|
|
1069
|
+
try {
|
|
1070
|
+
await this.ensureStartedForCryptoControlPlane();
|
|
1071
|
+
await this.ensureCryptoSupportInitialized();
|
|
1072
|
+
const crypto = this.client.getCrypto();
|
|
1073
|
+
if (!crypto) {
|
|
1074
|
+
throw new Error("Matrix crypto is not available (start client with encryption enabled)");
|
|
1075
|
+
}
|
|
1076
|
+
const rawRecoveryKey = params?.recoveryKey?.trim();
|
|
1077
|
+
if (rawRecoveryKey) {
|
|
1078
|
+
this.recoveryKeyStore.stageEncodedRecoveryKey({
|
|
1079
|
+
encodedPrivateKey: rawRecoveryKey,
|
|
1080
|
+
keyId: await this.resolveDefaultSecretStorageKeyId(crypto)
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
const cryptoBootstrapper = this.cryptoBootstrapper;
|
|
1084
|
+
if (!cryptoBootstrapper) {
|
|
1085
|
+
throw new Error("Matrix crypto bootstrapper is not available");
|
|
1086
|
+
}
|
|
1087
|
+
bootstrapSummary = await cryptoBootstrapper.bootstrap(
|
|
1088
|
+
crypto,
|
|
1089
|
+
createMatrixExplicitBootstrapOptions(params)
|
|
1090
|
+
);
|
|
1091
|
+
await this.ensureRoomKeyBackupEnabled(crypto);
|
|
1092
|
+
} catch (err) {
|
|
1093
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
1094
|
+
bootstrapError = formatMatrixErrorMessage(err);
|
|
1095
|
+
}
|
|
1096
|
+
const verification = await this.getOwnDeviceVerificationStatus();
|
|
1097
|
+
const crossSigning = await this.getOwnCrossSigningPublicationStatus();
|
|
1098
|
+
const verificationError = verification.verified && crossSigning.published ? null : bootstrapError ?? "Matrix verification bootstrap did not produce a device verified by its owner with published cross-signing keys";
|
|
1099
|
+
const backupError = verificationError === null ? resolveMatrixRoomKeyBackupReadinessError(verification.backup, {
|
|
1100
|
+
requireServerBackup: true
|
|
1101
|
+
}) : null;
|
|
1102
|
+
const success = verificationError === null && backupError === null;
|
|
1103
|
+
if (success) {
|
|
1104
|
+
this.recoveryKeyStore.commitStagedRecoveryKey({
|
|
1105
|
+
keyId: await this.resolveDefaultSecretStorageKeyId(
|
|
1106
|
+
this.client.getCrypto()
|
|
1107
|
+
)
|
|
1108
|
+
});
|
|
1109
|
+
} else {
|
|
1110
|
+
this.recoveryKeyStore.discardStagedRecoveryKey();
|
|
1111
|
+
}
|
|
1112
|
+
const error = success ? void 0 : backupError ?? verificationError ?? void 0;
|
|
1113
|
+
return {
|
|
1114
|
+
success,
|
|
1115
|
+
error,
|
|
1116
|
+
verification: success ? await this.getOwnDeviceVerificationStatus() : verification,
|
|
1117
|
+
crossSigning,
|
|
1118
|
+
pendingVerifications: await pendingVerifications(),
|
|
1119
|
+
cryptoBootstrap: bootstrapSummary
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
async listOwnDevices() {
|
|
1123
|
+
const currentDeviceId = this.client.getDeviceId()?.trim() || null;
|
|
1124
|
+
const devices = await this.client.getDevices();
|
|
1125
|
+
const entries = Array.isArray(devices?.devices) ? devices.devices : [];
|
|
1126
|
+
return entries.map((device) => ({
|
|
1127
|
+
deviceId: device.device_id,
|
|
1128
|
+
displayName: device.display_name?.trim() || null,
|
|
1129
|
+
lastSeenIp: device.last_seen_ip?.trim() || null,
|
|
1130
|
+
lastSeenTs: typeof device.last_seen_ts === "number" && Number.isFinite(device.last_seen_ts) ? device.last_seen_ts : null,
|
|
1131
|
+
current: currentDeviceId !== null && device.device_id === currentDeviceId
|
|
1132
|
+
}));
|
|
1133
|
+
}
|
|
1134
|
+
async deleteOwnDevices(deviceIds) {
|
|
1135
|
+
const uniqueDeviceIds = [...new Set(deviceIds.map((value) => value.trim()).filter(Boolean))];
|
|
1136
|
+
const currentDeviceId = this.client.getDeviceId()?.trim() || null;
|
|
1137
|
+
const protectedDeviceIds = uniqueDeviceIds.filter((deviceId) => deviceId === currentDeviceId);
|
|
1138
|
+
if (protectedDeviceIds.length > 0) {
|
|
1139
|
+
throw new Error(`Refusing to delete the current Matrix device: ${protectedDeviceIds[0]}`);
|
|
1140
|
+
}
|
|
1141
|
+
const deleteWithAuth = async (authData) => {
|
|
1142
|
+
await this.client.deleteMultipleDevices(uniqueDeviceIds, authData);
|
|
1143
|
+
};
|
|
1144
|
+
if (uniqueDeviceIds.length > 0) {
|
|
1145
|
+
try {
|
|
1146
|
+
await deleteWithAuth();
|
|
1147
|
+
} catch (err) {
|
|
1148
|
+
const session = err && typeof err === "object" && "data" in err && err.data && typeof err.data === "object" && "session" in err.data && typeof err.data.session === "string" ? err.data.session : null;
|
|
1149
|
+
const userId = await this.getUserId().catch(() => this.selfUserId);
|
|
1150
|
+
if (!session || !userId || !this.password?.trim()) {
|
|
1151
|
+
throw err;
|
|
1152
|
+
}
|
|
1153
|
+
await deleteWithAuth({
|
|
1154
|
+
type: "m.login.password",
|
|
1155
|
+
session,
|
|
1156
|
+
identifier: { type: "m.id.user", user: userId },
|
|
1157
|
+
password: this.password
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
return {
|
|
1162
|
+
currentDeviceId,
|
|
1163
|
+
deletedDeviceIds: uniqueDeviceIds,
|
|
1164
|
+
remainingDevices: await this.listOwnDevices()
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
async resolveActiveRoomKeyBackupVersion(crypto) {
|
|
1168
|
+
if (typeof crypto.getActiveSessionBackupVersion !== "function") {
|
|
1169
|
+
return null;
|
|
1170
|
+
}
|
|
1171
|
+
const version = await crypto.getActiveSessionBackupVersion().catch(() => null);
|
|
1172
|
+
return normalizeOptionalString(version);
|
|
1173
|
+
}
|
|
1174
|
+
async resolveCachedRoomKeyBackupDecryptionKey(crypto) {
|
|
1175
|
+
const getSessionBackupPrivateKey = crypto.getSessionBackupPrivateKey;
|
|
1176
|
+
if (typeof getSessionBackupPrivateKey !== "function") {
|
|
1177
|
+
return null;
|
|
1178
|
+
}
|
|
1179
|
+
const key = await getSessionBackupPrivateKey.call(crypto).catch(() => null);
|
|
1180
|
+
return key ? key.length > 0 : false;
|
|
1181
|
+
}
|
|
1182
|
+
async resolveRoomKeyBackupLocalState(crypto) {
|
|
1183
|
+
const [activeVersion, decryptionKeyCached] = await Promise.all([
|
|
1184
|
+
this.resolveActiveRoomKeyBackupVersion(crypto),
|
|
1185
|
+
this.resolveCachedRoomKeyBackupDecryptionKey(crypto)
|
|
1186
|
+
]);
|
|
1187
|
+
return { activeVersion, decryptionKeyCached };
|
|
1188
|
+
}
|
|
1189
|
+
async shouldForceSecretStorageRecreationForBackupReset(crypto) {
|
|
1190
|
+
const decryptionKeyCached = await this.resolveCachedRoomKeyBackupDecryptionKey(crypto);
|
|
1191
|
+
if (decryptionKeyCached !== false) {
|
|
1192
|
+
return false;
|
|
1193
|
+
}
|
|
1194
|
+
const loadSessionBackupPrivateKeyFromSecretStorage = crypto.loadSessionBackupPrivateKeyFromSecretStorage;
|
|
1195
|
+
if (typeof loadSessionBackupPrivateKeyFromSecretStorage !== "function") {
|
|
1196
|
+
return false;
|
|
1197
|
+
}
|
|
1198
|
+
try {
|
|
1199
|
+
await loadSessionBackupPrivateKeyFromSecretStorage.call(crypto);
|
|
1200
|
+
return false;
|
|
1201
|
+
} catch (err) {
|
|
1202
|
+
return isRepairableSecretStorageAccessError(err);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
async resolveRoomKeyBackupTrustState(crypto, fallbackVersion) {
|
|
1206
|
+
let serverVersion = fallbackVersion;
|
|
1207
|
+
let trusted = null;
|
|
1208
|
+
let matchesDecryptionKey = null;
|
|
1209
|
+
if (typeof crypto.getKeyBackupInfo === "function") {
|
|
1210
|
+
const info = await crypto.getKeyBackupInfo().catch(() => null);
|
|
1211
|
+
serverVersion = normalizeOptionalString(info?.version) ?? serverVersion;
|
|
1212
|
+
if (info && typeof crypto.isKeyBackupTrusted === "function") {
|
|
1213
|
+
const trustInfo = await crypto.isKeyBackupTrusted(info).catch(() => null);
|
|
1214
|
+
trusted = typeof trustInfo?.trusted === "boolean" ? trustInfo.trusted : null;
|
|
1215
|
+
matchesDecryptionKey = typeof trustInfo?.matchesDecryptionKey === "boolean" ? trustInfo.matchesDecryptionKey : null;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return { serverVersion, trusted, matchesDecryptionKey };
|
|
1219
|
+
}
|
|
1220
|
+
async resolveDefaultSecretStorageKeyId(crypto) {
|
|
1221
|
+
const getSecretStorageStatus = crypto?.getSecretStorageStatus;
|
|
1222
|
+
if (typeof getSecretStorageStatus !== "function") {
|
|
1223
|
+
return void 0;
|
|
1224
|
+
}
|
|
1225
|
+
const status = await getSecretStorageStatus.call(crypto).catch(() => null);
|
|
1226
|
+
return status?.defaultKeyId;
|
|
1227
|
+
}
|
|
1228
|
+
async resolveRoomKeyBackupVersion() {
|
|
1229
|
+
try {
|
|
1230
|
+
const response = await this.doRequest("GET", "/_lobi/client/v3/room_keys/version");
|
|
1231
|
+
return normalizeOptionalString(response.version);
|
|
1232
|
+
} catch {
|
|
1233
|
+
return null;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
async enableTrustedRoomKeyBackupIfPossible(crypto) {
|
|
1237
|
+
if (typeof crypto.checkKeyBackupAndEnable !== "function") {
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
await crypto.checkKeyBackupAndEnable();
|
|
1241
|
+
}
|
|
1242
|
+
async ensureRoomKeyBackupEnabled(crypto) {
|
|
1243
|
+
const existingVersion = await this.resolveRoomKeyBackupVersion();
|
|
1244
|
+
if (existingVersion) {
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
LogService.info(
|
|
1248
|
+
"MatrixClientLite",
|
|
1249
|
+
"No room key backup version found on server, creating one via secret storage bootstrap"
|
|
1250
|
+
);
|
|
1251
|
+
await this.recoveryKeyStore.bootstrapSecretStorageWithRecoveryKey(crypto, {
|
|
1252
|
+
setupNewKeyBackup: true
|
|
1253
|
+
});
|
|
1254
|
+
const createdVersion = await this.resolveRoomKeyBackupVersion();
|
|
1255
|
+
if (!createdVersion) {
|
|
1256
|
+
throw new Error("Matrix room key backup is still missing after bootstrap");
|
|
1257
|
+
}
|
|
1258
|
+
LogService.info("MatrixClientLite", `Room key backup enabled (version ${createdVersion})`);
|
|
1259
|
+
}
|
|
1260
|
+
registerBridge() {
|
|
1261
|
+
if (this.bridgeRegistered || !this.decryptBridge) {
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
this.bridgeRegistered = true;
|
|
1265
|
+
const decryptBridge = this.decryptBridge;
|
|
1266
|
+
this.client.on(ClientEvent.Event, (event) => {
|
|
1267
|
+
const roomId = event.getRoomId();
|
|
1268
|
+
if (!roomId) {
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
const raw = matrixEventToRaw(event);
|
|
1272
|
+
const isEncryptedEvent = raw.type === "m.room.encrypted";
|
|
1273
|
+
this.emitter.emit("room.event", roomId, raw);
|
|
1274
|
+
if (isEncryptedEvent) {
|
|
1275
|
+
this.emitter.emit("room.encrypted_event", roomId, raw);
|
|
1276
|
+
} else {
|
|
1277
|
+
if (decryptBridge.shouldEmitUnencryptedMessage(roomId, raw.event_id)) {
|
|
1278
|
+
this.emitter.emit("room.message", roomId, raw);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const stateKey = raw.state_key ?? "";
|
|
1282
|
+
const selfUserId = this.client.getUserId() ?? this.selfUserId ?? "";
|
|
1283
|
+
const membership = raw.type === "m.room.member" ? raw.content.membership : void 0;
|
|
1284
|
+
if (stateKey && selfUserId && stateKey === selfUserId) {
|
|
1285
|
+
if (membership === "invite") {
|
|
1286
|
+
this.emitter.emit("room.invite", roomId, raw);
|
|
1287
|
+
} else if (membership === "join") {
|
|
1288
|
+
this.emitter.emit("room.join", roomId, raw);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
if (isEncryptedEvent) {
|
|
1292
|
+
decryptBridge.attachEncryptedEvent(event, roomId);
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
this.client.on(ClientEvent.Room, (room) => {
|
|
1296
|
+
this.emitMembershipForRoom(room);
|
|
1297
|
+
});
|
|
1298
|
+
this.client.on(
|
|
1299
|
+
ClientEvent.Sync,
|
|
1300
|
+
(state, prevState, data) => {
|
|
1301
|
+
this.currentSyncState = state;
|
|
1302
|
+
const error = data && typeof data === "object" && "error" in data ? data.error : void 0;
|
|
1303
|
+
this.emitter.emit("sync.state", state, prevState, error);
|
|
1304
|
+
}
|
|
1305
|
+
);
|
|
1306
|
+
this.client.on(ClientEvent.SyncUnexpectedError, (error) => {
|
|
1307
|
+
this.emitter.emit("sync.unexpected_error", error);
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
emitMembershipForRoom(room) {
|
|
1311
|
+
const roomObj = room;
|
|
1312
|
+
const roomId = roomObj.roomId?.trim();
|
|
1313
|
+
if (!roomId) {
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
const membership = roomObj.getMyMembership?.() ?? roomObj.selfMembership ?? void 0;
|
|
1317
|
+
const selfUserId = this.client.getUserId() ?? this.selfUserId ?? "";
|
|
1318
|
+
if (!selfUserId) {
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
const raw = {
|
|
1322
|
+
event_id: `$membership-${roomId}-${Date.now()}`,
|
|
1323
|
+
type: "m.room.member",
|
|
1324
|
+
sender: selfUserId,
|
|
1325
|
+
state_key: selfUserId,
|
|
1326
|
+
content: { membership },
|
|
1327
|
+
origin_server_ts: Date.now(),
|
|
1328
|
+
unsigned: { age: 0 }
|
|
1329
|
+
};
|
|
1330
|
+
if (membership === "invite") {
|
|
1331
|
+
this.emitter.emit("room.invite", roomId, raw);
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
if (membership === "join") {
|
|
1335
|
+
this.emitter.emit("room.join", roomId, raw);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
emitOutstandingInviteEvents() {
|
|
1339
|
+
const listRooms = this.client.getRooms;
|
|
1340
|
+
if (typeof listRooms !== "function") {
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
const rooms = listRooms.call(this.client);
|
|
1344
|
+
if (!Array.isArray(rooms)) {
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
for (const room of rooms) {
|
|
1348
|
+
this.emitMembershipForRoom(room);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
async refreshDmCache() {
|
|
1352
|
+
const direct = await this.getAccountData("m.direct");
|
|
1353
|
+
this.dmRoomIds.clear();
|
|
1354
|
+
if (!direct || typeof direct !== "object") {
|
|
1355
|
+
return false;
|
|
1356
|
+
}
|
|
1357
|
+
for (const value of Object.values(direct)) {
|
|
1358
|
+
if (!Array.isArray(value)) {
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
for (const roomId of value) {
|
|
1362
|
+
if (typeof roomId === "string" && roomId.trim()) {
|
|
1363
|
+
this.dmRoomIds.add(roomId);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
return true;
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
export {
|
|
1371
|
+
ConsoleLogger,
|
|
1372
|
+
LogService,
|
|
1373
|
+
MatrixClient
|
|
1374
|
+
};
|
|
1375
|
+
//# sourceMappingURL=sdk.js.map
|