class Rack::Session::Encryptor
def serialize_payload(message)
the message will be padded. The first 2 bytes of the returned string will
Returns a serialized payload of the message. If a :pad_size is supplied,
def serialize_payload(message) serialized_data = serializer.dump(message) return "#{[0].pack('v')}#{serialized_data}" if @options[:pad_size].nil? padding_bytes = @options[:pad_size] - (2 + serialized_data.size) % @options[:pad_size] padding_data = SecureRandom.random_bytes(padding_bytes) "#{[padding_bytes].pack('v')}#{padding_data}#{serialized_data}" end