Class: Karafka::Pro::Encryption::Messages::Middleware
- Inherits:
-
Object
- Object
- Karafka::Pro::Encryption::Messages::Middleware
- Defined in:
- lib/karafka/pro/encryption/messages/middleware.rb
Overview
Middleware for WaterDrop. It automatically encrypts messages payload. It is injected only if encryption is enabled.
Instance Method Summary collapse
-
#call(message) ⇒ Hash
Hash with encrypted payload and encryption version indicator.
Instance Method Details
#call(message) ⇒ Hash
Returns hash with encrypted payload and encryption version indicator.
24 25 26 27 28 29 |
# File 'lib/karafka/pro/encryption/messages/middleware.rb', line 24 def call() [:headers] ||= {} [:headers]['encryption'] = version [:payload] = cipher.encrypt([:payload]) end |