Open cre8 opened 9 months ago
Did you find a fix for that?
I have a suspicion it could be a collusion with another crypto polyfill library but I'm still investigating.
Did you find a fix for that?
I have a suspicion it could be a collusion with another crypto polyfill library but I'm still investigating.
I am not working on the project anymore (no access anymore) so I don't know if this could be the problem...
For maintainers I have tried to turn things around but the problem persist.
So getCiphers
is used here: https://github.com/PeculiarVentures/webcrypto/blob/919c67e3d578d06916e3f57a070d3ad5ebef19d5/src/subtle.ts#L34, and if I manually remove the call I get a subsequent error on getHashes
https://github.com/PeculiarVentures/webcrypto/blob/919c67e3d578d06916e3f57a070d3ad5ebef19d5/src/subtle.ts#L80.
Those functions come from crypto
(node:crypto
) as imported here https://github.com/PeculiarVentures/webcrypto/blob/919c67e3d578d06916e3f57a070d3ad5ebef19d5/src/subtle.ts#L1.
However, it seems that getCiphers
and getHashes
have been deprecated from node 20, as they don't appear in the docs anymore from that version.
I also couldn't find getCiphers
in polyfill libraries for rollup and vite, and only this mention of getHashes
in this licence (https://github.com/FredKSchott/rollup-plugin-polyfill-node/blob/31face71b94b8408a907f04753318dff589adc2f/polyfills/LICENSE-crypto-browserify.txt#L55), which means I cannot inject them in my browser build either.
What do you advise from here?
I don't see any indication that these methods are deprecated. They are still present in the documentation for version v22:
If you're trying to build your application using Rollup for Node.js, you should exclude the crypto
module from the bundle to prevent it from being included.
If you're building the application for the browser, use the native crypto
module instead of @peculiar/webcrypto
, as that module is intended for implementing the WebCrypto API in Node.js.
Thanks for checking the docs, I swear I couldn't find them.
If you're building the application for the browser, use the native crypto module instead of @peculiar/webcrypto, as that module is intended for implementing the WebCrypto API in Node.js.
My main problem here is that webcrypto
supports secp256k1
which the original crypto
does not, in the browser or in nodejs.
Try webcrypto-liner. It supports the K-256
named curve.
I am using your package in one of my subpackages in the browser with Angular. However when I call it, I am getting this error:
I am using esbuild and added the polyfills like
On the backend it's working fine, it seems to be a problem with the browser. Do you know if there needs to be an extra import?