     callback null, s2Bytes,
       clientPublicKey: key
 
+# Generate S0/S1/S2 combined message
 generateS0S1S2 = (clientsig, callback) ->
   clientType = clientsig[0]
   console.log "client type: #{clientType}"

  generateS1 messageFormat, dh, (err, s1Bytes) ->
    generateS2 messageFormat, clientsig, (err, s2Bytes, keys) ->
      allBytes = Buffer.concat [
        new Buffer([ clientType ]),  # version
        s1Bytes,
        s2Bytes
      ], 3073
      keys.dh = dh
      callback null, allBytes, keys

MESSAGE_FORMAT_UNKNOWN = -1

RTMP_SIG_SIZE = 1536
SHA256DL = 32  # SHA256 digest length (bytes)

KEY_LENGTH = 128

