Sha256: bd6e542adca4b79c4c2bd125d6dc35e7a877725f0c0dca7c73638be82a3a1616

Contents?: true

Size: 308 Bytes

Versions: 4

Compression:

Stored size: 308 Bytes

Contents

# Helper class to simulate a user generating TOTP codes from a secret key
class TotpHelper
  def initialize(secret_key, otp_length)
    @secret_key = secret_key
    @otp_length = otp_length
  end

  def totp_code(time = Time.now)
    ROTP::TOTP.new(@secret_key, digits: @otp_length).at(time, true)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
two_factor_authentication-2.1.1 spec/support/totp_helper.rb
two_factor_authentication-2.1.0 spec/support/totp_helper.rb
two_factor_authentication-2.0.1 spec/support/totp_helper.rb
two_factor_authentication-2.0.0 spec/support/totp_helper.rb