Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
conn.dialStream(function (err, stream) {
if (err) {
return console.log(err)
}
var msi = new Interactive()
msi.handle(stream, function () {
msi.select('/ipfs/identify/1.0.0', function (err, ds) {
if (err) { return console.log(err) }
var identifyMsg = {}
identifyMsg = {}
identifyMsg.sender = exportPeer(peerSelf)
// TODO (daviddias) populate with the way I see the other peer
stream.write(JSON.stringify(identifyMsg))
var answer = ''
stream.on('data', function (chunk) {
answer = answer + chunk.toString()
})
function multistreamHandshake (conn) {
var msI = new multistream.Interactive()
msI.handle(conn, function () {
msI.select(protocol, callback)
})
}
}