@abtnode/blocklet-services 1.16.54-beta-20251016-050817-2fc632b8 → 1.16.54-beta-20251021-070951-25e3083c
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/api/cache.js +1 -1
- package/api/emails/_components/asset.js +7 -2
- package/api/emails/_components/attachments.js +1 -1
- package/api/index.js +2 -0
- package/api/libs/connect/v1.js +2 -2
- package/api/libs/connect/v2.js +1 -1
- package/api/libs/email.js +1 -1
- package/api/libs/push-kit/index.js +2 -2
- package/api/middlewares/check-federated.js +4 -4
- package/api/middlewares/verify-sig.js +3 -2
- package/api/routes/blocklet.js +1 -1
- package/api/routes/federated.js +1 -1
- package/api/routes/mcp.js +1 -1
- package/api/routes/sign.js +388 -0
- package/api/routes/user.js +1 -1
- package/api/services/auth/connect/receive-transfer-app-owner.js +2 -2
- package/api/services/auth/session.js +2 -2
- package/api/services/notification/blocklet-events-notifier.js +1 -1
- package/api/services/notification/queue.js +2 -1
- package/api/socket/channel/component.js +1 -1
- package/api/socket/channel/did.js +1 -1
- package/api/socket/util.js +4 -2
- package/api/util/federated.js +1 -1
- package/api/util/index.js +1 -1
- package/dist/assets/{AdapterDayjs-DyE9ImrK.js → AdapterDayjs-_MgvkJfN.js} +1 -1
- package/dist/assets/{Google-ZJmTt04Y.js → Google-BqikEiR8.js} +1 -1
- package/dist/assets/{access-control-C5AwSG3T.js → access-control-BoqKXv8e.js} +1 -1
- package/dist/assets/{actions-C4-lIUPY.js → actions-DqoNrBDK.js} +1 -1
- package/dist/assets/add-component-core-sYAwjN9z.js +768 -0
- package/dist/assets/{add-resource-Brh4F6D2.js → add-resource-hzPcoJ0T.js} +1 -1
- package/dist/assets/{addon-DMW6BcQH.js → addon-CS6YZSHC.js} +2 -2
- package/dist/assets/{advanced-ykwSXzlQ.js → advanced-J_6wIjW2.js} +2 -2
- package/dist/assets/{aigne-DmDL-WLj.js → aigne-CxLs420v.js} +1 -1
- package/dist/assets/api-Btn0Tp3W.js +1 -0
- package/dist/assets/{appearance-CwaUUdyp.js → appearance-Bwlo2rIk.js} +1 -1
- package/dist/assets/{ar-Ge3t6oI2.js → ar-BQm9lQ4M.js} +1 -1
- package/dist/assets/{arrow-down.svg-D3B8bxxx.js → arrow-down.svg-D6V-7qfa.js} +1 -1
- package/dist/assets/audit-logs-drM5It_9.js +35 -0
- package/dist/assets/{authorize-CmneXxos.js → authorize-C2nAxV7L.js} +1 -1
- package/dist/assets/{base-chart-C_jLgGFD.js → base-chart-C-Raz4Q-.js} +1 -1
- package/dist/assets/{base32-Cg02gOuu.js → base32-ka8Vb9QP.js} +1 -1
- package/dist/assets/bind-account-BKkm4lat.js +1 -0
- package/dist/assets/{branding-B_eCdYJK.js → branding-BMzG8nKx.js} +5 -5
- package/dist/assets/branding-LL49PkTZ.js +1 -0
- package/dist/assets/{branding-DETOdgiW.js → branding-ZGJRfDDo.js} +1 -1
- package/dist/assets/{bundle-avatar-BFaxogKz.js → bundle-avatar-DLTX9h1v.js} +1 -1
- package/dist/assets/button-9InonP1B.js +1 -0
- package/dist/assets/click-to-copy-C1mF6WNf.js +1 -0
- package/dist/assets/{cloneDeep-gpb_g13N.js → cloneDeep-C6qewg0C.js} +1 -1
- package/dist/assets/{collapse-D7GlSZQp.js → collapse-BMy0GGFk.js} +1 -1
- package/dist/assets/{complete-Bqi3d0V1.js → complete-D-B5H4ek.js} +2 -2
- package/dist/assets/{component-CSPqPsOF.js → component-BRcD0ov6.js} +4 -4
- package/dist/assets/{config-BHZS65kz.js → config-BBtGnVxO.js} +1 -1
- package/dist/assets/{config-BWSyA18z.js → config-Cbg3z3uP.js} +4 -4
- package/dist/assets/{config-CPdtVTio.js → config-D_zbuwUO.js} +1 -1
- package/dist/assets/{config-navigation-BFsrGucq.js → config-navigation-C1GAik0L.js} +3 -3
- package/dist/assets/{config-space-CSl6D7xo.js → config-space-DAd9qYRh.js} +1 -1
- package/dist/assets/confirm-G3RZHlkC.js +7 -0
- package/dist/assets/{connect-BVXqic92.js → connect-BKAyVkDD.js} +1 -1
- package/dist/assets/{connect-FvriLilq.js → connect-BsaKZiRP.js} +1 -1
- package/dist/assets/connect-to-CEyhDVUe.js +1 -0
- package/dist/assets/{content-layout-W7JDm8iO.js → content-layout-oyz1EqNZ.js} +1 -1
- package/dist/assets/{create-passport-svg-BsR3hKFq.js → create-passport-svg-_Jak4aT3.js} +1 -1
- package/dist/assets/createClass-SqayuDE6.js +1 -0
- package/dist/assets/{dashboard-DyYLnek8.js → dashboard-DmRLgkA_.js} +2 -2
- package/dist/assets/{de-CbARTvf4.js → de-D0uPENSq.js} +1 -1
- package/dist/assets/{delete-confirm-DpKJ9gtf.js → delete-confirm-DfQxKTw0.js} +1 -1
- package/dist/assets/{did-address-BQL5Zxlr.js → did-address-CZak4Nzl.js} +1 -1
- package/dist/assets/domain-BAM622YE.js +9 -0
- package/dist/assets/{domain-action-card-CRdL2PFv.js → domain-action-card-CQGZ0jGR.js} +2 -2
- package/dist/assets/domains-CO0Aw1Yc.js +1 -0
- package/dist/assets/{email-OlQWpbtF.js → email-Dl8yxP6V.js} +1 -1
- package/dist/assets/{empty-spinner-sNq-0DF5.js → empty-spinner-DYOzicuy.js} +1 -1
- package/dist/assets/engine-9k0o50qZ.js +1 -0
- package/dist/assets/{es-CaCbzATO.js → es-Dh4_UfCu.js} +1 -1
- package/dist/assets/{exchange-passport-DK4-g9my.js → exchange-passport-D8yfPLJz.js} +1 -1
- package/dist/assets/{form-C5dLovtO.js → form-CNqHi73v.js} +3 -3
- package/dist/assets/{form-text-input-AIMlcRaM.js → form-text-input-BAs2p7bF.js} +1 -1
- package/dist/assets/{form-wrapper-DINLdpTN.js → form-wrapper-C8oo_Fdy.js} +1 -1
- package/dist/assets/{fr-B3yjKUFH.js → fr-CzZWQkiT.js} +1 -1
- package/dist/assets/{fuel-DkqmEB8D.js → fuel-CplPFp5J.js} +1 -1
- package/dist/assets/{gen-access-key-BnCg2Wu1.js → gen-access-key-BOCSj0Mk.js} +1 -1
- package/dist/assets/{gen-simple-access-key-zOQbFtZ8.js → gen-simple-access-key-BtXjt6B3.js} +1 -1
- package/dist/assets/get-safe-url-BFcRpP-P.js +1 -0
- package/dist/assets/{hi-q4mhHiIl.js → hi-Do9VCuRi.js} +1 -1
- package/dist/assets/{home-DTXdAvXT.js → home-C4yo5X5x.js} +1 -1
- package/dist/assets/{id-DTf7aVH8.js → id-Dhhrveu9.js} +1 -1
- package/dist/assets/{iframe-DAoobOBi.js → iframe-BnDsbRZG.js} +1 -1
- package/dist/assets/index-B-TqDd4N.js +6 -0
- package/dist/assets/{index-IGBGBXd_.js → index-B-Z_6Rom.js} +1 -1
- package/dist/assets/index-B4cuO9Xn.js +1 -0
- package/dist/assets/index-BF2QIyXe.js +1 -0
- package/dist/assets/{index-ve-p7nSZ.js → index-BXeml37I.js} +5 -5
- package/dist/assets/index-Bg7omuZF.js +120 -0
- package/dist/assets/index-BkN8Xhir.js +4 -0
- package/dist/assets/{index-DNGdj2R4.js → index-BnLQoeO-.js} +8 -8
- package/dist/assets/{index-DHQkab_n.js → index-Bq0J1vuR.js} +4 -4
- package/dist/assets/{index-DFceGCP0.js → index-C1Dar18k.js} +1 -1
- package/dist/assets/{index-D1thq8eN.js → index-C2BTIEUf.js} +6 -6
- package/dist/assets/index-C4jOkJlz.js +7 -0
- package/dist/assets/{index-D6Y3sCzN.js → index-C80zMKsC.js} +2 -2
- package/dist/assets/{index-Cs_I9KFa.js → index-CBUhK5iP.js} +7 -7
- package/dist/assets/index-CJ-XSW_L.js +281 -0
- package/dist/assets/{index-BJrVQ6ch.js → index-CVsqBtJa.js} +8 -8
- package/dist/assets/{index-C80JxCSn.js → index-CZin5K15.js} +1 -1
- package/dist/assets/{index-B6a6aopU.js → index-CjkeMMBV.js} +10 -10
- package/dist/assets/{index-D_vhPpT2.js → index-ClNZcPUD.js} +1 -1
- package/dist/assets/{index-Cr5RxnHu.js → index-CusWQN3w.js} +2 -2
- package/dist/assets/{index-iOD1kOar.js → index-D1efASvL.js} +4 -4
- package/dist/assets/{index-VySXxf4w.js → index-D5TNmV3K.js} +1 -1
- package/dist/assets/index-DBAtORvP.js +1 -0
- package/dist/assets/index-DGdrBC5v.js +55 -0
- package/dist/assets/index-DOKjY-HO.js +124 -0
- package/dist/assets/{index-rQAVknkX.js → index-DPyXKBMU.js} +1 -1
- package/dist/assets/{index-BdHbrnpK.js → index-DdsyasUE.js} +2 -2
- package/dist/assets/{index-DX3L95vz.js → index-De-Vgsb6.js} +1 -1
- package/dist/assets/{index-DlRa8Zeh.js → index-DsXcQxrF.js} +1 -1
- package/dist/assets/index-FASRIZyi.js +1039 -0
- package/dist/assets/{index-Cd_Gml9C.js → index-KLDWx9Xh.js} +1 -1
- package/dist/assets/{index-KpZGUssm.js → index-NomqB6Iy.js} +1 -1
- package/dist/assets/{index-DeVDiUjo.js → index-SEBP2NIP.js} +1 -1
- package/dist/assets/index-XxymBn5U.js +29 -0
- package/dist/assets/{invitation-P1aXUnIO.js → invitation-BUnl3HPw.js} +2 -2
- package/dist/assets/{invitations-dPkgiFPr.js → invitations-C4hW9Ss3.js} +1 -1
- package/dist/assets/{invite-Bz99qCDF.js → invite-C3ahxxD9.js} +1 -1
- package/dist/assets/{isURL-DYsELTMk.js → isURL-2pkMgw7e.js} +2 -2
- package/dist/assets/{issue-passport-DPyxNFLD.js → issue-passport-Ciq2eM7I.js} +1 -1
- package/dist/assets/{item-B1UaStjk.js → item-O0rUCXMz.js} +1 -1
- package/dist/assets/{ja-Csh_XwzF.js → ja-B70UYq5X.js} +1 -1
- package/dist/assets/{ko-xiNTwgO9.js → ko-C7TZwmXC.js} +1 -1
- package/dist/assets/{landing-page-CkVnGimh.js → landing-page-CG20_HOe.js} +1 -1
- package/dist/assets/{launch-result-message-Dt-T7zmz.js → launch-result-message-DWeUg9rM.js} +1 -1
- package/dist/assets/{layout-fFNOz6Xe.js → layout-1o45g_uH.js} +1 -1
- package/dist/assets/list-C71-rjVf.js +2 -0
- package/dist/assets/list-DINgkvuD.js +103 -0
- package/dist/assets/{list-header-CjohGZ9B.js → list-header-BE2kzda_.js} +1 -1
- package/dist/assets/localization-DYkMU0eo.js +1 -0
- package/dist/assets/{log-lPrpnnPZ.js → log-DqmR8QgI.js} +1 -1
- package/dist/assets/logger-oH4RP6-F.js +1 -0
- package/dist/assets/login-BI9XDtGo.js +1 -0
- package/dist/assets/{login-oauth-callback-DebmT1Db.js → login-oauth-callback-DtnKE3JA.js} +1 -1
- package/dist/assets/{logo-uploader-3OpHGD1n.js → logo-uploader-B4ZyAHbx.js} +1 -1
- package/dist/assets/{lost-passport-xCmWuuxC.js → lost-passport-Bjk0xMLc.js} +3 -3
- package/dist/assets/{observability-B458LeIE.js → observability-Zow0Sv-X.js} +1 -1
- package/dist/assets/{omit-DdfLLBNW.js → omit-hhiOJGRf.js} +1 -1
- package/dist/assets/{open-window-CzYfI7l7.js → open-window-Dtxc-Syt.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-C5fynimj.js → over-due-invoice-payment-Bk50hmsa.js} +1 -1
- package/dist/assets/{overview-BFzvEbcq.js → overview-CknecGQX.js} +2 -2
- package/dist/assets/{page-header-gosgJ3fX.js → page-header-DCvzRay5.js} +1 -1
- package/dist/assets/passport-C1l7yRXa.js +1 -0
- package/dist/assets/passport-item-Dysdq_0a.js +1 -0
- package/dist/assets/{permission-UeJPGiMm.js → permission-YVbPVhS_.js} +1 -1
- package/dist/assets/{playground-_1Dj8J_h.js → playground-CAOOFQT1.js} +1 -1
- package/dist/assets/preferences-BnD1O3qZ.js +1 -0
- package/dist/assets/profile-embed-C-sTb3pJ.js +1 -0
- package/dist/assets/{pt-BvcG4R7B.js → pt-DObJ_ADK.js} +1 -1
- package/dist/assets/publish-resource-DyVr3uUG.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CIwtis6a.js → react-beautiful-dnd.esm-sCK871VJ.js} +1 -1
- package/dist/assets/{react-stripe.esm-omsK4b05.js → react-stripe.esm-Dc9snvfb.js} +1 -1
- package/dist/assets/{required-BPzIdi1N.js → required-BGaDOGrj.js} +1 -1
- package/dist/assets/revoke.svg-CmffMlcP.js +1 -0
- package/dist/assets/{ru-DzUPRLmr.js → ru-nYDmEUmY.js} +1 -1
- package/dist/assets/runtime-CRB33yxr.js +1 -0
- package/dist/assets/{sanitize-CEXE1rEu.js → sanitize-BEqBHa8a.js} +1 -1
- package/dist/assets/sdk-Cl2zdl3A.js +1 -0
- package/dist/assets/{section-DOw43pby.js → section-C75bzkkL.js} +1 -1
- package/dist/assets/security-cMS5Z8Ta.js +22 -0
- package/dist/assets/{session-Dnp_ufkx.js → session-Chl38-LD.js} +1 -1
- package/dist/assets/{setup-DpBiTcjv.js → setup-C01-2uXI.js} +1 -1
- package/dist/assets/{shorten-label-C-X_7vr2.js → shorten-label-RqvHqcC3.js} +1 -1
- package/dist/assets/simple-select-DN_9r-L2.js +1 -0
- package/dist/assets/{spaces-Bu7-7u79.js → spaces-BH2l_OkZ.js} +1 -1
- package/dist/assets/{start-B1qawsPb.js → start-BFh5jV0q.js} +1 -1
- package/dist/assets/{starting-progress-BfM3wNuj.js → starting-progress-bX2MhHI_.js} +1 -1
- package/dist/assets/status-Cchdz2Py.js +1 -0
- package/dist/assets/{step-actions-BzwezgI2.js → step-actions-CcUwY5bt.js} +1 -1
- package/dist/assets/{studio-Bk9PCaeS.js → studio-C0FYSJNq.js} +1 -1
- package/dist/assets/{switch-control-CRxlGq2g.js → switch-control-Bn_HYEC5.js} +1 -1
- package/dist/assets/{table-tips-BMq3WO_p.js → table-tips-Crqym4Bn.js} +1 -1
- package/dist/assets/team-Bje0MaMX.js +146 -0
- package/dist/assets/{th-BmW1qKpZ.js → th-DMcUw_9_.js} +1 -1
- package/dist/assets/traffic-CeSX-kN3.js +1 -0
- package/dist/assets/{transfer-CUe_bnhh.js → transfer-Ja2mKjqd.js} +2 -2
- package/dist/assets/ua-parser-DP5omx3I.js +1 -0
- package/dist/assets/{unsubscribe-5Z1xcJ3T.js → unsubscribe-Dmbg53P8.js} +1 -1
- package/dist/assets/{use-app-logo-0uziDh86.js → use-app-logo-DhmCQsWv.js} +1 -1
- package/dist/assets/{use-mobile-DLnLSQQq.js → use-mobile-DCNBsOlH.js} +1 -1
- package/dist/assets/{use-mobile-Db5FIl07.js → use-mobile-maRlSUwU.js} +1 -1
- package/dist/assets/{use-server-logo-CFlVReBS.js → use-server-logo-n_aaKVoZ.js} +1 -1
- package/dist/assets/{use-window-close-CrHmRyVV.js → use-window-close-CYqH6r-n.js} +1 -1
- package/dist/assets/{useAsync-BKYfrNw7.js → useAsync-BcVLpt2E.js} +1 -1
- package/dist/assets/{useAsync-1_z8P8M4.js → useAsync-cZ_FPf9k.js} +1 -1
- package/dist/assets/{useAsyncRetry-Dyo5t1bq.js → useAsyncRetry-DwwEjrjs.js} +1 -1
- package/dist/assets/{useLocalStorage-Be_1V0gr.js → useLocalStorage-BIH12-5o.js} +1 -1
- package/dist/assets/user-center-_0Nuo2NC.js +126 -0
- package/dist/assets/user-follower-rI_4OXB_.js +32 -0
- package/dist/assets/{util-DXaZWduO.js → util-CVi4JaWM.js} +1 -1
- package/dist/assets/{util-CQfGbjyT.js → util-LPNcvj77.js} +1 -1
- package/dist/assets/{vendor-arcblock-DGOH9a3F.js → vendor-arcblock-DVRwGBYP.js} +114 -115
- package/dist/assets/{vendor-hooks-DmThWyyG.js → vendor-hooks-CjESGRlR.js} +2 -2
- package/dist/assets/{vendor-mui-core-BFPsXaTR.js → vendor-mui-core-CnXrAOs3.js} +1 -1
- package/dist/assets/{vendor-mui-x-C6iZOJbV.js → vendor-mui-x-bJ5idfMH.js} +1 -1
- package/dist/assets/vendor-utils-cJEl_UEd.js +213 -0
- package/dist/assets/{vendor-ux-CE4sOH7O.js → vendor-ux-DtnxszG_.js} +126 -133
- package/dist/assets/{vi-BPU54RQW.js → vi-B73oWQBC.js} +1 -1
- package/dist/assets/{wait-connect-Rle27g9O.js → wait-connect-DDuMthnp.js} +1 -1
- package/dist/assets/{wizard-CewJTR0V.js → wizard-Boblk5Le.js} +1 -1
- package/dist/assets/{wizard-components-B4yvBYZF.js → wizard-components-DxHb4Zui.js} +1 -1
- package/dist/assets/wrap-locale-DTDVuPVv.js +1 -0
- package/dist/assets/{zh-Bg-a-bz5.js → zh-CeqvJ1eC.js} +1 -1
- package/dist/assets/{zh-WrFfMVyM.js → zh-DCABA61W.js} +1 -1
- package/dist/assets/{zh-tw-DjWFpq-W.js → zh-tw-M_0Y4wmR.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +49 -48
- package/dist/assets/add-component-core-CrZWbFmf.js +0 -768
- package/dist/assets/api-txzyyizM.js +0 -1
- package/dist/assets/audit-logs-eJR1v94e.js +0 -35
- package/dist/assets/bind-account-B_UMGXib.js +0 -1
- package/dist/assets/branding-CHRz3wuZ.js +0 -1
- package/dist/assets/button-CaqBEwnu.js +0 -1
- package/dist/assets/click-to-copy-CK42VmRr.js +0 -1
- package/dist/assets/confirm-CEAKWDZJ.js +0 -7
- package/dist/assets/connect-to-dZwJX0bt.js +0 -1
- package/dist/assets/createClass-B4I2IV47.js +0 -1
- package/dist/assets/domain-Bq75ZuOm.js +0 -9
- package/dist/assets/domains-BiIZZN7p.js +0 -1
- package/dist/assets/engine-B1U2TY7M.js +0 -1
- package/dist/assets/get-safe-url-3Xj-tgXY.js +0 -1
- package/dist/assets/index-3yzleS_1.js +0 -1041
- package/dist/assets/index-BcGECSaf.js +0 -1
- package/dist/assets/index-Bgt2qHLn.js +0 -30
- package/dist/assets/index-CDCcuLh3.js +0 -7
- package/dist/assets/index-CZp06HHE.js +0 -281
- package/dist/assets/index-D9QTZSnh.js +0 -1
- package/dist/assets/index-DJj8GmQS.js +0 -6
- package/dist/assets/index-D_HqsEfj.js +0 -4
- package/dist/assets/index-D_s4QOu7.js +0 -1
- package/dist/assets/index-Dfmjh5-5.js +0 -124
- package/dist/assets/index-LeqLm9hN.js +0 -55
- package/dist/assets/index-RD-gFG7U.js +0 -113
- package/dist/assets/list-C-9EwvIL.js +0 -2
- package/dist/assets/list-CX2Q1hbc.js +0 -103
- package/dist/assets/localization-DQioZq4I.js +0 -1
- package/dist/assets/logger-DkBs7Soy.js +0 -1
- package/dist/assets/login-63olb_gZ.js +0 -1
- package/dist/assets/passport-BLmrTDdo.js +0 -1
- package/dist/assets/passport-item-CBB6usyJ.js +0 -1
- package/dist/assets/preferences-Da8NATLw.js +0 -1
- package/dist/assets/profile-embed-9LLnCulK.js +0 -1
- package/dist/assets/publish-resource-Chyv1Trw.js +0 -1
- package/dist/assets/runtime-iwxdTEke.js +0 -1
- package/dist/assets/sdk-D4xzRwM9.js +0 -1
- package/dist/assets/security-D4Sx6wQO.js +0 -22
- package/dist/assets/simple-select-Bg4XC1E_.js +0 -1
- package/dist/assets/status-LEG00uGL.js +0 -1
- package/dist/assets/team-DmYSbFMF.js +0 -146
- package/dist/assets/traffic-CzxoP9Vj.js +0 -1
- package/dist/assets/user-center-u6FpYGow.js +0 -126
- package/dist/assets/user-follower-CyGK-1so.js +0 -32
- package/dist/assets/user-sessions-4qrRIOb8.js +0 -1
- package/dist/assets/vendor-utils-OrZFrHBP.js +0 -213
- package/dist/assets/wrap-locale-qW2Nj5Kt.js +0 -1
package/api/cache.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { DBCache, getAbtNodeRedisAndSQLiteUrl } = require('@abtnode/db-cache');
|
|
2
2
|
const nodemailer = require('nodemailer');
|
|
3
3
|
const { LRUCache } = require('lru-cache');
|
|
4
|
-
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
4
|
+
const { getBlockletInfo } = require('@blocklet/meta/lib/info');
|
|
5
5
|
const { fromJSON } = require('@ocap/wallet');
|
|
6
6
|
|
|
7
7
|
const CACHE_TTL = 60 * 60 * 1000;
|
|
@@ -4,10 +4,15 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
4
4
|
const components_1 = require("@react-email/components");
|
|
5
5
|
const chain_1 = require("../_libs/chain");
|
|
6
6
|
const style_1 = require("../_libs/style");
|
|
7
|
-
function Asset({ locale, data, }) {
|
|
7
|
+
function Asset({ locale, data, type = 'vc', }) {
|
|
8
8
|
const title = { zh: '接收', en: 'Received' }[locale] || 'Received';
|
|
9
9
|
const chainHost = (0, chain_1.getUrlHost)(data.chainHost) || (0, chain_1.getChainHost)(data.chainId);
|
|
10
10
|
const url = `https://${chainHost}/explorer/assets/${data.did}`;
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)("a", { href: url, target: "_blank", style: Object.assign(Object.assign({}, style_1.assetStyle), { margin: '1em 0', textDecoration: 'none', color: 'initial', display: 'block' }),
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("a", { href: url, target: "_blank", style: Object.assign(Object.assign({}, style_1.assetStyle), { margin: '1em 0', textDecoration: 'none', color: 'initial', display: 'block' }), onClick: (e) => {
|
|
12
|
+
if (type === 'vc') {
|
|
13
|
+
e.preventDefault();
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}, children: [(0, jsx_runtime_1.jsxs)(components_1.Row, { style: style_1.titleStyle, children: [(0, jsx_runtime_1.jsx)(components_1.Column, { children: title }), (0, jsx_runtime_1.jsx)(components_1.Column, { align: "right", style: style_1.summaryStyle, children: "+1 Asset" })] }), (0, jsx_runtime_1.jsx)(components_1.Text, { style: style_1.remarkStyle, children: data.did })] }));
|
|
12
17
|
}
|
|
13
18
|
exports.default = Asset;
|
|
@@ -41,7 +41,7 @@ function Attachments({ locale, severity = 'normal', attachments = [], }) {
|
|
|
41
41
|
return (0, jsx_runtime_1.jsx)(components_1.Hr, {}, `${item.type}-${index}`);
|
|
42
42
|
case 'vc':
|
|
43
43
|
case 'asset':
|
|
44
|
-
return (0, jsx_runtime_1.jsx)(asset_1.default, { data: item.data, locale: locale }, `${item.type}-${index}`);
|
|
44
|
+
return (0, jsx_runtime_1.jsx)(asset_1.default, { type: item.type, data: item.data, locale: locale }, `${item.type}-${index}`);
|
|
45
45
|
case 'section':
|
|
46
46
|
return (0, jsx_runtime_1.jsx)(compose_1.default, { data: item.fields }, `${item.type}-${index}`);
|
|
47
47
|
default:
|
package/api/index.js
CHANGED
|
@@ -88,6 +88,7 @@ const createOpenEventRoutes = require('./routes/openevent');
|
|
|
88
88
|
const createOpenComponentRoutes = require('./routes/opencomponent');
|
|
89
89
|
const createOpenEmbedRoutes = require('./routes/openembed');
|
|
90
90
|
const createAccessKeyRoutes = require('./routes/access-key');
|
|
91
|
+
const createSignRoutes = require('./routes/sign');
|
|
91
92
|
const checkRunning = require('./middlewares/check-running');
|
|
92
93
|
const { launcherLogin } = require('./middlewares/launcher-login');
|
|
93
94
|
const { checkMemberPermission, checkGuestPermission } = require('./middlewares/check-permission');
|
|
@@ -800,6 +801,7 @@ self.blocklet = {
|
|
|
800
801
|
createCspProxyRoutes.init(server);
|
|
801
802
|
createUserSessionRoutes.init(server, node, options);
|
|
802
803
|
createEnvRoutes.init(server, node, options);
|
|
804
|
+
createSignRoutes.init(server, node, options);
|
|
803
805
|
createBlockletRoutes.init(server, node);
|
|
804
806
|
createConnectSessionRoutes.init(server, node, options);
|
|
805
807
|
createConnectRelayRoutes.init(server, node, options, wsRouter);
|
package/api/libs/connect/v1.js
CHANGED
|
@@ -4,8 +4,8 @@ const { toAddress } = require('@ocap/util');
|
|
|
4
4
|
const { WalletAuthenticator } = require('@arcblock/did-connect-js');
|
|
5
5
|
const { types } = require('@ocap/mcrypto');
|
|
6
6
|
const { getBlockletAppIdList } = require('@blocklet/meta/lib/util');
|
|
7
|
-
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
8
|
-
const WalletHandlers = require('@blocklet/sdk
|
|
7
|
+
const { getBlockletInfo } = require('@blocklet/meta/lib/info');
|
|
8
|
+
const { WalletHandlers } = require('@blocklet/sdk');
|
|
9
9
|
const { getDelegation } = require('@blocklet/sdk/lib/connect/shared');
|
|
10
10
|
const { sendToUser, sendToRelay } = require('@blocklet/sdk/lib/util/send-notification');
|
|
11
11
|
const { WELLKNOWN_SERVICE_PATH_PREFIX } = require('@abtnode/constant');
|
package/api/libs/connect/v2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const DynamicStorage = require('@abtnode/connect-storage');
|
|
3
3
|
const { Authenticator } = require('@did-connect/authenticator');
|
|
4
|
-
const createHandlers = require('@blocklet/sdk/lib/connect/handler');
|
|
4
|
+
const { createConnectHandlers: createHandlers } = require('@blocklet/sdk/lib/connect/handler');
|
|
5
5
|
const { sendToUser } = require('@blocklet/sdk/lib/util/send-notification');
|
|
6
6
|
const { WELLKNOWN_SERVICE_PATH_PREFIX } = require('@abtnode/constant');
|
|
7
7
|
|
package/api/libs/email.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { Joi } = require('@arcblock/validator');
|
|
2
2
|
const { render } = require('@react-email/components');
|
|
3
|
-
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
3
|
+
const { getBlockletInfo } = require('@blocklet/meta/lib/info');
|
|
4
4
|
const { getEmailServiceProvider, getEmailSignatureConfig } = require('@abtnode/auth/lib/email');
|
|
5
5
|
const { sendEmailWithLauncher } = require('@abtnode/auth/lib/launcher');
|
|
6
6
|
const { isActivityIncluded } = require('@abtnode/util/lib/notification-preview/util');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const uniqWith = require('lodash/uniqWith');
|
|
2
2
|
const { getSignData } = require('@blocklet/sdk/lib/util/verify-sign');
|
|
3
|
-
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
3
|
+
const { getBlockletInfo } = require('@blocklet/meta/lib/info');
|
|
4
4
|
const { joinURL } = require('ufo');
|
|
5
5
|
const pRetry = require('p-retry');
|
|
6
6
|
const pMap = require('p-map');
|
|
@@ -88,7 +88,7 @@ async function sendPush(receiver, notification, { node, teamDid }) {
|
|
|
88
88
|
|
|
89
89
|
const blockletInfo = getBlockletInfo(blocklet);
|
|
90
90
|
|
|
91
|
-
const { iat, exp, sig, version } = getSignData(
|
|
91
|
+
const { iat, exp, sig, version } = await getSignData(
|
|
92
92
|
{
|
|
93
93
|
data: {
|
|
94
94
|
targets: filterTargets,
|
|
@@ -11,7 +11,7 @@ const logger = require('../libs/logger')('check-federated');
|
|
|
11
11
|
* @param {Array<'pending'|'approved'|'rejected'|'revoked'>} options.allowStatus
|
|
12
12
|
*/
|
|
13
13
|
function checkFederatedCall({ mode = 'all', allowStatus = ['approved', 'revoked'] } = {}) {
|
|
14
|
-
return (req, res, next) => {
|
|
14
|
+
return async (req, res, next) => {
|
|
15
15
|
const { blocklet } = req;
|
|
16
16
|
if (!blocklet) {
|
|
17
17
|
res.status(400).send('blocklet not exists');
|
|
@@ -58,7 +58,7 @@ function checkFederatedCall({ mode = 'all', allowStatus = ['approved', 'revoked'
|
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const verified = verify(data, sig, {
|
|
61
|
+
const verified = await verify(data, sig, {
|
|
62
62
|
appPk: sigPk,
|
|
63
63
|
});
|
|
64
64
|
if (!verified) {
|
|
@@ -76,7 +76,7 @@ function checkFederatedCall({ mode = 'all', allowStatus = ['approved', 'revoked'
|
|
|
76
76
|
|
|
77
77
|
// DEPRECATED: @zhanghan 在 1.16.35 发布时移除旧版本的兼容
|
|
78
78
|
function checkFederatedCallLegacy({ mode = 'all', allowStatus = ['approved', 'revoked'] } = {}) {
|
|
79
|
-
return (req, res, next) => {
|
|
79
|
+
return async (req, res, next) => {
|
|
80
80
|
const { blocklet } = req;
|
|
81
81
|
if (!blocklet) {
|
|
82
82
|
res.status(400).send('blocklet not exists');
|
|
@@ -125,7 +125,7 @@ function checkFederatedCallLegacy({ mode = 'all', allowStatus = ['approved', 're
|
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
if (!jwt.verify(data, validSite.pk)) {
|
|
128
|
+
if (!(await jwt.verify(data, validSite.pk))) {
|
|
129
129
|
res.status(401).send('Invalid signature during federated call');
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
@@ -11,10 +11,11 @@ const verifySig = async (req, res, next) => {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const verified = verify(data, sig, {
|
|
14
|
+
const verified = await verify(data, sig, {
|
|
15
15
|
// NOTICE: blocklet-service 的运行环境中不包含以下环境变量,必须从 blocklet 信息中去获取并传递
|
|
16
16
|
type: blocklet.environmentObj.BLOCKLET_APP_CHAIN_TYPE,
|
|
17
|
-
|
|
17
|
+
// Compatible with previous version where APP_ASK does not exist
|
|
18
|
+
appSk: blocklet.environmentObj.BLOCKLET_APP_ASK || blocklet.environmentObj.BLOCKLET_APP_SK,
|
|
18
19
|
});
|
|
19
20
|
if (!verified) {
|
|
20
21
|
logger.error('verify sig failed', { data, sig });
|
package/api/routes/blocklet.js
CHANGED
|
@@ -251,7 +251,7 @@ module.exports = {
|
|
|
251
251
|
|
|
252
252
|
// send notification to wallet
|
|
253
253
|
const receiver = userDid;
|
|
254
|
-
const token = JWT.sign(wallet.address, wallet.secretKey);
|
|
254
|
+
const token = await JWT.sign(wallet.address, wallet.secretKey);
|
|
255
255
|
|
|
256
256
|
// send passport to wallet if no passport for this user
|
|
257
257
|
const role = ROLES.OWNER;
|
package/api/routes/federated.js
CHANGED
|
@@ -377,7 +377,7 @@ module.exports = {
|
|
|
377
377
|
const { blocklet, verifySite } = req;
|
|
378
378
|
const teamDid = blocklet.appPid;
|
|
379
379
|
const { permanentWallet } = await req.getBlockletInfo();
|
|
380
|
-
const delegation = signV2(permanentWallet.address, permanentWallet.secretKey, {
|
|
380
|
+
const delegation = await signV2(permanentWallet.address, permanentWallet.secretKey, {
|
|
381
381
|
// HACK: 钱包签名使用的始终是最新的,这里的 dalegation 也保持 agentDid 就是当前应用最新的 did(appId)
|
|
382
382
|
agentDid: `did:abt:${verifySite.appId}`,
|
|
383
383
|
permissions: [
|
package/api/routes/mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { WELLKNOWN_SERVICE_PATH_PREFIX, SECURITY_RULE_DEFAULT_ID } = require('@abtnode/constant');
|
|
2
2
|
const { joinURL } = require('ufo');
|
|
3
3
|
const get = require('lodash/get');
|
|
4
|
-
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
4
|
+
const { getBlockletInfo } = require('@blocklet/meta/lib/info');
|
|
5
5
|
const { checkPublicAccess } = require('@blocklet/meta/lib/util');
|
|
6
6
|
// eslint-disable-next-line import/no-unresolved
|
|
7
7
|
const { StreamableHTTPServerTransport } = require('@modelcontextprotocol/sdk/server/streamableHttp.js');
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
const stableStringify = require('json-stable-stringify');
|
|
2
|
+
const { fromSecretKey, WalletType } = require('@ocap/wallet');
|
|
3
|
+
const { types } = require('@ocap/mcrypto');
|
|
4
|
+
const { DidType, isEthereumType } = require('@arcblock/did');
|
|
5
|
+
const { WELLKNOWN_SERVICE_PATH_PREFIX } = require('@abtnode/constant');
|
|
6
|
+
const JWT = require('@arcblock/jwt');
|
|
7
|
+
const { formatError } = require('@blocklet/error');
|
|
8
|
+
const { fromAppDid } = require('@arcblock/did-ext');
|
|
9
|
+
const formatContext = require('@abtnode/util/lib/format-context');
|
|
10
|
+
const { getComponentApiKey } = require('@abtnode/util/lib/blocklet');
|
|
11
|
+
const { findComponentByIdV2 } = require('@blocklet/meta/lib/util');
|
|
12
|
+
|
|
13
|
+
const ensureBlocklet = require('../middlewares/ensure-blocklet');
|
|
14
|
+
const logger = require('../libs/logger')('blocklet-services:sign');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Middleware to ensure request comes from localhost only
|
|
18
|
+
*/
|
|
19
|
+
function ensureLocalhost(req, res, next) {
|
|
20
|
+
const ip = req.ip || req.connection.remoteAddress || req.socket.remoteAddress;
|
|
21
|
+
|
|
22
|
+
const isLocalhost = ip === '127.0.0.1' || ip === '::1' || ip === '::ffff:127.0.0.1' || ip === 'localhost';
|
|
23
|
+
|
|
24
|
+
// Check if the request is from private network (RFC 1918)
|
|
25
|
+
// 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
|
|
26
|
+
const isPrivateNetwork = /^10\./.test(ip) || /^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(ip) || /^192\.168\./.test(ip);
|
|
27
|
+
|
|
28
|
+
// Check if the request is from localhost
|
|
29
|
+
if (!isLocalhost && !isPrivateNetwork) {
|
|
30
|
+
logger.warn('Rejected non-localhost request to signing API', {
|
|
31
|
+
ip,
|
|
32
|
+
path: req.path,
|
|
33
|
+
});
|
|
34
|
+
res.status(403).json({ error: 'Signing API is only accessible from localhost' });
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
next();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Middleware to verify component API key
|
|
43
|
+
*/
|
|
44
|
+
function ensureComponentApiKey(req, res, next) {
|
|
45
|
+
(async () => {
|
|
46
|
+
try {
|
|
47
|
+
const { blocklet } = req;
|
|
48
|
+
const { apiKey } = req.body || {};
|
|
49
|
+
|
|
50
|
+
// Get component ID from header
|
|
51
|
+
const componentId = req.headers['x-component-did'];
|
|
52
|
+
if (!componentId) {
|
|
53
|
+
res.status(400).json({ error: 'Missing x-component-did header' });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Find component in blocklet
|
|
58
|
+
const component = findComponentByIdV2(blocklet, componentId);
|
|
59
|
+
if (!component) {
|
|
60
|
+
logger.warn('Component not found', {
|
|
61
|
+
blockletDid: blocklet?.meta?.did,
|
|
62
|
+
componentId,
|
|
63
|
+
});
|
|
64
|
+
res.status(404).json({ error: 'Component not found' });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const nodeInfo = await req.getNodeInfo();
|
|
69
|
+
|
|
70
|
+
// Calculate expected component API key
|
|
71
|
+
const componentApiKey = getComponentApiKey({
|
|
72
|
+
serverSk: nodeInfo.sk,
|
|
73
|
+
app: blocklet,
|
|
74
|
+
component,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Verify API key
|
|
78
|
+
if (!apiKey || componentApiKey !== apiKey) {
|
|
79
|
+
logger.warn('Component API key verification failed', {
|
|
80
|
+
blockletDid: blocklet?.meta?.did,
|
|
81
|
+
componentId,
|
|
82
|
+
});
|
|
83
|
+
res.status(401).json({ error: 'Invalid component API key' });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
next();
|
|
88
|
+
} catch (error) {
|
|
89
|
+
logger.error('Component API key verification error', {
|
|
90
|
+
error,
|
|
91
|
+
blockletDid: req?.blocklet?.meta?.did,
|
|
92
|
+
componentId: req.headers['x-component-did'],
|
|
93
|
+
});
|
|
94
|
+
res.status(500).json({ error: 'Failed to verify component API key' });
|
|
95
|
+
}
|
|
96
|
+
})();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function toSignablePayload(payload) {
|
|
100
|
+
if (payload === null || payload === undefined) {
|
|
101
|
+
return stableStringify({});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (payload && payload.__type === 'buffer' && typeof payload.data === 'string') {
|
|
105
|
+
return Buffer.from(payload.data, 'hex');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (typeof payload === 'string') {
|
|
109
|
+
return payload;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (Buffer.isBuffer(payload)) {
|
|
113
|
+
return payload;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (typeof payload === 'object') {
|
|
117
|
+
return stableStringify(payload);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return String(payload);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Format message for audit log display
|
|
125
|
+
*/
|
|
126
|
+
function formatMessageForAudit(message) {
|
|
127
|
+
if (Buffer.isBuffer(message)) {
|
|
128
|
+
return message.toString('hex');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return String(message);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function getWalletFromBlocklet({ blocklet, options = {} }) {
|
|
135
|
+
const env = blocklet?.environmentObj || {};
|
|
136
|
+
const appSk = env.BLOCKLET_APP_SK;
|
|
137
|
+
if (!appSk) {
|
|
138
|
+
throw new Error('BLOCKLET_APP_SK not found for blocklet');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const type = options.type || env.BLOCKLET_APP_CHAIN_TYPE || env.BLOCKLET_WALLET_TYPE;
|
|
142
|
+
let walletType;
|
|
143
|
+
let secretKey;
|
|
144
|
+
|
|
145
|
+
if (type && isEthereumType(DidType(type))) {
|
|
146
|
+
secretKey = appSk.slice(0, 66);
|
|
147
|
+
walletType = WalletType(type);
|
|
148
|
+
} else {
|
|
149
|
+
secretKey = appSk;
|
|
150
|
+
walletType = WalletType({
|
|
151
|
+
role: types.RoleType.ROLE_APPLICATION,
|
|
152
|
+
pk: types.KeyType.ED25519,
|
|
153
|
+
hash: types.HashType.SHA3,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return fromSecretKey(secretKey, walletType);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
module.exports = {
|
|
161
|
+
// eslint-disable-next-line no-unused-vars
|
|
162
|
+
init(server, node, _options) {
|
|
163
|
+
server.post(
|
|
164
|
+
`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/sign`,
|
|
165
|
+
ensureLocalhost,
|
|
166
|
+
ensureBlocklet(),
|
|
167
|
+
ensureComponentApiKey,
|
|
168
|
+
async (req, res) => {
|
|
169
|
+
try {
|
|
170
|
+
const { blocklet } = req;
|
|
171
|
+
const { payload } = req.body || {};
|
|
172
|
+
|
|
173
|
+
if (payload === undefined) {
|
|
174
|
+
res.status(400).json({ error: 'Payload is required' });
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const wallet = getWalletFromBlocklet({ blocklet });
|
|
179
|
+
const message = toSignablePayload(payload);
|
|
180
|
+
const signature = await wallet.sign(message);
|
|
181
|
+
|
|
182
|
+
// Create audit log asynchronously (don't block response)
|
|
183
|
+
const componentId = req.headers['x-component-did'];
|
|
184
|
+
node
|
|
185
|
+
.createAuditLog({
|
|
186
|
+
action: 'remoteSign',
|
|
187
|
+
args: {
|
|
188
|
+
teamDid: blocklet.meta.did,
|
|
189
|
+
componentId,
|
|
190
|
+
payloadType: typeof payload,
|
|
191
|
+
payloadContent: formatMessageForAudit(message),
|
|
192
|
+
},
|
|
193
|
+
context: {
|
|
194
|
+
...formatContext(req),
|
|
195
|
+
user: {
|
|
196
|
+
did: blocklet.meta.did,
|
|
197
|
+
fullName: `Component: ${componentId || 'unknown'}`,
|
|
198
|
+
role: 'blocklet',
|
|
199
|
+
componentDid: componentId,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
result: { publicKey: wallet.publicKey },
|
|
203
|
+
})
|
|
204
|
+
.catch((err) => logger.error('create remoteSign audit log failed', { error: err }));
|
|
205
|
+
|
|
206
|
+
res.json({ signature, publicKey: wallet.publicKey });
|
|
207
|
+
} catch (error) {
|
|
208
|
+
logger.error('Failed to sign payload', {
|
|
209
|
+
error,
|
|
210
|
+
blockletDid: req?.blocklet?.meta?.did,
|
|
211
|
+
componentId: req.headers['x-component-did'],
|
|
212
|
+
});
|
|
213
|
+
res.status(500).json({ error: formatError(error) });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
server.post(
|
|
219
|
+
`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/sign/jwt`,
|
|
220
|
+
ensureLocalhost,
|
|
221
|
+
ensureBlocklet(),
|
|
222
|
+
ensureComponentApiKey,
|
|
223
|
+
async (req, res) => {
|
|
224
|
+
try {
|
|
225
|
+
const { blocklet } = req;
|
|
226
|
+
const { payload, options } = req.body || {};
|
|
227
|
+
|
|
228
|
+
const wallet = getWalletFromBlocklet({ blocklet, options });
|
|
229
|
+
// Use doSign from options, default to true if not provided
|
|
230
|
+
const token = await JWT.sign(
|
|
231
|
+
wallet.address,
|
|
232
|
+
wallet.secretKey,
|
|
233
|
+
payload || {},
|
|
234
|
+
options?.doSign ?? true,
|
|
235
|
+
options?.version
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
const componentId = req.headers['x-component-did'];
|
|
239
|
+
node
|
|
240
|
+
.createAuditLog({
|
|
241
|
+
action: 'remoteSignJWT',
|
|
242
|
+
args: {
|
|
243
|
+
teamDid: blocklet.meta.did,
|
|
244
|
+
componentId,
|
|
245
|
+
jwtVersion: options?.version,
|
|
246
|
+
payloadContent: stableStringify(payload || {}),
|
|
247
|
+
},
|
|
248
|
+
context: {
|
|
249
|
+
...formatContext(req),
|
|
250
|
+
user: {
|
|
251
|
+
did: blocklet.meta.did,
|
|
252
|
+
fullName: `Component: ${componentId || 'unknown'}`,
|
|
253
|
+
role: 'blocklet',
|
|
254
|
+
componentDid: componentId,
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
result: { publicKey: wallet.publicKey },
|
|
258
|
+
})
|
|
259
|
+
.catch((err) => logger.error('create remoteSignJWT audit log failed', { error: err }));
|
|
260
|
+
|
|
261
|
+
res.json({ token, publicKey: wallet.publicKey });
|
|
262
|
+
} catch (error) {
|
|
263
|
+
logger.error('Failed to sign JWT', {
|
|
264
|
+
error,
|
|
265
|
+
blockletDid: req?.blocklet?.meta?.did,
|
|
266
|
+
componentId: req.headers['x-component-did'],
|
|
267
|
+
});
|
|
268
|
+
res.status(500).json({ error: formatError(error) });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
server.post(
|
|
274
|
+
`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/sign/eth`,
|
|
275
|
+
ensureLocalhost,
|
|
276
|
+
ensureBlocklet(),
|
|
277
|
+
ensureComponentApiKey,
|
|
278
|
+
async (req, res) => {
|
|
279
|
+
try {
|
|
280
|
+
const { blocklet } = req;
|
|
281
|
+
const { data, hashBeforeSign, options } = req.body || {};
|
|
282
|
+
|
|
283
|
+
if (!data) {
|
|
284
|
+
res.status(400).json({ error: 'Data is required' });
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const wallet = getWalletFromBlocklet({ blocklet, options });
|
|
289
|
+
const signature = await wallet.ethSign(data, hashBeforeSign);
|
|
290
|
+
|
|
291
|
+
const componentId = req.headers['x-component-did'];
|
|
292
|
+
node
|
|
293
|
+
.createAuditLog({
|
|
294
|
+
action: 'remoteSignETH',
|
|
295
|
+
args: {
|
|
296
|
+
teamDid: blocklet.meta.did,
|
|
297
|
+
componentId,
|
|
298
|
+
hashBeforeSign: !!hashBeforeSign,
|
|
299
|
+
dataContent: data,
|
|
300
|
+
},
|
|
301
|
+
context: {
|
|
302
|
+
...formatContext(req),
|
|
303
|
+
user: {
|
|
304
|
+
did: blocklet.meta.did,
|
|
305
|
+
fullName: `Component: ${componentId || 'unknown'}`,
|
|
306
|
+
role: 'blocklet',
|
|
307
|
+
componentDid: componentId,
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
result: { publicKey: wallet.publicKey },
|
|
311
|
+
})
|
|
312
|
+
.catch((err) => logger.error('create remoteSignETH audit log failed', { error: err }));
|
|
313
|
+
|
|
314
|
+
res.json({ signature, publicKey: wallet.publicKey });
|
|
315
|
+
} catch (error) {
|
|
316
|
+
logger.error('Failed to sign ETH', {
|
|
317
|
+
error,
|
|
318
|
+
blockletDid: req?.blocklet?.meta?.did,
|
|
319
|
+
componentId: req.headers['x-component-did'],
|
|
320
|
+
});
|
|
321
|
+
res.status(500).json({ error: formatError(error) });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
server.post(
|
|
327
|
+
`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/sign/derive`,
|
|
328
|
+
ensureLocalhost,
|
|
329
|
+
ensureBlocklet(),
|
|
330
|
+
ensureComponentApiKey,
|
|
331
|
+
(req, res) => {
|
|
332
|
+
try {
|
|
333
|
+
const { blocklet } = req;
|
|
334
|
+
const { sub, type, index } = req.body || {};
|
|
335
|
+
|
|
336
|
+
if (!sub) {
|
|
337
|
+
res.status(400).json({ error: 'Sub is required' });
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const wallet = getWalletFromBlocklet({ blocklet, options: { type } });
|
|
342
|
+
const userWallet = fromAppDid(sub, wallet.secretKey, type, index);
|
|
343
|
+
|
|
344
|
+
const componentId = req.headers['x-component-did'];
|
|
345
|
+
node
|
|
346
|
+
.createAuditLog({
|
|
347
|
+
action: 'remoteDeriveWallet',
|
|
348
|
+
args: {
|
|
349
|
+
teamDid: blocklet.meta.did,
|
|
350
|
+
componentId,
|
|
351
|
+
sub,
|
|
352
|
+
type,
|
|
353
|
+
index,
|
|
354
|
+
},
|
|
355
|
+
context: {
|
|
356
|
+
...formatContext(req),
|
|
357
|
+
user: {
|
|
358
|
+
did: blocklet.meta.did,
|
|
359
|
+
fullName: `Component: ${componentId || 'unknown'}`,
|
|
360
|
+
role: 'blocklet',
|
|
361
|
+
componentDid: componentId,
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
result: {
|
|
365
|
+
address: userWallet.address,
|
|
366
|
+
publicKey: userWallet.publicKey,
|
|
367
|
+
type: userWallet.type,
|
|
368
|
+
},
|
|
369
|
+
})
|
|
370
|
+
.catch((err) => logger.error('create remoteDeriveWallet audit log failed', { error: err }));
|
|
371
|
+
|
|
372
|
+
res.json({
|
|
373
|
+
address: userWallet.address,
|
|
374
|
+
publicKey: userWallet.publicKey,
|
|
375
|
+
type: userWallet.type,
|
|
376
|
+
});
|
|
377
|
+
} catch (error) {
|
|
378
|
+
logger.error('Failed to create wallet from app DID', {
|
|
379
|
+
error,
|
|
380
|
+
blockletDid: req?.blocklet?.meta?.did,
|
|
381
|
+
componentId: req.headers['x-component-did'],
|
|
382
|
+
});
|
|
383
|
+
res.status(500).json({ error: formatError(error) });
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
},
|
|
388
|
+
};
|
package/api/routes/user.js
CHANGED
|
@@ -1217,7 +1217,7 @@ module.exports = {
|
|
|
1217
1217
|
const blockletInfo = await req.getBlockletInfo();
|
|
1218
1218
|
const doc = await node.createVerifyCode({ teamDid, subject, purpose: 'login' });
|
|
1219
1219
|
const now = Math.floor(Date.now() / 1000);
|
|
1220
|
-
const magicLinkToken = JWT.signV2(blockletInfo.wallet.address, blockletInfo.wallet.secretKey, {
|
|
1220
|
+
const magicLinkToken = await JWT.signV2(blockletInfo.wallet.address, blockletInfo.wallet.secretKey, {
|
|
1221
1221
|
exp: String(now + VERIFY_CODE_TTL),
|
|
1222
1222
|
data: {
|
|
1223
1223
|
id: doc.id,
|
|
@@ -14,7 +14,7 @@ const {
|
|
|
14
14
|
createUserPassport,
|
|
15
15
|
getRoleFromLocalPassport,
|
|
16
16
|
} = require('@abtnode/auth/lib/passport');
|
|
17
|
-
const getBlockletWallet = require('@blocklet/meta/lib/wallet');
|
|
17
|
+
const { getApplicationWallet: getBlockletWallet } = require('@blocklet/meta/lib/wallet');
|
|
18
18
|
const getRequestIP = require('@abtnode/util/lib/get-request-ip');
|
|
19
19
|
const { getBlockletChainInfo, isInProgress } = require('@blocklet/meta/lib/util');
|
|
20
20
|
const { ROLES, MAIN_CHAIN_ENDPOINT } = require('@abtnode/constant');
|
|
@@ -210,7 +210,7 @@ module.exports = function createRoutes(node, _, createSessionToken) {
|
|
|
210
210
|
dataDir,
|
|
211
211
|
secret,
|
|
212
212
|
logo,
|
|
213
|
-
} = await getApplicationInfo({ node, teamDid: appPid, baseUrl });
|
|
213
|
+
} = await getApplicationInfo({ node, nodeInfo: await node.getNodeInfo(), teamDid: appPid, baseUrl });
|
|
214
214
|
|
|
215
215
|
const statusEndpointBaseUrl = baseUrl;
|
|
216
216
|
const endpoint = baseUrl;
|
|
@@ -245,7 +245,7 @@ module.exports = {
|
|
|
245
245
|
unReadCount = await getUnreadNotificationCount({ teamDid, receiver: req.user.did }, node);
|
|
246
246
|
}
|
|
247
247
|
// FIXME: @zhanghan 待各应用更新完新版,移除这个签名的处理
|
|
248
|
-
res.json(signResponse({ unReadCount }, wallet));
|
|
248
|
+
res.json(await signResponse({ unReadCount }, wallet));
|
|
249
249
|
} catch (err) {
|
|
250
250
|
res.status(500).json({ error: 'Internal Server Error' });
|
|
251
251
|
}
|
|
@@ -505,7 +505,7 @@ module.exports = {
|
|
|
505
505
|
});
|
|
506
506
|
|
|
507
507
|
res.json(
|
|
508
|
-
signResponse(
|
|
508
|
+
await signResponse(
|
|
509
509
|
{
|
|
510
510
|
user: omit(user, ['extra']),
|
|
511
511
|
nextToken: sessionToken,
|
|
@@ -177,7 +177,7 @@ const init = ({ node, notificationService }) => {
|
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
const token = JWT.sign(wallet.address, wallet.secretKey);
|
|
180
|
+
const token = await JWT.sign(wallet.address, wallet.secretKey);
|
|
181
181
|
const sender = { token, appDid: wallet.address };
|
|
182
182
|
|
|
183
183
|
const message = messages[eventName]({ data, blockletInfo, error });
|
|
@@ -172,7 +172,7 @@ const init = ({ node, notificationService }) => {
|
|
|
172
172
|
const now = Math.floor(Date.now() / 1000);
|
|
173
173
|
const unsubscribeToken =
|
|
174
174
|
wallet && allowUnsubscribe
|
|
175
|
-
? JWT.signV2(wallet.address, wallet.secretKey, {
|
|
175
|
+
? await JWT.signV2(wallet.address, wallet.secretKey, {
|
|
176
176
|
userDid: userInfo.did,
|
|
177
177
|
channel: 'email',
|
|
178
178
|
exp: String(now + 30 * 24 * 60 * 60), // 30 days
|
|
@@ -687,6 +687,7 @@ const init = ({ node, notificationService }) => {
|
|
|
687
687
|
data.sender ??
|
|
688
688
|
Object.freeze({
|
|
689
689
|
appDid: teamDid || nodeInfo.did,
|
|
690
|
+
appSk: nodeInfo.sk,
|
|
690
691
|
verified: true,
|
|
691
692
|
type: 'server',
|
|
692
693
|
});
|
|
@@ -91,7 +91,7 @@ const sendToAppComponents = async ({ event, appDid, componentDid: inputComponent
|
|
|
91
91
|
sender: {
|
|
92
92
|
did: senderInfo.wallet.address,
|
|
93
93
|
pk: senderInfo.wallet.publicKey,
|
|
94
|
-
token: JWT.sign(senderInfo.wallet.address, senderInfo.wallet.secretKey),
|
|
94
|
+
token: await JWT.sign(senderInfo.wallet.address, senderInfo.wallet.secretKey),
|
|
95
95
|
name: senderInfo.name,
|
|
96
96
|
},
|
|
97
97
|
};
|
|
@@ -261,7 +261,7 @@ const sendToAppDid = async ({
|
|
|
261
261
|
_notification.sender = {
|
|
262
262
|
did: senderInfo.wallet.address,
|
|
263
263
|
pk: senderInfo.wallet.publicKey,
|
|
264
|
-
token: JWT.sign(senderInfo.wallet.address, senderInfo.wallet.secretKey),
|
|
264
|
+
token: await JWT.sign(senderInfo.wallet.address, senderInfo.wallet.secretKey),
|
|
265
265
|
name: senderInfo.name,
|
|
266
266
|
};
|
|
267
267
|
|