Sha256: 9be08ef85bf04fb40da2740eb10f0ae9cac480696c26e7a637a470bc6549b35a

Contents?: true

Size: 518 Bytes

Versions: 4

Compression:

Stored size: 518 Bytes

Contents

# frozen_string_literal: true

module RailsBase::Mfa::Totp
  class OtpMetadata < RailsBase::ServiceBase
    delegate :user, to: :context

    def call
      context.metadata = user.otp_metadata(safe: true)
    rescue => e
      log(level: :error, msg: "Failed to retreive OTP data: #{e.message}")
      log(level: :error, msg: e.backtrace)
      context.fail!(message: "Failed to retrieve Metadata for Code")
    end

    def validate!
      raise "Expected user to be a User. " unless User === user
    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/otp_metadata.rb
rails_base-0.81.1 app/services/rails_base/mfa/totp/otp_metadata.rb
rails_base-0.81.0 app/services/rails_base/mfa/totp/otp_metadata.rb
rails_base-0.80.0 app/services/rails_base/mfa/totp/otp_metadata.rb