mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Try to get it to work :/
This commit is contained in:
parent
95d436100d
commit
ae9bc8a75d
1 changed files with 14 additions and 3 deletions
17
build.js
17
build.js
|
|
@ -35,14 +35,25 @@ async function bundleSafeChain() {
|
||||||
external: ["certifi"],
|
external: ["certifi"],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Post-process: Replace all usePureJavaScript: false with true
|
// Post-process: Force node-forge to use pure JavaScript
|
||||||
// This ensures node-forge uses pure JavaScript crypto instead of native bindings
|
// This prevents segmentation faults in pkg binaries on Linux
|
||||||
// which prevents segmentation faults in pkg binaries on Linux
|
|
||||||
let bundledContent = await readFile("./build/bin/safe-chain.cjs", "utf-8");
|
let bundledContent = await readFile("./build/bin/safe-chain.cjs", "utf-8");
|
||||||
|
|
||||||
|
// 1. Set the option to true
|
||||||
bundledContent = bundledContent.replace(
|
bundledContent = bundledContent.replace(
|
||||||
/usePureJavaScript:\s*false/g,
|
/usePureJavaScript:\s*false/g,
|
||||||
"usePureJavaScript: true"
|
"usePureJavaScript: true"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 2. Replace all checks that would enable native crypto
|
||||||
|
// Change: if (!forge2.options.usePureJavaScript && ...)
|
||||||
|
// To: if (false && ...)
|
||||||
|
// This makes the native crypto branches unreachable
|
||||||
|
bundledContent = bundledContent.replace(
|
||||||
|
/!forge2\.options\.usePureJavaScript/g,
|
||||||
|
"false"
|
||||||
|
);
|
||||||
|
|
||||||
await writeFile("./build/bin/safe-chain.cjs", bundledContent);
|
await writeFile("./build/bin/safe-chain.cjs", bundledContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue