lib/event_store_client/mapper/encrypted.rb
def serialize(event)
        encryption_schema = (
          event.class.respond_to?(:encryption_schema) &&
          event.class.encryption_schema
        )
        encryptor = EventStoreClient::DataEncryptor.new(
          data: event.data,
          schema: encryption_schema,
          repository: key_repository
        )
        encryptor.call
        EventStoreClient::Event.new(
          data: serializer.serialize(encryptor.encrypted_data),
          metadata: serializer.serialize(
            event.metadata.merge(encryption: encryptor.encryption_metadata)
          ),
          type: event.class.to_s
        )
      end
##
# Encrypts the given event's subset of data.
# Accepts specific event class instance with:
# * +#data+ - hash with non-encrypted values.
# * encryption_schema - hash with information which data to encrypt and
#   which key should be used as an identifier.
# *Returns*: General +Event+ instance with encrypted data
Encrypts the given event's subset of data.
Accepts specific event class instance with:
+#data+ - hash with non-encrypted values.
encryption_schema - hash with information which data to encrypt and
which key should be used as an identifier.
Returns*: General +Event+ instance with encrypted data
Encrypts the given event ' s subset of data . Accepts specific event class instance with : + #data + - hash with non - encrypted values . encryption_schema - hash with information which data to encrypt and which key should be used as an identifier . Returns * : General + Event + instance with encrypted data
def serialize(event)
        encryption_schema = (
          event.class.respond_to?(:encryption_schema) &&
          event.class.encryption_schema
        )
        encryptor = EventStoreClient::DataEncryptor.new(
          data: event.data,
          schema: encryption_schema,
          repository: key_repository
        )
        encryptor.call
        EventStoreClient::Event.new(
          data: serializer.serialize(encryptor.encrypted_data),
          metadata: serializer.serialize(
            event.metadata.merge(encryption: encryptor.encryption_metadata)
          ),
          type: event.class.to_s
        )
      end
def serialize ( event ) encryption_schema = ( event . class . respond_to? ( :encryption_schema ) && event . class . encryption_schema ) encryptor = EventStoreClient :: DataEncryptor . new ( data : event . data , schema : encryption_schema , repository : key_repository ) encryptor . call EventStoreClient :: Event . new ( data : serializer . serialize ( encryptor . encrypted_data ) , metadata : serializer . serialize ( event . metadata . merge ( encryption : encryptor . encryption_metadata ) ) , type : event . class . to_s ) end
Encrypts the given event's subset of data.
Encrypts the given event ' s subset of data .
event