lib/lockbox/active_storage_extensions.rb in lockbox-0.1.0 vs lib/lockbox/active_storage_extensions.rb in lockbox-0.1.1

- old
+ new

@@ -1,5 +1,9 @@ +# ideally encrypt and decrypt would happen at the blob/service level +# however, there isn't really a great place to define encryption settings there +# instead, we encrypt and decrypt at the attachment level, +# and we define encryption settings at the model level class Lockbox module ActiveStorageExtensions module Attached protected @@ -13,11 +17,11 @@ options = Utils.encrypted_options(record, name) box = Utils.build_box(record, options) case attachable when ActiveStorage::Blob - raise NotImplemented, "Not supported yet" + raise NotImplemented, "Not supported" when ActionDispatch::Http::UploadedFile, Rack::Test::UploadedFile attachable = { io: StringIO.new(box.encrypt(attachable.read)), filename: attachable.original_filename, content_type: attachable.content_type @@ -27,10 +31,10 @@ io: StringIO.new(box.encrypt(attachable[:io].read)), filename: attachable[:filename], content_type: attachable[:content_type] } when String - raise NotImplemented, "Not supported yet" + raise NotImplemented, "Not supported" else nil end attachable