@tinycloud/node-sdk 3.8.0-beta.14 → 3.8.0-beta.16
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/core.cjs +16 -3
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +20 -5
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/share-receive.cjs +775 -0
- package/dist/share-receive.cjs.map +1 -0
- package/dist/share-receive.d.cts +32 -0
- package/dist/share-receive.d.ts +32 -0
- package/dist/share-receive.js +777 -0
- package/dist/share-receive.js.map +1 -0
- package/package.json +11 -4
package/dist/core.js
CHANGED
|
@@ -1031,7 +1031,8 @@ var NodeUserAuthorization = class {
|
|
|
1031
1031
|
return true;
|
|
1032
1032
|
}
|
|
1033
1033
|
const parsed = entry.path.includes("/") ? parseEncryptionResource(entry.path) : { ...parseNetworkId(entry.path), kind: "network" };
|
|
1034
|
-
|
|
1034
|
+
const sharePrefix = parsed.kind === "prefix" && parsed.network === "default" && parsed.prefix === "share" && entry.actions.length === 1 && entry.actions[0] === DECRYPT_ACTION && didPrincipalMatches(parsed.ownerDid, currentDid);
|
|
1035
|
+
if (parsed.kind !== "network" && !sharePrefix) {
|
|
1035
1036
|
throw new ManifestValidationError("named keys go in manifest.keys");
|
|
1036
1037
|
}
|
|
1037
1038
|
for (const action of entry.actions) {
|
|
@@ -2914,10 +2915,12 @@ import {
|
|
|
2914
2915
|
ENCRYPTION_PERMISSION_SERVICE as ENCRYPTION_PERMISSION_SERVICE2,
|
|
2915
2916
|
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError2,
|
|
2916
2917
|
PermissionNotInManifestError,
|
|
2918
|
+
ManifestValidationError as ManifestValidationError2,
|
|
2917
2919
|
SessionExpiredError,
|
|
2918
2920
|
canonicalizeRecapCaveats as canonicalizeRecapCaveats2,
|
|
2919
2921
|
recapCaveatsEqual as recapCaveatsEqual2,
|
|
2920
2922
|
expandPermissionEntries as expandPermissionEntriesCore,
|
|
2923
|
+
expandDelegationPermissionEntries,
|
|
2921
2924
|
isCapabilitySubset as isCapabilitySubset2,
|
|
2922
2925
|
isExplicitOnlyAction,
|
|
2923
2926
|
parseRecapCapabilities,
|
|
@@ -7342,7 +7345,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
7342
7345
|
graph.assertActive();
|
|
7343
7346
|
const signed = await this.signRawNetworkAuthorization({
|
|
7344
7347
|
targetNode: input.targetNode,
|
|
7345
|
-
networkId: input.networkId
|
|
7348
|
+
networkId: input.body.keyPath === void 0 ? input.networkId : `${input.networkId}/${input.body.keyPath}`,
|
|
7346
7349
|
action: DECRYPT_ACTION2,
|
|
7347
7350
|
facts: input.facts
|
|
7348
7351
|
}, { graph, session });
|
|
@@ -8932,7 +8935,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8932
8935
|
"delegateTo requires a non-empty permissions array"
|
|
8933
8936
|
);
|
|
8934
8937
|
}
|
|
8935
|
-
const expandedEntries =
|
|
8938
|
+
const expandedEntries = expandDelegationPermissionEntries(permissions);
|
|
8939
|
+
const namedKeyEntries = expandedEntries.filter((entry) => entry.service === ENCRYPTION_PERMISSION_SERVICE2 && entry.path.includes("/"));
|
|
8940
|
+
if (namedKeyEntries.length > 0) {
|
|
8941
|
+
if (expandedEntries.some((entry) => entry.service === ENCRYPTION_PERMISSION_SERVICE2 && !entry.path.includes("/"))) {
|
|
8942
|
+
throw new ManifestValidationError2("named-key delegation cannot include bare-network permissions");
|
|
8943
|
+
}
|
|
8944
|
+
if (options?.forceWalletSign) {
|
|
8945
|
+
throw new ManifestValidationError2("named-key delegation requires a signed session grant");
|
|
8946
|
+
}
|
|
8947
|
+
const granted = this.projectSignedRecapCapabilities(session.siwe);
|
|
8948
|
+
const { subset, missing } = this.signedCapabilitySubset(namedKeyEntries, granted);
|
|
8949
|
+
if (!subset) throw new PermissionNotInManifestError(missing, granted);
|
|
8950
|
+
}
|
|
8936
8951
|
const now = /* @__PURE__ */ new Date();
|
|
8937
8952
|
const expiryMs = resolveExpiryMs(options?.expiry);
|
|
8938
8953
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
@@ -10317,7 +10332,7 @@ import {
|
|
|
10317
10332
|
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError3,
|
|
10318
10333
|
PermissionNotInManifestError as PermissionNotInManifestError2,
|
|
10319
10334
|
SessionExpiredError as SessionExpiredError2,
|
|
10320
|
-
ManifestValidationError as
|
|
10335
|
+
ManifestValidationError as ManifestValidationError3,
|
|
10321
10336
|
composeManifestRequest as composeManifestRequest2,
|
|
10322
10337
|
resolveManifest as resolveManifest2,
|
|
10323
10338
|
validateManifest,
|
|
@@ -10402,7 +10417,7 @@ export {
|
|
|
10402
10417
|
IdentityParseError,
|
|
10403
10418
|
InvalidRestoredSessionError,
|
|
10404
10419
|
KVService3 as KVService,
|
|
10405
|
-
|
|
10420
|
+
ManifestValidationError3 as ManifestValidationError,
|
|
10406
10421
|
MemorySessionStorage,
|
|
10407
10422
|
NodeUserAuthorization,
|
|
10408
10423
|
PermissionNotInManifestError2 as PermissionNotInManifestError,
|