@interfold/sdk 0.2.1 → 0.2.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/crypto/index.cjs +13 -12
- package/dist/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.js +13 -12
- package/dist/crypto/index.js.map +1 -1
- package/dist/index.cjs +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -2379,6 +2379,8 @@ var import_node_path = require("path");
|
|
|
2379
2379
|
var import_node_url = require("url");
|
|
2380
2380
|
var import_meta = {};
|
|
2381
2381
|
var SDK_CIRCUIT_COMMITTEE = "minimum";
|
|
2382
|
+
var isNode = typeof window === "undefined" && typeof import_meta.url !== "undefined";
|
|
2383
|
+
var checked = false;
|
|
2382
2384
|
function findActivePath() {
|
|
2383
2385
|
if (!import_meta.url) return null;
|
|
2384
2386
|
let dir = (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
@@ -2395,39 +2397,38 @@ function findActivePath() {
|
|
|
2395
2397
|
}
|
|
2396
2398
|
throw new SDKError("Could not locate SDK package root", "SDK_CIRCUIT_STAMP_MISSING");
|
|
2397
2399
|
}
|
|
2398
|
-
var ACTIVE_PRESET_PATH = findActivePath();
|
|
2399
|
-
var checked = false;
|
|
2400
2400
|
function assertSdkMinimumCircuits() {
|
|
2401
|
-
if (checked)
|
|
2402
|
-
if (ACTIVE_PRESET_PATH === null) {
|
|
2401
|
+
if (checked || !isNode) {
|
|
2403
2402
|
checked = true;
|
|
2404
2403
|
return;
|
|
2405
2404
|
}
|
|
2405
|
+
checked = true;
|
|
2406
|
+
const activePresetPath = findActivePath();
|
|
2407
|
+
if (activePresetPath === null) return;
|
|
2406
2408
|
let raw;
|
|
2407
2409
|
try {
|
|
2408
|
-
raw = (0, import_node_fs.readFileSync)(
|
|
2410
|
+
raw = (0, import_node_fs.readFileSync)(activePresetPath, "utf-8");
|
|
2409
2411
|
} catch {
|
|
2410
2412
|
throw new SDKError(
|
|
2411
|
-
`Missing ${
|
|
2413
|
+
`Missing ${activePresetPath}. Run \`pnpm -C packages/interfold-sdk compile:circuits\` first.`,
|
|
2412
2414
|
"SDK_CIRCUIT_STAMP_MISSING"
|
|
2413
2415
|
);
|
|
2414
2416
|
}
|
|
2415
|
-
let
|
|
2417
|
+
let active;
|
|
2416
2418
|
try {
|
|
2417
|
-
|
|
2419
|
+
active = JSON.parse(raw);
|
|
2418
2420
|
} catch {
|
|
2419
2421
|
throw new SDKError(
|
|
2420
|
-
`
|
|
2422
|
+
`Could not parse ${activePresetPath} \u2014 run \`pnpm -C packages/interfold-sdk compile:circuits\`.`,
|
|
2421
2423
|
"SDK_CIRCUIT_STAMP_INVALID"
|
|
2422
2424
|
);
|
|
2423
2425
|
}
|
|
2424
|
-
if (committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
2426
|
+
if (!active.committee || active.committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
2425
2427
|
throw new SDKError(
|
|
2426
|
-
`
|
|
2428
|
+
`Active circuit committee is "${active.committee ?? "unknown"}" but the SDK requires "${SDK_CIRCUIT_COMMITTEE}". Run \`pnpm build:circuits --committee ${SDK_CIRCUIT_COMMITTEE}\`.`,
|
|
2427
2429
|
"SDK_CIRCUIT_COMMITTEE_MISMATCH"
|
|
2428
2430
|
);
|
|
2429
2431
|
}
|
|
2430
|
-
checked = true;
|
|
2431
2432
|
}
|
|
2432
2433
|
|
|
2433
2434
|
// src/crypto/user-data-encryption.ts
|