lib/lockbox/model.rb in lockbox-0.3.1 vs lib/lockbox/model.rb in lockbox-0.3.2
- old
+ new
@@ -278,21 +278,18 @@
end
if message.nil? || (message == "" && !options[:padding])
message
else
- ciphertext = Lockbox::Utils.build_box(opts[:context], options, table, encrypted_attribute).encrypt(message)
- ciphertext = Base64.strict_encode64(ciphertext) if options[:encode]
- ciphertext
+ Lockbox::Utils.build_box(opts[:context], options, table, encrypted_attribute).encrypt(message)
end
end
define_singleton_method decrypt_method_name do |ciphertext, **opts|
message =
if ciphertext.nil? || (ciphertext == "" && !options[:padding])
ciphertext
else
- ciphertext = Base64.decode64(ciphertext) if options[:encode]
table = activerecord ? table_name : collection_name.to_s
Lockbox::Utils.build_box(opts[:context], options, table, encrypted_attribute).decrypt(ciphertext)
end
unless message.nil?