
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
secret-handshake
Advanced tools
secure-channel based on a a mutually authenticating key agreement handshake, with forward secure identity metadata.
For a full explanation of the design, read the Design Paper
This protocol derives shared keys and mutually authenticates both ends of the connection. The shared secrets are forward secure, and so is the identity metadata.
by "forward secure identity metadata" I mean:
And also:
note: a wrong number is just an accidental man in the middle.
By "confirm" I mean check a guess at the public key. By "learn" I mean that you can either extract the public key, or confirm the public key.
Also note that if the server decides not to authenticate a client, it will learn their public key. To get to this stage, the client must know the server's key, so now the client and server both know each others key. This is fair.
This protocol cannot hide your ip address. This protocol does not attempt to obscure packet boundries. If a man in the middle or wrong number later compromises the server's key, they will be able to extract the client key from the client's hello packet.
var SHS = require('secret-handshake')
var cl = require('chloride')
var appKey = ... //32 random bytes
var alice = cl.crypto_sign_keypair() //client
var bob = cl.crypto_sign_keypair() //server
function authorize(id, cb) {
cb(null, check(id)) //check wether id is authorized.
}
//initialize, with default timeouts.
var ServerStream = SHS.createServer(alice, authorize, appKey)
var ClientStream = SHS.createClient(bob, appkey)
var alice_stream = ServerStream(function (err, stream) {
...
})
var bob_stream = ClientStream(alice.publicKey, function (err, stream) {
...
})
//simulate a streaming network connection by connecting streams together
pull(alice_stream, bob_stream, alice_stream)
I recommend using secret-handshake via multiserver
pull-streams are used. Learn about how pull-streams from these examples
Keypairs are expected to be of the form sodium produces. chloride is my fork of this and is compatible.
If you're interested in the protocol, you can read more here : https://ssbc.github.io/scuttlebutt-protocol-guide/#handshake
createClient
takes:
keypair
- a keypair of form { secretKey, publicKey }
- your clients keys (see chloride#crypto_sign_keypair
)appkey
- the network identifier, 32 random bytestimeout
- an integer (in milliseconds? CHECK THIS)and returns a createClientStream
createClientStream
takes a the public key
for the remote peer,
an optional seed
(which is used to generate a one-time private key),
and a callback, cb
. cipherstream
, an encrypted duplex pull-stream is returned.
Once the stream is connected to a server stream,
secret-handshake will attempt to authorize, and will call
cb
with an err
if it fails, or plainstream
if it succeeds.
If keypair
is null, seed
must be provided.
createServer
is similar, except it takes authorize
,
keypair
- a keypair of form { secretKey, publicKey }
(see chloride#crypto_sign_keypair
)authorize
- an async function of signature (id, cb)
that decides whether a client with id == publicKey is allowed to continue with handshakeappkey
- the network identifier, 32 random bytestimeout
- an integer (in milliseconds? CHECK THIS)A stream constructor function is returned
Note the server DOES NOT take the client id as an argument - instead, in the process
of the handshake, the server learns the id
, and passes it to authorize
.
If authorize
calls back truthy, then it will callback cb(null, plainstream)
else it errors, cb(err)
.
The value that authorize
calls back cb(null, <V>)
will be assigned to plainstream.auth = <V>
.
Also, the id
of the remote will be assigned to plainstream.id
.
This way the application layer can know who it's peer is.
MIT
FAQs
a simple and highly private secure-channel protocol
The npm package secret-handshake receives a total of 98 weekly downloads. As such, secret-handshake popularity was classified as not popular.
We found that secret-handshake demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.