Secret stream backed by Noise and libsodium's secretstream
npm install noise-secret-stream
const NoiseSecretStream = require('noise-secret-stream')
const a = new NoiseSecretStream(true)
const b = new NoiseSecretStream(false)
a.pipe(b).pipe(a)
a.send(Buffer.from('hello'))
b.on('message', function (message) {
console.log(message) // <Buffer hello>
})Make a new stream. isInitiator is a boolean indication whether you are the client or the server.
Pipe this over a tcp/utp stream or similar to another noise secret stream instance.
Options include:
{
keyPair: { publicKey, secretKey }
}Generate a key pair.
Send a message. Returns true if the stream was flushed, false otherwards.
Emitted when a message is received.
MIT