@ixo/editor 6.36.0 → 7.0.0
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/dist/{BidConfig-3NEUNXN3.js → BidConfig-ZH625SNZ.js} +12 -13
- package/dist/{BidConfig-3NEUNXN3.js.map → BidConfig-ZH625SNZ.js.map} +1 -1
- package/dist/{BidFlowDetail-NJJOKPMS.js → BidFlowDetail-SZMKY75S.js} +18 -19
- package/dist/{BidFlowDetail-NJJOKPMS.js.map → BidFlowDetail-SZMKY75S.js.map} +1 -1
- package/dist/{CalendarEventCreateConfig-AR5VZCNA.js → CalendarEventCreateConfig-F7EYC4VL.js} +13 -14
- package/dist/{CalendarEventCreateConfig-AR5VZCNA.js.map → CalendarEventCreateConfig-F7EYC4VL.js.map} +1 -1
- package/dist/{CalendarEventCreateFlowDetail-NTLCWABI.js → CalendarEventCreateFlowDetail-JMYDUZRK.js} +14 -15
- package/dist/{CalendarEventCreateFlowDetail-NTLCWABI.js.map → CalendarEventCreateFlowDetail-JMYDUZRK.js.map} +1 -1
- package/dist/{CalendarEventListConfig-BLET3XIM.js → CalendarEventListConfig-RRIV7IZG.js} +13 -14
- package/dist/{CalendarEventListConfig-BLET3XIM.js.map → CalendarEventListConfig-RRIV7IZG.js.map} +1 -1
- package/dist/{CalendarEventListFlowDetail-IRF3TICA.js → CalendarEventListFlowDetail-6LN4I3SI.js} +7 -5
- package/dist/{CalendarEventListFlowDetail-IRF3TICA.js.map → CalendarEventListFlowDetail-6LN4I3SI.js.map} +1 -1
- package/dist/{CalendarEventUpdateConfig-VPNLMHO3.js → CalendarEventUpdateConfig-SARWZZG4.js} +13 -14
- package/dist/{CalendarEventUpdateConfig-VPNLMHO3.js.map → CalendarEventUpdateConfig-SARWZZG4.js.map} +1 -1
- package/dist/{CalendarEventUpdateFlowDetail-NQFXP7QM.js → CalendarEventUpdateFlowDetail-KZ2FG76Z.js} +14 -15
- package/dist/{CalendarEventUpdateFlowDetail-NQFXP7QM.js.map → CalendarEventUpdateFlowDetail-KZ2FG76Z.js.map} +1 -1
- package/dist/{ClaimConfig-AJERKKQX.js → ClaimConfig-PMRVROQ7.js} +12 -13
- package/dist/{ClaimConfig-AJERKKQX.js.map → ClaimConfig-PMRVROQ7.js.map} +1 -1
- package/dist/{ClaimFlowDetail-4AX4E5EO.js → ClaimFlowDetail-3364FIDU.js} +18 -19
- package/dist/{ClaimFlowDetail-4AX4E5EO.js.map → ClaimFlowDetail-3364FIDU.js.map} +1 -1
- package/dist/{CollectionLifecycleConfig-VLDN3YDI.js → CollectionLifecycleConfig-YPTZZJ3S.js} +6 -4
- package/dist/{CollectionLifecycleConfig-VLDN3YDI.js.map → CollectionLifecycleConfig-YPTZZJ3S.js.map} +1 -1
- package/dist/{CollectionLifecycleFlowDetail-UIEUQTK2.js → CollectionLifecycleFlowDetail-OD7OZH6W.js} +17 -18
- package/dist/{CollectionLifecycleFlowDetail-UIEUQTK2.js.map → CollectionLifecycleFlowDetail-OD7OZH6W.js.map} +1 -1
- package/dist/{CollectionUsersConfig-B2GOEJRC.js → CollectionUsersConfig-ETJM2G23.js} +15 -16
- package/dist/{CollectionUsersConfig-B2GOEJRC.js.map → CollectionUsersConfig-ETJM2G23.js.map} +1 -1
- package/dist/{CollectionUsersFlowDetail-LXH6BL5P.js → CollectionUsersFlowDetail-AMPT7UEV.js} +19 -20
- package/dist/{CollectionUsersFlowDetail-LXH6BL5P.js.map → CollectionUsersFlowDetail-AMPT7UEV.js.map} +1 -1
- package/dist/{CredentialStoreConfig-V3YSYSIT.js → CredentialStoreConfig-ZQFLCBDT.js} +9 -11
- package/dist/{CredentialStoreConfig-V3YSYSIT.js.map → CredentialStoreConfig-ZQFLCBDT.js.map} +1 -1
- package/dist/{CredentialStoreFlowDetail-TWZUFVAT.js → CredentialStoreFlowDetail-5LRH7NH5.js} +9 -10
- package/dist/{CredentialStoreFlowDetail-TWZUFVAT.js.map → CredentialStoreFlowDetail-5LRH7NH5.js.map} +1 -1
- package/dist/{DesignPodFlowDetail-3FIOPZGM.js → DesignPodFlowDetail-ECFMDZZ3.js} +7 -8
- package/dist/{DesignPodFlowDetail-3FIOPZGM.js.map → DesignPodFlowDetail-ECFMDZZ3.js.map} +1 -1
- package/dist/{DomainCardPreviewFlowDetail-5T6KQYUP.js → DomainCardPreviewFlowDetail-M7FPXS4N.js} +9 -10
- package/dist/{DomainCardPreviewFlowDetail-5T6KQYUP.js.map → DomainCardPreviewFlowDetail-M7FPXS4N.js.map} +1 -1
- package/dist/{DomainIndexerLookupFlowDetail-RITIJBF5.js → DomainIndexerLookupFlowDetail-L6GSDWLI.js} +7 -5
- package/dist/{DomainIndexerLookupFlowDetail-RITIJBF5.js.map → DomainIndexerLookupFlowDetail-L6GSDWLI.js.map} +1 -1
- package/dist/{DomainSignFlowDetail-5UDKSTBX.js → DomainSignFlowDetail-5ERYSTPG.js} +10 -11
- package/dist/{DomainSignFlowDetail-5UDKSTBX.js.map → DomainSignFlowDetail-5ERYSTPG.js.map} +1 -1
- package/dist/{DomainSingleSelectionConfig-Q6I7KLOO.js → DomainSingleSelectionConfig-DTHYPZBO.js} +6 -4
- package/dist/{DomainSingleSelectionConfig-Q6I7KLOO.js.map → DomainSingleSelectionConfig-DTHYPZBO.js.map} +1 -1
- package/dist/{DomainSingleSelectionFlowDetail-RXYRQMR5.js → DomainSingleSelectionFlowDetail-JKNAC2RY.js} +7 -5
- package/dist/{DomainSingleSelectionFlowDetail-RXYRQMR5.js.map → DomainSingleSelectionFlowDetail-JKNAC2RY.js.map} +1 -1
- package/dist/{EmailSendConfig-OVPVZNXQ.js → EmailSendConfig-O3XDS5IE.js} +12 -13
- package/dist/{EmailSendConfig-OVPVZNXQ.js.map → EmailSendConfig-O3XDS5IE.js.map} +1 -1
- package/dist/{EntityCreateOracleFlowDetail-IVB42PED.js → EntityCreateOracleFlowDetail-6XJ4UEL5.js} +9 -10
- package/dist/{EntityCreateOracleFlowDetail-IVB42PED.js.map → EntityCreateOracleFlowDetail-6XJ4UEL5.js.map} +1 -1
- package/dist/{EntitySingleSelectionFlowDetail-PIKQ4ZHV.js → EntitySingleSelectionFlowDetail-5BDIVHQV.js} +7 -5
- package/dist/{EntitySingleSelectionFlowDetail-PIKQ4ZHV.js.map → EntitySingleSelectionFlowDetail-5BDIVHQV.js.map} +1 -1
- package/dist/{EntityTransferFlowDetail-73NTV5BJ.js → EntityTransferFlowDetail-DY2UZ5VA.js} +9 -10
- package/dist/{EntityTransferFlowDetail-73NTV5BJ.js.map → EntityTransferFlowDetail-DY2UZ5VA.js.map} +1 -1
- package/dist/{EvalEngineConfig-BTCVWQ2D.js → EvalEngineConfig-5ZBXA3Q6.js} +17 -18
- package/dist/{EvalEngineConfig-BTCVWQ2D.js.map → EvalEngineConfig-5ZBXA3Q6.js.map} +1 -1
- package/dist/{EvalEngineFlowDetail-JTD2226A.js → EvalEngineFlowDetail-YL3FFONH.js} +11 -10
- package/dist/{EvalEngineFlowDetail-JTD2226A.js.map → EvalEngineFlowDetail-YL3FFONH.js.map} +1 -1
- package/dist/{EvaluateBidConfig-7VDC3NXD.js → EvaluateBidConfig-ZU7QUFXL.js} +12 -13
- package/dist/{EvaluateBidConfig-7VDC3NXD.js.map → EvaluateBidConfig-ZU7QUFXL.js.map} +1 -1
- package/dist/{EvaluateBidFlowDetail-6VDGVP3L.js → EvaluateBidFlowDetail-IATWBOE5.js} +17 -18
- package/dist/{EvaluateBidFlowDetail-6VDGVP3L.js.map → EvaluateBidFlowDetail-IATWBOE5.js.map} +1 -1
- package/dist/{EvaluateClaimConfig-6CQHIXJV.js → EvaluateClaimConfig-HEYNWGSN.js} +12 -13
- package/dist/{EvaluateClaimConfig-6CQHIXJV.js.map → EvaluateClaimConfig-HEYNWGSN.js.map} +1 -1
- package/dist/{EvaluateClaimFlowDetail-JBYINXH2.js → EvaluateClaimFlowDetail-TOX53BGP.js} +18 -19
- package/dist/{EvaluateClaimFlowDetail-JBYINXH2.js.map → EvaluateClaimFlowDetail-TOX53BGP.js.map} +1 -1
- package/dist/{FormSubmitFlowDetail-3KNCCNFI.js → FormSubmitFlowDetail-CVSUWEAW.js} +9 -10
- package/dist/{FormSubmitFlowDetail-3KNCCNFI.js.map → FormSubmitFlowDetail-CVSUWEAW.js.map} +1 -1
- package/dist/{GovernanceAuthzExecFlowDetail-WJJWWFQP.js → GovernanceAuthzExecFlowDetail-GWKPT7QW.js} +10 -11
- package/dist/{GovernanceAuthzExecFlowDetail-WJJWWFQP.js.map → GovernanceAuthzExecFlowDetail-GWKPT7QW.js.map} +1 -1
- package/dist/{GovernanceAuthzGrantFlowDetail-MTGEOXWC.js → GovernanceAuthzGrantFlowDetail-L7EPQQZ6.js} +11 -12
- package/dist/{GovernanceAuthzGrantFlowDetail-MTGEOXWC.js.map → GovernanceAuthzGrantFlowDetail-L7EPQQZ6.js.map} +1 -1
- package/dist/{GovernanceAuthzRevokeFlowDetail-DG23KMXM.js → GovernanceAuthzRevokeFlowDetail-X2VQHRCB.js} +11 -12
- package/dist/{GovernanceAuthzRevokeFlowDetail-DG23KMXM.js.map → GovernanceAuthzRevokeFlowDetail-X2VQHRCB.js.map} +1 -1
- package/dist/{GovernanceChainVoteFlowDetail-OKZKMLKC.js → GovernanceChainVoteFlowDetail-BO3DJNDF.js} +10 -11
- package/dist/{GovernanceChainVoteFlowDetail-OKZKMLKC.js.map → GovernanceChainVoteFlowDetail-BO3DJNDF.js.map} +1 -1
- package/dist/{GovernanceConfigFlowDetail-H7OB765D.js → GovernanceConfigFlowDetail-FZB4R54G.js} +7 -5
- package/dist/{GovernanceConfigFlowDetail-H7OB765D.js.map → GovernanceConfigFlowDetail-FZB4R54G.js.map} +1 -1
- package/dist/{GovernanceContractExecuteFlowDetail-DNCHU5WZ.js → GovernanceContractExecuteFlowDetail-JHIXCNXS.js} +11 -12
- package/dist/{GovernanceContractExecuteFlowDetail-DNCHU5WZ.js.map → GovernanceContractExecuteFlowDetail-JHIXCNXS.js.map} +1 -1
- package/dist/{GovernanceContractInstantiateFlowDetail-AILJZJGC.js → GovernanceContractInstantiateFlowDetail-XWSI2HXG.js} +11 -12
- package/dist/{GovernanceContractInstantiateFlowDetail-AILJZJGC.js.map → GovernanceContractInstantiateFlowDetail-XWSI2HXG.js.map} +1 -1
- package/dist/{GovernanceContractManageCw20FlowDetail-YUZU7NB3.js → GovernanceContractManageCw20FlowDetail-5QI3FBNT.js} +10 -11
- package/dist/{GovernanceContractManageCw20FlowDetail-YUZU7NB3.js.map → GovernanceContractManageCw20FlowDetail-5QI3FBNT.js.map} +1 -1
- package/dist/{GovernanceContractMigrateFlowDetail-IKM6JYCI.js → GovernanceContractMigrateFlowDetail-W2DEBKKU.js} +11 -12
- package/dist/{GovernanceContractMigrateFlowDetail-IKM6JYCI.js.map → GovernanceContractMigrateFlowDetail-W2DEBKKU.js.map} +1 -1
- package/dist/{GovernanceContractUpdateAdminFlowDetail-76WJU356.js → GovernanceContractUpdateAdminFlowDetail-VZ6245TK.js} +10 -11
- package/dist/{GovernanceContractUpdateAdminFlowDetail-76WJU356.js.map → GovernanceContractUpdateAdminFlowDetail-VZ6245TK.js.map} +1 -1
- package/dist/{GovernanceCustomMessageFlowDetail-I2BLIIHM.js → GovernanceCustomMessageFlowDetail-NNTHVM5D.js} +11 -12
- package/dist/{GovernanceCustomMessageFlowDetail-I2BLIIHM.js.map → GovernanceCustomMessageFlowDetail-NNTHVM5D.js.map} +1 -1
- package/dist/{GovernanceDaoAcceptToMarketplaceFlowDetail-A2BO5RMM.js → GovernanceDaoAcceptToMarketplaceFlowDetail-EO3CFNLA.js} +11 -12
- package/dist/{GovernanceDaoAcceptToMarketplaceFlowDetail-A2BO5RMM.js.map → GovernanceDaoAcceptToMarketplaceFlowDetail-EO3CFNLA.js.map} +1 -1
- package/dist/{GovernanceDaoAdminExecFlowDetail-PUQSONHN.js → GovernanceDaoAdminExecFlowDetail-YQCDUW2V.js} +12 -13
- package/dist/{GovernanceDaoAdminExecFlowDetail-PUQSONHN.js.map → GovernanceDaoAdminExecFlowDetail-YQCDUW2V.js.map} +1 -1
- package/dist/{GovernanceDaoCreateEntityFlowDetail-6PKHZQHG.js → GovernanceDaoCreateEntityFlowDetail-RSFFRATK.js} +11 -12
- package/dist/{GovernanceDaoCreateEntityFlowDetail-6PKHZQHG.js.map → GovernanceDaoCreateEntityFlowDetail-RSFFRATK.js.map} +1 -1
- package/dist/{GovernanceDaoJoinFlowDetail-LCRPX4CQ.js → GovernanceDaoJoinFlowDetail-GJWWQPD2.js} +11 -12
- package/dist/{GovernanceDaoJoinFlowDetail-LCRPX4CQ.js.map → GovernanceDaoJoinFlowDetail-GJWWQPD2.js.map} +1 -1
- package/dist/{GovernanceDaoManageStorageFlowDetail-G7MRHMZZ.js → GovernanceDaoManageStorageFlowDetail-KGMWUB4Z.js} +10 -11
- package/dist/{GovernanceDaoManageStorageFlowDetail-G7MRHMZZ.js.map → GovernanceDaoManageStorageFlowDetail-KGMWUB4Z.js.map} +1 -1
- package/dist/{GovernanceDaoManageSubDaosFlowDetail-3JOXJUC2.js → GovernanceDaoManageSubDaosFlowDetail-3WTI6AX7.js} +11 -12
- package/dist/{GovernanceDaoManageSubDaosFlowDetail-3JOXJUC2.js.map → GovernanceDaoManageSubDaosFlowDetail-3WTI6AX7.js.map} +1 -1
- package/dist/{GovernanceDaoUpdateInfoFlowDetail-RQIFMUOD.js → GovernanceDaoUpdateInfoFlowDetail-2DCOJGYV.js} +10 -11
- package/dist/{GovernanceDaoUpdateInfoFlowDetail-RQIFMUOD.js.map → GovernanceDaoUpdateInfoFlowDetail-2DCOJGYV.js.map} +1 -1
- package/dist/{GovernanceMemberProposalConfig-P4LVM7CK.js → GovernanceMemberProposalConfig-LW6KNHVY.js} +7 -5
- package/dist/{GovernanceMemberProposalConfig-P4LVM7CK.js.map → GovernanceMemberProposalConfig-LW6KNHVY.js.map} +1 -1
- package/dist/{GovernanceMemberProposalFlowDetail-BVHFB54O.js → GovernanceMemberProposalFlowDetail-JNO3RPDW.js} +11 -12
- package/dist/{GovernanceMemberProposalFlowDetail-BVHFB54O.js.map → GovernanceMemberProposalFlowDetail-JNO3RPDW.js.map} +1 -1
- package/dist/{GovernanceNftBurnFlowDetail-BXZCQ3NX.js → GovernanceNftBurnFlowDetail-MG3S2DZB.js} +10 -11
- package/dist/{GovernanceNftBurnFlowDetail-BXZCQ3NX.js.map → GovernanceNftBurnFlowDetail-MG3S2DZB.js.map} +1 -1
- package/dist/{GovernanceNftManageCollectionsFlowDetail-UNX5EONL.js → GovernanceNftManageCollectionsFlowDetail-FB5BRSLF.js} +10 -11
- package/dist/{GovernanceNftManageCollectionsFlowDetail-UNX5EONL.js.map → GovernanceNftManageCollectionsFlowDetail-FB5BRSLF.js.map} +1 -1
- package/dist/{GovernanceNftTransferFlowDetail-N4HJVV2Y.js → GovernanceNftTransferFlowDetail-27CRQVTA.js} +11 -12
- package/dist/{GovernanceNftTransferFlowDetail-N4HJVV2Y.js.map → GovernanceNftTransferFlowDetail-27CRQVTA.js.map} +1 -1
- package/dist/{GovernanceSettingsProposalConfig-SQD7EFEJ.js → GovernanceSettingsProposalConfig-WBOTSKNF.js} +7 -5
- package/dist/{GovernanceSettingsProposalConfig-SQD7EFEJ.js.map → GovernanceSettingsProposalConfig-WBOTSKNF.js.map} +1 -1
- package/dist/{GovernanceSettingsProposalFlowDetail-O3EMALFD.js → GovernanceSettingsProposalFlowDetail-W2KXBQM2.js} +10 -11
- package/dist/{GovernanceSettingsProposalFlowDetail-O3EMALFD.js.map → GovernanceSettingsProposalFlowDetail-W2KXBQM2.js.map} +1 -1
- package/dist/{GovernanceStakingStakeFlowDetail-DBAC24FE.js → GovernanceStakingStakeFlowDetail-Z7MCDZDV.js} +10 -11
- package/dist/{GovernanceStakingStakeFlowDetail-DBAC24FE.js.map → GovernanceStakingStakeFlowDetail-Z7MCDZDV.js.map} +1 -1
- package/dist/{GovernanceStakingStakeToGroupFlowDetail-VQZA4XTB.js → GovernanceStakingStakeToGroupFlowDetail-EC6JGRMB.js} +10 -11
- package/dist/{GovernanceStakingStakeToGroupFlowDetail-VQZA4XTB.js.map → GovernanceStakingStakeToGroupFlowDetail-EC6JGRMB.js.map} +1 -1
- package/dist/{GovernanceSubmissionConfigProposalFlowDetail-FSJEBTH5.js → GovernanceSubmissionConfigProposalFlowDetail-YHO3F7TI.js} +10 -11
- package/dist/{GovernanceSubmissionConfigProposalFlowDetail-FSJEBTH5.js.map → GovernanceSubmissionConfigProposalFlowDetail-YHO3F7TI.js.map} +1 -1
- package/dist/{GovernanceTransactionMintFlowDetail-K6T4SWYJ.js → GovernanceTransactionMintFlowDetail-K6PPDCH6.js} +11 -12
- package/dist/{GovernanceTransactionMintFlowDetail-K6T4SWYJ.js.map → GovernanceTransactionMintFlowDetail-K6PPDCH6.js.map} +1 -1
- package/dist/{GovernanceTransactionPerformTokenSwapFlowDetail-NHU7M4TT.js → GovernanceTransactionPerformTokenSwapFlowDetail-6PEN4FED.js} +10 -11
- package/dist/{GovernanceTransactionPerformTokenSwapFlowDetail-NHU7M4TT.js.map → GovernanceTransactionPerformTokenSwapFlowDetail-6PEN4FED.js.map} +1 -1
- package/dist/{GovernanceTransactionSendFundsConfig-N3LS6ZVU.js → GovernanceTransactionSendFundsConfig-JRROE44J.js} +7 -5
- package/dist/{GovernanceTransactionSendFundsConfig-N3LS6ZVU.js.map → GovernanceTransactionSendFundsConfig-JRROE44J.js.map} +1 -1
- package/dist/{GovernanceTransactionSendFundsFlowDetail-HQKL7LNN.js → GovernanceTransactionSendFundsFlowDetail-Z57XAY3D.js} +11 -12
- package/dist/{GovernanceTransactionSendFundsFlowDetail-HQKL7LNN.js.map → GovernanceTransactionSendFundsFlowDetail-Z57XAY3D.js.map} +1 -1
- package/dist/{GovernanceTransactionSendGroupTokenFlowDetail-ZLAJN5NB.js → GovernanceTransactionSendGroupTokenFlowDetail-OSEHM66P.js} +11 -12
- package/dist/{GovernanceTransactionSendGroupTokenFlowDetail-ZLAJN5NB.js.map → GovernanceTransactionSendGroupTokenFlowDetail-OSEHM66P.js.map} +1 -1
- package/dist/{GovernanceTransactionWithdrawTokenSwapFlowDetail-K6NUYFPJ.js → GovernanceTransactionWithdrawTokenSwapFlowDetail-AZFHSIBD.js} +10 -11
- package/dist/{GovernanceTransactionWithdrawTokenSwapFlowDetail-K6NUYFPJ.js.map → GovernanceTransactionWithdrawTokenSwapFlowDetail-AZFHSIBD.js.map} +1 -1
- package/dist/{GovernanceValidatorActionsFlowDetail-6TALBJ3L.js → GovernanceValidatorActionsFlowDetail-3YSPIIVG.js} +10 -11
- package/dist/{GovernanceValidatorActionsFlowDetail-6TALBJ3L.js.map → GovernanceValidatorActionsFlowDetail-3YSPIIVG.js.map} +1 -1
- package/dist/{HarvestConfig-72UJXJ2I.js → HarvestConfig-FXZYEZRA.js} +10 -12
- package/dist/{HarvestConfig-72UJXJ2I.js.map → HarvestConfig-FXZYEZRA.js.map} +1 -1
- package/dist/{HarvestFlowDetail-G6XES3W6.js → HarvestFlowDetail-Y2AJWJKR.js} +9 -10
- package/dist/{HarvestFlowDetail-G6XES3W6.js.map → HarvestFlowDetail-Y2AJWJKR.js.map} +1 -1
- package/dist/{HttpRequestConfig-PZAX5VZO.js → HttpRequestConfig-A3UIM3K2.js} +9 -11
- package/dist/{HttpRequestConfig-PZAX5VZO.js.map → HttpRequestConfig-A3UIM3K2.js.map} +1 -1
- package/dist/{HttpRequestFlowDetail-H3IWKJYT.js → HttpRequestFlowDetail-VWD64O3P.js} +7 -5
- package/dist/{HttpRequestFlowDetail-H3IWKJYT.js.map → HttpRequestFlowDetail-VWD64O3P.js.map} +1 -1
- package/dist/{IdentityCreateFlowDetail-YRUTCMXG.js → IdentityCreateFlowDetail-DXUI6S4I.js} +17 -18
- package/dist/{IdentityCreateFlowDetail-YRUTCMXG.js.map → IdentityCreateFlowDetail-DXUI6S4I.js.map} +1 -1
- package/dist/{IidCreateFlowDetail-FJKDBRVD.js → IidCreateFlowDetail-INISHT4R.js} +17 -18
- package/dist/{IidCreateFlowDetail-FJKDBRVD.js.map → IidCreateFlowDetail-INISHT4R.js.map} +1 -1
- package/dist/{KycVerifyConfig-7YN6E4QF.js → KycVerifyConfig-KSECQD2D.js} +9 -11
- package/dist/{KycVerifyConfig-7YN6E4QF.js.map → KycVerifyConfig-KSECQD2D.js.map} +1 -1
- package/dist/{KycVerifyFlowDetail-HNBUINHC.js → KycVerifyFlowDetail-ZLDIZ4HC.js} +16 -17
- package/dist/{KycVerifyFlowDetail-HNBUINHC.js.map → KycVerifyFlowDetail-ZLDIZ4HC.js.map} +1 -1
- package/dist/{ListDomainFlowsFlowDetail-Z2JE5XLW.js → ListDomainFlowsFlowDetail-PJQCAY3I.js} +7 -5
- package/dist/{ListDomainFlowsFlowDetail-Z2JE5XLW.js.map → ListDomainFlowsFlowDetail-PJQCAY3I.js.map} +1 -1
- package/dist/{LoadBatchesFlowDetail-MHRJDFBU.js → LoadBatchesFlowDetail-TL4TQDZ5.js} +9 -10
- package/dist/{LoadBatchesFlowDetail-MHRJDFBU.js.map → LoadBatchesFlowDetail-TL4TQDZ5.js.map} +1 -1
- package/dist/{MatrixDmConfig-MFC6DXMH.js → MatrixDmConfig-DRY27FAM.js} +6 -4
- package/dist/{MatrixDmConfig-MFC6DXMH.js.map → MatrixDmConfig-DRY27FAM.js.map} +1 -1
- package/dist/{MatrixRegisterFlowDetail-FJ2FVOWE.js → MatrixRegisterFlowDetail-RXHGTTQF.js} +9 -10
- package/dist/{MatrixRegisterFlowDetail-FJ2FVOWE.js.map → MatrixRegisterFlowDetail-RXHGTTQF.js.map} +1 -1
- package/dist/{MemberMultiSelectFlowDetail-GM45G5EA.js → MemberMultiSelectFlowDetail-N64ZK7GE.js} +7 -5
- package/dist/{MemberMultiSelectFlowDetail-GM45G5EA.js.map → MemberMultiSelectFlowDetail-N64ZK7GE.js.map} +1 -1
- package/dist/{OracleConfig-RW55I2YD.js → OracleConfig-KUPPRFL2.js} +9 -11
- package/dist/{OracleConfig-RW55I2YD.js.map → OracleConfig-KUPPRFL2.js.map} +1 -1
- package/dist/{OracleConfigureOracleFlowDetail-Y34ZSUNM.js → OracleConfigureOracleFlowDetail-L7GRKOSV.js} +17 -18
- package/dist/{OracleConfigureOracleFlowDetail-Y34ZSUNM.js.map → OracleConfigureOracleFlowDetail-L7GRKOSV.js.map} +1 -1
- package/dist/{OracleContractFlowDetail-YPS3STPP.js → OracleContractFlowDetail-D2XZYWVG.js} +9 -10
- package/dist/{OracleContractFlowDetail-YPS3STPP.js.map → OracleContractFlowDetail-D2XZYWVG.js.map} +1 -1
- package/dist/{OracleDeployFlowDetail-OF5DDC4Y.js → OracleDeployFlowDetail-TCFIJYP7.js} +9 -10
- package/dist/{OracleDeployFlowDetail-OF5DDC4Y.js.map → OracleDeployFlowDetail-TCFIJYP7.js.map} +1 -1
- package/dist/{OracleDeploySetupFlowDetail-BJ2KFO7M.js → OracleDeploySetupFlowDetail-KMGBPIND.js} +9 -10
- package/dist/{OracleDeploySetupFlowDetail-BJ2KFO7M.js.map → OracleDeploySetupFlowDetail-KMGBPIND.js.map} +1 -1
- package/dist/{OracleDeployStartFlowDetail-OLMKT4FX.js → OracleDeployStartFlowDetail-DTK5PLC5.js} +9 -10
- package/dist/{OracleDeployStartFlowDetail-OLMKT4FX.js.map → OracleDeployStartFlowDetail-DTK5PLC5.js.map} +1 -1
- package/dist/{OracleFlowDetail-RXRNN7LG.js → OracleFlowDetail-FEPE3YYU.js} +9 -10
- package/dist/{OracleFlowDetail-RXRNN7LG.js.map → OracleFlowDetail-FEPE3YYU.js.map} +1 -1
- package/dist/{OraclePromptFlowDetail-ST7EC3H7.js → OraclePromptFlowDetail-2B55RVOO.js} +9 -10
- package/dist/{OraclePromptFlowDetail-ST7EC3H7.js.map → OraclePromptFlowDetail-2B55RVOO.js.map} +1 -1
- package/dist/{OracleStoreConfigFlowDetail-LQK5UF4I.js → OracleStoreConfigFlowDetail-Q6PTB2TR.js} +9 -10
- package/dist/{OracleStoreConfigFlowDetail-LQK5UF4I.js.map → OracleStoreConfigFlowDetail-Q6PTB2TR.js.map} +1 -1
- package/dist/{OracleStoreSecretsAndConfigFlowDetail-ZKJZNK2U.js → OracleStoreSecretsAndConfigFlowDetail-D2YXIJ57.js} +17 -18
- package/dist/{OracleStoreSecretsAndConfigFlowDetail-ZKJZNK2U.js.map → OracleStoreSecretsAndConfigFlowDetail-D2YXIJ57.js.map} +1 -1
- package/dist/{OracleStoreSecretsFlowDetail-Q67XEZYS.js → OracleStoreSecretsFlowDetail-DHNXG3CZ.js} +17 -18
- package/dist/{OracleStoreSecretsFlowDetail-Q67XEZYS.js.map → OracleStoreSecretsFlowDetail-DHNXG3CZ.js.map} +1 -1
- package/dist/{ProposalCreateConfig-PJ4AQULI.js → ProposalCreateConfig-W3XNV7SH.js} +12 -13
- package/dist/{ProposalCreateConfig-PJ4AQULI.js.map → ProposalCreateConfig-W3XNV7SH.js.map} +1 -1
- package/dist/{ProposalCreateFlowDetail-M3XGZI66.js → ProposalCreateFlowDetail-2ZNJZMSY.js} +19 -20
- package/dist/{ProposalCreateFlowDetail-M3XGZI66.js.map → ProposalCreateFlowDetail-2ZNJZMSY.js.map} +1 -1
- package/dist/{ProposalVoteConfig-LYPYZDHK.js → ProposalVoteConfig-DDEF76CL.js} +12 -13
- package/dist/{ProposalVoteConfig-LYPYZDHK.js.map → ProposalVoteConfig-DDEF76CL.js.map} +1 -1
- package/dist/{ProposalVoteFlowDetail-JZ2KISZX.js → ProposalVoteFlowDetail-6BOYU4XJ.js} +10 -11
- package/dist/{ProposalVoteFlowDetail-JZ2KISZX.js.map → ProposalVoteFlowDetail-6BOYU4XJ.js.map} +1 -1
- package/dist/{ProtocolSelectFlowDetail-GNQD3G7Y.js → ProtocolSelectFlowDetail-IKYJQZAO.js} +6 -4
- package/dist/{ProtocolSelectFlowDetail-GNQD3G7Y.js.map → ProtocolSelectFlowDetail-IKYJQZAO.js.map} +1 -1
- package/dist/{RetireConfig-EICGSI7K.js → RetireConfig-PQPUZHIW.js} +10 -12
- package/dist/{RetireConfig-EICGSI7K.js.map → RetireConfig-PQPUZHIW.js.map} +1 -1
- package/dist/{RetireFlowDetail-7OSWHOZ2.js → RetireFlowDetail-SP5GBJSA.js} +9 -10
- package/dist/{RetireFlowDetail-7OSWHOZ2.js.map → RetireFlowDetail-SP5GBJSA.js.map} +1 -1
- package/dist/{SandboxProvisionFlowDetail-ORDCFVAQ.js → SandboxProvisionFlowDetail-CQ7XZWNA.js} +9 -10
- package/dist/{SandboxProvisionFlowDetail-ORDCFVAQ.js.map → SandboxProvisionFlowDetail-CQ7XZWNA.js.map} +1 -1
- package/dist/{WalletFundConfig-UYEI6LIU.js → WalletFundConfig-T5S6B2HH.js} +7 -5
- package/dist/{WalletFundConfig-UYEI6LIU.js.map → WalletFundConfig-T5S6B2HH.js.map} +1 -1
- package/dist/{WalletFundFlowDetail-UI63COIK.js → WalletFundFlowDetail-WLQLJS34.js} +10 -11
- package/dist/{WalletFundFlowDetail-UI63COIK.js.map → WalletFundFlowDetail-WLQLJS34.js.map} +1 -1
- package/dist/{WalletGenerateAndFundFlowDetail-KUYU35BS.js → WalletGenerateAndFundFlowDetail-7LEBWWEA.js} +7 -5
- package/dist/{WalletGenerateAndFundFlowDetail-KUYU35BS.js.map → WalletGenerateAndFundFlowDetail-7LEBWWEA.js.map} +1 -1
- package/dist/{WalletGenerateFlowDetail-Y5JBQO7R.js → WalletGenerateFlowDetail-CBAVDW7Z.js} +7 -5
- package/dist/{WalletGenerateFlowDetail-Y5JBQO7R.js.map → WalletGenerateFlowDetail-CBAVDW7Z.js.map} +1 -1
- package/dist/{XeroContactCreateConfig-6LS7JANF.js → XeroContactCreateConfig-TKJKZAC4.js} +13 -14
- package/dist/{XeroContactCreateConfig-6LS7JANF.js.map → XeroContactCreateConfig-TKJKZAC4.js.map} +1 -1
- package/dist/{XeroContactCreateFlowDetail-6YHUS6TT.js → XeroContactCreateFlowDetail-O3ZITUCC.js} +14 -15
- package/dist/{XeroContactCreateFlowDetail-6YHUS6TT.js.map → XeroContactCreateFlowDetail-O3ZITUCC.js.map} +1 -1
- package/dist/{XeroInvoiceCreateConfig-YF456J5Y.js → XeroInvoiceCreateConfig-LAMB7Q3J.js} +16 -17
- package/dist/{XeroInvoiceCreateConfig-YF456J5Y.js.map → XeroInvoiceCreateConfig-LAMB7Q3J.js.map} +1 -1
- package/dist/{XeroInvoiceCreateFlowDetail-3EKFNDIL.js → XeroInvoiceCreateFlowDetail-KIYWUT2B.js} +16 -17
- package/dist/{XeroInvoiceCreateFlowDetail-3EKFNDIL.js.map → XeroInvoiceCreateFlowDetail-KIYWUT2B.js.map} +1 -1
- package/dist/{XeroInvoiceListConfig-RYMS37GK.js → XeroInvoiceListConfig-PUUQP4UP.js} +13 -14
- package/dist/{XeroInvoiceListConfig-RYMS37GK.js.map → XeroInvoiceListConfig-PUUQP4UP.js.map} +1 -1
- package/dist/{XeroInvoiceListFlowDetail-TOE7BTXJ.js → XeroInvoiceListFlowDetail-YPU6MFSX.js} +7 -5
- package/dist/{XeroInvoiceListFlowDetail-TOE7BTXJ.js.map → XeroInvoiceListFlowDetail-YPU6MFSX.js.map} +1 -1
- package/dist/{XeroPaymentCreateConfig-KLIV5FAB.js → XeroPaymentCreateConfig-XNMSDVG3.js} +9 -11
- package/dist/{XeroPaymentCreateConfig-KLIV5FAB.js.map → XeroPaymentCreateConfig-XNMSDVG3.js.map} +1 -1
- package/dist/{XeroPaymentCreateFlowDetail-YFOGJCHR.js → XeroPaymentCreateFlowDetail-CB55SP6X.js} +15 -16
- package/dist/{XeroPaymentCreateFlowDetail-YFOGJCHR.js.map → XeroPaymentCreateFlowDetail-CB55SP6X.js.map} +1 -1
- package/dist/chunk-2KOJBMG5.js +1296 -0
- package/dist/chunk-2KOJBMG5.js.map +1 -0
- package/dist/{chunk-7VFCZZMP.js → chunk-3WLWIA7D.js} +68 -7
- package/dist/chunk-3WLWIA7D.js.map +1 -0
- package/dist/{chunk-G2RJXFHV.js → chunk-6JOBSAZF.js} +2 -2
- package/dist/{chunk-JIDTNKKL.js → chunk-7TVYQNOR.js} +57 -6
- package/dist/chunk-7TVYQNOR.js.map +1 -0
- package/dist/{chunk-A7IARZTV.js → chunk-A7L3NJK6.js} +2 -2
- package/dist/{chunk-NBPKDSLX.js → chunk-BAQA4AZN.js} +36 -5
- package/dist/chunk-BAQA4AZN.js.map +1 -0
- package/dist/{chunk-MQCDMHRZ.js → chunk-C376YPPE.js} +3 -3
- package/dist/{chunk-4PONO4US.js → chunk-CMG6TZKH.js} +3 -3
- package/dist/{chunk-MFUNBOLH.js → chunk-DMXZIAAW.js} +3 -3
- package/dist/{chunk-E6N2G3BQ.js → chunk-DVZU2FI6.js} +13 -13
- package/dist/chunk-DVZU2FI6.js.map +1 -0
- package/dist/{chunk-KYLJS66J.js → chunk-EH7EYO4N.js} +4 -4
- package/dist/{chunk-UHH7KCNX.js → chunk-EWDTMHPF.js} +694 -641
- package/dist/chunk-EWDTMHPF.js.map +1 -0
- package/dist/{chunk-S4QEIR3K.js → chunk-FJ36VM6S.js} +2 -2
- package/dist/{chunk-Y4EEDWYE.js → chunk-IMN2PXVU.js} +8 -6
- package/dist/{chunk-Y4EEDWYE.js.map → chunk-IMN2PXVU.js.map} +1 -1
- package/dist/{chunk-5HJZYZBH.js → chunk-J6AWMFEF.js} +2 -2
- package/dist/{chunk-T5POEJGB.js → chunk-JDNOVB6L.js} +2 -2
- package/dist/{chunk-NIXT2SBH.js → chunk-JK6RAKE3.js} +2 -2
- package/dist/{chunk-F2SBFVIX.js → chunk-JSE2MTU7.js} +241 -218
- package/dist/chunk-JSE2MTU7.js.map +1 -0
- package/dist/{chunk-PYNDJDWZ.js → chunk-JWC4VVY7.js} +3 -5
- package/dist/{chunk-PYNDJDWZ.js.map → chunk-JWC4VVY7.js.map} +1 -1
- package/dist/{chunk-JANA35XL.js → chunk-L7WHIPGC.js} +2 -2
- package/dist/{chunk-K7NQ6NB5.js → chunk-LSWKBCB3.js} +5 -5
- package/dist/{chunk-NJAII6CO.js → chunk-M3GHFF5N.js} +2 -2
- package/dist/{chunk-VVFKJQW2.js → chunk-MQAJXYIS.js} +2 -2
- package/dist/{chunk-QZYCJ2GZ.js → chunk-MY22PTP4.js} +2 -2
- package/dist/{chunk-JVROGQ7Q.js → chunk-QSUE3ZFB.js} +2 -2
- package/dist/{chunk-IIIZZ4E4.js → chunk-QW7LA67J.js} +304 -213
- package/dist/chunk-QW7LA67J.js.map +1 -0
- package/dist/{chunk-FFYZXA75.js → chunk-RETGBEFM.js} +2 -2
- package/dist/{chunk-6433FBH2.js → chunk-RQS3KQLQ.js} +2 -2
- package/dist/{chunk-LECVAJYY.js → chunk-RV7QJFSE.js} +2 -2
- package/dist/{chunk-EMTMYB2N.js → chunk-S2ETTOE5.js} +2 -2
- package/dist/{chunk-L4XGJV5O.js → chunk-SRSVMD6E.js} +2 -2
- package/dist/{chunk-P7OBLJAG.js → chunk-SUUULPJP.js} +13 -11
- package/dist/chunk-SUUULPJP.js.map +1 -0
- package/dist/chunk-THG6RXFR.js +68 -0
- package/dist/chunk-THG6RXFR.js.map +1 -0
- package/dist/{chunk-RRYBAE6E.js → chunk-UTLM6U75.js} +6 -66
- package/dist/chunk-UTLM6U75.js.map +1 -0
- package/dist/{chunk-ZZK5IHK2.js → chunk-X23SZR5N.js} +2 -2
- package/dist/{chunk-ZZ7FDJKJ.js → chunk-YMGLWNV5.js} +2 -2
- package/dist/{chunk-6RJIR3DT.js → chunk-ZIT2N7CI.js} +2 -2
- package/dist/{connections-CAuWls3b.d.ts → connections-tcxJgB1K.d.ts} +20 -23
- package/dist/core/index.cjs +1495 -414
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +276 -24
- package/dist/core/index.js +366 -85
- package/dist/core/index.js.map +1 -1
- package/dist/flow-vnext/index.js +6 -4
- package/dist/{graphql-client-CU0Iog8N.d.ts → graphql-client-VK7-KGDc.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +28 -28
- package/dist/mantine/index.d.ts +4 -4
- package/dist/mantine/index.js +30 -32
- package/dist/mantine/index.js.map +1 -1
- package/dist/{types-DgKNZJ-B.d.ts → types-CYtPUWc7.d.ts} +886 -402
- package/package.json +3 -2
- package/dist/chunk-7VFCZZMP.js.map +0 -1
- package/dist/chunk-7W7UUUIE.js +0 -609
- package/dist/chunk-7W7UUUIE.js.map +0 -1
- package/dist/chunk-E6N2G3BQ.js.map +0 -1
- package/dist/chunk-F2SBFVIX.js.map +0 -1
- package/dist/chunk-HT6L7A5M.js +0 -12
- package/dist/chunk-HT6L7A5M.js.map +0 -1
- package/dist/chunk-IIIZZ4E4.js.map +0 -1
- package/dist/chunk-JIDTNKKL.js.map +0 -1
- package/dist/chunk-NBPKDSLX.js.map +0 -1
- package/dist/chunk-P7OBLJAG.js.map +0 -1
- package/dist/chunk-RRYBAE6E.js.map +0 -1
- package/dist/chunk-TS2LNBF2.js +0 -68
- package/dist/chunk-TS2LNBF2.js.map +0 -1
- package/dist/chunk-UHH7KCNX.js.map +0 -1
- /package/dist/{chunk-G2RJXFHV.js.map → chunk-6JOBSAZF.js.map} +0 -0
- /package/dist/{chunk-A7IARZTV.js.map → chunk-A7L3NJK6.js.map} +0 -0
- /package/dist/{chunk-MQCDMHRZ.js.map → chunk-C376YPPE.js.map} +0 -0
- /package/dist/{chunk-4PONO4US.js.map → chunk-CMG6TZKH.js.map} +0 -0
- /package/dist/{chunk-MFUNBOLH.js.map → chunk-DMXZIAAW.js.map} +0 -0
- /package/dist/{chunk-KYLJS66J.js.map → chunk-EH7EYO4N.js.map} +0 -0
- /package/dist/{chunk-S4QEIR3K.js.map → chunk-FJ36VM6S.js.map} +0 -0
- /package/dist/{chunk-5HJZYZBH.js.map → chunk-J6AWMFEF.js.map} +0 -0
- /package/dist/{chunk-T5POEJGB.js.map → chunk-JDNOVB6L.js.map} +0 -0
- /package/dist/{chunk-NIXT2SBH.js.map → chunk-JK6RAKE3.js.map} +0 -0
- /package/dist/{chunk-JANA35XL.js.map → chunk-L7WHIPGC.js.map} +0 -0
- /package/dist/{chunk-K7NQ6NB5.js.map → chunk-LSWKBCB3.js.map} +0 -0
- /package/dist/{chunk-NJAII6CO.js.map → chunk-M3GHFF5N.js.map} +0 -0
- /package/dist/{chunk-VVFKJQW2.js.map → chunk-MQAJXYIS.js.map} +0 -0
- /package/dist/{chunk-QZYCJ2GZ.js.map → chunk-MY22PTP4.js.map} +0 -0
- /package/dist/{chunk-JVROGQ7Q.js.map → chunk-QSUE3ZFB.js.map} +0 -0
- /package/dist/{chunk-FFYZXA75.js.map → chunk-RETGBEFM.js.map} +0 -0
- /package/dist/{chunk-6433FBH2.js.map → chunk-RQS3KQLQ.js.map} +0 -0
- /package/dist/{chunk-LECVAJYY.js.map → chunk-RV7QJFSE.js.map} +0 -0
- /package/dist/{chunk-EMTMYB2N.js.map → chunk-S2ETTOE5.js.map} +0 -0
- /package/dist/{chunk-L4XGJV5O.js.map → chunk-SRSVMD6E.js.map} +0 -0
- /package/dist/{chunk-ZZK5IHK2.js.map → chunk-X23SZR5N.js.map} +0 -0
- /package/dist/{chunk-ZZ7FDJKJ.js.map → chunk-YMGLWNV5.js.map} +0 -0
- /package/dist/{chunk-6RJIR3DT.js.map → chunk-ZIT2N7CI.js.map} +0 -0
|
@@ -0,0 +1,1296 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getRunMeta,
|
|
3
|
+
normalizeDid,
|
|
4
|
+
resetActionState
|
|
5
|
+
} from "./chunk-QW7LA67J.js";
|
|
6
|
+
import {
|
|
7
|
+
digestCanonicalJson
|
|
8
|
+
} from "./chunk-THG6RXFR.js";
|
|
9
|
+
|
|
10
|
+
// src/core/lib/ucanDelegationStore.ts
|
|
11
|
+
var ROOT_DELEGATION_KEY = "__root__";
|
|
12
|
+
var STORE_VERSION_KEY = "__version__";
|
|
13
|
+
var CURRENT_VERSION = 2;
|
|
14
|
+
function normalizeAbility(value) {
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
const lastDot = trimmed.lastIndexOf(".");
|
|
17
|
+
return !trimmed.includes("/") && lastDot > 0 ? `${trimmed.slice(0, lastDot)}/${trimmed.slice(lastDot + 1)}` : trimmed;
|
|
18
|
+
}
|
|
19
|
+
function abilityCovers(granted, requested) {
|
|
20
|
+
const pattern = normalizeAbility(granted);
|
|
21
|
+
const target = normalizeAbility(requested);
|
|
22
|
+
if (pattern === "*" || pattern === target) return true;
|
|
23
|
+
return pattern.endsWith("/*") && target.startsWith(pattern.slice(0, -1));
|
|
24
|
+
}
|
|
25
|
+
function resourceCovers(granted, requested) {
|
|
26
|
+
if (granted === "*" || granted === requested) return true;
|
|
27
|
+
return granted.endsWith("*") && requested.startsWith(granted.slice(0, -1));
|
|
28
|
+
}
|
|
29
|
+
function canonicalCaveat(value) {
|
|
30
|
+
if (!value || typeof value !== "object") return JSON.stringify(value ?? null);
|
|
31
|
+
if (Array.isArray(value)) return `[${value.map(canonicalCaveat).join(",")}]`;
|
|
32
|
+
return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${canonicalCaveat(entry)}`).join(",")}}`;
|
|
33
|
+
}
|
|
34
|
+
function ucanCapabilityCovers(granted, requested) {
|
|
35
|
+
if (!abilityCovers(granted.can, requested.can) || !resourceCovers(granted.with, requested.with)) return false;
|
|
36
|
+
if (granted.nb === void 0) return true;
|
|
37
|
+
return canonicalCaveat(granted.nb) === canonicalCaveat(requested.nb);
|
|
38
|
+
}
|
|
39
|
+
var isValidEntry = (value) => {
|
|
40
|
+
if (!value || typeof value !== "object") return false;
|
|
41
|
+
const entry = value;
|
|
42
|
+
return entry.v === CURRENT_VERSION && entry.data !== void 0;
|
|
43
|
+
};
|
|
44
|
+
var isReservedKey = (key) => key === ROOT_DELEGATION_KEY || key === STORE_VERSION_KEY;
|
|
45
|
+
var createUcanDelegationStore = (yMap) => {
|
|
46
|
+
const get = (cid) => {
|
|
47
|
+
if (isReservedKey(cid)) return null;
|
|
48
|
+
const raw = yMap.get(cid);
|
|
49
|
+
if (!raw) return null;
|
|
50
|
+
if (isValidEntry(raw)) return raw.data;
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
53
|
+
const set = (delegation) => {
|
|
54
|
+
const entry = { v: CURRENT_VERSION, data: delegation };
|
|
55
|
+
yMap.set(delegation.cid, entry);
|
|
56
|
+
};
|
|
57
|
+
const remove = (cid) => {
|
|
58
|
+
yMap.delete(cid);
|
|
59
|
+
};
|
|
60
|
+
const has = (cid) => {
|
|
61
|
+
return yMap.has(cid) && !isReservedKey(cid);
|
|
62
|
+
};
|
|
63
|
+
const getRoot = () => {
|
|
64
|
+
const rootCid = yMap.get(ROOT_DELEGATION_KEY);
|
|
65
|
+
if (!rootCid) return null;
|
|
66
|
+
return get(rootCid);
|
|
67
|
+
};
|
|
68
|
+
const setRootCid = (cid) => {
|
|
69
|
+
yMap.set(ROOT_DELEGATION_KEY, cid);
|
|
70
|
+
};
|
|
71
|
+
const getRootCid = () => {
|
|
72
|
+
return yMap.get(ROOT_DELEGATION_KEY) || null;
|
|
73
|
+
};
|
|
74
|
+
const getAll = () => {
|
|
75
|
+
const delegations = [];
|
|
76
|
+
yMap.forEach((value, key) => {
|
|
77
|
+
if (isReservedKey(key)) return;
|
|
78
|
+
if (isValidEntry(value)) {
|
|
79
|
+
delegations.push(value.data);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return delegations;
|
|
83
|
+
};
|
|
84
|
+
const getByAudience = (audienceDid) => {
|
|
85
|
+
return getAll().filter((d) => d.audienceDid === audienceDid);
|
|
86
|
+
};
|
|
87
|
+
const getByIssuer = (issuerDid) => {
|
|
88
|
+
return getAll().filter((d) => d.issuerDid === issuerDid);
|
|
89
|
+
};
|
|
90
|
+
const findByCapability = (can, withUri) => {
|
|
91
|
+
return getAll().filter((d) => d.capabilities.some((capability) => ucanCapabilityCovers(capability, { can, with: withUri })));
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
get,
|
|
95
|
+
set,
|
|
96
|
+
remove,
|
|
97
|
+
has,
|
|
98
|
+
getRoot,
|
|
99
|
+
setRootCid,
|
|
100
|
+
getRootCid,
|
|
101
|
+
getAll,
|
|
102
|
+
getByAudience,
|
|
103
|
+
getByIssuer,
|
|
104
|
+
findByCapability
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
var createMemoryUcanDelegationStore = () => {
|
|
108
|
+
const store = /* @__PURE__ */ new Map();
|
|
109
|
+
const get = (cid) => {
|
|
110
|
+
if (isReservedKey(cid)) return null;
|
|
111
|
+
const raw = store.get(cid);
|
|
112
|
+
if (!raw) return null;
|
|
113
|
+
if (isValidEntry(raw)) return raw.data;
|
|
114
|
+
return null;
|
|
115
|
+
};
|
|
116
|
+
const set = (delegation) => {
|
|
117
|
+
const entry = { v: CURRENT_VERSION, data: delegation };
|
|
118
|
+
store.set(delegation.cid, entry);
|
|
119
|
+
};
|
|
120
|
+
const remove = (cid) => {
|
|
121
|
+
store.delete(cid);
|
|
122
|
+
};
|
|
123
|
+
const has = (cid) => {
|
|
124
|
+
return store.has(cid) && !isReservedKey(cid);
|
|
125
|
+
};
|
|
126
|
+
const getRoot = () => {
|
|
127
|
+
const rootCid = store.get(ROOT_DELEGATION_KEY);
|
|
128
|
+
if (!rootCid) return null;
|
|
129
|
+
return get(rootCid);
|
|
130
|
+
};
|
|
131
|
+
const setRootCid = (cid) => {
|
|
132
|
+
store.set(ROOT_DELEGATION_KEY, cid);
|
|
133
|
+
};
|
|
134
|
+
const getRootCid = () => {
|
|
135
|
+
return store.get(ROOT_DELEGATION_KEY) || null;
|
|
136
|
+
};
|
|
137
|
+
const getAll = () => {
|
|
138
|
+
const delegations = [];
|
|
139
|
+
store.forEach((value, key) => {
|
|
140
|
+
if (isReservedKey(key)) return;
|
|
141
|
+
if (isValidEntry(value)) {
|
|
142
|
+
delegations.push(value.data);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return delegations;
|
|
146
|
+
};
|
|
147
|
+
const getByAudience = (audienceDid) => {
|
|
148
|
+
return getAll().filter((d) => d.audienceDid === audienceDid);
|
|
149
|
+
};
|
|
150
|
+
const getByIssuer = (issuerDid) => {
|
|
151
|
+
return getAll().filter((d) => d.issuerDid === issuerDid);
|
|
152
|
+
};
|
|
153
|
+
const findByCapability = (can, withUri) => {
|
|
154
|
+
return getAll().filter((d) => d.capabilities.some((capability) => ucanCapabilityCovers(capability, { can, with: withUri })));
|
|
155
|
+
};
|
|
156
|
+
return {
|
|
157
|
+
get,
|
|
158
|
+
set,
|
|
159
|
+
remove,
|
|
160
|
+
has,
|
|
161
|
+
getRoot,
|
|
162
|
+
setRootCid,
|
|
163
|
+
getRootCid,
|
|
164
|
+
getAll,
|
|
165
|
+
getByAudience,
|
|
166
|
+
getByIssuer,
|
|
167
|
+
findByCapability
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// src/core/lib/ucan/requestProofs.ts
|
|
172
|
+
var FLOW_REQUESTS_MAP_KEY = "qi.flow.requests";
|
|
173
|
+
function capabilityForRequest(kind, docId, stepId) {
|
|
174
|
+
const flow = `ixo:flow:${docId}`;
|
|
175
|
+
switch (kind) {
|
|
176
|
+
case "run.start":
|
|
177
|
+
return { can: "flow/run.start", with: flow };
|
|
178
|
+
case "run.close":
|
|
179
|
+
return { can: "flow/run.close", with: flow };
|
|
180
|
+
case "schedule.arm":
|
|
181
|
+
return { can: "flow/run.start-scheduled", with: flow };
|
|
182
|
+
case "step.request":
|
|
183
|
+
case "input.respond":
|
|
184
|
+
if (!stepId) throw new Error(`A ${kind} request needs the step it is about.`);
|
|
185
|
+
return { can: "flow/block/execute", with: `${flow}:${stepId}` };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function digestRequestValue(value) {
|
|
189
|
+
return digestCanonicalJson(JSON.parse(JSON.stringify(value ?? null)));
|
|
190
|
+
}
|
|
191
|
+
function digestInputResponse(content) {
|
|
192
|
+
const { authorization: _authorization, ...rest } = content;
|
|
193
|
+
return digestRequestValue(rest);
|
|
194
|
+
}
|
|
195
|
+
function randomRequestId() {
|
|
196
|
+
const bytes = new Uint8Array(16);
|
|
197
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
198
|
+
return `req-${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
199
|
+
}
|
|
200
|
+
async function createFlowRequest(ucanService, params) {
|
|
201
|
+
if (!params.flowManagerDid.startsWith("did:")) throw new Error("The flow-manager is not known, so this request cannot be addressed to it.");
|
|
202
|
+
if (params.kind !== "schedule.arm" && !params.runId) throw new Error(`A ${params.kind} request needs the run it is about.`);
|
|
203
|
+
if (params.kind === "schedule.arm" && (!params.scheduleId || params.scheduleRevision === void 0)) {
|
|
204
|
+
throw new Error("A schedule arm request needs the schedule and its current revision.");
|
|
205
|
+
}
|
|
206
|
+
const requestId = params.requestId ?? randomRequestId();
|
|
207
|
+
const capability = capabilityForRequest(params.kind, params.docId, params.stepId);
|
|
208
|
+
const facts = {
|
|
209
|
+
type: "qi.flow.request",
|
|
210
|
+
v: 1,
|
|
211
|
+
kind: params.kind,
|
|
212
|
+
roomId: params.roomId,
|
|
213
|
+
docId: params.docId,
|
|
214
|
+
...params.runId ? { runId: params.runId } : {},
|
|
215
|
+
...params.stepId ? { stepId: params.stepId } : {},
|
|
216
|
+
defHash: params.defHash,
|
|
217
|
+
...params.input !== void 0 ? { inputDigest: await digestRequestValue(params.input) } : {},
|
|
218
|
+
requestId,
|
|
219
|
+
...params.answerDigest ? { answerDigest: params.answerDigest } : {},
|
|
220
|
+
...params.requestEventId ? { requestEventId: params.requestEventId } : {},
|
|
221
|
+
...params.scheduleId ? { scheduleId: params.scheduleId } : {},
|
|
222
|
+
...params.scheduleRevision !== void 0 ? { scheduleRevision: params.scheduleRevision } : {}
|
|
223
|
+
};
|
|
224
|
+
const result = await ucanService.createAndValidateInvocation(
|
|
225
|
+
{
|
|
226
|
+
invokerDid: params.requesterDid,
|
|
227
|
+
invokerType: "user",
|
|
228
|
+
audience: params.flowManagerDid,
|
|
229
|
+
capability,
|
|
230
|
+
proofs: [],
|
|
231
|
+
facts,
|
|
232
|
+
pin: params.pin
|
|
233
|
+
},
|
|
234
|
+
params.docId,
|
|
235
|
+
params.stepId
|
|
236
|
+
);
|
|
237
|
+
if (!result.valid || !result.cid || !result.invocation) {
|
|
238
|
+
throw new Error(result.error || "Your request could not be signed.");
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
v: 1,
|
|
242
|
+
requestId,
|
|
243
|
+
kind: params.kind,
|
|
244
|
+
runId: params.runId ?? "",
|
|
245
|
+
...params.stepId ? { stepId: params.stepId } : {},
|
|
246
|
+
requesterDid: params.requesterDid,
|
|
247
|
+
invocationCid: result.cid,
|
|
248
|
+
invocation: result.invocation,
|
|
249
|
+
createdAt: (params.now ?? Date.now)()
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function writeFlowRequest(yDoc, record) {
|
|
253
|
+
yDoc.getMap(FLOW_REQUESTS_MAP_KEY).set(record.invocationCid, record);
|
|
254
|
+
}
|
|
255
|
+
function readFlowRequest(yDoc, requestId) {
|
|
256
|
+
let found;
|
|
257
|
+
yDoc.getMap(FLOW_REQUESTS_MAP_KEY).forEach((record) => {
|
|
258
|
+
if (!found && record && typeof record === "object" && record.requestId === requestId) found = record;
|
|
259
|
+
});
|
|
260
|
+
return found;
|
|
261
|
+
}
|
|
262
|
+
function lifecycleRequestProof(options) {
|
|
263
|
+
return async ({ runId, defHash }) => options.ucanService.createRequestInvocation({
|
|
264
|
+
kind: options.kind,
|
|
265
|
+
requesterDid: options.requesterDid,
|
|
266
|
+
flowManagerDid: options.flowManagerDid,
|
|
267
|
+
roomId: options.roomId,
|
|
268
|
+
docId: options.docId,
|
|
269
|
+
runId,
|
|
270
|
+
defHash,
|
|
271
|
+
pin: await options.getPin()
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
async function requestStepRun(yDoc, params) {
|
|
275
|
+
const docId = yDoc.getMap("root").get("doc_id");
|
|
276
|
+
if (typeof docId !== "string" || !docId) throw new Error("The flow has no id yet, so a step request cannot be signed for it.");
|
|
277
|
+
const record = await createFlowRequest(params.ucanService, {
|
|
278
|
+
kind: "step.request",
|
|
279
|
+
requesterDid: params.requesterDid,
|
|
280
|
+
flowManagerDid: params.flowManagerDid,
|
|
281
|
+
roomId: params.roomId,
|
|
282
|
+
docId,
|
|
283
|
+
runId: params.runId,
|
|
284
|
+
stepId: params.stepId,
|
|
285
|
+
defHash: params.defHash ?? getRunMeta(yDoc, params.runId)?.manifest?.defHash ?? "",
|
|
286
|
+
...params.input !== void 0 ? { input: params.input } : {},
|
|
287
|
+
pin: params.pin
|
|
288
|
+
});
|
|
289
|
+
yDoc.transact(() => {
|
|
290
|
+
writeFlowRequest(yDoc, record);
|
|
291
|
+
resetActionState(yDoc, params.runId, params.stepId, { state: "idle", requestId: record.requestId });
|
|
292
|
+
});
|
|
293
|
+
return record;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/core/lib/ucan/signedChain.ts
|
|
297
|
+
import { createUCANValidator, defineCapability, ed25519 } from "@ixo/ucan";
|
|
298
|
+
import { Delegation as UcantoDelegation, UCAN } from "@ucanto/core";
|
|
299
|
+
var RECEIPT_ANCHOR_WINDOW_MS = 10 * 60 * 1e3;
|
|
300
|
+
var fail = (code, reason) => ({ ok: false, code, reason });
|
|
301
|
+
function decodeCarBase64(value) {
|
|
302
|
+
let normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
303
|
+
if (normalized.length % 4) normalized += "=".repeat(4 - normalized.length % 4);
|
|
304
|
+
const binary = globalThis.atob(normalized);
|
|
305
|
+
return Uint8Array.from(binary, (character) => character.charCodeAt(0));
|
|
306
|
+
}
|
|
307
|
+
function isSignedNode(value) {
|
|
308
|
+
const node = value;
|
|
309
|
+
return Boolean(node && typeof node === "object" && node.cid && typeof node.issuer?.did === "function" && typeof node.audience?.did === "function");
|
|
310
|
+
}
|
|
311
|
+
async function decodeSigned(car, cid) {
|
|
312
|
+
if (typeof car !== "string" || car.length === 0) {
|
|
313
|
+
return fail("MISSING_CAR", "This record has no signed copy, so it proves nothing.");
|
|
314
|
+
}
|
|
315
|
+
let extracted;
|
|
316
|
+
try {
|
|
317
|
+
extracted = await UcantoDelegation.extract(decodeCarBase64(car));
|
|
318
|
+
} catch (error) {
|
|
319
|
+
return fail("INVALID_FORMAT", `The signed copy could not be read: ${error instanceof Error ? error.message : String(error)}`);
|
|
320
|
+
}
|
|
321
|
+
if (extracted.error || !isSignedNode(extracted.ok)) {
|
|
322
|
+
return fail("INVALID_FORMAT", `The signed copy could not be read: ${extracted.error?.message ?? "unknown format"}`);
|
|
323
|
+
}
|
|
324
|
+
const node = extracted.ok;
|
|
325
|
+
if (node.cid.toString() !== cid) {
|
|
326
|
+
return fail("CID_MISMATCH", `The signed copy is a different grant (${node.cid.toString()}) from the one it is stored as (${cid}).`);
|
|
327
|
+
}
|
|
328
|
+
return { ok: true, node };
|
|
329
|
+
}
|
|
330
|
+
function signedCapabilities(node) {
|
|
331
|
+
const item = node;
|
|
332
|
+
return [...item.capabilities ?? []].flatMap((entry) => {
|
|
333
|
+
const capability = entry && typeof entry === "object" ? entry : null;
|
|
334
|
+
if (!capability || typeof capability.can !== "string" || typeof capability.with !== "string") return [];
|
|
335
|
+
const nb = capability.nb && typeof capability.nb === "object" && !Array.isArray(capability.nb) ? capability.nb : void 0;
|
|
336
|
+
return [{ can: capability.can, with: capability.with, ...nb ? { nb } : {} }];
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function abilityCovers2(parent, child) {
|
|
340
|
+
if (parent === "*" || parent === child) return true;
|
|
341
|
+
return parent.endsWith("/*") && child.startsWith(parent.slice(0, -1));
|
|
342
|
+
}
|
|
343
|
+
function resourceCovers2(parent, child) {
|
|
344
|
+
return parent === "*" || parent === child || child.startsWith(`${parent}:`) || parent.endsWith("*") && child.startsWith(parent.slice(0, -1));
|
|
345
|
+
}
|
|
346
|
+
function caveatsAttenuate(parent, child) {
|
|
347
|
+
if (!parent || Object.keys(parent).length === 0) return true;
|
|
348
|
+
if (!child) return false;
|
|
349
|
+
return Object.entries(parent).every(([key, value]) => JSON.stringify(child[key]) === JSON.stringify(value));
|
|
350
|
+
}
|
|
351
|
+
function signedCapabilityCovers(parent, child) {
|
|
352
|
+
return abilityCovers2(parent.can, child.can) && resourceCovers2(parent.with, child.with) && caveatsAttenuate(parent.nb, child.nb);
|
|
353
|
+
}
|
|
354
|
+
function grantCoversExercise(granted, required) {
|
|
355
|
+
const resourceMatches = granted.with === "*" || granted.with === required.with || granted.with.endsWith("*") && required.with.startsWith(granted.with.slice(0, -1));
|
|
356
|
+
return abilityCovers2(granted.can, required.can) && resourceMatches && caveatsAttenuate(granted.nb, required.nb);
|
|
357
|
+
}
|
|
358
|
+
function walkToOwner(node, ownerDid, seen = /* @__PURE__ */ new Set(), leafFallback = false) {
|
|
359
|
+
const cid = node.cid.toString();
|
|
360
|
+
if (seen.has(cid)) return fail("BROKEN_LINK", "The signed chain loops back on itself.");
|
|
361
|
+
const issuer = normalizeDid(node.issuer.did());
|
|
362
|
+
const proofs = node.proofs ?? [];
|
|
363
|
+
if (issuer === ownerDid) {
|
|
364
|
+
for (const proof of proofs) {
|
|
365
|
+
if (!isSignedNode(proof) || normalizeDid(proof.audience.did()) !== issuer) continue;
|
|
366
|
+
const walked = walkToOwner(proof, ownerDid, new Set(seen).add(cid));
|
|
367
|
+
if (walked.ok) return { ok: true, dids: [...walked.dids, issuer], cids: [...walked.cids, cid], nodes: [...walked.nodes, node] };
|
|
368
|
+
}
|
|
369
|
+
return { ok: true, dids: [issuer], cids: [cid], nodes: [node] };
|
|
370
|
+
}
|
|
371
|
+
if (proofs.length === 0) {
|
|
372
|
+
return fail("NOT_ROOTED_AT_OWNER", `The chain starts with ${issuer}, who did not create this flow (${ownerDid}).`);
|
|
373
|
+
}
|
|
374
|
+
const nextSeen = new Set(seen).add(cid);
|
|
375
|
+
const parents = proofs.filter((proof) => isSignedNode(proof) && normalizeDid(proof.audience.did()) === issuer);
|
|
376
|
+
if (parents.length === 0) {
|
|
377
|
+
const referencedOnly = proofs.some((proof) => !isSignedNode(proof));
|
|
378
|
+
return fail(
|
|
379
|
+
"BROKEN_LINK",
|
|
380
|
+
referencedOnly ? "A grant in the chain is referenced but not included in the signed copy." : `Nothing in the chain was given to ${issuer}, who signed this.`
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
const parentCapabilities = parents.flatMap(signedCapabilities);
|
|
384
|
+
for (const child of signedCapabilities(node)) {
|
|
385
|
+
const coveredByFallback = (parent) => leafFallback && abilityCovers2(parent.can, "flow/block/execute") && resourceCovers2(parent.with, child.with) && caveatsAttenuate(parent.nb, child.nb);
|
|
386
|
+
if (!parentCapabilities.some((parent) => signedCapabilityCovers(parent, child) || coveredByFallback(parent))) {
|
|
387
|
+
return fail("EXCEEDS_PARENT", `${child.can} on ${child.with} is wider than what ${issuer} was given.`);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
let first = null;
|
|
391
|
+
const cids = [];
|
|
392
|
+
const nodes = [];
|
|
393
|
+
for (const parent of parents) {
|
|
394
|
+
const walked = walkToOwner(parent, ownerDid, nextSeen);
|
|
395
|
+
if (!walked.ok) return walked;
|
|
396
|
+
first ?? (first = walked);
|
|
397
|
+
for (const parentCid of walked.cids) if (!cids.includes(parentCid)) cids.push(parentCid);
|
|
398
|
+
nodes.push(...walked.nodes);
|
|
399
|
+
}
|
|
400
|
+
return { ok: true, dids: [...first.dids, issuer], cids: [...cids, cid], nodes: [...nodes, node] };
|
|
401
|
+
}
|
|
402
|
+
function finiteSeconds(value) {
|
|
403
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
404
|
+
}
|
|
405
|
+
function earliestExpirationSeconds(nodes) {
|
|
406
|
+
let earliest;
|
|
407
|
+
for (const node of nodes) {
|
|
408
|
+
const exp = finiteSeconds(node.expiration);
|
|
409
|
+
if (exp !== void 0 && (earliest === void 0 || exp < earliest)) earliest = exp;
|
|
410
|
+
}
|
|
411
|
+
return earliest;
|
|
412
|
+
}
|
|
413
|
+
async function resolveKeys(did, env) {
|
|
414
|
+
if (did.startsWith("did:key:")) return [did];
|
|
415
|
+
if (!env.didResolver) return fail("INVALID_SIGNATURE", `Cannot look up the keys for ${did}: no DID resolver is configured.`);
|
|
416
|
+
const resolved = await env.didResolver(did);
|
|
417
|
+
if ("error" in resolved) return fail("INVALID_SIGNATURE", `Cannot look up the keys for ${did}: ${resolved.error.message}`);
|
|
418
|
+
if (!resolved.ok?.length) return fail("INVALID_SIGNATURE", `${did} has no signing keys on record.`);
|
|
419
|
+
return resolved.ok;
|
|
420
|
+
}
|
|
421
|
+
async function verifyNodeSignature(node, env) {
|
|
422
|
+
const issuerDid = node.issuer.did();
|
|
423
|
+
const keys = await resolveKeys(issuerDid, env);
|
|
424
|
+
if (!Array.isArray(keys)) return keys;
|
|
425
|
+
for (const key of keys) {
|
|
426
|
+
try {
|
|
427
|
+
const verifier = ed25519.Verifier.parse(key);
|
|
428
|
+
const wrapped = {
|
|
429
|
+
did: () => issuerDid,
|
|
430
|
+
verify: (payload, signature) => verifier.verify(payload, signature)
|
|
431
|
+
};
|
|
432
|
+
if (await UCAN.verifySignature(node.data, wrapped)) return null;
|
|
433
|
+
} catch {
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return fail("INVALID_SIGNATURE", `The signature by ${issuerDid} does not check out.`);
|
|
437
|
+
}
|
|
438
|
+
function checkTimeAt(nodes, atMs) {
|
|
439
|
+
const atSeconds = Math.floor(atMs / 1e3);
|
|
440
|
+
for (const node of nodes) {
|
|
441
|
+
const nbf = finiteSeconds(node.notBefore);
|
|
442
|
+
if (nbf !== void 0 && atSeconds < nbf) {
|
|
443
|
+
return fail("NOT_YET_VALID", `A grant in the chain only starts at ${new Date(nbf * 1e3).toISOString()}.`);
|
|
444
|
+
}
|
|
445
|
+
const exp = finiteSeconds(node.expiration);
|
|
446
|
+
if (exp !== void 0 && atSeconds >= exp) {
|
|
447
|
+
return fail("EXPIRED", `A grant in the chain had already expired at ${new Date(exp * 1e3).toISOString()}.`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
async function checkRevocation(cids, env) {
|
|
453
|
+
if (!env.revocationChecker) return fail("NO_REVOCATION_CHECKER", "Could not confirm the grant was not cancelled: no revocation service is configured.");
|
|
454
|
+
try {
|
|
455
|
+
const revoked = await env.revocationChecker.check(cids);
|
|
456
|
+
const hit = revoked.find((cid) => cids.includes(cid));
|
|
457
|
+
return hit ? { revoked: hit } : {};
|
|
458
|
+
} catch (error) {
|
|
459
|
+
return fail("REVOCATION_CHECK_FAILED", `Could not confirm the grant was not cancelled: ${error instanceof Error ? error.message : String(error)}`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function mapValidatorError(error) {
|
|
463
|
+
const message = error?.message ?? "The signed chain did not verify.";
|
|
464
|
+
switch (error?.code) {
|
|
465
|
+
case "EXPIRED":
|
|
466
|
+
return fail("EXPIRED", "This grant has expired.");
|
|
467
|
+
case "REVOKED":
|
|
468
|
+
return fail("REVOKED", `This grant has been cancelled. ${message}`);
|
|
469
|
+
case "REVOCATION_CHECK_FAILED":
|
|
470
|
+
return fail("REVOCATION_CHECK_FAILED", `Could not confirm the grant was not cancelled. ${message}`);
|
|
471
|
+
case "INVALID_SIGNATURE":
|
|
472
|
+
return fail("INVALID_SIGNATURE", message);
|
|
473
|
+
case "INVALID_FORMAT":
|
|
474
|
+
return fail("INVALID_FORMAT", message);
|
|
475
|
+
default:
|
|
476
|
+
if (/no expiration/i.test(message)) return fail("NO_EXPIRATION", "This grant never expires. Grants must have an end date; ask the flow creator to sign it again.");
|
|
477
|
+
if (/expired/i.test(message)) return fail("EXPIRED", "This grant has expired.");
|
|
478
|
+
return fail("UNAUTHORIZED", message);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
async function verifyGrant(car, options) {
|
|
482
|
+
const ownerDid = options.ownerDid ? normalizeDid(options.ownerDid) : "";
|
|
483
|
+
if (!ownerDid.startsWith("did:")) return fail("NO_OWNER", "This flow has no known creator, so no grant in it can be checked.");
|
|
484
|
+
const decoded = await decodeSigned(car, options.cid);
|
|
485
|
+
if (!decoded.ok) return decoded;
|
|
486
|
+
const { node } = decoded;
|
|
487
|
+
const audienceDid = normalizeDid(node.audience.did());
|
|
488
|
+
if (audienceDid !== normalizeDid(options.actorDid)) {
|
|
489
|
+
return fail("WRONG_AUDIENCE", `This grant was given to ${audienceDid}, not to ${normalizeDid(options.actorDid)}.`);
|
|
490
|
+
}
|
|
491
|
+
const walked = walkToOwner(node, ownerDid);
|
|
492
|
+
if (!walked.ok) return walked;
|
|
493
|
+
const capabilities = signedCapabilities(node);
|
|
494
|
+
const covers = options.coverage === "hierarchical" ? signedCapabilityCovers : grantCoversExercise;
|
|
495
|
+
if (!capabilities.some((capability) => covers(capability, options.required))) {
|
|
496
|
+
return fail("CAPABILITY_NOT_COVERED", `This grant does not allow ${options.required.can} on ${options.required.with}.`);
|
|
497
|
+
}
|
|
498
|
+
const expSeconds = earliestExpirationSeconds(walked.nodes);
|
|
499
|
+
const grant = {
|
|
500
|
+
cid: options.cid,
|
|
501
|
+
issuerDid: normalizeDid(node.issuer.did()),
|
|
502
|
+
audienceDid,
|
|
503
|
+
capabilities,
|
|
504
|
+
...expSeconds !== void 0 ? { expiresAt: expSeconds * 1e3 } : {},
|
|
505
|
+
proofChain: walked.dids,
|
|
506
|
+
proofChainCids: walked.cids
|
|
507
|
+
};
|
|
508
|
+
if (options.at === void 0) {
|
|
509
|
+
if (!options.env.revocationChecker) return fail("NO_REVOCATION_CHECKER", "Could not confirm the grant was not cancelled: no revocation service is configured.");
|
|
510
|
+
const notYet = checkTimeAt(walked.nodes, Date.now());
|
|
511
|
+
if (notYet?.code === "NOT_YET_VALID") return notYet;
|
|
512
|
+
const validator = await createUCANValidator({
|
|
513
|
+
serverDid: node.audience.did(),
|
|
514
|
+
rootIssuers: [ownerDid],
|
|
515
|
+
didResolver: options.env.didResolver,
|
|
516
|
+
revocationChecker: options.env.revocationChecker,
|
|
517
|
+
revocationFailure: "closed",
|
|
518
|
+
requireExpiration: true
|
|
519
|
+
});
|
|
520
|
+
const result = await validator.validateDelegation(car);
|
|
521
|
+
if (!result.ok) return mapValidatorError(result.error);
|
|
522
|
+
return { ok: true, grant };
|
|
523
|
+
}
|
|
524
|
+
for (const chainNode of walked.nodes) {
|
|
525
|
+
const bad = await verifyNodeSignature(chainNode, options.env);
|
|
526
|
+
if (bad) return bad;
|
|
527
|
+
}
|
|
528
|
+
const timeFailure = checkTimeAt(walked.nodes, options.at);
|
|
529
|
+
if (timeFailure) return timeFailure;
|
|
530
|
+
const revocation = await checkRevocation(walked.cids, options.env);
|
|
531
|
+
if ("ok" in revocation) return revocation;
|
|
532
|
+
return { ok: true, grant, ...revocation.revoked ? { revokedNow: revocation.revoked } : {} };
|
|
533
|
+
}
|
|
534
|
+
var capabilityParsers = /* @__PURE__ */ new Map();
|
|
535
|
+
function capabilityParser(can) {
|
|
536
|
+
let parser = capabilityParsers.get(can);
|
|
537
|
+
if (!parser) {
|
|
538
|
+
parser = defineCapability({ can, protocol: "ixo:" });
|
|
539
|
+
capabilityParsers.set(can, parser);
|
|
540
|
+
}
|
|
541
|
+
return parser;
|
|
542
|
+
}
|
|
543
|
+
var NO_REPLAY_STORE = {
|
|
544
|
+
has: async () => false,
|
|
545
|
+
add: async () => void 0
|
|
546
|
+
};
|
|
547
|
+
function factsMatch(facts, expected) {
|
|
548
|
+
if (!expected || Object.keys(expected).length === 0) return true;
|
|
549
|
+
return (facts ?? []).some((fact) => {
|
|
550
|
+
if (!fact || typeof fact !== "object") return false;
|
|
551
|
+
const record = fact;
|
|
552
|
+
return Object.entries(expected).every(([key, value]) => JSON.stringify(record[key]) === JSON.stringify(value));
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
function plainFacts(facts) {
|
|
556
|
+
return (facts ?? []).filter((fact) => Boolean(fact) && typeof fact === "object" && !Array.isArray(fact));
|
|
557
|
+
}
|
|
558
|
+
async function verifyInvocation(car, options) {
|
|
559
|
+
const ownerDid = options.ownerDid ? normalizeDid(options.ownerDid) : "";
|
|
560
|
+
if (!ownerDid.startsWith("did:")) return fail("NO_OWNER", "This flow has no known creator, so no receipt in it can be checked.");
|
|
561
|
+
const decoded = await decodeSigned(car, options.cid);
|
|
562
|
+
if (!decoded.ok) return decoded;
|
|
563
|
+
const { node } = decoded;
|
|
564
|
+
const audienceDid = normalizeDid(node.audience.did());
|
|
565
|
+
if (audienceDid !== normalizeDid(options.expectedAudience)) {
|
|
566
|
+
return fail("WRONG_AUDIENCE", `This receipt is addressed to ${audienceDid}, not ${normalizeDid(options.expectedAudience)}.`);
|
|
567
|
+
}
|
|
568
|
+
const invokerDid = normalizeDid(node.issuer.did());
|
|
569
|
+
if (options.actorDid && invokerDid !== normalizeDid(options.actorDid)) {
|
|
570
|
+
return fail("WRONG_INVOKER", `This receipt was signed by ${invokerDid}, not by ${normalizeDid(options.actorDid)} as recorded.`);
|
|
571
|
+
}
|
|
572
|
+
const capabilities = signedCapabilities(node);
|
|
573
|
+
const capability = capabilities[0];
|
|
574
|
+
if (capabilities.length !== 1 || capability.can !== options.required.can || capability.with !== options.required.with) {
|
|
575
|
+
return fail("CAPABILITY_NOT_COVERED", `This receipt is not for ${options.required.can} on ${options.required.with}.`);
|
|
576
|
+
}
|
|
577
|
+
if (!factsMatch(node.facts, options.expectedFacts)) {
|
|
578
|
+
return fail("FACTS_MISMATCH", "The signed receipt does not match what the record says happened (action, inputs or run).");
|
|
579
|
+
}
|
|
580
|
+
const walked = walkToOwner(node, ownerDid, /* @__PURE__ */ new Set(), options.allowBlockExecuteFallback === true);
|
|
581
|
+
if (!walked.ok) return walked;
|
|
582
|
+
const expSeconds = earliestExpirationSeconds(walked.nodes);
|
|
583
|
+
const grantExpSeconds = earliestExpirationSeconds(walked.nodes.filter((chainNode) => chainNode !== node));
|
|
584
|
+
const verified = {
|
|
585
|
+
cid: options.cid,
|
|
586
|
+
invokerDid,
|
|
587
|
+
audienceDid,
|
|
588
|
+
capability,
|
|
589
|
+
facts: plainFacts(node.facts),
|
|
590
|
+
...expSeconds !== void 0 ? { expiresAt: expSeconds * 1e3 } : {},
|
|
591
|
+
...grantExpSeconds !== void 0 ? { grantsExpireAt: grantExpSeconds * 1e3 } : {},
|
|
592
|
+
proofChain: walked.dids,
|
|
593
|
+
proofChainCids: walked.cids
|
|
594
|
+
};
|
|
595
|
+
if (options.at === void 0) {
|
|
596
|
+
if (!options.env.revocationChecker) return fail("NO_REVOCATION_CHECKER", "Could not confirm the grant was not cancelled: no revocation service is configured.");
|
|
597
|
+
const validator = await createUCANValidator({
|
|
598
|
+
serverDid: node.audience.did(),
|
|
599
|
+
rootIssuers: [ownerDid],
|
|
600
|
+
didResolver: options.env.didResolver,
|
|
601
|
+
invocationStore: NO_REPLAY_STORE,
|
|
602
|
+
revocationChecker: options.env.revocationChecker,
|
|
603
|
+
revocationFailure: "closed",
|
|
604
|
+
requireExpiration: true
|
|
605
|
+
});
|
|
606
|
+
const result = await validator.validate(car, capabilityParser(options.required.can), options.required.with);
|
|
607
|
+
if (!result.ok) return mapValidatorError(result.error);
|
|
608
|
+
if (normalizeDid(result.proofChain?.[0] ?? "") !== ownerDid) {
|
|
609
|
+
return fail("NOT_ROOTED_AT_OWNER", `The chain starts with ${result.proofChain?.[0] ?? "nobody"}, who did not create this flow.`);
|
|
610
|
+
}
|
|
611
|
+
return { ok: true, invocation: verified };
|
|
612
|
+
}
|
|
613
|
+
const ownExp = finiteSeconds(node.expiration);
|
|
614
|
+
let noTimeAnchor = false;
|
|
615
|
+
if (ownExp === void 0) {
|
|
616
|
+
noTimeAnchor = true;
|
|
617
|
+
} else {
|
|
618
|
+
const expMs = ownExp * 1e3;
|
|
619
|
+
if (options.at >= expMs || options.at < expMs - RECEIPT_ANCHOR_WINDOW_MS) {
|
|
620
|
+
return fail("EXPIRED", `The recorded time ${new Date(options.at).toISOString()} is outside the time this receipt was signed for.`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
for (const chainNode of walked.nodes) {
|
|
624
|
+
const bad = await verifyNodeSignature(chainNode, options.env);
|
|
625
|
+
if (bad) return bad;
|
|
626
|
+
}
|
|
627
|
+
const timeFailure = checkTimeAt(walked.nodes, options.at);
|
|
628
|
+
if (timeFailure) return timeFailure;
|
|
629
|
+
const revocation = await checkRevocation(walked.cids, options.env);
|
|
630
|
+
if ("ok" in revocation) return revocation;
|
|
631
|
+
return {
|
|
632
|
+
ok: true,
|
|
633
|
+
invocation: verified,
|
|
634
|
+
...revocation.revoked ? { revokedNow: revocation.revoked } : {},
|
|
635
|
+
...noTimeAnchor ? { noTimeAnchor: true } : {}
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// src/core/services/ucanService.ts
|
|
640
|
+
import {
|
|
641
|
+
createDelegation as ucanCreateDelegation,
|
|
642
|
+
createInvocation as ucanCreateInvocation,
|
|
643
|
+
serializeDelegation,
|
|
644
|
+
serializeInvocation,
|
|
645
|
+
parseDelegation,
|
|
646
|
+
parseSigner,
|
|
647
|
+
signerFromMnemonic
|
|
648
|
+
} from "@ixo/ucan";
|
|
649
|
+
var FLOW_INVOCATION_SIGNER_TTL_SECONDS = 60 * 60;
|
|
650
|
+
var FLOW_INVOCATION_TTL_SECONDS = 300;
|
|
651
|
+
function createInvocationNonce() {
|
|
652
|
+
const bytes = new Uint8Array(16);
|
|
653
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
654
|
+
let binary = "";
|
|
655
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
656
|
+
return globalThis.btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
657
|
+
}
|
|
658
|
+
function toSupportedDID(did) {
|
|
659
|
+
if (did.startsWith("did:ixo:") || did.startsWith("did:key:")) {
|
|
660
|
+
return did;
|
|
661
|
+
}
|
|
662
|
+
return void 0;
|
|
663
|
+
}
|
|
664
|
+
var DEFAULT_FLOW_GRANT_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
665
|
+
function resolveGrantExpiration(expiration, now = Date.now()) {
|
|
666
|
+
if (expiration === void 0) return now + DEFAULT_FLOW_GRANT_TTL_MS;
|
|
667
|
+
if (!Number.isFinite(expiration) || expiration <= now) throw new Error("A grant needs an expiry date in the future.");
|
|
668
|
+
return expiration;
|
|
669
|
+
}
|
|
670
|
+
function toInvocationAudienceDID(did) {
|
|
671
|
+
const normalized = normalizeDid(did);
|
|
672
|
+
const supported = toSupportedDID(normalized);
|
|
673
|
+
if (!supported) {
|
|
674
|
+
throw new Error(`Invalid DID "${did}", must start with 'did:'`);
|
|
675
|
+
}
|
|
676
|
+
return supported;
|
|
677
|
+
}
|
|
678
|
+
function toUcantoCapabilities(capabilities) {
|
|
679
|
+
return capabilities.map((cap) => ({
|
|
680
|
+
can: cap.can,
|
|
681
|
+
with: cap.with,
|
|
682
|
+
...cap.nb && { nb: cap.nb }
|
|
683
|
+
}));
|
|
684
|
+
}
|
|
685
|
+
async function getSigner(handlers, did, didType, entityRoomId, pin) {
|
|
686
|
+
const normalizedDid = normalizeDid(did);
|
|
687
|
+
const supportedDid = toSupportedDID(normalizedDid);
|
|
688
|
+
if (handlers.getPrivateKey) {
|
|
689
|
+
const privateKey = await handlers.getPrivateKey({ did: normalizedDid, didType, entityRoomId, pin });
|
|
690
|
+
return parseSigner(privateKey, supportedDid);
|
|
691
|
+
}
|
|
692
|
+
if (handlers.getMnemonic) {
|
|
693
|
+
const mnemonic = await handlers.getMnemonic({ did: normalizedDid, didType, entityRoomId, pin });
|
|
694
|
+
const result = await signerFromMnemonic(mnemonic, supportedDid);
|
|
695
|
+
return result.signer;
|
|
696
|
+
}
|
|
697
|
+
throw new Error("No signer handler configured (need getPrivateKey or getMnemonic)");
|
|
698
|
+
}
|
|
699
|
+
function getCidFromDelegation(delegation) {
|
|
700
|
+
return delegation.cid.toString();
|
|
701
|
+
}
|
|
702
|
+
var createUcanService = (config) => {
|
|
703
|
+
const { delegationStore, invocationStore, handlers, flowOwnerDid } = config;
|
|
704
|
+
const delegationCache = /* @__PURE__ */ new Map();
|
|
705
|
+
const isConfigured = () => {
|
|
706
|
+
const hasSessionHandlers = !!(handlers.createSignerSession && handlers.signWithSession);
|
|
707
|
+
const hasLegacyHandlers = !!(handlers.getPrivateKey || handlers.getMnemonic);
|
|
708
|
+
return hasSessionHandlers || hasLegacyHandlers;
|
|
709
|
+
};
|
|
710
|
+
const parseDelegationFromStore = async (cid) => {
|
|
711
|
+
if (delegationCache.has(cid)) {
|
|
712
|
+
return delegationCache.get(cid);
|
|
713
|
+
}
|
|
714
|
+
const stored = delegationStore.get(cid);
|
|
715
|
+
if (!stored || !stored.delegation) {
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
try {
|
|
719
|
+
const delegation = await parseDelegation(stored.delegation);
|
|
720
|
+
delegationCache.set(cid, delegation);
|
|
721
|
+
return delegation;
|
|
722
|
+
} catch {
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
const getProofDelegations = async (proofCids) => {
|
|
727
|
+
const proofs = [];
|
|
728
|
+
for (const cid of proofCids) {
|
|
729
|
+
const delegation = await parseDelegationFromStore(cid);
|
|
730
|
+
if (delegation) {
|
|
731
|
+
proofs.push(delegation);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return proofs;
|
|
735
|
+
};
|
|
736
|
+
const getProofCars = async (proofCids) => {
|
|
737
|
+
const cars = [];
|
|
738
|
+
for (const cid of proofCids) {
|
|
739
|
+
const stored = delegationStore.get(cid);
|
|
740
|
+
if (stored && stored.delegation) {
|
|
741
|
+
cars.push(stored.delegation);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return cars;
|
|
745
|
+
};
|
|
746
|
+
const createRootDelegation = async (params) => {
|
|
747
|
+
const { flowOwnerDid: ownerDid, issuerType, entityRoomId, flowUri: uri, pin } = params;
|
|
748
|
+
const normalizedOwnerDid = normalizeDid(ownerDid);
|
|
749
|
+
const capabilities = [{ can: "flow/*", with: uri }];
|
|
750
|
+
const rootExpiration = resolveGrantExpiration();
|
|
751
|
+
if (handlers.createSignerSession && handlers.createDelegationWithSession) {
|
|
752
|
+
const session = await handlers.createSignerSession({
|
|
753
|
+
did: normalizedOwnerDid,
|
|
754
|
+
didType: issuerType,
|
|
755
|
+
entityRoomId,
|
|
756
|
+
pin,
|
|
757
|
+
scope: "operation"
|
|
758
|
+
});
|
|
759
|
+
const result = await handlers.createDelegationWithSession({
|
|
760
|
+
sessionId: session.sessionId,
|
|
761
|
+
audience: normalizedOwnerDid,
|
|
762
|
+
capabilities,
|
|
763
|
+
proofs: [],
|
|
764
|
+
expiration: Math.floor(rootExpiration / 1e3)
|
|
765
|
+
});
|
|
766
|
+
const storedDelegation2 = {
|
|
767
|
+
cid: result.cid,
|
|
768
|
+
delegation: result.delegation,
|
|
769
|
+
issuerDid: normalizedOwnerDid,
|
|
770
|
+
audienceDid: normalizedOwnerDid,
|
|
771
|
+
capabilities,
|
|
772
|
+
expiration: rootExpiration,
|
|
773
|
+
createdAt: Date.now(),
|
|
774
|
+
format: "car",
|
|
775
|
+
proofCids: []
|
|
776
|
+
};
|
|
777
|
+
delegationStore.set(storedDelegation2);
|
|
778
|
+
delegationStore.setRootCid(result.cid);
|
|
779
|
+
return storedDelegation2;
|
|
780
|
+
}
|
|
781
|
+
const signer = await getSigner(handlers, ownerDid, issuerType, entityRoomId, pin);
|
|
782
|
+
const delegation = await ucanCreateDelegation({
|
|
783
|
+
issuer: signer,
|
|
784
|
+
audience: toInvocationAudienceDID(normalizedOwnerDid),
|
|
785
|
+
capabilities,
|
|
786
|
+
proofs: [],
|
|
787
|
+
expiration: Math.floor(rootExpiration / 1e3)
|
|
788
|
+
});
|
|
789
|
+
const serialized = await serializeDelegation(delegation);
|
|
790
|
+
const cid = getCidFromDelegation(delegation);
|
|
791
|
+
const storedDelegation = {
|
|
792
|
+
cid,
|
|
793
|
+
delegation: serialized,
|
|
794
|
+
issuerDid: normalizedOwnerDid,
|
|
795
|
+
audienceDid: normalizedOwnerDid,
|
|
796
|
+
capabilities,
|
|
797
|
+
expiration: rootExpiration,
|
|
798
|
+
createdAt: Date.now(),
|
|
799
|
+
format: "car",
|
|
800
|
+
proofCids: []
|
|
801
|
+
};
|
|
802
|
+
delegationStore.set(storedDelegation);
|
|
803
|
+
delegationStore.setRootCid(cid);
|
|
804
|
+
delegationCache.set(cid, delegation);
|
|
805
|
+
return storedDelegation;
|
|
806
|
+
};
|
|
807
|
+
const createDelegation = async (params) => {
|
|
808
|
+
const { issuerDid, issuerType, entityRoomId, audience, capabilities, proofs = [], pin } = params;
|
|
809
|
+
const expiration = resolveGrantExpiration(params.expiration);
|
|
810
|
+
const normalizedIssuerDid = normalizeDid(issuerDid);
|
|
811
|
+
const normalizedAudienceDid = normalizeDid(audience);
|
|
812
|
+
const proofCids = proofs;
|
|
813
|
+
if (handlers.createSignerSession && handlers.createDelegationWithSession) {
|
|
814
|
+
const session = await handlers.createSignerSession({
|
|
815
|
+
did: normalizedIssuerDid,
|
|
816
|
+
didType: issuerType,
|
|
817
|
+
entityRoomId,
|
|
818
|
+
pin,
|
|
819
|
+
scope: "operation"
|
|
820
|
+
});
|
|
821
|
+
const proofCars = await getProofCars(proofCids);
|
|
822
|
+
const result = await handlers.createDelegationWithSession({
|
|
823
|
+
sessionId: session.sessionId,
|
|
824
|
+
audience: normalizedAudienceDid,
|
|
825
|
+
capabilities,
|
|
826
|
+
proofs: proofCars,
|
|
827
|
+
expiration: Math.floor(expiration / 1e3)
|
|
828
|
+
});
|
|
829
|
+
const storedDelegation2 = {
|
|
830
|
+
cid: result.cid,
|
|
831
|
+
delegation: result.delegation,
|
|
832
|
+
issuerDid: normalizedIssuerDid,
|
|
833
|
+
audienceDid: normalizedAudienceDid,
|
|
834
|
+
capabilities,
|
|
835
|
+
expiration,
|
|
836
|
+
createdAt: Date.now(),
|
|
837
|
+
format: "car",
|
|
838
|
+
proofCids
|
|
839
|
+
};
|
|
840
|
+
delegationStore.set(storedDelegation2);
|
|
841
|
+
return storedDelegation2;
|
|
842
|
+
}
|
|
843
|
+
const signer = await getSigner(handlers, issuerDid, issuerType, entityRoomId, pin);
|
|
844
|
+
const proofDelegations = await getProofDelegations(proofCids);
|
|
845
|
+
const delegation = await ucanCreateDelegation({
|
|
846
|
+
issuer: signer,
|
|
847
|
+
audience: toInvocationAudienceDID(normalizedAudienceDid),
|
|
848
|
+
capabilities: toUcantoCapabilities(capabilities),
|
|
849
|
+
proofs: proofDelegations,
|
|
850
|
+
expiration: Math.floor(expiration / 1e3)
|
|
851
|
+
});
|
|
852
|
+
const serialized = await serializeDelegation(delegation);
|
|
853
|
+
const cid = getCidFromDelegation(delegation);
|
|
854
|
+
const storedDelegation = {
|
|
855
|
+
cid,
|
|
856
|
+
delegation: serialized,
|
|
857
|
+
issuerDid: normalizedIssuerDid,
|
|
858
|
+
audienceDid: normalizedAudienceDid,
|
|
859
|
+
capabilities,
|
|
860
|
+
expiration,
|
|
861
|
+
createdAt: Date.now(),
|
|
862
|
+
format: "car",
|
|
863
|
+
proofCids
|
|
864
|
+
};
|
|
865
|
+
delegationStore.set(storedDelegation);
|
|
866
|
+
delegationCache.set(cid, delegation);
|
|
867
|
+
return storedDelegation;
|
|
868
|
+
};
|
|
869
|
+
const revokeDelegation = async (cid) => {
|
|
870
|
+
const token = delegationStore.get(cid)?.delegation;
|
|
871
|
+
if (token) {
|
|
872
|
+
if (!handlers.revokeDelegation) throw new Error("Revoking is not available here, so the grant was left in place.");
|
|
873
|
+
await handlers.revokeDelegation({ cid, token });
|
|
874
|
+
}
|
|
875
|
+
delegationStore.remove(cid);
|
|
876
|
+
delegationCache.delete(cid);
|
|
877
|
+
config.authority?.invalidate();
|
|
878
|
+
};
|
|
879
|
+
const getDelegation = (cid) => {
|
|
880
|
+
return delegationStore.get(cid);
|
|
881
|
+
};
|
|
882
|
+
const getAllDelegations = () => {
|
|
883
|
+
return delegationStore.getAll();
|
|
884
|
+
};
|
|
885
|
+
const getRootDelegation = () => {
|
|
886
|
+
return delegationStore.getRoot();
|
|
887
|
+
};
|
|
888
|
+
const findValidProofs = async (audienceDid, capability) => {
|
|
889
|
+
if (!config.authority) {
|
|
890
|
+
return { found: false, error: "Grants cannot be checked in this editor: no UCAN verifier is set up." };
|
|
891
|
+
}
|
|
892
|
+
const decision = await config.authority.authorize(audienceDid, capability);
|
|
893
|
+
return decision.allowed ? { found: true, proofCids: decision.proofCids } : { found: false, error: decision.reason };
|
|
894
|
+
};
|
|
895
|
+
const validateDelegationChain = async (audienceDid, capability) => {
|
|
896
|
+
const proofsResult = await findValidProofs(audienceDid, capability);
|
|
897
|
+
if (!proofsResult.found || !proofsResult.proofCids) {
|
|
898
|
+
return { valid: false, error: proofsResult.error };
|
|
899
|
+
}
|
|
900
|
+
const proofChain = proofsResult.proofCids.map((cid) => delegationStore.get(cid)).filter((delegation) => delegation !== null);
|
|
901
|
+
return { valid: true, proofChain };
|
|
902
|
+
};
|
|
903
|
+
const createAndValidateInvocation = async (params, _flowId, _blockId) => {
|
|
904
|
+
const { invokerDid, invokerType, entityRoomId, capability, pin } = params;
|
|
905
|
+
const normalizedInvokerDid = normalizeDid(invokerDid);
|
|
906
|
+
const refuse = (error) => ({ cid: "", invocation: "", valid: false, error });
|
|
907
|
+
const proofsResult = await findValidProofs(normalizedInvokerDid, capability);
|
|
908
|
+
if (!proofsResult.found || !proofsResult.proofCids) return refuse(proofsResult.error ?? "No valid grant for this action.");
|
|
909
|
+
const proofs = proofsResult.proofCids;
|
|
910
|
+
const audience = normalizeDid(params.audience ?? flowOwnerDid);
|
|
911
|
+
if (!audience.startsWith("did:")) return refuse("We can't tell who created this flow yet, so nothing can be signed for it.");
|
|
912
|
+
const ttlSeconds = Math.min(params.ttlSeconds ?? FLOW_INVOCATION_TTL_SECONDS, FLOW_INVOCATION_TTL_SECONDS);
|
|
913
|
+
let expiration = 0;
|
|
914
|
+
const facts = { ...params.facts ?? {}, nonce: typeof params.facts?.nonce === "string" ? params.facts.nonce : createInvocationNonce() };
|
|
915
|
+
let minted;
|
|
916
|
+
if (handlers.createSignerSession && handlers.createInvocationWithSession) {
|
|
917
|
+
try {
|
|
918
|
+
const cachedSession = await handlers.getActiveSignerSession?.({ did: normalizedInvokerDid });
|
|
919
|
+
const session = cachedSession ?? await handlers.createSignerSession({
|
|
920
|
+
did: normalizedInvokerDid,
|
|
921
|
+
didType: invokerType,
|
|
922
|
+
entityRoomId,
|
|
923
|
+
pin,
|
|
924
|
+
scope: "session",
|
|
925
|
+
ttlSeconds: FLOW_INVOCATION_SIGNER_TTL_SECONDS
|
|
926
|
+
});
|
|
927
|
+
const proofCars = await getProofCars(proofs);
|
|
928
|
+
expiration = Math.floor(Date.now() / 1e3) + ttlSeconds;
|
|
929
|
+
minted = await handlers.createInvocationWithSession({
|
|
930
|
+
sessionId: session.sessionId,
|
|
931
|
+
audience,
|
|
932
|
+
capability: {
|
|
933
|
+
can: capability.can,
|
|
934
|
+
with: capability.with,
|
|
935
|
+
...capability.nb && { nb: capability.nb }
|
|
936
|
+
},
|
|
937
|
+
proofs: proofCars,
|
|
938
|
+
facts,
|
|
939
|
+
expiration
|
|
940
|
+
});
|
|
941
|
+
} catch (err) {
|
|
942
|
+
return refuse(err instanceof Error ? err.message : "Failed to create invocation via session");
|
|
943
|
+
}
|
|
944
|
+
} else {
|
|
945
|
+
const signer = await getSigner(handlers, invokerDid, invokerType, entityRoomId, pin);
|
|
946
|
+
const proofDelegations = await getProofDelegations(proofs);
|
|
947
|
+
const ucantoCapability = {
|
|
948
|
+
can: capability.can,
|
|
949
|
+
with: capability.with,
|
|
950
|
+
...capability.nb && { nb: capability.nb }
|
|
951
|
+
};
|
|
952
|
+
expiration = Math.floor(Date.now() / 1e3) + ttlSeconds;
|
|
953
|
+
const invocation = await ucanCreateInvocation({
|
|
954
|
+
issuer: signer,
|
|
955
|
+
audience,
|
|
956
|
+
capability: ucantoCapability,
|
|
957
|
+
proofs: proofDelegations,
|
|
958
|
+
facts: [facts],
|
|
959
|
+
expiration
|
|
960
|
+
});
|
|
961
|
+
const built = await invocation.buildIPLDView();
|
|
962
|
+
minted = { cid: built.cid.toString(), invocation: await serializeInvocation(invocation) };
|
|
963
|
+
}
|
|
964
|
+
if (!config.verification) return refuse("This invocation cannot be checked in this editor: no UCAN verifier is set up.");
|
|
965
|
+
const verdict = await verifyInvocation(minted.invocation, {
|
|
966
|
+
cid: minted.cid,
|
|
967
|
+
expectedAudience: audience,
|
|
968
|
+
ownerDid: flowOwnerDid,
|
|
969
|
+
actorDid: normalizedInvokerDid,
|
|
970
|
+
required: { can: capability.can, with: capability.with },
|
|
971
|
+
expectedFacts: facts,
|
|
972
|
+
env: config.verification,
|
|
973
|
+
at: (expiration - ttlSeconds) * 1e3
|
|
974
|
+
});
|
|
975
|
+
if (!verdict.ok) return { cid: minted.cid, invocation: minted.invocation, valid: false, error: verdict.reason };
|
|
976
|
+
if (verdict.revokedNow) return { cid: minted.cid, invocation: minted.invocation, valid: false, error: "The grant this relies on has been cancelled." };
|
|
977
|
+
return { cid: minted.cid, invocation: minted.invocation, valid: true, facts, proofCids: proofs, expiresAt: expiration * 1e3, signedAt: (expiration - ttlSeconds) * 1e3 };
|
|
978
|
+
};
|
|
979
|
+
const executeWithInvocation = async (params, action, flowId, blockId, sessionRunId) => {
|
|
980
|
+
const invocationResult = await createAndValidateInvocation(params, flowId, blockId);
|
|
981
|
+
if (!invocationResult.valid) {
|
|
982
|
+
return {
|
|
983
|
+
success: false,
|
|
984
|
+
invocationCid: invocationResult.cid,
|
|
985
|
+
error: invocationResult.error
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
if (invocationStore.hasBeenInvoked(invocationResult.cid)) {
|
|
989
|
+
return {
|
|
990
|
+
success: false,
|
|
991
|
+
invocationCid: invocationResult.cid,
|
|
992
|
+
error: "Invocation has already been used (replay attack prevented)"
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
try {
|
|
996
|
+
const actionResult = await action();
|
|
997
|
+
const storedInvocation = {
|
|
998
|
+
cid: invocationResult.cid,
|
|
999
|
+
invocation: invocationResult.invocation,
|
|
1000
|
+
invokerDid: params.invokerDid,
|
|
1001
|
+
capability: params.capability,
|
|
1002
|
+
// The receipt's time anchor: when it was signed, so that
|
|
1003
|
+
// exp = executedAt + 300s holds (contract §3).
|
|
1004
|
+
executedAt: invocationResult.signedAt ?? Date.now(),
|
|
1005
|
+
flowId,
|
|
1006
|
+
sessionRunId,
|
|
1007
|
+
blockId,
|
|
1008
|
+
result: "success",
|
|
1009
|
+
proofCids: invocationResult.proofCids ?? params.proofs,
|
|
1010
|
+
facts: invocationResult.facts ?? params.facts
|
|
1011
|
+
};
|
|
1012
|
+
invocationStore.add(storedInvocation);
|
|
1013
|
+
return {
|
|
1014
|
+
success: true,
|
|
1015
|
+
invocationCid: invocationResult.cid,
|
|
1016
|
+
result: actionResult,
|
|
1017
|
+
actionResult
|
|
1018
|
+
};
|
|
1019
|
+
} catch (error) {
|
|
1020
|
+
const storedInvocation = {
|
|
1021
|
+
cid: invocationResult.cid,
|
|
1022
|
+
invocation: invocationResult.invocation,
|
|
1023
|
+
invokerDid: params.invokerDid,
|
|
1024
|
+
capability: params.capability,
|
|
1025
|
+
// The receipt's time anchor: when it was signed, so that
|
|
1026
|
+
// exp = executedAt + 300s holds (contract §3).
|
|
1027
|
+
executedAt: invocationResult.signedAt ?? Date.now(),
|
|
1028
|
+
flowId,
|
|
1029
|
+
sessionRunId,
|
|
1030
|
+
blockId,
|
|
1031
|
+
result: "failure",
|
|
1032
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
1033
|
+
proofCids: invocationResult.proofCids ?? params.proofs,
|
|
1034
|
+
facts: invocationResult.facts ?? params.facts
|
|
1035
|
+
};
|
|
1036
|
+
invocationStore.add(storedInvocation);
|
|
1037
|
+
return {
|
|
1038
|
+
success: false,
|
|
1039
|
+
invocationCid: invocationResult.cid,
|
|
1040
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
const service = {
|
|
1045
|
+
createRootDelegation,
|
|
1046
|
+
createDelegation,
|
|
1047
|
+
revokeDelegation,
|
|
1048
|
+
getDelegation,
|
|
1049
|
+
getAllDelegations,
|
|
1050
|
+
getRootDelegation,
|
|
1051
|
+
createAndValidateInvocation,
|
|
1052
|
+
executeWithInvocation,
|
|
1053
|
+
validateDelegationChain,
|
|
1054
|
+
findValidProofs,
|
|
1055
|
+
parseDelegationFromStore,
|
|
1056
|
+
isConfigured,
|
|
1057
|
+
authority: config.authority,
|
|
1058
|
+
verification: config.verification,
|
|
1059
|
+
receipts: config.receipts,
|
|
1060
|
+
createRequestInvocation: (params) => createFlowRequest(service, params)
|
|
1061
|
+
};
|
|
1062
|
+
return service;
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
// src/core/lib/ucan/verificationEnv.ts
|
|
1066
|
+
import { createUcanStoreRevocationChecker } from "@ixo/ucan";
|
|
1067
|
+
var checkers = /* @__PURE__ */ new Map();
|
|
1068
|
+
function revocationCheckerFor(url) {
|
|
1069
|
+
let checker = checkers.get(url);
|
|
1070
|
+
if (!checker) {
|
|
1071
|
+
checker = createUcanStoreRevocationChecker({ url });
|
|
1072
|
+
checkers.set(url, checker);
|
|
1073
|
+
}
|
|
1074
|
+
return checker;
|
|
1075
|
+
}
|
|
1076
|
+
function ucanVerificationEnvFrom(handlers) {
|
|
1077
|
+
const injected = handlers?.ucanVerification;
|
|
1078
|
+
if (!injected) return {};
|
|
1079
|
+
return {
|
|
1080
|
+
didResolver: injected.didResolver,
|
|
1081
|
+
...injected.revocationStoreUrl ? { revocationChecker: revocationCheckerFor(injected.revocationStoreUrl) } : {}
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// src/core/lib/ucan/flowAuthorityIndex.ts
|
|
1086
|
+
import { Delegation as UcantoDelegation2 } from "@ucanto/core";
|
|
1087
|
+
var AUTHORITY_RECHECK_MS = 3e4;
|
|
1088
|
+
var NO_CACHE_CODES = /* @__PURE__ */ new Set(["REVOCATION_CHECK_FAILED", "NO_REVOCATION_CHECKER", "NO_OWNER"]);
|
|
1089
|
+
var FAILURE_PRIORITY = ["REVOKED", "EXPIRED", "NO_EXPIRATION", "REVOCATION_CHECK_FAILED", "NO_REVOCATION_CHECKER", "NOT_ROOTED_AT_OWNER", "EXCEEDS_PARENT", "INVALID_SIGNATURE"];
|
|
1090
|
+
function keyOf(actorDid, capability) {
|
|
1091
|
+
return `${actorDid}\0${capability.can}\0${capability.with}`;
|
|
1092
|
+
}
|
|
1093
|
+
function createFlowAuthorityIndex(options) {
|
|
1094
|
+
const now = options.now ?? Date.now;
|
|
1095
|
+
const decisions = /* @__PURE__ */ new Map();
|
|
1096
|
+
const parsed = /* @__PURE__ */ new Map();
|
|
1097
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1098
|
+
let generation = 0;
|
|
1099
|
+
const notify = () => {
|
|
1100
|
+
for (const listener of listeners) listener();
|
|
1101
|
+
};
|
|
1102
|
+
async function audienceOf(cid, car) {
|
|
1103
|
+
if (parsed.has(cid)) return parsed.get(cid);
|
|
1104
|
+
let value = null;
|
|
1105
|
+
if (car) {
|
|
1106
|
+
try {
|
|
1107
|
+
const extracted = await UcantoDelegation2.extract(decodeCarBase64(car));
|
|
1108
|
+
const node = extracted.ok;
|
|
1109
|
+
if (node && node.cid.toString() === cid) {
|
|
1110
|
+
value = { audience: normalizeDid(node.audience.did()), resources: node.capabilities.map((capability) => String(capability.with ?? "")) };
|
|
1111
|
+
}
|
|
1112
|
+
} catch {
|
|
1113
|
+
value = null;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
parsed.set(cid, value);
|
|
1117
|
+
return value;
|
|
1118
|
+
}
|
|
1119
|
+
const flowUriNow = () => typeof options.flowUri === "function" ? options.flowUri() : options.flowUri;
|
|
1120
|
+
function isFlowCapability(capability) {
|
|
1121
|
+
const flowUri = flowUriNow();
|
|
1122
|
+
if (!flowUri || !capability.can.startsWith("flow/")) return false;
|
|
1123
|
+
return capability.with === flowUri || capability.with.startsWith(`${flowUri}:`);
|
|
1124
|
+
}
|
|
1125
|
+
async function ownerDecision(owner, capability) {
|
|
1126
|
+
const root = options.delegationStore.getRoot();
|
|
1127
|
+
const rootCid = options.delegationStore.getRootCid();
|
|
1128
|
+
if (root && rootCid) {
|
|
1129
|
+
const verdict = await verifyGrant(root.delegation, { cid: rootCid, actorDid: owner, ownerDid: owner, required: capability, env: options.env, at: now(), coverage: "hierarchical" });
|
|
1130
|
+
if (verdict.ok && !verdict.revokedNow && verdict.grant.issuerDid === owner) {
|
|
1131
|
+
return { allowed: true, proofCids: [rootCid], viaOwner: true };
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
return { allowed: true, proofCids: [], viaOwner: true };
|
|
1135
|
+
}
|
|
1136
|
+
async function decide(actorDid, capability) {
|
|
1137
|
+
const owner = options.getOwnerDid() ? normalizeDid(options.getOwnerDid()) : "";
|
|
1138
|
+
const recheck = now() + AUTHORITY_RECHECK_MS;
|
|
1139
|
+
if (!owner) {
|
|
1140
|
+
return { decision: { allowed: false, code: "NO_OWNER", reason: "We can't tell who created this flow yet, so nobody's grants can be checked." }, until: 0 };
|
|
1141
|
+
}
|
|
1142
|
+
if (!isFlowCapability(capability)) {
|
|
1143
|
+
return { decision: { allowed: false, code: "NOT_A_FLOW_CAPABILITY", reason: `${capability.can} on ${capability.with} is not part of this flow.` }, until: recheck };
|
|
1144
|
+
}
|
|
1145
|
+
const actor = normalizeDid(actorDid);
|
|
1146
|
+
if (actor === owner) return { decision: await ownerDecision(owner, capability), until: recheck };
|
|
1147
|
+
const rootCid = options.delegationStore.getRootCid();
|
|
1148
|
+
const candidates = [];
|
|
1149
|
+
for (const record of options.delegationStore.getAll()) {
|
|
1150
|
+
if (record.cid === rootCid) continue;
|
|
1151
|
+
const signed = await audienceOf(record.cid, record.delegation);
|
|
1152
|
+
if (!signed || signed.audience !== actor) continue;
|
|
1153
|
+
candidates.push({ cid: record.cid, car: record.delegation, exact: signed.resources.includes(capability.with) });
|
|
1154
|
+
}
|
|
1155
|
+
if (candidates.length === 0) {
|
|
1156
|
+
return { decision: { allowed: false, code: "NO_GRANT", reason: "You have not been given this step in this flow." }, until: recheck };
|
|
1157
|
+
}
|
|
1158
|
+
candidates.sort((left, right) => Number(right.exact) - Number(left.exact) || (left.cid < right.cid ? -1 : left.cid > right.cid ? 1 : 0));
|
|
1159
|
+
const failures = [];
|
|
1160
|
+
for (const candidate of candidates) {
|
|
1161
|
+
const verdict = await verifyGrant(candidate.car, { cid: candidate.cid, actorDid: actor, ownerDid: owner, required: capability, env: options.env });
|
|
1162
|
+
if (verdict.ok) {
|
|
1163
|
+
const inStore = verdict.grant.proofChainCids.filter((cid) => cid !== candidate.cid && options.delegationStore.has(cid)).reverse();
|
|
1164
|
+
const until = Math.min(recheck, verdict.grant.expiresAt ?? recheck);
|
|
1165
|
+
return { decision: { allowed: true, proofCids: [candidate.cid, ...inStore], grant: verdict.grant, viaOwner: false }, until };
|
|
1166
|
+
}
|
|
1167
|
+
failures.push({ code: verdict.code, reason: verdict.reason });
|
|
1168
|
+
}
|
|
1169
|
+
failures.sort((a, b) => {
|
|
1170
|
+
const rank = (code) => {
|
|
1171
|
+
const index = FAILURE_PRIORITY.indexOf(code);
|
|
1172
|
+
return index === -1 ? FAILURE_PRIORITY.length : index;
|
|
1173
|
+
};
|
|
1174
|
+
return rank(a.code) - rank(b.code);
|
|
1175
|
+
});
|
|
1176
|
+
const worst = failures[0];
|
|
1177
|
+
return { decision: { allowed: false, code: worst.code, reason: worst.reason }, until: NO_CACHE_CODES.has(worst.code) ? 0 : recheck };
|
|
1178
|
+
}
|
|
1179
|
+
return {
|
|
1180
|
+
async authorize(actorDid, capability) {
|
|
1181
|
+
const key = keyOf(normalizeDid(actorDid), capability);
|
|
1182
|
+
const cached = decisions.get(key);
|
|
1183
|
+
if (cached && cached.until > now()) return cached.decision;
|
|
1184
|
+
const started = generation;
|
|
1185
|
+
const { decision, until } = await decide(actorDid, capability);
|
|
1186
|
+
if (started === generation) {
|
|
1187
|
+
if (until > now()) decisions.set(key, { decision, until });
|
|
1188
|
+
else decisions.delete(key);
|
|
1189
|
+
notify();
|
|
1190
|
+
}
|
|
1191
|
+
return decision;
|
|
1192
|
+
},
|
|
1193
|
+
peek(actorDid, capability) {
|
|
1194
|
+
const cached = decisions.get(keyOf(normalizeDid(actorDid), capability));
|
|
1195
|
+
return cached && cached.until > now() ? cached.decision : void 0;
|
|
1196
|
+
},
|
|
1197
|
+
invalidate() {
|
|
1198
|
+
generation += 1;
|
|
1199
|
+
decisions.clear();
|
|
1200
|
+
parsed.clear();
|
|
1201
|
+
notify();
|
|
1202
|
+
},
|
|
1203
|
+
subscribe(listener) {
|
|
1204
|
+
listeners.add(listener);
|
|
1205
|
+
return () => listeners.delete(listener);
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// src/core/lib/ucan/receiptVerifier.ts
|
|
1211
|
+
var TRANSIENT = /* @__PURE__ */ new Set(["REVOCATION_CHECK_FAILED", "NO_REVOCATION_CHECKER", "NO_OWNER"]);
|
|
1212
|
+
var TRANSIENT_TTL_MS = 5e3;
|
|
1213
|
+
function createReceiptVerifier(options) {
|
|
1214
|
+
const now = options.now ?? Date.now;
|
|
1215
|
+
const ttlMs = options.ttlMs ?? 3e4;
|
|
1216
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1217
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
1218
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1219
|
+
const keyOf2 = (invocation, expected) => `${invocation.cid}\0${expected.blockId}\0${invocation.invokerDid}\0${invocation.sessionRunId ?? ""}`;
|
|
1220
|
+
async function run(invocation, expected) {
|
|
1221
|
+
const owner = options.getOwnerDid() ? normalizeDid(options.getOwnerDid()) : "";
|
|
1222
|
+
if (!owner) return { status: { status: "unverified", reason: "We can't tell who created this flow yet, so its receipts can't be checked." }, transient: true };
|
|
1223
|
+
const verdict = await verifyInvocation(invocation.invocation, {
|
|
1224
|
+
cid: invocation.cid,
|
|
1225
|
+
expectedAudience: owner,
|
|
1226
|
+
ownerDid: owner,
|
|
1227
|
+
actorDid: invocation.invokerDid,
|
|
1228
|
+
required: { can: "flow/block/execute", with: `${typeof options.flowUri === "function" ? options.flowUri() : options.flowUri}:${expected.blockId}` },
|
|
1229
|
+
// The record's session run (what every surface groups it under) must be
|
|
1230
|
+
// the one the signer bound it to.
|
|
1231
|
+
...invocation.sessionRunId ? { expectedFacts: { sessionRunId: invocation.sessionRunId } } : {},
|
|
1232
|
+
env: options.env,
|
|
1233
|
+
at: invocation.executedAt
|
|
1234
|
+
});
|
|
1235
|
+
if (!verdict.ok) return { status: { status: "unverified", reason: verdict.reason }, transient: TRANSIENT.has(verdict.code) };
|
|
1236
|
+
if (verdict.revokedNow) {
|
|
1237
|
+
return { status: { status: "unverified", reason: "This step was done under a grant that has since been cancelled.", revokedSince: true }, transient: false };
|
|
1238
|
+
}
|
|
1239
|
+
return { status: { status: "verified", ...verdict.noTimeAnchor ? { noTimeAnchor: true } : {} }, transient: false };
|
|
1240
|
+
}
|
|
1241
|
+
const verifier = {
|
|
1242
|
+
check(invocation, expected) {
|
|
1243
|
+
const key = keyOf2(invocation, expected);
|
|
1244
|
+
const hit = cache.get(key);
|
|
1245
|
+
if (hit && hit.until > now()) return hit.status;
|
|
1246
|
+
void verifier.verify(invocation, expected);
|
|
1247
|
+
return hit?.status ?? { status: "pending" };
|
|
1248
|
+
},
|
|
1249
|
+
verify(invocation, expected) {
|
|
1250
|
+
const key = keyOf2(invocation, expected);
|
|
1251
|
+
const pending = inFlight.get(key);
|
|
1252
|
+
if (pending) return pending;
|
|
1253
|
+
const request = run(invocation, expected).then(({ status, transient }) => {
|
|
1254
|
+
cache.set(key, { status, until: now() + (transient ? TRANSIENT_TTL_MS : ttlMs) });
|
|
1255
|
+
for (const listener of listeners) listener();
|
|
1256
|
+
return status;
|
|
1257
|
+
}).finally(() => inFlight.delete(key));
|
|
1258
|
+
inFlight.set(key, request);
|
|
1259
|
+
return request;
|
|
1260
|
+
},
|
|
1261
|
+
remember(invocation, expected, status) {
|
|
1262
|
+
cache.set(keyOf2(invocation, expected), { status, until: now() + ttlMs });
|
|
1263
|
+
},
|
|
1264
|
+
subscribe(listener) {
|
|
1265
|
+
listeners.add(listener);
|
|
1266
|
+
return () => listeners.delete(listener);
|
|
1267
|
+
}
|
|
1268
|
+
};
|
|
1269
|
+
return verifier;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
export {
|
|
1273
|
+
createUcanDelegationStore,
|
|
1274
|
+
createMemoryUcanDelegationStore,
|
|
1275
|
+
FLOW_REQUESTS_MAP_KEY,
|
|
1276
|
+
capabilityForRequest,
|
|
1277
|
+
digestRequestValue,
|
|
1278
|
+
digestInputResponse,
|
|
1279
|
+
createFlowRequest,
|
|
1280
|
+
writeFlowRequest,
|
|
1281
|
+
readFlowRequest,
|
|
1282
|
+
lifecycleRequestProof,
|
|
1283
|
+
requestStepRun,
|
|
1284
|
+
decodeCarBase64,
|
|
1285
|
+
signedCapabilityCovers,
|
|
1286
|
+
grantCoversExercise,
|
|
1287
|
+
verifyGrant,
|
|
1288
|
+
verifyInvocation,
|
|
1289
|
+
createUcanService,
|
|
1290
|
+
revocationCheckerFor,
|
|
1291
|
+
ucanVerificationEnvFrom,
|
|
1292
|
+
AUTHORITY_RECHECK_MS,
|
|
1293
|
+
createFlowAuthorityIndex,
|
|
1294
|
+
createReceiptVerifier
|
|
1295
|
+
};
|
|
1296
|
+
//# sourceMappingURL=chunk-2KOJBMG5.js.map
|