Module: Devise::Models::TwoFactorAuthenticatable::ClassMethods

Defined in:
lib/devise_two_factor/models/two_factor_authenticatable.rb

Instance Method Summary collapse

Instance Method Details

#generate_otp_secret(otp_secret_length = self.otp_secret_length) ⇒ Object



96
97
98
# File 'lib/devise_two_factor/models/two_factor_authenticatable.rb', line 96

def generate_otp_secret(otp_secret_length = self.otp_secret_length)
  ROTP::Base32.random_base32(otp_secret_length)
end

#splattable_encrypted_attr_optionsHash

Return value will be splatted with ** so return a version of the encrypted attribute options which is always a Hash.

Returns:

  • (Hash)


103
104
105
106
107
# File 'lib/devise_two_factor/models/two_factor_authenticatable.rb', line 103

def splattable_encrypted_attr_options
  return {} if otp_encrypted_attribute_options.nil?

  otp_encrypted_attribute_options
end