@tinycloud/sdk-core 2.1.0-beta.2 → 2.1.0-beta.4

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
@@ -4227,6 +4227,16 @@ var SessionExpiredError = class extends Error {
4227
4227
  this.expiredAt = expiredAt;
4228
4228
  }
4229
4229
  };
4230
+ function normalizeSpace(space) {
4231
+ if (!space.startsWith("tinycloud:")) {
4232
+ return space;
4233
+ }
4234
+ const lastColon = space.lastIndexOf(":");
4235
+ if (lastColon === -1 || lastColon === space.length - 1) {
4236
+ return space;
4237
+ }
4238
+ return space.slice(lastColon + 1);
4239
+ }
4230
4240
  function isCapabilitySubset(requested, granted) {
4231
4241
  const missing = [];
4232
4242
  for (const req of requested) {
@@ -4242,7 +4252,7 @@ function canonicalizeEntryMatches(requested, granted) {
4242
4252
  if (requested.service !== granted.service) {
4243
4253
  return false;
4244
4254
  }
4245
- if (requested.space !== granted.space) {
4255
+ if (normalizeSpace(requested.space) !== normalizeSpace(granted.space)) {
4246
4256
  return false;
4247
4257
  }
4248
4258
  if (!pathContains(granted.path, requested.path)) {
@@ -4294,7 +4304,10 @@ function parseRecapCapabilities(parseWasm, siwe) {
4294
4304
  (entry.service.startsWith("tinycloud.") ? entry.service : `tinycloud.${entry.service}`);
4295
4305
  return {
4296
4306
  service: longService,
4297
- space: entry.space,
4307
+ // The Rust layer emits the space as a full `tinycloud:pkh:...:name`
4308
+ // URI (the recap target URI). Normalize to the short name so the
4309
+ // returned entries match the shape manifests use.
4310
+ space: normalizeSpace(entry.space),
4298
4311
  path: entry.path,
4299
4312
  actions: [...entry.actions]
4300
4313
  };