Description
Would you consider support for client side?
Right now, if I try to use the lib in a react app, I get this errors:
Module not found: Error: Can't resolve 'crypto' in '/path/to/node_modules/.pnpm/http-message-signatures@1.0.1/node_modules/http-message-signatures/lib/algorithm'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/.pnpm/http-message-signatures@1.0.1/node_modules/http-message-signatures/lib/algorithm/index.js 8:20-40
Module not found: Error: Can't resolve 'constants' in '/path/to/.pnpm/http-message-signatures@1.0.1/node_modules/http-message-signatures/lib/algorithm'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "constants": require.resolve("constants-browserify") }'
- install 'constants-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "constants": false }
Unfortunately react-script is a little bit of its own beast... it uses webpack 5 but has a very complex internal config, that makes it practically impossible to override it. So, the solution "add resolve.fallback" is not straightforward in a real/new react application (and most workaround you can find on google just work for a limited amount of time, then people stop maintaining them).
In summary, the solution would be to make it possible to just link the relevant parts of the library without direct dependency on node's crypto and constants.
For additional context, I'm signing requests on the client side (react app) using two types of signers:
- ed25519 using https://github.com/paulmillr/noble-curves
- webauthn, ed25519 or es256