You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello first I want to thank you for this amazing work you've done unifying both webcrypto and node crypto API
I just encountered an error when I was trying to execute aes encrpytion with js-crpyto-aes on my ExpressJs server
i was getting an error saying that my iv was not an instance of Buffer or ArrayBuffer even when it is a Buffer Instance and then I saw in my StackTrace that the error comes from a webapi.js file
so I investigate some file in node_modules and i found this js-crypto-env library which seem to detect incorrectly the platform iam running
btw iam running on node 22.3.0 npm 10.8.1
so i force the use of require('crypto') in the index.js fil of js-crypto-env and now everything seems to work for me
this is the new function I replaced
var getCrypto = function () {
var webCrypto = getWebCrypto();
var nodeCrypto = getNodeCrypto();
nodeCrypto = require('crypto'); // I added this line
console.log(nodeCrypto)
if (typeof nodeCrypto !== 'undefined'){
console.error('Crypto NODE')//this was to be sure what I was modifying
return { name: 'nodeCrypto', crypto: nodeCrypto };
}
else if (typeof webCrypto !== 'undefined'){
console.error('Crypto WEB') //this was to be sure what I was modifying
return { name: 'webCrypto', crypto: webCrypto };
}
else
return { name: undefined };
};
can you fix this method of platform detection in the next update please
that would be amazing !
iam not an expert enough to correctly distinguish both platform myself :/
The text was updated successfully, but these errors were encountered:
Hello first I want to thank you for this amazing work you've done unifying both webcrypto and node crypto API
I just encountered an error when I was trying to execute aes encrpytion with js-crpyto-aes on my ExpressJs server
i was getting an error saying that my iv was not an instance of Buffer or ArrayBuffer even when it is a Buffer Instance and then I saw in my StackTrace that the error comes from a webapi.js file
so I investigate some file in node_modules and i found this js-crypto-env library which seem to detect incorrectly the platform iam running
btw iam running on node 22.3.0 npm 10.8.1
so i force the use of require('crypto') in the index.js fil of js-crypto-env and now everything seems to work for me
this is the new function I replaced
can you fix this method of platform detection in the next update please
that would be amazing !
iam not an expert enough to correctly distinguish both platform myself :/
The text was updated successfully, but these errors were encountered: