Class: Supabase::Auth::Types::AuthMFAEnrollResponse

Inherits:
Struct
  • Object
show all
Defined in:
lib/supabase/auth/types.rb

Overview

MFA Enroll response - returned when enrolling a new TOTP factor

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#friendly_nameObject

Returns the value of attribute friendly_name

Returns:

  • (Object)

    the current value of friendly_name



270
271
272
# File 'lib/supabase/auth/types.rb', line 270

def friendly_name
  @friendly_name
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



270
271
272
# File 'lib/supabase/auth/types.rb', line 270

def id
  @id
end

#phoneObject

Returns the value of attribute phone

Returns:

  • (Object)

    the current value of phone



270
271
272
# File 'lib/supabase/auth/types.rb', line 270

def phone
  @phone
end

#totpObject

Returns the value of attribute totp

Returns:

  • (Object)

    the current value of totp



270
271
272
# File 'lib/supabase/auth/types.rb', line 270

def totp
  @totp
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



270
271
272
# File 'lib/supabase/auth/types.rb', line 270

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/supabase/auth/types.rb', line 278

def self.from_hash(hash)
  return nil if hash.nil?

  totp = hash["totp"] || hash[:totp]
  totp_struct = totp ? MFATotpInfo.new(qr_code: totp["qr_code"] || totp[:qr_code],
                                        secret: totp["secret"] || totp[:secret],
                                        uri: totp["uri"] || totp[:uri]) : nil
  new(
    id: hash["id"] || hash[:id],
    type: hash["type"] || hash[:type],
    friendly_name: hash["friendly_name"] || hash[:friendly_name],
    totp: totp_struct,
    phone: hash["phone"] || hash[:phone]
  )
end