diff --git a/changelogs/unreleased/1338-dark64 b/changelogs/unreleased/1338-dark64 new file mode 100644 index 000000000..30fab9b3b --- /dev/null +++ b/changelogs/unreleased/1338-dark64 @@ -0,0 +1 @@ +Set webcrypto only if crypto instance is not available (nodejs) \ No newline at end of file diff --git a/zokrates_js/index-node.js b/zokrates_js/index-node.js index 566a24632..9045fe1fa 100644 --- a/zokrates_js/index-node.js +++ b/zokrates_js/index-node.js @@ -1,5 +1,7 @@ // https://docs.rs/getrandom/0.2.8/getrandom/index.html#nodejs-es-module-support import { webcrypto } from "node:crypto"; -globalThis.crypto = webcrypto; +if (typeof globalThis.crypto === "undefined") { + globalThis.crypto = webcrypto; +} export * from "./index.js"; diff --git a/zokrates_js/package-lock.json b/zokrates_js/package-lock.json index 4c3f24745..2d687d21f 100644 --- a/zokrates_js/package-lock.json +++ b/zokrates_js/package-lock.json @@ -1,12 +1,12 @@ { "name": "zokrates-js", - "version": "1.1.5", + "version": "1.1.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zokrates-js", - "version": "1.1.5", + "version": "1.1.8", "license": "GPLv3", "dependencies": { "pako": "^2.1.0"