@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/core.js
CHANGED
|
@@ -2914,10 +2914,12 @@ import {
|
|
|
2914
2914
|
ENCRYPTION_PERMISSION_SERVICE as ENCRYPTION_PERMISSION_SERVICE2,
|
|
2915
2915
|
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError2,
|
|
2916
2916
|
PermissionNotInManifestError,
|
|
2917
|
+
ManifestValidationError as ManifestValidationError2,
|
|
2917
2918
|
SessionExpiredError,
|
|
2918
2919
|
canonicalizeRecapCaveats as canonicalizeRecapCaveats2,
|
|
2919
2920
|
recapCaveatsEqual as recapCaveatsEqual2,
|
|
2920
2921
|
expandPermissionEntries as expandPermissionEntriesCore,
|
|
2922
|
+
expandDelegationPermissionEntries,
|
|
2921
2923
|
isCapabilitySubset as isCapabilitySubset2,
|
|
2922
2924
|
isExplicitOnlyAction,
|
|
2923
2925
|
parseRecapCapabilities,
|
|
@@ -8932,7 +8934,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8932
8934
|
"delegateTo requires a non-empty permissions array"
|
|
8933
8935
|
);
|
|
8934
8936
|
}
|
|
8935
|
-
const expandedEntries =
|
|
8937
|
+
const expandedEntries = expandDelegationPermissionEntries(permissions);
|
|
8938
|
+
const namedKeyEntries = expandedEntries.filter((entry) => entry.service === ENCRYPTION_PERMISSION_SERVICE2 && entry.path.includes("/"));
|
|
8939
|
+
if (namedKeyEntries.length > 0) {
|
|
8940
|
+
if (expandedEntries.some((entry) => entry.service === ENCRYPTION_PERMISSION_SERVICE2 && !entry.path.includes("/"))) {
|
|
8941
|
+
throw new ManifestValidationError2("named-key delegation cannot include bare-network permissions");
|
|
8942
|
+
}
|
|
8943
|
+
if (options?.forceWalletSign) {
|
|
8944
|
+
throw new ManifestValidationError2("named-key delegation requires a signed session grant");
|
|
8945
|
+
}
|
|
8946
|
+
const granted = this.projectSignedRecapCapabilities(session.siwe);
|
|
8947
|
+
const { subset, missing } = this.signedCapabilitySubset(namedKeyEntries, granted);
|
|
8948
|
+
if (!subset) throw new PermissionNotInManifestError(missing, granted);
|
|
8949
|
+
}
|
|
8936
8950
|
const now = /* @__PURE__ */ new Date();
|
|
8937
8951
|
const expiryMs = resolveExpiryMs(options?.expiry);
|
|
8938
8952
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
@@ -10317,7 +10331,7 @@ import {
|
|
|
10317
10331
|
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError3,
|
|
10318
10332
|
PermissionNotInManifestError as PermissionNotInManifestError2,
|
|
10319
10333
|
SessionExpiredError as SessionExpiredError2,
|
|
10320
|
-
ManifestValidationError as
|
|
10334
|
+
ManifestValidationError as ManifestValidationError3,
|
|
10321
10335
|
composeManifestRequest as composeManifestRequest2,
|
|
10322
10336
|
resolveManifest as resolveManifest2,
|
|
10323
10337
|
validateManifest,
|
|
@@ -10402,7 +10416,7 @@ export {
|
|
|
10402
10416
|
IdentityParseError,
|
|
10403
10417
|
InvalidRestoredSessionError,
|
|
10404
10418
|
KVService3 as KVService,
|
|
10405
|
-
|
|
10419
|
+
ManifestValidationError3 as ManifestValidationError,
|
|
10406
10420
|
MemorySessionStorage,
|
|
10407
10421
|
NodeUserAuthorization,
|
|
10408
10422
|
PermissionNotInManifestError2 as PermissionNotInManifestError,
|