Class: ROTP::HOTP
Instance Attribute Summary
Attributes inherited from OTP
Instance Method Summary collapse
-
#at(count) ⇒ Object
Generates the OTP for the given count.
-
#provisioning_uri(name, initial_count = 0) ⇒ String
Returns the provisioning URI for the OTP This can then be encoded in a QR Code and used to provision the Google Authenticator app.
-
#verify(otp, counter) ⇒ Object
Verifies the OTP passed in against the current time OTP.
Methods inherited from OTP
Constructor Details
This class inherits a constructor from ROTP::OTP
Instance Method Details
#at(count) ⇒ Object
Generates the OTP for the given count
6 7 8 |
# File 'lib/rotp/hotp.rb', line 6 def at(count) generate_otp(count) end |
#provisioning_uri(name, initial_count = 0) ⇒ String
Returns the provisioning URI for the OTP This can then be encoded in a QR Code and used to provision the Google Authenticator app
23 24 25 |
# File 'lib/rotp/hotp.rb', line 23 def provisioning_uri(name, initial_count=0) "otpauth://hotp/#{URI.encode(name)}?secret=#{secret}&counter=#{initial_count}" end |
#verify(otp, counter) ⇒ Object
Verifies the OTP passed in against the current time OTP
13 14 15 |
# File 'lib/rotp/hotp.rb', line 13 def verify(otp, counter) super(otp, self.at(counter)) end |