Sha256: 0bacdad026149e185735597ba848d3082b6949ebc96b5749785f6e828444b61f

Contents?: true

Size: 344 Bytes

Versions: 4

Compression:

Stored size: 344 Bytes

Contents

# frozen_string_literal: true

module RailsBase::Mfa::Totp
  module Helper
    def secret
      context.otp_secret || user.reload.otp_secret
    end

    def otp
      @otp ||= ROTP::TOTP.new(secret)
    end

    def current_code
      otp.at(Time.now)
    end

    def lgp
      @lgp ||= "[#{user.full_name}:(#{user.id})] :"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_base-0.82.0 app/services/rails_base/mfa/totp/helper.rb
rails_base-0.81.1 app/services/rails_base/mfa/totp/helper.rb
rails_base-0.81.0 app/services/rails_base/mfa/totp/helper.rb
rails_base-0.80.0 app/services/rails_base/mfa/totp/helper.rb