I am using a bigInt library in gatsby, like this
import BigInteger from 'bigi';
const signature = ecdsa.sign(shaMsg, BigInteger.fromBuffer(privateKey));
There seem to be some polyfill issues on the production build that I haven't been able to fix. When running in localhost there are no issues.
So I figured I would try a different bigInt library to see if this fixes it
import bigInt from "big-integer";
The thing is this library does not have a fromBuffer function, and signature in the code above is type buffer.
How can I convert it, other than using the function from the 'bigi' library?
Thank you (does this question even make sense, because I don't know what I am doing)
Edit: For clarification, console logging BigInteger.fromBuffer(privateKey) in the development build (the one that works) results:
BigInteger {0: 5218218, 1: 6291014, 2: 34656281, 3: 1776116, 4: 53518743, 5: 10808093, 6: 62725491, 7: 63913863, 8: 50275223, 9: 1979384, t: 10, s: 0}
In the production env, where it does not work, the same log for the above
n {0: 5218218, 1: 6291014, 2: 34656281, 3: 1776116, 4: 53518743, 5: 10808093, 6: 62725491, 7: 63913863, 8: 50275223, 9: 1979384, t: 10, s: 0}
I don't understand what happens, maybe the problem is in the ecdsa library as suggested by a commentator below
The error I get in production is
Expected property "1" of type BigInteger, got n
Edit: I solved this, I was helped somewhere else, by using elliptic instead of ecdsa to make signature, as suggested below, it was an ecsda issue. I can't close because of the bounty, nor post an answer, so I don't know what to do