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

Geneartes an OTP secret of the specified length, returning it after Base32 encoding.



98
99
100
# File 'lib/devise_two_factor/models/two_factor_authenticatable.rb', line 98

def generate_otp_secret(otp_secret_length = self.otp_secret_length)
  ROTP::Base32.random(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)


105
106
107
108
109
# File 'lib/devise_two_factor/models/two_factor_authenticatable.rb', line 105

def splattable_encrypted_attr_options
  return {} if otp_encrypted_attribute_options.nil?

  otp_encrypted_attribute_options
end