class ActiveStorage::Service::DiskService

def ensure_integrity_of(key, checksum)

def ensure_integrity_of(key, checksum)
  unless OpenSSL::Digest::MD5.file(path_for(key)).base64digest == checksum
    delete key
    raise ActiveStorage::IntegrityError
  end
end