@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.js
CHANGED
|
@@ -2323,6 +2323,8 @@ import { existsSync, readFileSync } from "fs";
|
|
|
2323
2323
|
import { dirname, resolve } from "path";
|
|
2324
2324
|
import { fileURLToPath } from "url";
|
|
2325
2325
|
var SDK_CIRCUIT_COMMITTEE = "minimum";
|
|
2326
|
+
var isNode = typeof window === "undefined" && typeof import.meta.url !== "undefined";
|
|
2327
|
+
var checked = false;
|
|
2326
2328
|
function findActivePath() {
|
|
2327
2329
|
if (!import.meta.url) return null;
|
|
2328
2330
|
let dir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -2339,39 +2341,38 @@ function findActivePath() {
|
|
|
2339
2341
|
}
|
|
2340
2342
|
throw new SDKError("Could not locate SDK package root", "SDK_CIRCUIT_STAMP_MISSING");
|
|
2341
2343
|
}
|
|
2342
|
-
var ACTIVE_PRESET_PATH = findActivePath();
|
|
2343
|
-
var checked = false;
|
|
2344
2344
|
function assertSdkMinimumCircuits() {
|
|
2345
|
-
if (checked)
|
|
2346
|
-
if (ACTIVE_PRESET_PATH === null) {
|
|
2345
|
+
if (checked || !isNode) {
|
|
2347
2346
|
checked = true;
|
|
2348
2347
|
return;
|
|
2349
2348
|
}
|
|
2349
|
+
checked = true;
|
|
2350
|
+
const activePresetPath = findActivePath();
|
|
2351
|
+
if (activePresetPath === null) return;
|
|
2350
2352
|
let raw;
|
|
2351
2353
|
try {
|
|
2352
|
-
raw = readFileSync(
|
|
2354
|
+
raw = readFileSync(activePresetPath, "utf-8");
|
|
2353
2355
|
} catch {
|
|
2354
2356
|
throw new SDKError(
|
|
2355
|
-
`Missing ${
|
|
2357
|
+
`Missing ${activePresetPath}. Run \`pnpm -C packages/interfold-sdk compile:circuits\` first.`,
|
|
2356
2358
|
"SDK_CIRCUIT_STAMP_MISSING"
|
|
2357
2359
|
);
|
|
2358
2360
|
}
|
|
2359
|
-
let
|
|
2361
|
+
let active;
|
|
2360
2362
|
try {
|
|
2361
|
-
|
|
2363
|
+
active = JSON.parse(raw);
|
|
2362
2364
|
} catch {
|
|
2363
2365
|
throw new SDKError(
|
|
2364
|
-
`
|
|
2366
|
+
`Could not parse ${activePresetPath} \u2014 run \`pnpm -C packages/interfold-sdk compile:circuits\`.`,
|
|
2365
2367
|
"SDK_CIRCUIT_STAMP_INVALID"
|
|
2366
2368
|
);
|
|
2367
2369
|
}
|
|
2368
|
-
if (committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
2370
|
+
if (!active.committee || active.committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
2369
2371
|
throw new SDKError(
|
|
2370
|
-
`
|
|
2372
|
+
`Active circuit committee is "${active.committee ?? "unknown"}" but the SDK requires "${SDK_CIRCUIT_COMMITTEE}". Run \`pnpm build:circuits --committee ${SDK_CIRCUIT_COMMITTEE}\`.`,
|
|
2371
2373
|
"SDK_CIRCUIT_COMMITTEE_MISMATCH"
|
|
2372
2374
|
);
|
|
2373
2375
|
}
|
|
2374
|
-
checked = true;
|
|
2375
2376
|
}
|
|
2376
2377
|
|
|
2377
2378
|
// src/crypto/user-data-encryption.ts
|