class ROTP::HOTP
def at(count)
-
count
(Integer
) -- counter
def at(count) generate_otp(count) end
def provisioning_uri(name = nil, initial_count = 0)
-
(String)
- provisioning uri
Parameters:
-
initial_count
(Integer
) -- starting counter value, defaults to 0 -
name
(String
) -- of the account
def provisioning_uri(name = nil, initial_count = 0) OTP::URI.new(self, account_name: name || @name, counter: initial_count).to_s end
def verify(otp, counter, retries: 0)
-
retries
(Integer
) -- number of counters to incrementally retry -
counter
(Integer
) -- the counter of the OTP -
otp
(String/Integer
) -- the OTP to check against
def verify(otp, counter, retries: 0) counters = (counter..counter + retries).to_a counters.find do |c| super(otp, at(c)) end end