Class ROTP::TOTP
In: lib/rotp/totp.rb
Parent: OTP

Methods

at   new   now   provisioning_uri   verify  

Attributes

interval  [R] 
issuer  [R] 

Public Class methods

@option options [Integer] interval (30) the time interval in seconds for OTP

    This defaults to 30 which is standard.

Public Instance methods

Accepts either a Unix timestamp integer or a Time object. Time objects will be adjusted to UTC automatically @param time [Time/Integer] the time to generate an OTP for, integer unix timestamp or Time object

Generate the current time OTP @return [Integer] the OTP as an integer

Returns the provisioning URI for the OTP This can then be encoded in a QR Code and used to provision the Google Authenticator app @param [String] name of the account @return [String] provisioning URI

Verifies the OTP passed in against the current time OTP and adjacent intervals up to drift. Excludes OTPs from `after` and earlier. Returns time value of matching OTP code for use in subsequent call. @param otp [String] the one time password to verify @param drift_behind [Integer] how many seconds to look back @param drift_ahead [Integer] how many seconds to look ahead @param after [Integer] prevent token reuse, last login timestamp @param at [Time] time at which to generate and verify a particular

  otp. default Time.now

@return [Integer, nil] the last successful timestamp

  interval

[Validate]