Closed pt-rick closed 2 years ago
Try setting IsGoogle to true. What Google does is not to RFC spec but many libraries default to it. That might fix it.
Edit: nvm, i tested it locally, still dont match. Ill do some digging and find out. I vaguely remember hitting and fixing a similar issue in the past, but need to figure out if its a regression or something new.
Found the problem, thank you for spotting it! The fix should be available in 3.1.0, you should be able to use the original function you had an it should match notp
and otplib
. Please let me know if you still have issues.
Indeed it is now producing the correct TOTP. Thanks for chasing it down and so promptly!
Using OTP 3.0.1
The TOTP is generated and immediately posted to the NodeJS server which takes the same secret and issues a call to a TOTP library (I tried these two libraries). Their TOTP outputs differ from the one generated by dart-otp. I did a time check on both server and app and the timestamps are within the same 30 second time period. Also tried the different algorithms (SHA256, SHA512) and DateTime.now().millisecond
NodeJS
Note: the secret is just an example. It's a randomly generated 20 byte string in hex, text encoded (RFC4648) and then base32 encoded