Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Replacing the module crypto

See original GitHub issue


I’m opening this issue to know if you are open to replacing the use of crypto for more browser-friendly libraries like create-hmac and randombytes.

I’ve had a hard time using this library with Rollup, which led me to bundling my own version here:

I’d love not to have to do that, and the needed change is really small. I can prepare a PR for this, making sure that the builtin implementations are used on node.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

alcuadradocommented, May 31, 2020

I don’t see how tiny-secp256k1 compilation step is related to browsers, since we fallback to pure JS when packaging for browsers. If the compilation fails you will use pure JS in node environment too.

I’m leading an effort to remove native dependencies (except N-API based ones) from the Ethereum js ecosystem. Why?

  1. They are degrade the development experience by being slow to install.
  2. They tend to break with new Node.js major versions
  3. Many people, especially Windows users, don’t have a proper setup to use them. This is incredibly common in educational contexts (e.g. a workshop at a conference). In those cases, many people just desist.

As part of this process, I’m also making sure that the dependencies being used work well with web bundlers and don’t produce unnecessarily large bundles.

The problems with the crypto module are:

  1. It is normally be replaced by crypto-browserify, which is HUGE.
  2. It doesn’t work with Rollup.

Why hdkey and not bip32? hdkey is more popular in the Ethereum ecosystem, so migrating to a portable version of it is easier than migrating to bip32. This is especially important because this effort requires the buy-in of multiple open source projects.

alcuadradocommented, Feb 22, 2022

Thanks for the heads up, @junderw!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can the crypto module replace bcryptjs and jsonwebtoken ...
no, crypto module doesn't implement JWT, what code you don't use by not using a package you would need to write to replace...
Read more >
ModuleNotFoundError: No module named 'Crypto' in Python
To solve the error, install the module by running the pip install pycryptodome command.
Read more >
ModuleNotFoundError No module named Crypto - Edureka
I am trying to run this line in python. from Crypto.Cipher import AES. But I am getting this error ModuleNotFoundError: No module named...
Read more >
Install Guide - Crypto
Mac OSX GPG Install ... with the Mac GPG Tools Suite installer, or by compiling and installing from the source. ... The installed...
Read more >
Node.js crypto module: A tutorial - LogRocket Blog
Learn how to use the Node.js crypto module to secure user data and review the basics of cryptography in Node.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found