src/protocol/messages.js
function readMessage(socketData, signer) {
  var identities = socketData[0];
  var signature = socketData[2].toString();
  var header = socketData[3];
  var parentHeader = socketData[4];
  var metadata = socketData[5];
  var content = socketData[6];

  if (!signer.validate(signature, [ header, parentHeader, metadata, content ])) {
    return null;
  }

  return createMessage(identities,
                       JSON.parse(header),
                       JSON.parse(parentHeader),
                       JSON.parse(metadata),
                       JSON.parse(content));
}
function readMessage(socketData, signer) {
  var identities = socketData[0];
  var signature = socketData[2].toString();
  var header = socketData[3];
  var parentHeader = socketData[4];
  var metadata = socketData[5];
  var content = socketData[6];

  if (!signer.validate(signature, [ header, parentHeader, metadata, content ])) {
    return null;
  }

  return createMessage(identities,
                       JSON.parse(header),
                       JSON.parse(parentHeader),
                       JSON.parse(metadata),
                       JSON.parse(content));
}
Helper to read in a message from incoming message data.