class Lite::Encryption::Message

Public Instance Methods

decrypt(value, opts = {}) click to toggle source
# File lib/lite/encryption/message.rb, line 9
def decrypt(value, opts = {})
  scheme = scheme_by_option(opts)
  scheme.decrypt(value, **opts)
end
encrypt(value, opts = {}) click to toggle source
# File lib/lite/encryption/message.rb, line 14
def encrypt(value, opts = {})
  scheme = scheme_by_option(opts)
  scheme.encrypt(value, **opts)
end

Private Instance Methods

deterministic_scheme() click to toggle source
# File lib/lite/encryption/message.rb, line 21
def deterministic_scheme
  @deterministic_scheme ||= Lite::Encryption::Schemes::Deterministic.new
end
non_deterministic_scheme() click to toggle source
# File lib/lite/encryption/message.rb, line 25
def non_deterministic_scheme
  @non_deterministic_scheme ||= Lite::Encryption::Schemes::NonDeterministic.new
end
scheme_by_option(options) click to toggle source
# File lib/lite/encryption/message.rb, line 29
def scheme_by_option(options)
  options.delete(:deterministic) ? deterministic_scheme : non_deterministic_scheme
end