Sha256: 2d15b76fadbdf1a0bf1a8757f49542b8e08d4850dbb439eef3b1bf473db06291
Contents?: true
Size: 544 Bytes
Versions: 2
Compression:
Stored size: 544 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 uri_params params = super params["period"] = period if period != DEFAULT_PERIOD return params end def extract_uri_params(params) super self.period = (params["period"] || period).to_i end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
otp-0.0.11 | lib/otp/totp.rb |
otp-0.0.10 | lib/otp/totp.rb |