guyht / notp

Node One Time Password library, supports HOTP, TOTP and works with Google Authenticator
https://github.com/guyht/notp
MIT License
685 stars 64 forks source link

HOTP counter not working as expected #56

Open TABmk opened 3 years ago

TABmk commented 3 years ago

https://github.com/guyht/notp/blob/bbdf82a34e5cb1534c411aaa63185bfab29feba0/index.js#L10-L19

intToBytes(9999999999999) will give [0, 0, 0, 0, 78, 114, 159, 255] which is <Buffer 00 00 00 00 4e 72 9f ff>

But 9999999999999 decimal to hexadecimal must return 00 00 09 18 4E 72 9F FF

Uzlopak commented 2 years ago

Well... [...Buffer.from("0" + BigInt(9999999999999).toString(16), "hex")]

ugly hack, bug whatever...