@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.cjs
CHANGED
|
@@ -1730,6 +1730,8 @@ function proofToFields(proof) {
|
|
|
1730
1730
|
// src/circuits/assert-minimum-circuits.ts
|
|
1731
1731
|
var import_meta = {};
|
|
1732
1732
|
var SDK_CIRCUIT_COMMITTEE = "minimum";
|
|
1733
|
+
var isNode = typeof window === "undefined" && typeof import_meta.url !== "undefined";
|
|
1734
|
+
var checked = false;
|
|
1733
1735
|
function findActivePath() {
|
|
1734
1736
|
if (!import_meta.url) return null;
|
|
1735
1737
|
let dir = (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
@@ -1746,39 +1748,38 @@ function findActivePath() {
|
|
|
1746
1748
|
}
|
|
1747
1749
|
throw new SDKError("Could not locate SDK package root", "SDK_CIRCUIT_STAMP_MISSING");
|
|
1748
1750
|
}
|
|
1749
|
-
var ACTIVE_PRESET_PATH = findActivePath();
|
|
1750
|
-
var checked = false;
|
|
1751
1751
|
function assertSdkMinimumCircuits() {
|
|
1752
|
-
if (checked)
|
|
1753
|
-
if (ACTIVE_PRESET_PATH === null) {
|
|
1752
|
+
if (checked || !isNode) {
|
|
1754
1753
|
checked = true;
|
|
1755
1754
|
return;
|
|
1756
1755
|
}
|
|
1756
|
+
checked = true;
|
|
1757
|
+
const activePresetPath = findActivePath();
|
|
1758
|
+
if (activePresetPath === null) return;
|
|
1757
1759
|
let raw;
|
|
1758
1760
|
try {
|
|
1759
|
-
raw = (0, import_node_fs.readFileSync)(
|
|
1761
|
+
raw = (0, import_node_fs.readFileSync)(activePresetPath, "utf-8");
|
|
1760
1762
|
} catch {
|
|
1761
1763
|
throw new SDKError(
|
|
1762
|
-
`Missing ${
|
|
1764
|
+
`Missing ${activePresetPath}. Run \`pnpm -C packages/interfold-sdk compile:circuits\` first.`,
|
|
1763
1765
|
"SDK_CIRCUIT_STAMP_MISSING"
|
|
1764
1766
|
);
|
|
1765
1767
|
}
|
|
1766
|
-
let
|
|
1768
|
+
let active;
|
|
1767
1769
|
try {
|
|
1768
|
-
|
|
1770
|
+
active = JSON.parse(raw);
|
|
1769
1771
|
} catch {
|
|
1770
1772
|
throw new SDKError(
|
|
1771
|
-
`
|
|
1773
|
+
`Could not parse ${activePresetPath} \u2014 run \`pnpm -C packages/interfold-sdk compile:circuits\`.`,
|
|
1772
1774
|
"SDK_CIRCUIT_STAMP_INVALID"
|
|
1773
1775
|
);
|
|
1774
1776
|
}
|
|
1775
|
-
if (committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
1777
|
+
if (!active.committee || active.committee !== SDK_CIRCUIT_COMMITTEE) {
|
|
1776
1778
|
throw new SDKError(
|
|
1777
|
-
`
|
|
1779
|
+
`Active circuit committee is "${active.committee ?? "unknown"}" but the SDK requires "${SDK_CIRCUIT_COMMITTEE}". Run \`pnpm build:circuits --committee ${SDK_CIRCUIT_COMMITTEE}\`.`,
|
|
1778
1780
|
"SDK_CIRCUIT_COMMITTEE_MISMATCH"
|
|
1779
1781
|
);
|
|
1780
1782
|
}
|
|
1781
|
-
checked = true;
|
|
1782
1783
|
}
|
|
1783
1784
|
|
|
1784
1785
|
// src/crypto/user-data-encryption.ts
|