Sha256: f2addf7ef6bc1fa5ea5e5745841f68f0cb894346163dc8df0f9d18f2fd61c182
Contents?: true
Size: 578 Bytes
Versions: 7
Compression:
Stored size: 578 Bytes
Contents
require "otp/base" module OTP class TOTP < OTP::Base attr_accessor :period, :time DEFAULT_PERIOD = 30 def initialize(*args) super self.period = DEFAULT_PERIOD self.time = nil end def moving_factor return (time || Time.now).to_i / period end def type_specific_uri_params params = {} params["period"] = period if period != DEFAULT_PERIOD return params end def extract_type_specific_uri_params(query) if value = query["period"] self.period = value.to_i end end end end
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
otp-0.0.9 | lib/otp/totp.rb |
otp-0.0.8 | lib/otp/totp.rb |
otp-0.0.7 | lib/otp/totp.rb |
otp-0.0.6 | lib/otp/totp.rb |
otp-0.0.5 | lib/otp/totp.rb |
otp-0.0.4 | lib/otp/totp.rb |
otp-0.0.3 | lib/otp/totp.rb |