Open baptisteArno opened 1 year ago
Probably an old browser that doesn't support BigInt literals. You can probably compile them away in your build step. What compiler are you using?
Actually, it looks like it may support BigInt literals (otherwise, it should have stopped on line 21), but maybe there's a bug where it fails to look ahead to see that 0n
is a BigInt literal, and not a hex literal (which is denoted with a leading 0x
)? Can you try replacing that line with BigInt(0)
and see if that solves the error?
I decided to remove it from the bundle, indeed! So I can't really do more testing!
Thank you very much for the help. 🙏
I think we still probably need to get this fixed. Thanks for reporting!
I received the same error. Since the buf is a string within 0-9 and a-f, I converted it into an array splitting each 2 characters. I really don't know if it is secure. So I am sharing my code:
function bufToBigInt(buf) {
//Convert buf to Uint8Array
const length = buf.length / 2;
const uint8Array = new Uint8Array(length);
for (let i = 0; i < length; i++) {
uint8Array[i] = parseInt(buf.substr(i * 2, 2), 16);
}
let bits = 8n;
let value = 0n;
//for (const i of buf.values()) {
for (const i of uint8Array) {
const bi = BigInt(i);
value = (value << bits) + bi;
}
return value;
}
My users have this error when using UC browser:
For now, I don't have much more info because I don't have the right device to debug this. But I'll continue to investigate.