Skip to content

Conversation

@adityagupta0251
Copy link

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 crypto to src/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

… (resolve 'crypto' -> src/utils/browserCrypto.ts)
@github-actions github-actions bot added the area: scripts Improvements or additions to custom scripts label Oct 18, 2025
@sidvishnoi
Copy link
Member

sidvishnoi commented Oct 19, 2025

@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)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: scripts Improvements or additions to custom scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Look into getting rid of crypto-browserify

2 participants