@tinycloud/node-sdk 3.8.0-beta.14 → 3.8.0-beta.15
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/core.cjs +13 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +17 -3
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -18738,10 +18738,12 @@ import {
|
|
|
18738
18738
|
ENCRYPTION_PERMISSION_SERVICE as ENCRYPTION_PERMISSION_SERVICE2,
|
|
18739
18739
|
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError2,
|
|
18740
18740
|
PermissionNotInManifestError,
|
|
18741
|
+
ManifestValidationError as ManifestValidationError2,
|
|
18741
18742
|
SessionExpiredError,
|
|
18742
18743
|
canonicalizeRecapCaveats as canonicalizeRecapCaveats2,
|
|
18743
18744
|
recapCaveatsEqual as recapCaveatsEqual2,
|
|
18744
18745
|
expandPermissionEntries as expandPermissionEntriesCore,
|
|
18746
|
+
expandDelegationPermissionEntries,
|
|
18745
18747
|
isCapabilitySubset as isCapabilitySubset2,
|
|
18746
18748
|
isExplicitOnlyAction,
|
|
18747
18749
|
parseRecapCapabilities,
|
|
@@ -26731,7 +26733,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
26731
26733
|
"delegateTo requires a non-empty permissions array"
|
|
26732
26734
|
);
|
|
26733
26735
|
}
|
|
26734
|
-
const expandedEntries =
|
|
26736
|
+
const expandedEntries = expandDelegationPermissionEntries(permissions);
|
|
26737
|
+
const namedKeyEntries = expandedEntries.filter((entry) => entry.service === ENCRYPTION_PERMISSION_SERVICE2 && entry.path.includes("/"));
|
|
26738
|
+
if (namedKeyEntries.length > 0) {
|
|
26739
|
+
if (expandedEntries.some((entry) => entry.service === ENCRYPTION_PERMISSION_SERVICE2 && !entry.path.includes("/"))) {
|
|
26740
|
+
throw new ManifestValidationError2("named-key delegation cannot include bare-network permissions");
|
|
26741
|
+
}
|
|
26742
|
+
if (options?.forceWalletSign) {
|
|
26743
|
+
throw new ManifestValidationError2("named-key delegation requires a signed session grant");
|
|
26744
|
+
}
|
|
26745
|
+
const granted = this.projectSignedRecapCapabilities(session.siwe);
|
|
26746
|
+
const { subset, missing } = this.signedCapabilitySubset(namedKeyEntries, granted);
|
|
26747
|
+
if (!subset) throw new PermissionNotInManifestError(missing, granted);
|
|
26748
|
+
}
|
|
26735
26749
|
const now = /* @__PURE__ */ new Date();
|
|
26736
26750
|
const expiryMs = resolveExpiryMs(options?.expiry);
|
|
26737
26751
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
@@ -28334,7 +28348,7 @@ import {
|
|
|
28334
28348
|
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError3,
|
|
28335
28349
|
PermissionNotInManifestError as PermissionNotInManifestError2,
|
|
28336
28350
|
SessionExpiredError as SessionExpiredError2,
|
|
28337
|
-
ManifestValidationError as
|
|
28351
|
+
ManifestValidationError as ManifestValidationError3,
|
|
28338
28352
|
composeManifestRequest as composeManifestRequest2,
|
|
28339
28353
|
resolveManifest as resolveManifest2,
|
|
28340
28354
|
validateManifest,
|
|
@@ -30999,7 +31013,7 @@ export {
|
|
|
30999
31013
|
InvalidRestoredSessionError,
|
|
31000
31014
|
KVService4 as KVService,
|
|
31001
31015
|
MAX_SECRET_SCOPE_LENGTH,
|
|
31002
|
-
|
|
31016
|
+
ManifestValidationError3 as ManifestValidationError,
|
|
31003
31017
|
MemorySessionStorage,
|
|
31004
31018
|
NETWORK_NAME_PATTERN,
|
|
31005
31019
|
NetworkIdError,
|