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

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.js CHANGED
@@ -4153,6 +4153,16 @@ var SessionExpiredError = class extends Error {
4153
4153
  this.expiredAt = expiredAt;
4154
4154
  }
4155
4155
  };
4156
+ function normalizeSpace(space) {
4157
+ if (!space.startsWith("tinycloud:")) {
4158
+ return space;
4159
+ }
4160
+ const lastColon = space.lastIndexOf(":");
4161
+ if (lastColon === -1 || lastColon === space.length - 1) {
4162
+ return space;
4163
+ }
4164
+ return space.slice(lastColon + 1);
4165
+ }
4156
4166
  function isCapabilitySubset(requested, granted) {
4157
4167
  const missing = [];
4158
4168
  for (const req of requested) {
@@ -4168,7 +4178,7 @@ function canonicalizeEntryMatches(requested, granted) {
4168
4178
  if (requested.service !== granted.service) {
4169
4179
  return false;
4170
4180
  }
4171
- if (requested.space !== granted.space) {
4181
+ if (normalizeSpace(requested.space) !== normalizeSpace(granted.space)) {
4172
4182
  return false;
4173
4183
  }
4174
4184
  if (!pathContains(granted.path, requested.path)) {
@@ -4220,7 +4230,10 @@ function parseRecapCapabilities(parseWasm, siwe) {
4220
4230
  (entry.service.startsWith("tinycloud.") ? entry.service : `tinycloud.${entry.service}`);
4221
4231
  return {
4222
4232
  service: longService,
4223
- space: entry.space,
4233
+ // The Rust layer emits the space as a full `tinycloud:pkh:...:name`
4234
+ // URI (the recap target URI). Normalize to the short name so the
4235
+ // returned entries match the shape manifests use.
4236
+ space: normalizeSpace(entry.space),
4224
4237
  path: entry.path,
4225
4238
  actions: [...entry.actions]
4226
4239
  };