class ActiveSupport::CachingKeyGenerator
key_size
re-executing the key generation process when it’s called using the same salt and
CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid
def generate_key(salt, key_size=64)
to be compatible with the default settings of ActiveSupport::MessageVerifier.
Returns a derived key suitable for use. The default key_size is chosen
def generate_key(salt, key_size=64) @cache_keys["#{salt}#{key_size}"] ||= @key_generator.generate_key(salt, key_size) end
def initialize(key_generator)
def initialize(key_generator) @key_generator = key_generator @cache_keys = ThreadSafe::Cache.new end