Method: RightScale::MessageEncoder::SecretSerializer#dump
- Defined in:
- lib/instance/message_encoder.rb
#dump(data) ⇒ String
Encodes the given serializable object to text.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/instance/message_encoder.rb', line 47 def dump(data) serialized_data = @serializer.dump(data) encrypted_data = ::Encryptor.encrypt(serialized_data, :key => @secret) printable_data = ::Base64.encode64(encrypted_data) # adhere to the SecureSerializer format in case we want to roll this # implementation into that class and distinguish 'secure' encryption # from 'secret' by the presence or absence of 'signature'. # # FIX: do we want to roll them together because it will introduce a # dependency on the encryptor gem? return @serializer.dump({'id' => @identity, 'data' => printable_data, 'encrypted' => true}, :json) end |