Class: Chamber::Filters::EncryptionFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/chamber/filters/encryption_filter.rb

Constant Summary collapse

BASE64_STRING_PATTERN =
%r{\A[A-Za-z0-9\+\/]{342}==\z}
LARGE_DATA_STRING_PATTERN =

rubocop:disable Metrics/LineLength

%r{\A([A-Za-z0-9\+\/#]*\={0,2})#([A-Za-z0-9\+\/#]*\={0,2})#([A-Za-z0-9\+\/#]*\={0,2})\z}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ EncryptionFilter

Returns a new instance of EncryptionFilter.



20
21
22
23
24
# File 'lib/chamber/filters/encryption_filter.rb', line 20

def initialize(options = {})
  self.encryption_keys  = options.fetch(:encryption_keys, {}) || {}
  self.data             = options.fetch(:data).dup
  self.secure_key_token = /\A#{Regexp.escape(options.fetch(:secure_key_prefix))}/
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



16
17
18
# File 'lib/chamber/filters/encryption_filter.rb', line 16

def data
  @data
end

#encryption_keysObject

Returns the value of attribute encryption_keys.



18
19
20
# File 'lib/chamber/filters/encryption_filter.rb', line 18

def encryption_keys
  @encryption_keys
end

#secure_key_tokenObject

Returns the value of attribute secure_key_token.



16
17
18
# File 'lib/chamber/filters/encryption_filter.rb', line 16

def secure_key_token
  @secure_key_token
end

Class Method Details

.execute(options = {}) ⇒ Object



26
27
28
# File 'lib/chamber/filters/encryption_filter.rb', line 26

def self.execute(options = {})
  new(options).__send__(:execute)
end