Class: ActiveRecord::Encryption::Config
- Inherits:
-
Object
- Object
- ActiveRecord::Encryption::Config
- Defined in:
- lib/active_record/encryption/config.rb
Overview
Container of configuration options
Instance Attribute Summary collapse
-
#add_to_filter_parameters ⇒ Object
Returns the value of attribute add_to_filter_parameters.
-
#deterministic_key ⇒ Object
Returns the value of attribute deterministic_key.
-
#encrypt_fixtures ⇒ Object
Returns the value of attribute encrypt_fixtures.
-
#excluded_from_filter_parameters ⇒ Object
Returns the value of attribute excluded_from_filter_parameters.
-
#extend_queries ⇒ Object
Returns the value of attribute extend_queries.
-
#forced_encoding_for_deterministic_encryption ⇒ Object
Returns the value of attribute forced_encoding_for_deterministic_encryption.
-
#hash_digest_class ⇒ Object
Returns the value of attribute hash_digest_class.
-
#key_derivation_salt ⇒ Object
Returns the value of attribute key_derivation_salt.
-
#previous_schemes ⇒ Object
Returns the value of attribute previous_schemes.
-
#primary_key ⇒ Object
Returns the value of attribute primary_key.
-
#store_key_references ⇒ Object
Returns the value of attribute store_key_references.
-
#support_unencrypted_data ⇒ Object
Returns the value of attribute support_unencrypted_data.
-
#validate_column_size ⇒ Object
Returns the value of attribute validate_column_size.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#previous=(previous_schemes_properties) ⇒ Object
Configure previous encryption schemes.
- #support_sha1_for_non_deterministic_encryption=(value) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
13 14 15 |
# File 'lib/active_record/encryption/config.rb', line 13 def initialize set_defaults end |
Instance Attribute Details
#add_to_filter_parameters ⇒ Object
Returns the value of attribute add_to_filter_parameters.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def add_to_filter_parameters @add_to_filter_parameters end |
#deterministic_key ⇒ Object
Returns the value of attribute deterministic_key.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def deterministic_key @deterministic_key end |
#encrypt_fixtures ⇒ Object
Returns the value of attribute encrypt_fixtures.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def encrypt_fixtures @encrypt_fixtures end |
#excluded_from_filter_parameters ⇒ Object
Returns the value of attribute excluded_from_filter_parameters.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def excluded_from_filter_parameters @excluded_from_filter_parameters end |
#extend_queries ⇒ Object
Returns the value of attribute extend_queries.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def extend_queries @extend_queries end |
#forced_encoding_for_deterministic_encryption ⇒ Object
Returns the value of attribute forced_encoding_for_deterministic_encryption.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def forced_encoding_for_deterministic_encryption @forced_encoding_for_deterministic_encryption end |
#hash_digest_class ⇒ Object
Returns the value of attribute hash_digest_class.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def hash_digest_class @hash_digest_class end |
#key_derivation_salt ⇒ Object
Returns the value of attribute key_derivation_salt.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def key_derivation_salt @key_derivation_salt end |
#previous_schemes ⇒ Object
Returns the value of attribute previous_schemes.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def previous_schemes @previous_schemes end |
#primary_key ⇒ Object
Returns the value of attribute primary_key.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def primary_key @primary_key end |
#store_key_references ⇒ Object
Returns the value of attribute store_key_references.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def store_key_references @store_key_references end |
#support_unencrypted_data ⇒ Object
Returns the value of attribute support_unencrypted_data.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def support_unencrypted_data @support_unencrypted_data end |
#validate_column_size ⇒ Object
Returns the value of attribute validate_column_size.
9 10 11 |
# File 'lib/active_record/encryption/config.rb', line 9 def validate_column_size @validate_column_size end |
Instance Method Details
#previous=(previous_schemes_properties) ⇒ Object
Configure previous encryption schemes.
config.active_record.encryption.previous = [ { key_provider: MyOldKeyProvider.new } ]
20 21 22 23 24 |
# File '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 |
#support_sha1_for_non_deterministic_encryption=(value) ⇒ Object
26 27 28 29 30 31 32 |
# File '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 |