@tinycloud/sdk-core 3.8.0-beta.20 → 3.8.0-beta.21

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
@@ -364,6 +364,7 @@ __export(index_exports, {
364
364
  expandDelegationPermissionEntries: () => expandDelegationPermissionEntries,
365
365
  expandPermissionEntries: () => expandPermissionEntries,
366
366
  expandPermissionEntry: () => expandPermissionEntry,
367
+ expandRuntimePermissionEntries: () => expandRuntimePermissionEntries,
367
368
  extractImmutableSiweFields: () => extractImmutableSiweFields,
368
369
  extractRecapAttenuations: () => extractRecapAttenuations,
369
370
  fetchLocationRecord: () => fetchLocationRecord,
@@ -7950,6 +7951,32 @@ function expandEncryptionPermissionEntry(entry) {
7950
7951
  function expandPermissionEntries(entries) {
7951
7952
  return entries.flatMap(expandPermissionEntry);
7952
7953
  }
7954
+ function expandRuntimePermissionEntries(entries, ownerDid) {
7955
+ return entries.flatMap((entry) => {
7956
+ if (entry.service !== ENCRYPTION_PERMISSION_SERVICE || typeof entry.path !== "string" || !entry.path.includes("/") || entry.path.endsWith("/share/")) {
7957
+ return expandPermissionEntry(entry);
7958
+ }
7959
+ let resource;
7960
+ let ownerNetwork;
7961
+ try {
7962
+ resource = (0, import_resource.parseEncryptionResource)(entry.path);
7963
+ if (typeof ownerDid !== "string" || ownerDid.length === 0) throw new Error("missing owner");
7964
+ ownerNetwork = (0, import_resource.parseEncryptionResource)(`urn:tinycloud:encryption:${ownerDid}:default`);
7965
+ } catch {
7966
+ throw new ManifestValidationError("runtime Share key creation requires a canonical current-owner key resource");
7967
+ }
7968
+ if (resource.kind !== "key" || resource.networkId !== ownerNetwork.networkId || !/^share\/[^/]+$/.test(resource.path) || entry.space !== void 0 && entry.space !== ENCRYPTION_MANIFEST_SPACE || !Array.isArray(entry.actions) || entry.actions.length === 0 || entry.actions.some((action) => action !== "key.create" && action !== "tinycloud.encryption/key.create")) {
7969
+ throw new ManifestValidationError("runtime Share key creation requires the current owner's exact default/share/<id> key and key.create only");
7970
+ }
7971
+ return [{
7972
+ ...entry,
7973
+ space: ENCRYPTION_MANIFEST_SPACE,
7974
+ path: `${resource.networkId}/${resource.path}`,
7975
+ actions: ["tinycloud.encryption/key.create"],
7976
+ skipPrefix: true
7977
+ }];
7978
+ });
7979
+ }
7953
7980
  function expandDelegationPermissionEntries(entries) {
7954
7981
  return entries.flatMap((entry) => {
7955
7982
  if (entry.service !== ENCRYPTION_PERMISSION_SERVICE || typeof entry.path !== "string" || !entry.path.includes("/")) {