Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to have 4 digit token, not 6 #4

Closed
almeynman opened this issue May 22, 2016 · 4 comments
Closed

is it possible to have 4 digit token, not 6 #4

almeynman opened this issue May 22, 2016 · 4 comments

Comments

@almeynman
Copy link

So basically I want to generate 4 digit code instead of 6 and also want to control expiration

@yuce
Copy link
Owner

yuce commented May 23, 2016

That is not possible with this library which implements HOTP algorithm. 6 digits is the minimum. See: https://en.wikipedia.org/wiki/HMAC-based_One-time_Password_Algorithm

@almeynman
Copy link
Author

Thanks for the link. I guess will have to stick with 6.
I have one more question: is it possible to control expiration time? i.e. 30 minutes, 1 hour. Currently it seems like the code expires in a minute or even less

@yuce
Copy link
Owner

yuce commented May 23, 2016

Sorry, I was wrong on the token length. You can specify the token length by passing e.g., {token_length, Length} in a proplist, like: pot:totp(Secret, [{token_length, 4}]).. And token expiration with {interval_length, Seconds}, .e.g: pot:totp(Secret, [{token_length, 4}, {interval_length, 3600}]).. But specifying these settings may create tokens incompatible with Google Authenticator, in case you care.

@almeynman
Copy link
Author

Oh thanks! Thats what I was looking for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants