@tinycloud/sdk-core 3.9.0-beta.8 → 3.9.1-beta.0
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/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +21 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -7412,6 +7412,10 @@ function expandEncryptionPermissionEntry(entry) {
|
|
|
7412
7412
|
normalizedActions.push("tinycloud.encryption/network.revoke");
|
|
7413
7413
|
continue;
|
|
7414
7414
|
}
|
|
7415
|
+
if (sharePrefix && (action === "key.create" || action === "tinycloud.encryption/key.create")) {
|
|
7416
|
+
normalizedActions.push("tinycloud.encryption/key.create");
|
|
7417
|
+
continue;
|
|
7418
|
+
}
|
|
7415
7419
|
if (action.includes("/")) {
|
|
7416
7420
|
throw new ManifestValidationError(
|
|
7417
7421
|
`unknown encryption action ${JSON.stringify(action)}; expected decrypt, network.create, or network.revoke`
|
|
@@ -7429,8 +7433,20 @@ function expandEncryptionPermissionEntry(entry) {
|
|
|
7429
7433
|
seen.add(a);
|
|
7430
7434
|
}
|
|
7431
7435
|
}
|
|
7432
|
-
if (sharePrefix && dedupedActions.some((action) => action !== "tinycloud.encryption/decrypt")) {
|
|
7433
|
-
throw new ManifestValidationError("share prefix only supports decrypt");
|
|
7436
|
+
if (sharePrefix && dedupedActions.some((action) => action !== "tinycloud.encryption/decrypt" && action !== "tinycloud.encryption/key.create")) {
|
|
7437
|
+
throw new ManifestValidationError("share prefix only supports decrypt and key.create");
|
|
7438
|
+
}
|
|
7439
|
+
if (dedupedActions.includes("tinycloud.encryption/key.create")) {
|
|
7440
|
+
let canonical = false;
|
|
7441
|
+
try {
|
|
7442
|
+
const parsed = parseEncryptionResource2(entry.path);
|
|
7443
|
+
canonical = parsed.kind === "prefix" && parsed.network === "default" && parsed.prefix === "share";
|
|
7444
|
+
} catch {
|
|
7445
|
+
canonical = false;
|
|
7446
|
+
}
|
|
7447
|
+
if (!canonical) {
|
|
7448
|
+
throw new ManifestValidationError("share prefix key.create requires the canonical owner address (EIP-55 checksummed) on the default network");
|
|
7449
|
+
}
|
|
7434
7450
|
}
|
|
7435
7451
|
return [
|
|
7436
7452
|
{
|
|
@@ -7449,6 +7465,9 @@ function expandPermissionEntries(entries) {
|
|
|
7449
7465
|
}
|
|
7450
7466
|
function expandRuntimePermissionEntries(entries, ownerDid) {
|
|
7451
7467
|
return entries.flatMap((entry) => {
|
|
7468
|
+
if (entry.service === ENCRYPTION_PERMISSION_SERVICE && typeof entry.path === "string" && entry.path.endsWith("/share/") && Array.isArray(entry.actions) && entry.actions.some((action) => action === "key.create" || action === "tinycloud.encryption/key.create")) {
|
|
7469
|
+
throw new ManifestValidationError("runtime Share key creation requires the current owner's exact default/share/<id> key and key.create only");
|
|
7470
|
+
}
|
|
7452
7471
|
if (entry.service !== ENCRYPTION_PERMISSION_SERVICE || typeof entry.path !== "string" || !entry.path.includes("/") || entry.path.endsWith("/share/")) {
|
|
7453
7472
|
return expandPermissionEntry(entry);
|
|
7454
7473
|
}
|