Module: Karafka::Pro::Encryption
- Defined in:
- lib/karafka/pro/encryption.rb,
lib/karafka/pro/encryption/cipher.rb,
lib/karafka/pro/encryption/errors.rb,
lib/karafka/pro/encryption/setup/config.rb,
lib/karafka/pro/encryption/messages/parser.rb,
lib/karafka/pro/encryption/contracts/config.rb,
lib/karafka/pro/encryption/messages/middleware.rb
Overview
Out of the box encryption engine for both Karafka and WaterDrop It uses asymmetric encryption via RSA. We use asymmetric so we can have producers that won’t have ability (when private key not added) to decrypt messages.
Defined Under Namespace
Modules: Contracts, Errors, Messages, Setup Classes: Cipher
Class Method Summary collapse
- .post_setup(config) ⇒ Object
-
.pre_setup(config) ⇒ Object
Sets up additional config scope, validations and other things.
Class Method Details
.post_setup(config) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/karafka/pro/encryption.rb', line 32 def post_setup(config) Encryption::Contracts::Config.new.validate!(config.to_h) # Don't inject extra components if encryption is not active return unless config.encryption.active # This parser is encryption aware config.internal..parser = Messages::Parser.new # Encryption for WaterDrop config.producer.middleware.append(Messages::Middleware.new) end |
.pre_setup(config) ⇒ Object
Sets up additional config scope, validations and other things
24 25 26 27 28 29 |
# File 'lib/karafka/pro/encryption.rb', line 24 def pre_setup(config) # Expand the config with this feature specific stuff config.instance_eval do setting(:encryption, default: Setup::Config.config) end end |