Closed vgomez3 closed 2 years ago
That's probably because the integer has a leading zero. Because it's an integer, it isn't included by dart. It is why I added generateTOTPString
that returns a string as it preserves the 0.
You can also pad it yourself with 0s on the left side if it's under the size you want.
So 047763 would show up as 47763 when an integer. And 040000 would also be 40000. But if it was 147763, it would be 144763.
Also version 1 is very old, please upgrade to 3.0
Hi, i am getting 5 digits instead of 6 in cases such as the following.
millisecondsSinceEpoch: 1634663272444
Base32 code: ZB43UA3ZK4JT6B3HT5VC63VFLP57V2ZZB4XCNGEZI72TGPYEJ6JHVERLYJRCPAFMBAIFW3WAQS5CA6LAUTXJHUQIS6GD6EXITL3ZIAAW7FRFSAOSUAV7NSHP4VPU7XXSJICPOAASWJBQMTNUYWGR4SCQAG6S2I4H6F7SJYY3DGB4GVRD4PX2G3IJYHLS27SZZZDNPBDPQJ46FIL45L46ZNTPUBU2RAQZ5BGN4UC3SM52PQI27262JJ5WFAO5OBBK
TOTP code: 47763
Programming code:
int ms = DateTime.now().millisecondsSinceEpoch;
var res = OTP.generateTOTPCode(otpToken, ms,algorithm: Algorithm.SHA1,interval: 30,isGoogle: true);
print("OTP Response: "+res.toString());
I am using version 1.0 of the library.
Thanks