@ixo/editor 3.0.0-beta.28 → 3.0.0-beta.29
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/{chunk-SZSEZY6Z.mjs → chunk-5PHI3WWK.mjs} +2 -2
- package/dist/{chunk-NOMJJJDB.mjs → chunk-77R3T42S.mjs} +43 -672
- package/dist/chunk-77R3T42S.mjs.map +1 -0
- package/dist/{chunk-LQP2DPYM.mjs → chunk-EDCITCO5.mjs} +424 -645
- package/dist/chunk-EDCITCO5.mjs.map +1 -0
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.mjs +6 -20
- package/dist/{graphql-client-CSiffz9I.d.ts → graphql-client-D1Zgezg6.d.ts} +1 -8
- package/dist/{index-BmOZ-1iJ.d.ts → index-7ptWHYA8.d.ts} +212 -124
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +17 -15
- package/dist/index.mjs.map +1 -1
- package/dist/mantine/index.d.ts +5 -4
- package/dist/mantine/index.mjs +2 -2
- package/dist/setup-CahGoKeh.d.ts +452 -0
- package/package.json +1 -1
- package/dist/chunk-LQP2DPYM.mjs.map +0 -1
- package/dist/chunk-NOMJJJDB.mjs.map +0 -1
- package/dist/setup-C5MpJdyr.d.ts +0 -780
- /package/dist/{chunk-SZSEZY6Z.mjs.map → chunk-5PHI3WWK.mjs.map} +0 -0
|
@@ -1624,69 +1624,31 @@ registerAction({
|
|
|
1624
1624
|
|
|
1625
1625
|
// src/core/lib/ucanDelegationStore.ts
|
|
1626
1626
|
var ROOT_DELEGATION_KEY = "__root__";
|
|
1627
|
-
var
|
|
1627
|
+
var STORE_VERSION_KEY = "__version__";
|
|
1628
1628
|
var CURRENT_VERSION = 2;
|
|
1629
|
-
var
|
|
1629
|
+
var isValidEntry = (value) => {
|
|
1630
1630
|
if (!value || typeof value !== "object") return false;
|
|
1631
1631
|
const entry = value;
|
|
1632
1632
|
return entry.v === CURRENT_VERSION && entry.data !== void 0;
|
|
1633
1633
|
};
|
|
1634
|
-
var
|
|
1635
|
-
return typeof value === "string";
|
|
1636
|
-
};
|
|
1637
|
-
var parseLegacy = (value) => {
|
|
1638
|
-
try {
|
|
1639
|
-
return JSON.parse(value);
|
|
1640
|
-
} catch {
|
|
1641
|
-
return null;
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
var legacyToStoredDelegation = (legacy) => {
|
|
1645
|
-
return {
|
|
1646
|
-
cid: legacy.id,
|
|
1647
|
-
delegation: "",
|
|
1648
|
-
// Empty - CAR requires re-signing
|
|
1649
|
-
issuerDid: legacy.issuer,
|
|
1650
|
-
audienceDid: legacy.audience,
|
|
1651
|
-
capabilities: legacy.capabilities.map((c) => ({
|
|
1652
|
-
can: c.can,
|
|
1653
|
-
with: c.with,
|
|
1654
|
-
nb: c.nb
|
|
1655
|
-
})),
|
|
1656
|
-
expiration: legacy.expiration,
|
|
1657
|
-
createdAt: legacy.issuedAt ? new Date(legacy.issuedAt).getTime() : Date.now(),
|
|
1658
|
-
format: "legacy",
|
|
1659
|
-
proofCids: legacy.proofs
|
|
1660
|
-
};
|
|
1661
|
-
};
|
|
1634
|
+
var isReservedKey = (key) => key === ROOT_DELEGATION_KEY || key === STORE_VERSION_KEY;
|
|
1662
1635
|
var createUcanDelegationStore = (yMap) => {
|
|
1663
1636
|
const get = (cid) => {
|
|
1664
|
-
if (cid
|
|
1637
|
+
if (isReservedKey(cid)) return null;
|
|
1665
1638
|
const raw = yMap.get(cid);
|
|
1666
1639
|
if (!raw) return null;
|
|
1667
|
-
if (
|
|
1668
|
-
return raw.data;
|
|
1669
|
-
}
|
|
1670
|
-
if (isLegacyFormat(raw)) {
|
|
1671
|
-
const legacy = parseLegacy(raw);
|
|
1672
|
-
if (legacy) {
|
|
1673
|
-
return legacyToStoredDelegation(legacy);
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1640
|
+
if (isValidEntry(raw)) return raw.data;
|
|
1676
1641
|
return null;
|
|
1677
1642
|
};
|
|
1678
1643
|
const set = (delegation) => {
|
|
1679
|
-
const entry = {
|
|
1680
|
-
v: CURRENT_VERSION,
|
|
1681
|
-
data: delegation
|
|
1682
|
-
};
|
|
1644
|
+
const entry = { v: CURRENT_VERSION, data: delegation };
|
|
1683
1645
|
yMap.set(delegation.cid, entry);
|
|
1684
1646
|
};
|
|
1685
1647
|
const remove = (cid) => {
|
|
1686
1648
|
yMap.delete(cid);
|
|
1687
1649
|
};
|
|
1688
1650
|
const has = (cid) => {
|
|
1689
|
-
return yMap.has(cid) && cid
|
|
1651
|
+
return yMap.has(cid) && !isReservedKey(cid);
|
|
1690
1652
|
};
|
|
1691
1653
|
const getRoot = () => {
|
|
1692
1654
|
const rootCid = yMap.get(ROOT_DELEGATION_KEY);
|
|
@@ -1702,16 +1664,9 @@ var createUcanDelegationStore = (yMap) => {
|
|
|
1702
1664
|
const getAll = () => {
|
|
1703
1665
|
const delegations = [];
|
|
1704
1666
|
yMap.forEach((value, key) => {
|
|
1705
|
-
if (key
|
|
1706
|
-
if (
|
|
1667
|
+
if (isReservedKey(key)) return;
|
|
1668
|
+
if (isValidEntry(value)) {
|
|
1707
1669
|
delegations.push(value.data);
|
|
1708
|
-
return;
|
|
1709
|
-
}
|
|
1710
|
-
if (isLegacyFormat(value)) {
|
|
1711
|
-
const legacy = parseLegacy(value);
|
|
1712
|
-
if (legacy) {
|
|
1713
|
-
delegations.push(legacyToStoredDelegation(legacy));
|
|
1714
|
-
}
|
|
1715
1670
|
}
|
|
1716
1671
|
});
|
|
1717
1672
|
return delegations;
|
|
@@ -1740,43 +1695,6 @@ var createUcanDelegationStore = (yMap) => {
|
|
|
1740
1695
|
})
|
|
1741
1696
|
);
|
|
1742
1697
|
};
|
|
1743
|
-
const getVersion = () => {
|
|
1744
|
-
const version = yMap.get(MIGRATION_VERSION_KEY);
|
|
1745
|
-
return version ?? 1;
|
|
1746
|
-
};
|
|
1747
|
-
const setVersion = (version) => {
|
|
1748
|
-
yMap.set(MIGRATION_VERSION_KEY, version);
|
|
1749
|
-
};
|
|
1750
|
-
const getLegacy = (id) => {
|
|
1751
|
-
if (id === ROOT_DELEGATION_KEY || id === MIGRATION_VERSION_KEY) return null;
|
|
1752
|
-
const raw = yMap.get(id);
|
|
1753
|
-
if (!raw) return null;
|
|
1754
|
-
if (isLegacyFormat(raw)) {
|
|
1755
|
-
return parseLegacy(raw);
|
|
1756
|
-
}
|
|
1757
|
-
return null;
|
|
1758
|
-
};
|
|
1759
|
-
const hasLegacy = (id) => {
|
|
1760
|
-
if (id === ROOT_DELEGATION_KEY || id === MIGRATION_VERSION_KEY) return false;
|
|
1761
|
-
const raw = yMap.get(id);
|
|
1762
|
-
return isLegacyFormat(raw);
|
|
1763
|
-
};
|
|
1764
|
-
const getAllLegacy = () => {
|
|
1765
|
-
const legacyDelegations = [];
|
|
1766
|
-
yMap.forEach((value, key) => {
|
|
1767
|
-
if (key === ROOT_DELEGATION_KEY || key === MIGRATION_VERSION_KEY) return;
|
|
1768
|
-
if (isLegacyFormat(value)) {
|
|
1769
|
-
const legacy = parseLegacy(value);
|
|
1770
|
-
if (legacy) {
|
|
1771
|
-
legacyDelegations.push(legacy);
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
});
|
|
1775
|
-
return legacyDelegations;
|
|
1776
|
-
};
|
|
1777
|
-
const convertLegacyToStored = (legacy) => {
|
|
1778
|
-
return legacyToStoredDelegation(legacy);
|
|
1779
|
-
};
|
|
1780
1698
|
return {
|
|
1781
1699
|
get,
|
|
1782
1700
|
set,
|
|
@@ -1788,44 +1706,27 @@ var createUcanDelegationStore = (yMap) => {
|
|
|
1788
1706
|
getAll,
|
|
1789
1707
|
getByAudience,
|
|
1790
1708
|
getByIssuer,
|
|
1791
|
-
findByCapability
|
|
1792
|
-
getVersion,
|
|
1793
|
-
setVersion,
|
|
1794
|
-
getLegacy,
|
|
1795
|
-
hasLegacy,
|
|
1796
|
-
getAllLegacy,
|
|
1797
|
-
convertLegacyToStored
|
|
1709
|
+
findByCapability
|
|
1798
1710
|
};
|
|
1799
1711
|
};
|
|
1800
1712
|
var createMemoryUcanDelegationStore = () => {
|
|
1801
1713
|
const store = /* @__PURE__ */ new Map();
|
|
1802
1714
|
const get = (cid) => {
|
|
1803
|
-
if (cid
|
|
1715
|
+
if (isReservedKey(cid)) return null;
|
|
1804
1716
|
const raw = store.get(cid);
|
|
1805
1717
|
if (!raw) return null;
|
|
1806
|
-
if (
|
|
1807
|
-
return raw.data;
|
|
1808
|
-
}
|
|
1809
|
-
if (isLegacyFormat(raw)) {
|
|
1810
|
-
const legacy = parseLegacy(raw);
|
|
1811
|
-
if (legacy) {
|
|
1812
|
-
return legacyToStoredDelegation(legacy);
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1718
|
+
if (isValidEntry(raw)) return raw.data;
|
|
1815
1719
|
return null;
|
|
1816
1720
|
};
|
|
1817
1721
|
const set = (delegation) => {
|
|
1818
|
-
const entry = {
|
|
1819
|
-
v: CURRENT_VERSION,
|
|
1820
|
-
data: delegation
|
|
1821
|
-
};
|
|
1722
|
+
const entry = { v: CURRENT_VERSION, data: delegation };
|
|
1822
1723
|
store.set(delegation.cid, entry);
|
|
1823
1724
|
};
|
|
1824
1725
|
const remove = (cid) => {
|
|
1825
1726
|
store.delete(cid);
|
|
1826
1727
|
};
|
|
1827
1728
|
const has = (cid) => {
|
|
1828
|
-
return store.has(cid) && cid
|
|
1729
|
+
return store.has(cid) && !isReservedKey(cid);
|
|
1829
1730
|
};
|
|
1830
1731
|
const getRoot = () => {
|
|
1831
1732
|
const rootCid = store.get(ROOT_DELEGATION_KEY);
|
|
@@ -1841,16 +1742,9 @@ var createMemoryUcanDelegationStore = () => {
|
|
|
1841
1742
|
const getAll = () => {
|
|
1842
1743
|
const delegations = [];
|
|
1843
1744
|
store.forEach((value, key) => {
|
|
1844
|
-
if (key
|
|
1845
|
-
if (
|
|
1745
|
+
if (isReservedKey(key)) return;
|
|
1746
|
+
if (isValidEntry(value)) {
|
|
1846
1747
|
delegations.push(value.data);
|
|
1847
|
-
return;
|
|
1848
|
-
}
|
|
1849
|
-
if (isLegacyFormat(value)) {
|
|
1850
|
-
const legacy = parseLegacy(value);
|
|
1851
|
-
if (legacy) {
|
|
1852
|
-
delegations.push(legacyToStoredDelegation(legacy));
|
|
1853
|
-
}
|
|
1854
1748
|
}
|
|
1855
1749
|
});
|
|
1856
1750
|
return delegations;
|
|
@@ -1879,43 +1773,6 @@ var createMemoryUcanDelegationStore = () => {
|
|
|
1879
1773
|
})
|
|
1880
1774
|
);
|
|
1881
1775
|
};
|
|
1882
|
-
const getVersion = () => {
|
|
1883
|
-
const version = store.get(MIGRATION_VERSION_KEY);
|
|
1884
|
-
return version ?? 1;
|
|
1885
|
-
};
|
|
1886
|
-
const setVersion = (version) => {
|
|
1887
|
-
store.set(MIGRATION_VERSION_KEY, version);
|
|
1888
|
-
};
|
|
1889
|
-
const getLegacy = (id) => {
|
|
1890
|
-
if (id === ROOT_DELEGATION_KEY || id === MIGRATION_VERSION_KEY) return null;
|
|
1891
|
-
const raw = store.get(id);
|
|
1892
|
-
if (!raw) return null;
|
|
1893
|
-
if (isLegacyFormat(raw)) {
|
|
1894
|
-
return parseLegacy(raw);
|
|
1895
|
-
}
|
|
1896
|
-
return null;
|
|
1897
|
-
};
|
|
1898
|
-
const hasLegacy = (id) => {
|
|
1899
|
-
if (id === ROOT_DELEGATION_KEY || id === MIGRATION_VERSION_KEY) return false;
|
|
1900
|
-
const raw = store.get(id);
|
|
1901
|
-
return isLegacyFormat(raw);
|
|
1902
|
-
};
|
|
1903
|
-
const getAllLegacy = () => {
|
|
1904
|
-
const legacyDelegations = [];
|
|
1905
|
-
store.forEach((value, key) => {
|
|
1906
|
-
if (key === ROOT_DELEGATION_KEY || key === MIGRATION_VERSION_KEY) return;
|
|
1907
|
-
if (isLegacyFormat(value)) {
|
|
1908
|
-
const legacy = parseLegacy(value);
|
|
1909
|
-
if (legacy) {
|
|
1910
|
-
legacyDelegations.push(legacy);
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1913
|
-
});
|
|
1914
|
-
return legacyDelegations;
|
|
1915
|
-
};
|
|
1916
|
-
const convertLegacyToStored = (legacy) => {
|
|
1917
|
-
return legacyToStoredDelegation(legacy);
|
|
1918
|
-
};
|
|
1919
1776
|
return {
|
|
1920
1777
|
get,
|
|
1921
1778
|
set,
|
|
@@ -1927,13 +1784,7 @@ var createMemoryUcanDelegationStore = () => {
|
|
|
1927
1784
|
getAll,
|
|
1928
1785
|
getByAudience,
|
|
1929
1786
|
getByIssuer,
|
|
1930
|
-
findByCapability
|
|
1931
|
-
getVersion,
|
|
1932
|
-
setVersion,
|
|
1933
|
-
getLegacy,
|
|
1934
|
-
hasLegacy,
|
|
1935
|
-
getAllLegacy,
|
|
1936
|
-
convertLegacyToStored
|
|
1787
|
+
findByCapability
|
|
1937
1788
|
};
|
|
1938
1789
|
};
|
|
1939
1790
|
|
|
@@ -2104,25 +1955,6 @@ var createMemoryInvocationStore = () => {
|
|
|
2104
1955
|
};
|
|
2105
1956
|
|
|
2106
1957
|
// src/core/lib/flowEngine/utils.ts
|
|
2107
|
-
var parseActors = (value) => {
|
|
2108
|
-
if (!value) return [];
|
|
2109
|
-
if (Array.isArray(value)) {
|
|
2110
|
-
return value.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean);
|
|
2111
|
-
}
|
|
2112
|
-
if (typeof value === "string") {
|
|
2113
|
-
const trimmed = value.trim();
|
|
2114
|
-
if (!trimmed) return [];
|
|
2115
|
-
try {
|
|
2116
|
-
const parsed = JSON.parse(trimmed);
|
|
2117
|
-
if (Array.isArray(parsed)) {
|
|
2118
|
-
return parsed.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean);
|
|
2119
|
-
}
|
|
2120
|
-
} catch {
|
|
2121
|
-
}
|
|
2122
|
-
return trimmed.split(",").map((item) => item.trim()).filter(Boolean);
|
|
2123
|
-
}
|
|
2124
|
-
return [];
|
|
2125
|
-
};
|
|
2126
1958
|
var parseActivationStatus = (value) => {
|
|
2127
1959
|
if (value === "pending" || value === "approved" || value === "rejected") {
|
|
2128
1960
|
return value;
|
|
@@ -2130,17 +1962,10 @@ var parseActivationStatus = (value) => {
|
|
|
2130
1962
|
return void 0;
|
|
2131
1963
|
};
|
|
2132
1964
|
var buildAuthzFromProps = (props) => {
|
|
2133
|
-
const authorisedActors = parseActors(props.authorisedActors);
|
|
2134
1965
|
const activationRequiredStatus = parseActivationStatus(props.activationRequiredStatus);
|
|
2135
1966
|
const activationUpstreamNodeId = typeof props.activationUpstreamNodeId === "string" ? props.activationUpstreamNodeId.trim() : "";
|
|
2136
1967
|
const linkedClaimCollectionId = typeof props.linkedClaimCollectionId === "string" ? props.linkedClaimCollectionId.trim() : "";
|
|
2137
1968
|
const authz = {};
|
|
2138
|
-
if (typeof props.parentCapability === "string" && props.parentCapability.trim()) {
|
|
2139
|
-
authz.parentCapability = props.parentCapability.trim();
|
|
2140
|
-
}
|
|
2141
|
-
if (authorisedActors.length > 0) {
|
|
2142
|
-
authz.authorisedActors = authorisedActors;
|
|
2143
|
-
}
|
|
2144
1969
|
if (linkedClaimCollectionId) {
|
|
2145
1970
|
authz.linkedClaim = { collectionId: linkedClaimCollectionId };
|
|
2146
1971
|
}
|
|
@@ -2234,304 +2059,54 @@ var isNodeActive = (node, runtime) => {
|
|
|
2234
2059
|
if (!upstreamActor) {
|
|
2235
2060
|
return { active: false, reason: "Upstream submission actor is unknown." };
|
|
2236
2061
|
}
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
return { active: false, reason: "Upstream claim not submitted by an authorised actor." };
|
|
2062
|
+
if (!upstreamState.lastInvocationCid) {
|
|
2063
|
+
return { active: false, reason: "Upstream execution has no invocation proof." };
|
|
2240
2064
|
}
|
|
2241
2065
|
}
|
|
2242
2066
|
return { active: true };
|
|
2243
2067
|
};
|
|
2244
2068
|
|
|
2245
|
-
// src/core/lib/flowEngine/capabilityValidation.ts
|
|
2246
|
-
var capabilityCovers = (granted, required) => {
|
|
2247
|
-
if (granted.can !== required.can && granted.can !== "*") {
|
|
2248
|
-
if (granted.can.endsWith("/*")) {
|
|
2249
|
-
const prefix = granted.can.slice(0, -2);
|
|
2250
|
-
if (!required.can.startsWith(prefix)) return false;
|
|
2251
|
-
} else {
|
|
2252
|
-
return false;
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
|
-
if (granted.with !== required.with && granted.with !== "*") {
|
|
2256
|
-
if (granted.with.endsWith("/*")) {
|
|
2257
|
-
const prefix = granted.with.slice(0, -2);
|
|
2258
|
-
if (!required.with.startsWith(prefix)) return false;
|
|
2259
|
-
} else if (granted.with.endsWith("*")) {
|
|
2260
|
-
const prefix = granted.with.slice(0, -1);
|
|
2261
|
-
if (!required.with.startsWith(prefix)) return false;
|
|
2262
|
-
} else {
|
|
2263
|
-
return false;
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
return true;
|
|
2267
|
-
};
|
|
2268
|
-
var validateCapabilityChain = async (params) => {
|
|
2269
|
-
const { capability, actorDid, requiredCapability, delegationStore, verifySignature, rootIssuer } = params;
|
|
2270
|
-
const chain = [];
|
|
2271
|
-
const visited = /* @__PURE__ */ new Set();
|
|
2272
|
-
let current = capability;
|
|
2273
|
-
while (current) {
|
|
2274
|
-
if (visited.has(current.id)) {
|
|
2275
|
-
return { valid: false, error: "Circular delegation detected" };
|
|
2276
|
-
}
|
|
2277
|
-
visited.add(current.id);
|
|
2278
|
-
chain.unshift(current);
|
|
2279
|
-
if (current.expiration && current.expiration < Date.now()) {
|
|
2280
|
-
return { valid: false, error: `Capability ${current.id} has expired` };
|
|
2281
|
-
}
|
|
2282
|
-
const signatureResult = await verifySignature(JSON.stringify(current), current.issuer);
|
|
2283
|
-
if (!signatureResult.valid) {
|
|
2284
|
-
return { valid: false, error: `Invalid signature on capability ${current.id}: ${signatureResult.error}` };
|
|
2285
|
-
}
|
|
2286
|
-
if (current.proofs.length === 0) {
|
|
2287
|
-
if (current.issuer !== rootIssuer) {
|
|
2288
|
-
return { valid: false, error: `Root capability issuer mismatch. Expected ${rootIssuer}, got ${current.issuer}` };
|
|
2289
|
-
}
|
|
2290
|
-
break;
|
|
2291
|
-
}
|
|
2292
|
-
const parentId = current.proofs[0];
|
|
2293
|
-
const parent = delegationStore.get(parentId);
|
|
2294
|
-
if (!parent) {
|
|
2295
|
-
return { valid: false, error: `Parent capability ${parentId} not found` };
|
|
2296
|
-
}
|
|
2297
|
-
if (parent.audience !== current.issuer) {
|
|
2298
|
-
return { valid: false, error: `Delegation chain broken: ${parent.audience} !== ${current.issuer}` };
|
|
2299
|
-
}
|
|
2300
|
-
current = parent;
|
|
2301
|
-
}
|
|
2302
|
-
const finalCap = chain[chain.length - 1];
|
|
2303
|
-
if (finalCap.audience !== actorDid) {
|
|
2304
|
-
return { valid: false, error: `Capability not granted to actor. Expected ${actorDid}, got ${finalCap.audience}` };
|
|
2305
|
-
}
|
|
2306
|
-
for (const cap of chain) {
|
|
2307
|
-
const hasRequiredCap = cap.capabilities.some((c) => capabilityCovers(c, requiredCapability));
|
|
2308
|
-
if (!hasRequiredCap) {
|
|
2309
|
-
return { valid: false, error: `Capability ${cap.id} does not grant required permission` };
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
return { valid: true, chain };
|
|
2313
|
-
};
|
|
2314
|
-
var findValidCapability = async (params) => {
|
|
2315
|
-
const { actorDid, requiredCapability, delegationStore, verifySignature, rootIssuer } = params;
|
|
2316
|
-
const allDelegations = delegationStore.getAll();
|
|
2317
|
-
const actorDelegations = allDelegations.filter((d) => d.audience === actorDid);
|
|
2318
|
-
for (const delegation of actorDelegations) {
|
|
2319
|
-
const result = await validateCapabilityChain({
|
|
2320
|
-
capability: delegation,
|
|
2321
|
-
actorDid,
|
|
2322
|
-
requiredCapability,
|
|
2323
|
-
delegationStore,
|
|
2324
|
-
verifySignature,
|
|
2325
|
-
rootIssuer
|
|
2326
|
-
});
|
|
2327
|
-
if (result.valid) {
|
|
2328
|
-
return { found: true, capabilityId: delegation.id };
|
|
2329
|
-
}
|
|
2330
|
-
}
|
|
2331
|
-
const root = delegationStore.getRoot();
|
|
2332
|
-
if (root && root.audience === actorDid) {
|
|
2333
|
-
const result = await validateCapabilityChain({
|
|
2334
|
-
capability: root,
|
|
2335
|
-
actorDid,
|
|
2336
|
-
requiredCapability,
|
|
2337
|
-
delegationStore,
|
|
2338
|
-
verifySignature,
|
|
2339
|
-
rootIssuer
|
|
2340
|
-
});
|
|
2341
|
-
if (result.valid) {
|
|
2342
|
-
return { found: true, capabilityId: root.id };
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
return { found: false, error: "No valid capability found for actor" };
|
|
2346
|
-
};
|
|
2347
|
-
|
|
2348
2069
|
// src/core/lib/flowEngine/authorization.ts
|
|
2349
|
-
var
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
}
|
|
2357
|
-
if (!node.parentCapability) {
|
|
2358
|
-
return { authorized: true };
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
if (node.parentCapability && context?.delegationStore && context?.verifySignature && context?.rootIssuer) {
|
|
2362
|
-
const requiredCapability = {
|
|
2363
|
-
can: "flow/block/execute",
|
|
2364
|
-
with: context.flowUri ? `${context.flowUri}:${node.id}` : `ixo:flow:*:${node.id}`
|
|
2365
|
-
};
|
|
2366
|
-
const result = await findValidCapability({
|
|
2367
|
-
actorDid,
|
|
2368
|
-
requiredCapability,
|
|
2369
|
-
delegationStore: context.delegationStore,
|
|
2370
|
-
verifySignature: context.verifySignature,
|
|
2371
|
-
rootIssuer: context.rootIssuer
|
|
2372
|
-
});
|
|
2373
|
-
if (!result.found) {
|
|
2374
|
-
return {
|
|
2375
|
-
authorized: false,
|
|
2376
|
-
reason: result.error || "No valid capability found"
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
return { authorized: true, capabilityId: result.capabilityId };
|
|
2380
|
-
}
|
|
2381
|
-
if (node.parentCapability && context?.ucanManager) {
|
|
2382
|
-
try {
|
|
2383
|
-
const parent = await context.ucanManager.loadParentCapability(node.parentCapability);
|
|
2384
|
-
const derived = await context.ucanManager.deriveNodeCapability(parent, node.id, actorDid);
|
|
2385
|
-
await context.ucanManager.validateDerivedCapability(derived, node.id, actorDid);
|
|
2386
|
-
return { authorized: true, derived };
|
|
2387
|
-
} catch (error) {
|
|
2388
|
-
const message = error instanceof Error ? error.message : "Capability derivation failed";
|
|
2389
|
-
return { authorized: false, reason: message };
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
if (node.parentCapability && !context?.delegationStore && !context?.ucanManager) {
|
|
2393
|
-
return {
|
|
2394
|
-
authorized: false,
|
|
2395
|
-
reason: "Capability validation required but neither delegation store nor UCAN manager configured."
|
|
2396
|
-
};
|
|
2397
|
-
}
|
|
2398
|
-
return { authorized: true };
|
|
2399
|
-
};
|
|
2400
|
-
var isActorAuthorizedV2 = async (node, actorDid, context) => {
|
|
2401
|
-
if (node.authorisedActors && node.authorisedActors.length > 0) {
|
|
2402
|
-
if (!node.authorisedActors.includes(actorDid)) {
|
|
2403
|
-
return {
|
|
2404
|
-
authorized: false,
|
|
2405
|
-
reason: `Actor ${actorDid} is not in the authorized actors list for this block.`
|
|
2406
|
-
};
|
|
2407
|
-
}
|
|
2408
|
-
if (!node.parentCapability) {
|
|
2409
|
-
return { authorized: true };
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
if (node.parentCapability && context?.ucanService && context?.flowUri) {
|
|
2413
|
-
const requiredCapability = {
|
|
2414
|
-
can: "flow/block/execute",
|
|
2415
|
-
with: `${context.flowUri}:${node.id}`
|
|
2416
|
-
};
|
|
2417
|
-
const validationResult = await context.ucanService.validateDelegationChain(actorDid, requiredCapability);
|
|
2418
|
-
if (!validationResult.valid) {
|
|
2419
|
-
return {
|
|
2420
|
-
authorized: false,
|
|
2421
|
-
reason: validationResult.error || "No valid capability chain found"
|
|
2422
|
-
};
|
|
2423
|
-
}
|
|
2424
|
-
const proofCids = validationResult.proofChain?.map((d) => d.cid) || [];
|
|
2425
|
-
return {
|
|
2426
|
-
authorized: true,
|
|
2427
|
-
capabilityId: proofCids[0],
|
|
2428
|
-
// First in chain is the actor's delegation
|
|
2429
|
-
proofCids
|
|
2430
|
-
};
|
|
2431
|
-
}
|
|
2432
|
-
if (node.parentCapability && context?.delegationStore && context?.verifySignature && context?.rootIssuer) {
|
|
2433
|
-
const requiredCapability = {
|
|
2434
|
-
can: "flow/block/execute",
|
|
2435
|
-
with: context.flowUri ? `${context.flowUri}:${node.id}` : `ixo:flow:*:${node.id}`
|
|
2436
|
-
};
|
|
2437
|
-
const result = await findValidCapability({
|
|
2438
|
-
actorDid,
|
|
2439
|
-
requiredCapability,
|
|
2440
|
-
delegationStore: context.delegationStore,
|
|
2441
|
-
verifySignature: context.verifySignature,
|
|
2442
|
-
rootIssuer: context.rootIssuer
|
|
2443
|
-
});
|
|
2444
|
-
if (!result.found) {
|
|
2445
|
-
return {
|
|
2446
|
-
authorized: false,
|
|
2447
|
-
reason: result.error || "No valid capability found"
|
|
2448
|
-
};
|
|
2449
|
-
}
|
|
2450
|
-
return { authorized: true, capabilityId: result.capabilityId };
|
|
2451
|
-
}
|
|
2452
|
-
if (node.parentCapability && context?.ucanManager) {
|
|
2453
|
-
try {
|
|
2454
|
-
const parent = await context.ucanManager.loadParentCapability(node.parentCapability);
|
|
2455
|
-
const derived = await context.ucanManager.deriveNodeCapability(parent, node.id, actorDid);
|
|
2456
|
-
await context.ucanManager.validateDerivedCapability(derived, node.id, actorDid);
|
|
2457
|
-
return { authorized: true, derived };
|
|
2458
|
-
} catch (error) {
|
|
2459
|
-
const message = error instanceof Error ? error.message : "Capability derivation failed";
|
|
2460
|
-
return { authorized: false, reason: message };
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
|
-
if (node.parentCapability && !context?.ucanService && !context?.delegationStore && !context?.ucanManager) {
|
|
2070
|
+
var isAuthorized = async (blockId, actorDid, ucanService, flowUri) => {
|
|
2071
|
+
const capability = {
|
|
2072
|
+
can: "flow/block/execute",
|
|
2073
|
+
with: `${flowUri}:${blockId}`
|
|
2074
|
+
};
|
|
2075
|
+
const result = await ucanService.validateDelegationChain(actorDid, capability);
|
|
2076
|
+
if (!result.valid) {
|
|
2464
2077
|
return {
|
|
2465
2078
|
authorized: false,
|
|
2466
|
-
reason:
|
|
2079
|
+
reason: result.error || "No valid capability chain found"
|
|
2467
2080
|
};
|
|
2468
2081
|
}
|
|
2469
|
-
|
|
2082
|
+
const proofCids = result.proofChain?.map((d) => d.cid) || [];
|
|
2083
|
+
return {
|
|
2084
|
+
authorized: true,
|
|
2085
|
+
capabilityId: proofCids[0],
|
|
2086
|
+
proofCids
|
|
2087
|
+
};
|
|
2470
2088
|
};
|
|
2471
2089
|
|
|
2472
2090
|
// src/core/lib/flowEngine/executor.ts
|
|
2473
|
-
var updateRuntimeAfterSuccess = (node, actorDid, runtime, actionResult,
|
|
2091
|
+
var updateRuntimeAfterSuccess = (node, actorDid, runtime, actionResult, invocationCid, now) => {
|
|
2474
2092
|
const updates = {
|
|
2475
2093
|
submittedByDid: actionResult.submittedByDid || actorDid,
|
|
2476
2094
|
evaluationStatus: actionResult.evaluationStatus || "pending",
|
|
2477
2095
|
executionTimestamp: now ? now() : Date.now(),
|
|
2478
|
-
|
|
2479
|
-
authorisedActorsSnapshot: node.authorisedActors
|
|
2096
|
+
lastInvocationCid: invocationCid
|
|
2480
2097
|
};
|
|
2481
2098
|
if (actionResult.claimId) {
|
|
2482
2099
|
updates.claimId = actionResult.claimId;
|
|
2483
2100
|
}
|
|
2484
2101
|
runtime.update(node.id, updates);
|
|
2485
2102
|
};
|
|
2486
|
-
var executeNode = async ({ node, actorDid, context, action }) => {
|
|
2487
|
-
const { runtime,
|
|
2103
|
+
var executeNode = async ({ node, actorDid, actorType, entityRoomId, context, action, pin }) => {
|
|
2104
|
+
const { runtime, ucanService, invocationStore, flowUri, flowId, now } = context;
|
|
2488
2105
|
const activation = isNodeActive(node, runtime);
|
|
2489
2106
|
if (!activation.active) {
|
|
2490
2107
|
return { success: false, stage: "activation", error: activation.reason };
|
|
2491
2108
|
}
|
|
2492
|
-
const
|
|
2493
|
-
delegationStore,
|
|
2494
|
-
verifySignature,
|
|
2495
|
-
rootIssuer,
|
|
2496
|
-
flowUri,
|
|
2497
|
-
ucanManager
|
|
2498
|
-
};
|
|
2499
|
-
const auth = await isActorAuthorized(node, actorDid, authContext);
|
|
2500
|
-
if (!auth.authorized) {
|
|
2501
|
-
return { success: false, stage: "authorization", error: auth.reason };
|
|
2502
|
-
}
|
|
2503
|
-
if (node.linkedClaim && !node.linkedClaim.collectionId) {
|
|
2504
|
-
return { success: false, stage: "claim", error: "Linked claim collection is required but missing." };
|
|
2505
|
-
}
|
|
2506
|
-
try {
|
|
2507
|
-
const result = await action();
|
|
2508
|
-
if (node.linkedClaim && !result.claimId) {
|
|
2509
|
-
return { success: false, stage: "claim", error: "Execution did not return a claimId for linked claim requirement." };
|
|
2510
|
-
}
|
|
2511
|
-
updateRuntimeAfterSuccess(node, actorDid, runtime, result, auth.capabilityId, now);
|
|
2512
|
-
return { success: true, stage: "complete", result, capabilityId: auth.capabilityId };
|
|
2513
|
-
} catch (error) {
|
|
2514
|
-
const message = error instanceof Error ? error.message : "Execution failed";
|
|
2515
|
-
return { success: false, stage: "action", error: message };
|
|
2516
|
-
}
|
|
2517
|
-
};
|
|
2518
|
-
var executeNodeWithInvocation = async ({ node, actorDid, actorType, entityRoomId, context, action, pin }) => {
|
|
2519
|
-
const { runtime, ucanService, invocationStore, flowUri, flowId, flowOwnerDid, now } = context;
|
|
2520
|
-
const activation = isNodeActive(node, runtime);
|
|
2521
|
-
if (!activation.active) {
|
|
2522
|
-
return { success: false, stage: "activation", error: activation.reason };
|
|
2523
|
-
}
|
|
2524
|
-
const authContext = {
|
|
2525
|
-
ucanService,
|
|
2526
|
-
flowUri,
|
|
2527
|
-
flowOwnerDid,
|
|
2528
|
-
// Legacy fallbacks
|
|
2529
|
-
delegationStore: context.delegationStore,
|
|
2530
|
-
verifySignature: context.verifySignature,
|
|
2531
|
-
rootIssuer: context.rootIssuer,
|
|
2532
|
-
ucanManager: context.ucanManager
|
|
2533
|
-
};
|
|
2534
|
-
const auth = await isActorAuthorizedV2(node, actorDid, authContext);
|
|
2109
|
+
const auth = await isAuthorized(node.id, actorDid, ucanService, flowUri);
|
|
2535
2110
|
if (!auth.authorized) {
|
|
2536
2111
|
return { success: false, stage: "authorization", error: auth.reason };
|
|
2537
2112
|
}
|
|
@@ -2540,7 +2115,7 @@ var executeNodeWithInvocation = async ({ node, actorDid, actorType, entityRoomId
|
|
|
2540
2115
|
}
|
|
2541
2116
|
let invocationCid;
|
|
2542
2117
|
let invocationData;
|
|
2543
|
-
if (
|
|
2118
|
+
if (auth.proofCids && auth.proofCids.length > 0) {
|
|
2544
2119
|
const capability = {
|
|
2545
2120
|
can: "flow/block/execute",
|
|
2546
2121
|
with: `${flowUri}:${node.id}`
|
|
@@ -2641,106 +2216,6 @@ var executeNodeWithInvocation = async ({ node, actorDid, actorType, entityRoomId
|
|
|
2641
2216
|
}
|
|
2642
2217
|
};
|
|
2643
2218
|
|
|
2644
|
-
// src/core/lib/delegationStore.ts
|
|
2645
|
-
var ROOT_CAPABILITY_KEY = "__root__";
|
|
2646
|
-
var createDelegationStore = (yMap) => {
|
|
2647
|
-
return {
|
|
2648
|
-
get: (capabilityId) => {
|
|
2649
|
-
const raw = yMap.get(capabilityId);
|
|
2650
|
-
if (!raw || capabilityId === ROOT_CAPABILITY_KEY) return null;
|
|
2651
|
-
try {
|
|
2652
|
-
return JSON.parse(raw);
|
|
2653
|
-
} catch {
|
|
2654
|
-
return null;
|
|
2655
|
-
}
|
|
2656
|
-
},
|
|
2657
|
-
set: (capability) => {
|
|
2658
|
-
yMap.set(capability.id, JSON.stringify(capability));
|
|
2659
|
-
},
|
|
2660
|
-
remove: (capabilityId) => {
|
|
2661
|
-
yMap.delete(capabilityId);
|
|
2662
|
-
},
|
|
2663
|
-
getRoot: () => {
|
|
2664
|
-
const rootId = yMap.get(ROOT_CAPABILITY_KEY);
|
|
2665
|
-
if (!rootId) return null;
|
|
2666
|
-
const raw = yMap.get(rootId);
|
|
2667
|
-
if (!raw) return null;
|
|
2668
|
-
try {
|
|
2669
|
-
return JSON.parse(raw);
|
|
2670
|
-
} catch {
|
|
2671
|
-
return null;
|
|
2672
|
-
}
|
|
2673
|
-
},
|
|
2674
|
-
setRootId: (capabilityId) => {
|
|
2675
|
-
yMap.set(ROOT_CAPABILITY_KEY, capabilityId);
|
|
2676
|
-
},
|
|
2677
|
-
getAll: () => {
|
|
2678
|
-
const capabilities = [];
|
|
2679
|
-
yMap.forEach((value, key) => {
|
|
2680
|
-
if (key !== ROOT_CAPABILITY_KEY) {
|
|
2681
|
-
try {
|
|
2682
|
-
capabilities.push(JSON.parse(value));
|
|
2683
|
-
} catch {
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
});
|
|
2687
|
-
return capabilities;
|
|
2688
|
-
},
|
|
2689
|
-
has: (capabilityId) => {
|
|
2690
|
-
return yMap.has(capabilityId);
|
|
2691
|
-
}
|
|
2692
|
-
};
|
|
2693
|
-
};
|
|
2694
|
-
var createMemoryDelegationStore = () => {
|
|
2695
|
-
const store = /* @__PURE__ */ new Map();
|
|
2696
|
-
return {
|
|
2697
|
-
get: (capabilityId) => {
|
|
2698
|
-
const raw = store.get(capabilityId);
|
|
2699
|
-
if (!raw || capabilityId === ROOT_CAPABILITY_KEY) return null;
|
|
2700
|
-
try {
|
|
2701
|
-
return JSON.parse(raw);
|
|
2702
|
-
} catch {
|
|
2703
|
-
return null;
|
|
2704
|
-
}
|
|
2705
|
-
},
|
|
2706
|
-
set: (capability) => {
|
|
2707
|
-
store.set(capability.id, JSON.stringify(capability));
|
|
2708
|
-
},
|
|
2709
|
-
remove: (capabilityId) => {
|
|
2710
|
-
store.delete(capabilityId);
|
|
2711
|
-
},
|
|
2712
|
-
getRoot: () => {
|
|
2713
|
-
const rootId = store.get(ROOT_CAPABILITY_KEY);
|
|
2714
|
-
if (!rootId) return null;
|
|
2715
|
-
const raw = store.get(rootId);
|
|
2716
|
-
if (!raw) return null;
|
|
2717
|
-
try {
|
|
2718
|
-
return JSON.parse(raw);
|
|
2719
|
-
} catch {
|
|
2720
|
-
return null;
|
|
2721
|
-
}
|
|
2722
|
-
},
|
|
2723
|
-
setRootId: (capabilityId) => {
|
|
2724
|
-
store.set(ROOT_CAPABILITY_KEY, capabilityId);
|
|
2725
|
-
},
|
|
2726
|
-
getAll: () => {
|
|
2727
|
-
const capabilities = [];
|
|
2728
|
-
store.forEach((value, key) => {
|
|
2729
|
-
if (key !== ROOT_CAPABILITY_KEY) {
|
|
2730
|
-
try {
|
|
2731
|
-
capabilities.push(JSON.parse(value));
|
|
2732
|
-
} catch {
|
|
2733
|
-
}
|
|
2734
|
-
}
|
|
2735
|
-
});
|
|
2736
|
-
return capabilities;
|
|
2737
|
-
},
|
|
2738
|
-
has: (capabilityId) => {
|
|
2739
|
-
return store.has(capabilityId);
|
|
2740
|
-
}
|
|
2741
|
-
};
|
|
2742
|
-
};
|
|
2743
|
-
|
|
2744
2219
|
// src/core/services/ucanService.ts
|
|
2745
2220
|
import {
|
|
2746
2221
|
createDelegation as ucanCreateDelegation,
|
|
@@ -2793,8 +2268,7 @@ var createUcanService = (config) => {
|
|
|
2793
2268
|
return delegationCache.get(cid);
|
|
2794
2269
|
}
|
|
2795
2270
|
const stored = delegationStore.get(cid);
|
|
2796
|
-
if (!stored)
|
|
2797
|
-
if (stored.format === "legacy" || !stored.delegation) {
|
|
2271
|
+
if (!stored || !stored.delegation) {
|
|
2798
2272
|
return null;
|
|
2799
2273
|
}
|
|
2800
2274
|
try {
|
|
@@ -2853,7 +2327,6 @@ var createUcanService = (config) => {
|
|
|
2853
2327
|
capabilities: toUcantoCapabilities(capabilities),
|
|
2854
2328
|
proofs: proofDelegations,
|
|
2855
2329
|
expiration: expiration ? Math.floor(expiration / 1e3) : void 0
|
|
2856
|
-
// Convert ms to seconds
|
|
2857
2330
|
});
|
|
2858
2331
|
const serialized = await serializeDelegation(delegation);
|
|
2859
2332
|
const cid = getCidFromDelegation(delegation);
|
|
@@ -3038,54 +2511,6 @@ var createUcanService = (config) => {
|
|
|
3038
2511
|
};
|
|
3039
2512
|
}
|
|
3040
2513
|
};
|
|
3041
|
-
const migrateLegacyDelegation = async (legacyId, pin) => {
|
|
3042
|
-
const legacy = delegationStore.getLegacy(legacyId);
|
|
3043
|
-
if (!legacy) {
|
|
3044
|
-
return null;
|
|
3045
|
-
}
|
|
3046
|
-
const newDelegation = await createDelegation({
|
|
3047
|
-
issuerDid: legacy.issuer,
|
|
3048
|
-
issuerType: "user",
|
|
3049
|
-
// Assume user, host app should verify
|
|
3050
|
-
audience: legacy.audience,
|
|
3051
|
-
capabilities: legacy.capabilities,
|
|
3052
|
-
proofs: legacy.proofs,
|
|
3053
|
-
expiration: legacy.expiration,
|
|
3054
|
-
pin
|
|
3055
|
-
});
|
|
3056
|
-
return newDelegation;
|
|
3057
|
-
};
|
|
3058
|
-
const migrateAllLegacy = async (pin) => {
|
|
3059
|
-
const report = {
|
|
3060
|
-
total: 0,
|
|
3061
|
-
migrated: 0,
|
|
3062
|
-
failed: 0,
|
|
3063
|
-
errors: []
|
|
3064
|
-
};
|
|
3065
|
-
const legacyDelegations = delegationStore.getAllLegacy();
|
|
3066
|
-
report.total = legacyDelegations.length;
|
|
3067
|
-
for (const legacy of legacyDelegations) {
|
|
3068
|
-
try {
|
|
3069
|
-
const migrated = await migrateLegacyDelegation(legacy.id, pin);
|
|
3070
|
-
if (migrated) {
|
|
3071
|
-
report.migrated++;
|
|
3072
|
-
} else {
|
|
3073
|
-
report.failed++;
|
|
3074
|
-
report.errors.push({ id: legacy.id, error: "Migration returned null" });
|
|
3075
|
-
}
|
|
3076
|
-
} catch (error) {
|
|
3077
|
-
report.failed++;
|
|
3078
|
-
report.errors.push({
|
|
3079
|
-
id: legacy.id,
|
|
3080
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
3081
|
-
});
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
return report;
|
|
3085
|
-
};
|
|
3086
|
-
const getLegacyCount = () => {
|
|
3087
|
-
return delegationStore.getAllLegacy().length;
|
|
3088
|
-
};
|
|
3089
2514
|
return {
|
|
3090
2515
|
createRootDelegation,
|
|
3091
2516
|
createDelegation,
|
|
@@ -3098,57 +2523,10 @@ var createUcanService = (config) => {
|
|
|
3098
2523
|
validateDelegationChain,
|
|
3099
2524
|
findValidProofs,
|
|
3100
2525
|
parseDelegationFromStore,
|
|
3101
|
-
migrateLegacyDelegation,
|
|
3102
|
-
migrateAllLegacy,
|
|
3103
|
-
getLegacyCount,
|
|
3104
2526
|
isConfigured
|
|
3105
2527
|
};
|
|
3106
2528
|
};
|
|
3107
2529
|
|
|
3108
|
-
// src/core/services/ucanManager.ts
|
|
3109
|
-
var parseGrant = (value) => {
|
|
3110
|
-
const trimmed = value.trim();
|
|
3111
|
-
if (!trimmed) {
|
|
3112
|
-
throw new Error("Empty capability value");
|
|
3113
|
-
}
|
|
3114
|
-
try {
|
|
3115
|
-
const parsed = JSON.parse(trimmed);
|
|
3116
|
-
if (parsed && typeof parsed === "object") {
|
|
3117
|
-
return {
|
|
3118
|
-
raw: trimmed,
|
|
3119
|
-
with: typeof parsed.with === "string" ? parsed.with : void 0,
|
|
3120
|
-
audience: typeof parsed.aud === "string" ? parsed.aud : void 0,
|
|
3121
|
-
expiresAt: typeof parsed.exp === "number" ? parsed.exp * 1e3 : void 0,
|
|
3122
|
-
action: typeof parsed.can === "string" ? parsed.can : void 0
|
|
3123
|
-
};
|
|
3124
|
-
}
|
|
3125
|
-
} catch {
|
|
3126
|
-
}
|
|
3127
|
-
return { raw: trimmed };
|
|
3128
|
-
};
|
|
3129
|
-
var SimpleUCANManager = class {
|
|
3130
|
-
async loadParentCapability(capability) {
|
|
3131
|
-
return parseGrant(capability);
|
|
3132
|
-
}
|
|
3133
|
-
async deriveNodeCapability(parent, nodeId, actorDid) {
|
|
3134
|
-
if (parent.expiresAt && parent.expiresAt < Date.now()) {
|
|
3135
|
-
throw new Error("Parent capability expired");
|
|
3136
|
-
}
|
|
3137
|
-
if (parent.audience && parent.audience !== actorDid) {
|
|
3138
|
-
throw new Error(`Actor ${actorDid} is not the audience for the capability`);
|
|
3139
|
-
}
|
|
3140
|
-
if (parent.with && !(parent.with.endsWith("*") || parent.with.includes(nodeId))) {
|
|
3141
|
-
throw new Error(`Capability resource ${parent.with} does not cover node ${nodeId}`);
|
|
3142
|
-
}
|
|
3143
|
-
return { ...parent };
|
|
3144
|
-
}
|
|
3145
|
-
async validateDerivedCapability(derived) {
|
|
3146
|
-
if (derived.expiresAt && derived.expiresAt < Date.now()) {
|
|
3147
|
-
throw new Error("Derived capability expired");
|
|
3148
|
-
}
|
|
3149
|
-
}
|
|
3150
|
-
};
|
|
3151
|
-
|
|
3152
2530
|
export {
|
|
3153
2531
|
resolveActionType,
|
|
3154
2532
|
registerAction,
|
|
@@ -3179,15 +2557,8 @@ export {
|
|
|
3179
2557
|
createRuntimeStateManager,
|
|
3180
2558
|
clearRuntimeForTemplateClone,
|
|
3181
2559
|
isNodeActive,
|
|
3182
|
-
|
|
3183
|
-
findValidCapability,
|
|
3184
|
-
isActorAuthorized,
|
|
3185
|
-
isActorAuthorizedV2,
|
|
2560
|
+
isAuthorized,
|
|
3186
2561
|
executeNode,
|
|
3187
|
-
|
|
3188
|
-
createDelegationStore,
|
|
3189
|
-
createMemoryDelegationStore,
|
|
3190
|
-
createUcanService,
|
|
3191
|
-
SimpleUCANManager
|
|
2562
|
+
createUcanService
|
|
3192
2563
|
};
|
|
3193
|
-
//# sourceMappingURL=chunk-
|
|
2564
|
+
//# sourceMappingURL=chunk-77R3T42S.mjs.map
|