@tinycloud/operations 0.7.7-beta.13 → 0.7.7-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.
@@ -744,6 +744,7 @@ var import_node_path2 = require("path");
744
744
  // ../sdk-core/src/manifest.ts
745
745
  var import_ms = __toESM(require_ms(), 1);
746
746
  var import_sdk_services = require("@tinycloud/sdk-services");
747
+ var import_resource = require("@tinycloud/sdk-services/encryption/resource");
747
748
  var DEFAULT_MANIFEST_SPACE = "applications";
748
749
  var SERVICE_SHORT_TO_LONG = Object.freeze({
749
750
  kv: "tinycloud.kv",
@@ -773,6 +774,7 @@ var KEY_APP_ID = new RegExp(`^${KEY_SEGMENT}$`);
773
774
  var KEY_PATH = new RegExp(`^${KEY_SEGMENT}(?:/${KEY_SEGMENT}){2,7}$`);
774
775
 
775
776
  // ../sdk-core/src/capabilities.ts
777
+ var import_resource2 = require("@tinycloud/sdk-services/encryption/resource");
776
778
  function normalizeSpace(space) {
777
779
  if (!space.startsWith("tinycloud:")) {
778
780
  return space;
@@ -796,10 +798,9 @@ function isCapabilitySubset(requested, granted) {
796
798
  const grantedActions = matchingScope.flatMap(
797
799
  (entry) => expandActionShortNames(entry.service, entry.actions)
798
800
  );
801
+ const namedKeyRequest = req.service === "tinycloud.encryption" && req.path.startsWith("urn:tinycloud:encryption:") && req.path.includes("/");
799
802
  const covered = requestedActions.every(
800
- (requestedAction) => grantedActions.some(
801
- (grantedAction) => actionContains(grantedAction, requestedAction)
802
- )
803
+ (requestedAction) => grantedActions.some((grantedAction) => namedKeyRequest ? grantedAction === requestedAction : actionContains(grantedAction, requestedAction))
803
804
  );
804
805
  if (!covered) {
805
806
  missing.push(cloneEntry(req));
@@ -814,7 +815,9 @@ function canonicalizeEntryScopeMatches(requested, granted) {
814
815
  if (normalizeSpace(requested.space ?? DEFAULT_MANIFEST_SPACE) !== normalizeSpace(granted.space ?? DEFAULT_MANIFEST_SPACE)) {
815
816
  return false;
816
817
  }
817
- if (!pathContains(granted.path, requested.path)) {
818
+ const namedKeyRequest = requested.service === "tinycloud.encryption" && requested.path.startsWith("urn:tinycloud:encryption:") && requested.path.includes("/");
819
+ const coveredPath = namedKeyRequest ? (0, import_resource2.encryptionResourceContains)(granted.path, requested.path) : pathContains(granted.path, requested.path);
820
+ if (!coveredPath) {
818
821
  return false;
819
822
  }
820
823
  if (!recapCaveatsEqual(requested.caveats, granted.caveats)) {
@@ -3583,6 +3586,7 @@ var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
3583
3586
 
3584
3587
  // ../sdk-core/src/policy/unified.ts
3585
3588
  var import_zod = require("zod");
3589
+ var import_sdk_services2 = require("@tinycloud/sdk-services");
3586
3590
  var CompactHeaderSchema = import_zod.z.object({
3587
3591
  alg: import_zod.z.literal("EdDSA"),
3588
3592
  jwk: import_zod.z.object({ alg: import_zod.z.literal("EdDSA"), crv: import_zod.z.literal("Ed25519"), kty: import_zod.z.literal("OKP"), x: import_zod.z.string().min(1) }).strict(),