indutny / elliptic

Fast Elliptic Curve Cryptography in plain javascript
1.7k stars 381 forks source link

BN included twice by browserify #190

Closed Ayms closed 5 years ago

Ayms commented 5 years ago

Continuation of https://github.com/indutny/bn.js/issues/227

And please see https://github.com/browserify/browserify/issues/1923

Let's see if we get some feedback, apparently it does not look like an elliptic issue but I think it would not be bad to add something like utils.BN=BN or in elliptic.js so BN becomes available from elliptic directly

fanatid commented 5 years ago

Right now you can use such hack for access to bn.js from elliptic:

const elliptic = require('elliptic')
const BN = elliptic.utils.intFromLE('0').constructor
Ayms commented 5 years ago

OK, but my suggestion is to make it directly available from elliptic, not a big deal I think

Did you see the posts from (closed) https://github.com/browserify/browserify/issues/1923 ?

Why does bn.js appear twice after npm install of elliptic?

fanatid commented 5 years ago

Yeah, I had seen. I do not see that bn.js installed twice:

npm install elliptic
+ elliptic@6.5.0
npm ls bn.js
/home/kirill/tmp/node-test
└─┬ elliptic@6.5.0
  └── bn.js@4.11.8

Only one bn.js version. Same for yarn.

Ayms commented 5 years ago

Closing... not sure what I did when I installed elliptic first, maybe I used a too old version of npm,reinstalling correctly does not cause the duplication effect