paulmillr / noble-curves

Audited & minimal JS implementation of elliptic curve cryptography.
https://paulmillr.com/noble
MIT License
664 stars 62 forks source link

ReferenceError: Can't find variable: BigInt in React Native 0.67.4 #95

Closed iamnijat closed 11 months ago

iamnijat commented 11 months ago

Description: While using the latest version of noble-curves with React Native version 0.67.4, I encountered a ReferenceError: Can't find variable: BigInt in React Native. This issue prevents my application from running properly and seems to be a compatibility issue between the two versions.

Steps to Reproduce:

  1. Set up a new React Native project with version 0.67.4.
  2. Install the latest version of noble-curves.

Expected behavior: The library should integrate seamlessly with React Native without causing any syntax errors.

Actual behavior: ReferenceError: Can't find variable: BigInt in React Native

Additional context:

paulmillr commented 11 months ago

I'm not sure what your issue is. A lot of people are using react native with noble libraries. I remember it hasn't been supported in some old React Native version before, then they've added support for bigints. But if you've had noble-secp256k1 working properly before, the noble-curves should work as-is.

We don't even use bigint literals (2n instead of BigInt(2)), but I believe modern RN supports literals.

paulmillr commented 11 months ago

I see the bigint support was implemented in rn 0.70 https://github.com/facebook/react-native/commit/11bae63bb1f833802ec6ce01342ebdd1d61e9252. So if you've been using noble-secp256k1, i'm not sure how it ever worked.

iamnijat commented 11 months ago

Right, I was using noble libraries within the latest react native version successfully

But I had to downgrade version for specific project, then issue started to appear with the BigInt

Which seems react native 0.67.4 doesn't support BigInt

paulmillr commented 11 months ago

So this is not an issue of noble. We never supported environments which don't have bigints, since v0.1 in 2019.