@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/crypto/index.js
CHANGED
|
@@ -1691,6 +1691,8 @@ function proofToFields(proof) {
|
|
|
1691
1691
|
|
|
1692
1692
|
// src/circuits/assert-minimum-circuits.ts
|
|
1693
1693
|
var SDK_CIRCUIT_COMMITTEE = "minimum";
|
|
1694
|
+
var isNode = typeof window === "undefined" && typeof import.meta.url !== "undefined";
|
|
1695
|
+
var checked = false;
|
|
1694
1696
|
function findActivePath() {
|
|
1695
1697
|
if (!import.meta.url) return null;
|
|
1696
1698
|
let dir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -1707,39 +1709,38 @@ function findActivePath() {
|
|
|
1707
1709
|
}
|
|
1708
1710
|
throw new SDKError("Could not locate SDK package root", "SDK_CIRCUIT_STAMP_MISSING");
|
|
1709
1711
|
}
|
|
1710
|
-
var ACTIVE_PRESET_PATH = findActivePath();
|
|
1711
|
-
var checked = false;
|
|
1712
1712
|
function assertSdkMinimumCircuits() {
|
|
1713
|
-
if (checked)
|
|
1714
|
-
if (ACTIVE_PRESET_PATH === null) {
|
|
1713
|
+
if (checked || !isNode) {
|
|
1715
1714
|
checked = true;
|
|
1716
1715
|
return;
|
|
1717
1716
|
}
|
|
1717
|
+
checked = true;
|
|
1718
|
+
const activePresetPath = findActivePath();
|
|
1719
|
+
if (activePresetPath === null) return;
|
|
1718
1720
|
let raw;
|
|
1719
1721
|
try {
|
|
1720
|
-
raw = readFileSync(
|
|
1722
|
+
raw = readFileSync(activePresetPath, "utf-8");
|
|
1721
1723
|
} catch {
|
|
1722
1724
|
throw new SDKError(
|
|
1723
|
-
`Missing ${
|
|
1725
|
+
`Missing ${activePresetPath}. Run \`pnpm -C packages/interfold-sdk compile:circuits\` first.`,
|
|
1724
1726
|
"SDK_CIRCUIT_STAMP_MISSING"
|
|
1725
1727
|
);
|
|
1726
1728
|
}
|
|
1727
|
-
let
|
|
1729
|
+
let active;
|
|
1728
1730
|
try {
|
|
1729
|
-
|
|
1731
|
+
active = JSON.parse(raw);
|
|
1730
1732
|
} catch {
|
|
1731
1733
|
throw new SDKError(
|
|
1732
|
-
`
|
|
1734
|
+
`Could not parse ${activePresetPath} \u2014 run \`pnpm -C packages/interfold-sdk compile:circuits\`.`,
|
|
1733
1735
|
"SDK_CIRCUIT_STAMP_INVALID"
|
|
1734
1736
|
);
|
|
1735
1737
|
}
|
|
1736
|
-
if (committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
1738
|
+
if (!active.committee || active.committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
1737
1739
|
throw new SDKError(
|
|
1738
|
-
`
|
|
1740
|
+
`Active circuit committee is "${active.committee ?? "unknown"}" but the SDK requires "${SDK_CIRCUIT_COMMITTEE}". Run \`pnpm build:circuits --committee ${SDK_CIRCUIT_COMMITTEE}\`.`,
|
|
1739
1741
|
"SDK_CIRCUIT_COMMITTEE_MISMATCH"
|
|
1740
1742
|
);
|
|
1741
1743
|
}
|
|
1742
|
-
checked = true;
|
|
1743
1744
|
}
|
|
1744
1745
|
|
|
1745
1746
|
// src/crypto/user-data-encryption.ts
|