Skip to Content Skip to Search

class ActiveRecord::Encryption::Config

Container of configuration options

Attributes

[RW] add_to_filter_parameters
[RW] deterministic_key
[RW] encrypt_fixtures
[RW] excluded_from_filter_parameters
[RW] extend_queries
[RW] forced_encoding_for_deterministic_encryption
[RW] hash_digest_class
[RW] key_derivation_salt
[RW] previous_schemes
[RW] primary_key
[RW] store_key_references
[RW] support_unencrypted_data
[RW] validate_column_size

Public class methods

Source code GitHub
# File activerecord/lib/active_record/encryption/config.rb, line 13
def initialize
  set_defaults
end

Public instance methods

Configure previous encryption schemes.

config.active_record.encryption.previous = [ { key_provider: MyOldKeyProvider.new } ]
Source code GitHub
# File activerecord/lib/active_record/encryption/config.rb, line 20
def previous=(previous_schemes_properties)
  previous_schemes_properties.each do |properties|
    add_previous_scheme(**properties)
  end
end
Source code GitHub
# File activerecord/lib/active_record/encryption/config.rb, line 26
def support_sha1_for_non_deterministic_encryption=(value)
  if value && has_primary_key?
    sha1_key_generator = ActiveRecord::Encryption::KeyGenerator.new(hash_digest_class: OpenSSL::Digest::SHA1)
    sha1_key_provider = ActiveRecord::Encryption::DerivedSecretKeyProvider.new(primary_key, key_generator: sha1_key_generator)
    add_previous_scheme key_provider: sha1_key_provider
  end
end

Definition files