@tinycloud/node-sdk 3.8.0-beta.14 → 3.8.0-beta.16

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/index.cjs CHANGED
@@ -19615,7 +19615,8 @@ var NodeUserAuthorization = class {
19615
19615
  return true;
19616
19616
  }
19617
19617
  const parsed = entry.path.includes("/") ? (0, import_resource.parseEncryptionResource)(entry.path) : { ...(0, import_sdk_services3.parseNetworkId)(entry.path), kind: "network" };
19618
- if (parsed.kind !== "network") {
19618
+ const sharePrefix = parsed.kind === "prefix" && parsed.network === "default" && parsed.prefix === "share" && entry.actions.length === 1 && entry.actions[0] === DECRYPT_ACTION && didPrincipalMatches(parsed.ownerDid, currentDid);
19619
+ if (parsed.kind !== "network" && !sharePrefix) {
19619
19620
  throw new import_sdk_core5.ManifestValidationError("named keys go in manifest.keys");
19620
19621
  }
19621
19622
  for (const action of entry.actions) {
@@ -25130,7 +25131,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25130
25131
  graph.assertActive();
25131
25132
  const signed2 = await this.signRawNetworkAuthorization({
25132
25133
  targetNode: input.targetNode,
25133
- networkId: input.networkId,
25134
+ networkId: input.body.keyPath === void 0 ? input.networkId : `${input.networkId}/${input.body.keyPath}`,
25134
25135
  action: DECRYPT_ACTION2,
25135
25136
  facts: input.facts
25136
25137
  }, { graph, session });
@@ -26720,7 +26721,19 @@ var _TinyCloudNode = class _TinyCloudNode {
26720
26721
  "delegateTo requires a non-empty permissions array"
26721
26722
  );
26722
26723
  }
26723
- const expandedEntries = this.expandPermissionEntries(permissions);
26724
+ const expandedEntries = (0, import_sdk_core10.expandDelegationPermissionEntries)(permissions);
26725
+ const namedKeyEntries = expandedEntries.filter((entry) => entry.service === import_sdk_core10.ENCRYPTION_PERMISSION_SERVICE && entry.path.includes("/"));
26726
+ if (namedKeyEntries.length > 0) {
26727
+ if (expandedEntries.some((entry) => entry.service === import_sdk_core10.ENCRYPTION_PERMISSION_SERVICE && !entry.path.includes("/"))) {
26728
+ throw new import_sdk_core10.ManifestValidationError("named-key delegation cannot include bare-network permissions");
26729
+ }
26730
+ if (options?.forceWalletSign) {
26731
+ throw new import_sdk_core10.ManifestValidationError("named-key delegation requires a signed session grant");
26732
+ }
26733
+ const granted = this.projectSignedRecapCapabilities(session.siwe);
26734
+ const { subset, missing } = this.signedCapabilitySubset(namedKeyEntries, granted);
26735
+ if (!subset) throw new import_sdk_core10.PermissionNotInManifestError(missing, granted);
26736
+ }
26724
26737
  const now = /* @__PURE__ */ new Date();
26725
26738
  const expiryMs = resolveExpiryMs(options?.expiry);
26726
26739
  const expirationTime = new Date(now.getTime() + expiryMs);