Specific Length of OTP Token
nazarhussain opened this issue · 2 comments
nazarhussain commented
Hello,
I am in a situation that requirements are specifically asked for 4-digit OTP. Is there any possibility to generate 4-digit or any specific length OTP?
Your guidance will be much appreciated.
mdp commented
You can pass in the digits
option to get this
ROTP::TOTP.new("base32secretkey3232", :digits => 4)
See more at: http://www.rubydoc.info/github/mdp/rotp/master/ROTP/OTP#digits-instance_method
Let me know if that doesn't work for you.
nazarhussain commented
@mdp Yes it works. Thanks.