Sha256: 0faca5f9df9574f6a5d0b024648d113d953903c49a980051d23b98c0f7466aba

Contents?: true

Size: 931 Bytes

Versions: 4

Compression:

Stored size: 931 Bytes

Contents

# frozen_string_literal: true
# typed: true

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

    attr_accessor :authentication_factor, :authentication_challenge

    sig { params(authentication_response_json: String).void }
    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

4 entries across 4 versions & 1 rubygems

Version Path
workos-4.1.0 lib/workos/authentication_factor_and_challenge.rb
workos-4.0.0 lib/workos/authentication_factor_and_challenge.rb
workos-3.1.0 lib/workos/authentication_factor_and_challenge.rb
workos-3.0.0 lib/workos/authentication_factor_and_challenge.rb