Class: ActiveRecord::Encryption::Message
- Defined in:
- activerecord/lib/active_record/encryption/message.rb
Overview
A message defines the structure of the data we store in encrypted attributes. It contains:
-
An encrypted payload
-
A list of unencrypted headers
See Encryptor#encrypt
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#payload ⇒ Object
Returns the value of attribute payload.
Instance Method Summary collapse
- #==(other_message) ⇒ Object
-
#initialize(payload: nil, headers: {}) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(payload: nil, headers: {}) ⇒ Message
Returns a new instance of Message.
14 15 16 17 18 19 |
# File 'activerecord/lib/active_record/encryption/message.rb', line 14 def initialize(payload: nil, headers: {}) validate_payload_type(payload) @payload = payload @headers = Properties.new(headers) end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers
12 13 14 |
# File 'activerecord/lib/active_record/encryption/message.rb', line 12 def headers @headers end |
#payload ⇒ Object
Returns the value of attribute payload
12 13 14 |
# File 'activerecord/lib/active_record/encryption/message.rb', line 12 def payload @payload end |
Instance Method Details
#==(other_message) ⇒ Object
21 22 23 |
# File 'activerecord/lib/active_record/encryption/message.rb', line 21 def ==() payload == .payload && headers == .headers end |