Method: Rails::Application#key_generator

Defined in:
railties/lib/rails/application.rb

#key_generator(secret_key_base = self.secret_key_base) ⇒ Object

Returns a key generator (ActiveSupport::CachingKeyGenerator) for a specified secret_key_base. The return value is memoized, so additional calls with the same secret_key_base will return the same key generator instance.



167
168
169
170
171
172
173
# File 'railties/lib/rails/application.rb', line 167

def key_generator(secret_key_base = self.secret_key_base)
  # number of iterations selected based on consultation with the google security
  # team. Details at https://github.com/rails/rails/pull/6952#issuecomment-7661220
  @key_generators[secret_key_base] ||= ActiveSupport::CachingKeyGenerator.new(
    ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
  )
end