@tinycloud/node-sdk 3.0.0-beta.14 → 3.0.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 +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.cjs
CHANGED
|
@@ -19314,6 +19314,22 @@ function cloneRecapCaveats(caveats) {
|
|
|
19314
19314
|
throw new Error("Verified persisted session ReCap contains invalid caveats.");
|
|
19315
19315
|
}
|
|
19316
19316
|
}
|
|
19317
|
+
function jsonFromVerifier(value) {
|
|
19318
|
+
if (value === void 0) return null;
|
|
19319
|
+
if (Array.isArray(value)) return value.map(jsonFromVerifier);
|
|
19320
|
+
if (value instanceof Map) {
|
|
19321
|
+
const entries = [...value.entries()];
|
|
19322
|
+
if (!entries.every(([key2]) => typeof key2 === "string")) return value;
|
|
19323
|
+
return Object.fromEntries(entries.map(([key2, nested]) => [key2, jsonFromVerifier(nested)]));
|
|
19324
|
+
}
|
|
19325
|
+
if (value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
|
|
19326
|
+
return Object.fromEntries(Object.entries(value).map(([key2, nested]) => [key2, jsonFromVerifier(nested)]));
|
|
19327
|
+
}
|
|
19328
|
+
return value;
|
|
19329
|
+
}
|
|
19330
|
+
function verifierRecapEntries(entries) {
|
|
19331
|
+
return entries.map((entry) => Array.isArray(entry.caveats) ? { ...entry, caveats: entry.caveats.map((caveat) => jsonFromVerifier(caveat)) } : entry);
|
|
19332
|
+
}
|
|
19317
19333
|
var ServiceGraphLifetime = class {
|
|
19318
19334
|
constructor(invokeFn, invokeAnyFn, fetchFn) {
|
|
19319
19335
|
this.invokeFn = invokeFn;
|
|
@@ -20929,7 +20945,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20929
20945
|
throw new InvalidRestoredSessionError(error instanceof Error ? error.message : String(error));
|
|
20930
20946
|
}
|
|
20931
20947
|
})();
|
|
20932
|
-
const exactRecap = verified.verifiedRecap;
|
|
20948
|
+
const exactRecap = Array.isArray(verified.verifiedRecap) ? verifierRecapEntries(verified.verifiedRecap) : verified.verifiedRecap;
|
|
20933
20949
|
if (!Array.isArray(exactRecap) || !exactRecap.every(
|
|
20934
20950
|
(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(
|
|
20935
20951
|
(caveat) => caveat !== null && typeof caveat === "object" && !Array.isArray(caveat)
|
|
@@ -23937,7 +23953,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
23937
23953
|
}
|
|
23938
23954
|
/** Prefer the v2 caveat-preserving parser while retaining old custom WASM. */
|
|
23939
23955
|
parseRecapWithCaveats(siwe) {
|
|
23940
|
-
|
|
23956
|
+
const verified = this.wasmBindings.parseVerifiedRecapFromSiwe?.(siwe);
|
|
23957
|
+
return verified == null ? this.wasmBindings.parseRecapFromSiwe(siwe) : verifierRecapEntries(verified);
|
|
23941
23958
|
}
|
|
23942
23959
|
isEncryptionNetworkOperation(service, path) {
|
|
23943
23960
|
return service === "encryption" && path.startsWith("urn:tinycloud:encryption:");
|