chore(build): replace crypto-browserify with native WebCrypto wrapper…
This PR replaces the crypto-browserify bundling shim with a tiny, local wrapper that uses the browser's native Web Crypto API.
Why:
- removes large / outdated dependency (dependabot alerts)
- reduces bundle size
- uses native, audited WebCrypto APIs
What I changed:
- build plugin now resolves
cryptotosrc/utils/browserCrypto.ts - added
src/utils/browserCrypto.ts(minimal wrapper)
Notes:
- Tests and build should be run on CI to verify there are no unexpected runtime changes.
- If code paths rely on Node-only crypto features, please point them out and we can add wrapper implementations.
Closes #1206
@adityagupta0251 Thanks for beginning this work. The harder part of this initiative is in fact replacing the node:crypto usage in dependencies (in particular, open-payments and its dependencies) with a custom crypto layer - that's why the esbuild process was resolving crpyto to crypto-browserify.
We essentially want to create crypto-browserify (but thinner layer), by using existing SubtleCrypto APIs.
To continue forward with this task, I'd encourage you to set up the extension locally. Skimming the developers guide would be helpful there. The build/install instructions are available as well.
To avoid testing manually, you likely want to go through the E2E testing guide. For this specific case, successfully running connect.spec.ts locally would be enough - then we can check rest in CI. (Don't forget to pnpm build chrome each time before running E2E tests (pnpm test:e2e:chromium connect.spec)).
@adityagupta0251 Do you plan to continue working on this?
Yes 🙌 I'm happy for further 🤝
Here's also some of enhancement I need to work on