class ActiveRecord::Encryption::Properties
See Properties::DEFAULT_PROPERTIES
, Key, Message
message.headers.encrypted_data_key # instead of message.headers[:k]
a readable name.
for common properties that will keep these keys very short while exposing
efficiency to keep their keys as short as possible. It defines accessors
Since properties are serialized in messages, it is important for storageKey
(public tags) and Message
(headers).
This is a wrapper for a hash of encryption properties. It is used by
def []=(key, value)
Set a value for a given key
def []=(key, value) raise Errors::EncryptedContentIntegrity, "Properties can't be overridden: #{key}" if key?(key) validate_value_type(value) data[key] = value end
def add(other_properties)
def add(other_properties) other_properties.each do |key, value| self[key.to_sym] = value end end
def initialize(initial_properties = {})
def initialize(initial_properties = {}) @data = {} add(initial_properties) end
def to_h
def to_h data end
def validate_value_type(value)
def validate_value_type(value) unless ALLOWED_VALUE_CLASSES.find { |klass| value.is_a?(klass) } raise ActiveRecord::Encryption::Errors::ForbiddenClass, "Can't store a #{value.class}, only properties of type #{ALLOWED_VALUE_CLASSES.inspect} are allowed" end end