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.



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

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.



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

def data
  @data
end

#encryption_keysObject

Returns the value of attribute encryption_keys.



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

def encryption_keys
  @encryption_keys
end

#secure_key_tokenObject

Returns the value of attribute secure_key_token.



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

def secure_key_token
  @secure_key_token
end

Class Method Details

.execute(options = {}) ⇒ Object



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

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