Class: Serialization::Encrypted::Serializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rswim/serialization/encrypted/serializer.rb

Instance Method Summary collapse

Constructor Details

#initialize(directory) ⇒ Serializer

Returns a new instance of Serializer.



6
7
8
# File 'lib/rswim/serialization/encrypted/serializer.rb', line 6

def initialize(directory)
  @directory = directory
end

Instance Method Details

#serialize(message) ⇒ Object



10
11
12
13
14
# File 'lib/rswim/serialization/encrypted/serializer.rb', line 10

def serialize(message)
  unencrypted = serialize_unencrypted(message)
  cipher_text, salt = Encryption.encrypt(unencrypted).map { |s| Base64.encode64(s) }
  { message: cipher_text, salt: salt }.to_json
end