lib/rocket_job/sliced/encrypted_slice.rb in rocketjob-6.0.0.rc3 vs lib/rocket_job/sliced/encrypted_slice.rb in rocketjob-6.0.0
- old
+ new
@@ -4,20 +4,18 @@
# Compress the records within a slice
class EncryptedSlice < ::RocketJob::Sliced::Slice
private
def parse_records
- records = attributes.delete("records")
-
# Convert BSON::Binary to a string
- binary_str = records.data
+ encrypted_str = attributes.delete("records").data
header = SymmetricEncryption::Header.new
- header.parse(binary_str)
+ header.parse(encrypted_str)
# Use the header that is present to decrypt the data, since its version could be different
- str = header.cipher.binary_decrypt(binary_str, header: header)
+ decrypted_str = header.cipher.binary_decrypt(encrypted_str, header: header)
- @records = Hash.from_bson(BSON::ByteBuffer.new(str))["r"]
+ @records = Hash.from_bson(BSON::ByteBuffer.new(decrypted_str))["r"]
end
def serialize_records
return [] if @records.nil? || @records.empty?