bellstrand/totp-generator

Occasionally produces a five digit TOTP

mixophrygian opened this issue · 9 comments

when the otp substring results in a string that has zero as the first digit, parseInt will strip it off resulting in a five digit return value.

https://github.com/bellstrand/totp-generator/blob/master/index.js#L17

Cool, never noticed (we implemented a failover that retried our login sequence if it failed to fix a timing issue when generating a token right when the time slot swapped before we made the server check current and last token at authentication).

Anyhow, I'll make a fix and upload it asap.

Just a quick question, (the only way to do this is to return a string instead, (don't know why I ever parsed it to an integer).

This won't create a problem for you I hope?

No in fact that's our desired type. Thanks for the quick response!

Fixed with: fdc1781
Released as: 0.0.5

Thanks again

No problem, just give me a shout if you need anything else.

It's still an issue in caused by the type definition in TypeScript. Could you check it?

@benjaminbosko I can't do anything about the @DefinitelyTyped project, you have to send a PR to them to do anything about this.

Ok, thank you for the fast response!