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_fork(_config, _pre_fork_producer) ⇒ Object
This feature does not need any changes post-fork.
- .post_setup(config) ⇒ Object
-
.pre_setup(config) ⇒ Object
Sets up additional config scope, validations and other things.
Class Method Details
.post_fork(_config, _pre_fork_producer) ⇒ Object
This feature does not need any changes post-fork
61 62 63 |
# File 'lib/karafka/pro/encryption.rb', line 61 def post_fork(_config, _pre_fork_producer) true end |
.post_setup(config) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/karafka/pro/encryption.rb', line 41 def post_setup(config) Encryption::Contracts::Config.new.validate!( config.to_h, scope: %w[config] ) # 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
33 34 35 36 37 38 |
# File 'lib/karafka/pro/encryption.rb', line 33 def pre_setup(config) # Expand the config with this feature specific stuff config.instance_eval do setting(:encryption, default: Setup::Config.config) end end |