Sha256: a491bda089d358d407af26a3455748b7c47581c64a03a642e759a6766d1729ae

Contents?: true

Size: 837 Bytes

Versions: 25

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true

module WorkOS
  # The AuthenticationFactorAndChallenge class represents
  # an authentication factor and challenge for a given user.
  class AuthenticationFactorAndChallenge
    include HashProvider

    attr_accessor :authentication_factor, :authentication_challenge

    def initialize(authentication_response_json)
      json = JSON.parse(authentication_response_json, symbolize_names: true)
      @authentication_factor = WorkOS::Factor.new(
        json[:authentication_factor].to_json,
      )
      @authentication_challenge = WorkOS::Challenge.new(
        json[:authentication_challenge].to_json,
      )
    end

    def to_json(*)
      {
        authentication_factor: authentication_factor.to_json,
        authentication_challenge: authentication_challenge.to_json,
      }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
workos-5.15.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.14.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.13.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.12.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.11.1 lib/workos/authentication_factor_and_challenge.rb
workos-5.11.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.10.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.9.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.8.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.7.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.6.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.5.1 lib/workos/authentication_factor_and_challenge.rb
workos-5.5.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.4.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.3.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.2.1 lib/workos/authentication_factor_and_challenge.rb
workos-5.2.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.1.0 lib/workos/authentication_factor_and_challenge.rb
workos-5.0.0 lib/workos/authentication_factor_and_challenge.rb
workos-4.8.0 lib/workos/authentication_factor_and_challenge.rb