@tinycloud/node-sdk 3.0.0-beta.15 → 3.0.0-beta.17
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 +19 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +19 -2
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +19 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -19299,6 +19299,22 @@ function cloneRecapCaveats(caveats) {
|
|
|
19299
19299
|
throw new Error("Verified persisted session ReCap contains invalid caveats.");
|
|
19300
19300
|
}
|
|
19301
19301
|
}
|
|
19302
|
+
function jsonFromVerifier(value) {
|
|
19303
|
+
if (value === void 0) return null;
|
|
19304
|
+
if (Array.isArray(value)) return value.map(jsonFromVerifier);
|
|
19305
|
+
if (value instanceof Map) {
|
|
19306
|
+
const entries = [...value.entries()];
|
|
19307
|
+
if (!entries.every(([key2]) => typeof key2 === "string")) return value;
|
|
19308
|
+
return Object.fromEntries(entries.map(([key2, nested]) => [key2, jsonFromVerifier(nested)]));
|
|
19309
|
+
}
|
|
19310
|
+
if (value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
|
|
19311
|
+
return Object.fromEntries(Object.entries(value).map(([key2, nested]) => [key2, jsonFromVerifier(nested)]));
|
|
19312
|
+
}
|
|
19313
|
+
return value;
|
|
19314
|
+
}
|
|
19315
|
+
function verifierRecapEntries(entries) {
|
|
19316
|
+
return entries.map((entry) => Array.isArray(entry.caveats) ? { ...entry, caveats: entry.caveats.map((caveat) => jsonFromVerifier(caveat)) } : entry);
|
|
19317
|
+
}
|
|
19302
19318
|
var ServiceGraphLifetime = class {
|
|
19303
19319
|
constructor(invokeFn, invokeAnyFn, fetchFn) {
|
|
19304
19320
|
this.invokeFn = invokeFn;
|
|
@@ -20914,7 +20930,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20914
20930
|
throw new InvalidRestoredSessionError(error instanceof Error ? error.message : String(error));
|
|
20915
20931
|
}
|
|
20916
20932
|
})();
|
|
20917
|
-
const exactRecap = verified.verifiedRecap;
|
|
20933
|
+
const exactRecap = Array.isArray(verified.verifiedRecap) ? verifierRecapEntries(verified.verifiedRecap) : verified.verifiedRecap;
|
|
20918
20934
|
if (!Array.isArray(exactRecap) || !exactRecap.every(
|
|
20919
20935
|
(entry) => entry !== null && typeof entry === "object" && typeof entry.service === "string" && typeof entry.space === "string" && typeof entry.path === "string" && Array.isArray(entry.actions) && entry.actions.every((action) => typeof action === "string") && Array.isArray(entry.caveats) && entry.caveats.every(
|
|
20920
20936
|
(caveat) => caveat !== null && typeof caveat === "object" && !Array.isArray(caveat)
|
|
@@ -23922,7 +23938,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
23922
23938
|
}
|
|
23923
23939
|
/** Prefer the v2 caveat-preserving parser while retaining old custom WASM. */
|
|
23924
23940
|
parseRecapWithCaveats(siwe) {
|
|
23925
|
-
|
|
23941
|
+
const verified = this.wasmBindings.parseVerifiedRecapFromSiwe?.(siwe);
|
|
23942
|
+
return verified == null ? this.wasmBindings.parseRecapFromSiwe(siwe) : verifierRecapEntries(verified);
|
|
23926
23943
|
}
|
|
23927
23944
|
isEncryptionNetworkOperation(service, path) {
|
|
23928
23945
|
return service === "encryption" && path.startsWith("urn:tinycloud:encryption:");
|