New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-hypercore-protocol

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-hypercore-protocol - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

4

index.js

@@ -16,2 +16,3 @@ const Handshake = require('./lib/handshake')

this.publicKey = null
this.handshakeHash = null
this.destroyed = false

@@ -140,3 +141,3 @@

_onhandshake (err, remotePayload, split, overflow, remotePublicKey) {
_onhandshake (err, remotePayload, split, overflow, remotePublicKey, handshakeHash) {
if (err) return this.destroy(new Error('Noise handshake error')) // workaround for https://github.com/emilbayes/noise-protocol/issues/5

@@ -146,2 +147,3 @@ if (!remotePayload) return this.destroy(new Error('Remote did not include a handshake payload'))

this.remotePublicKey = remotePublicKey
this.handshakeHash = handshakeHash

@@ -148,0 +150,0 @@ try {

@@ -86,3 +86,3 @@ const SH = require('simple-handshake')

crypto.free(self.noise.split.tx)
self.ondone(null, self.remotePayload, split, self.buffer, self.remotePublicKey)
self.ondone(null, self.remotePayload, split, self.buffer, self.remotePublicKey, self.noise.handshakeHash)
}

@@ -89,0 +89,0 @@

{
"name": "simple-hypercore-protocol",
"version": "2.0.1",
"version": "2.1.0",
"description": "Hypercore protocol state machine",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -86,2 +86,8 @@ # simple-hypercore-protocol

#### `p.handshakeHash`
The noise handshake hash which uniquely identifies the noise session.
http://noiseprotocol.org/noise.html#channel-binding
#### `handlers.onauthenticate(remotePublicKey, done)`

@@ -88,0 +94,0 @@

@@ -256,1 +256,31 @@ const tape = require('tape')

})
tape('handshakeHash', function (t) {
t.plan(3)
var pending = 3
const a = new SHP(true, {
onhandshake () {
if (--pending === 0) process.nextTick(check)
},
send (data) {
process.nextTick(() => b.recv(data))
}
})
const b = new SHP(false, {
onhandshake () {
if (--pending === 0) process.nextTick(check)
},
send (data) {
process.nextTick(() => a.recv(data))
}
})
if (--pending === 0) check()
function check () {
t.ok(a.handshakeHash)
t.ok(b.handshakeHash)
t.deepEqual(a.handshakeHash, b.handshakeHash)
}
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc