
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
noise-secret-stream
Advanced tools
Secret stream backed by Noise and libsodium's secretstream
npm install noise-secret-stream
You can either make a secret stream from an existing transport stream.
const NoiseSecretStream = require('noise-secret-stream')
const a = new NoiseSecretStream(true, tcpClientStream)
const b = new NoiseSecretStream(false, tcpServerStream)
// pipe the underlying rawstreams together
a.write(Buffer.from('hello encrypted!'))
b.on('data', function (data) {
console.log(data) // <Buffer hello encrypted!>
})
Or by making your own pipeline
const a = new NoiseSecretStream(true)
const b = new NoiseSecretStream(false)
// pipe the underlying rawstreams together
a.rawStream.pipe(b.rawStream).pipe(a.rawStream)
a.write(Buffer.from('hello encrypted!'))
b.on('data', function (data) {
console.log(data) // <Buffer hello encrypted!>
})
const s = new NoiseSecretStream(isInitiator, [rawStream], [options])Make a new stream. isInitiator is a boolean indication whether you are the client or the server.
rawStream can be set to an underlying transport stream you want to run the noise stream over.
Options include:
{
pattern: 'XX', // which noise pattern to use
remotePublicKey, // set if your handshake requires it
keyPair: { publicKey, secretKey },
handshake: { // if you want to use an handshake performed elsewhere pass it here
tx,
rx,
handshakeHash,
publicKey,
remotePublicKey
}
}
The NoiseSecretStream returned is a Duplex stream that you use as as normal stream, to write/read data from, except it's payloads are encrypted using the libsodium secretstream.
Note that this uses ed25519 for the handshakes per default.
s.start(rawStream, [options])Start a NoiseSecretStream from a rawStream asynchrously.
const s = new NoiseSecretStream({
autoStart: false // call start manually
})
// ... do async stuff or destroy the stream
s.start(rawStream, {
... options from above
})
keyPair = NoiseSecretStream.keyPair([seed])Generate a ed25519 key pair.
s.publicKeyGet the local public key.
s.remotePublicKeyGet the remote's public key.
Populated after open is emitted.
s.handshakeHashGet the unique hash of this handshake.
Populated after open is emitted.
MIT
FAQs
Secret stream backed by Noise and libsodium's secretstream
We found that noise-secret-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.