Sha256: 58c1e8ad259df7fe07e04b5d5af0e8880d040e8f578d5eb31f3dfec01d8f1e5a

Contents?: true

Size: 302 Bytes

Versions: 18

Compression:

Stored size: 302 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)
  end
end

Version data entries

18 entries across 18 versions & 4 rubygems

Version Path
devise-multi-factor-3.2.5 spec/support/totp_helper.rb
devise-multi-factor-3.2.4 spec/support/totp_helper.rb
devise-multi-factor-3.2.3 spec/support/totp_helper.rb
devise-multi-factor-3.2.2 spec/support/totp_helper.rb
devise_xfactor_authentication-2.2.23 spec/support/totp_helper.rb
devise_xfactor_authentication-2.2.22 spec/support/totp_helper.rb
devise_xfactor_authentication-2.2.21 spec/support/totp_helper.rb
devise_xfactor_authentication-2.2.20 spec/support/totp_helper.rb
devise_xfactor_authentication-2.2.19 spec/support/totp_helper.rb
devise_xfactor_authentication-2.2.18 spec/support/totp_helper.rb
devise-multi-factor-3.2.1 spec/support/totp_helper.rb
devise_two_factor_authentication-3.0.0 spec/support/totp_helper.rb
devise-multi-factor-3.2.0 spec/support/totp_helper.rb
devise-multi-factor-3.1.8 spec/support/totp_helper.rb
devise-multi-factor-3.1.7 spec/support/totp_helper.rb
devise-multi-factor-3.1.6 spec/support/totp_helper.rb
devise-multi-factor-3.1.5 spec/support/totp_helper.rb
two_factor_authentication-2.2.0 spec/support/totp_helper.rb