Class: EventStoreClient::DataEncryptor
- Inherits:
-
Object
- Object
- EventStoreClient::DataEncryptor
- Defined in:
- lib/event_store_client/data_encryptor.rb
Instance Attribute Summary collapse
-
#encrypted_data ⇒ Object
readonly
Returns the value of attribute encrypted_data.
-
#encryption_metadata ⇒ Object
readonly
Returns the value of attribute encryption_metadata.
Instance Method Summary collapse
Instance Attribute Details
#encrypted_data ⇒ Object (readonly)
Returns the value of attribute encrypted_data.
21 22 23 |
# File 'lib/event_store_client/data_encryptor.rb', line 21 def encrypted_data @encrypted_data end |
#encryption_metadata ⇒ Object (readonly)
Returns the value of attribute encryption_metadata.
21 22 23 |
# File 'lib/event_store_client/data_encryptor.rb', line 21 def @encryption_metadata end |
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/event_store_client/data_encryptor.rb', line 5 def call return encrypted_data if .empty? key_id = [:key] res = key_repository.find(key_id) res = res.failure? ? key_repository.create(key_id) : res key = res.value! [:iv] = key.attributes[:iv] encrypt_attributes( key: key, data: encrypted_data, attributes: [:attributes].map(&:to_s) ) end |