@tinycloud/cli 0.7.0-beta.2 → 0.7.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 +13 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11918,9 +11918,10 @@ function groupPermissionsBySpace(permissions) {
|
|
|
11918
11918
|
rawEntries.push(permission);
|
|
11919
11919
|
continue;
|
|
11920
11920
|
}
|
|
11921
|
-
const
|
|
11921
|
+
const key = normalizeSpaceForCompare(permission.space);
|
|
11922
|
+
const group = groups.get(key) ?? [];
|
|
11922
11923
|
group.push(permission);
|
|
11923
|
-
groups.set(
|
|
11924
|
+
groups.set(key, group);
|
|
11924
11925
|
}
|
|
11925
11926
|
const grouped = Array.from(groups.values());
|
|
11926
11927
|
if (grouped.length === 0) {
|
|
@@ -11932,8 +11933,16 @@ function groupPermissionsBySpace(permissions) {
|
|
|
11932
11933
|
function isRawPermission(permission) {
|
|
11933
11934
|
return permission.service === "tinycloud.encryption" && permission.path.startsWith("urn:tinycloud:encryption:");
|
|
11934
11935
|
}
|
|
11936
|
+
function normalizeSpaceForCompare(space) {
|
|
11937
|
+
return space.replace(
|
|
11938
|
+
/(eip155:\d+:)(0x[0-9a-fA-F]{40})/,
|
|
11939
|
+
(_match, prefix, addr) => prefix + addr.toLowerCase()
|
|
11940
|
+
);
|
|
11941
|
+
}
|
|
11935
11942
|
function returnedSpaceMatchesExpected(returnedSpace, expectedSpace) {
|
|
11936
|
-
if (returnedSpace === expectedSpace)
|
|
11943
|
+
if (normalizeSpaceForCompare(returnedSpace) === normalizeSpaceForCompare(expectedSpace)) {
|
|
11944
|
+
return true;
|
|
11945
|
+
}
|
|
11937
11946
|
if (!returnedSpace.startsWith("tinycloud:")) return false;
|
|
11938
11947
|
const returnedName = returnedSpace.slice(returnedSpace.lastIndexOf(":") + 1);
|
|
11939
11948
|
return returnedName === expectedSpace;
|
|
@@ -11942,7 +11951,7 @@ function portableFromOpenKeyDelegation(data, permissions, host) {
|
|
|
11942
11951
|
const primary = permissions.find((permission) => !isRawPermission(permission)) ?? permissions[0];
|
|
11943
11952
|
const returnedSpace = String(data.spaceId ?? primary.space ?? "encryption");
|
|
11944
11953
|
const expectedSpaces = new Set(
|
|
11945
|
-
permissions.filter((permission) => !isRawPermission(permission)).map((permission) => permission.space)
|
|
11954
|
+
permissions.filter((permission) => !isRawPermission(permission)).map((permission) => normalizeSpaceForCompare(permission.space))
|
|
11946
11955
|
);
|
|
11947
11956
|
const matchesExpectedSpace = expectedSpaces.size === 1 && returnedSpaceMatchesExpected(returnedSpace, Array.from(expectedSpaces)[0]);
|
|
11948
11957
|
if (expectedSpaces.size > 0 && !matchesExpectedSpace) {
|