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

hypercore-protocol

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-protocol - npm Package Compare versions

Comparing version 7.0.0 to 7.1.0

11

index.js

@@ -413,8 +413,11 @@ const SHP = require('simple-hypercore-protocol')

close (key) {
const discoveryKey = crypto.discoveryKey(key)
close (discoveryKey) {
const ch = this.channelizer.getChannel(discoveryKey)
if (ch) ch.close()
else this.state.close(this.channelizer.allocLocal(), { discoveryKey })
if (ch && ch.localId > -1) {
ch.close()
return
}
this.state.close(this.channelizer.allocLocal(), { discoveryKey })
}

@@ -421,0 +424,0 @@

{
"name": "hypercore-protocol",
"version": "7.0.0",
"version": "7.1.0",
"description": "Stream that implements the hypercore protocol",

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

@@ -117,2 +117,7 @@ # hypercore-protocol

#### `stream.close(discoveryKey)`
You can call this method to signal to the other side that you do not have the key
corresponding to the discoveryKey. Normally you would use this together with the `ondiscoverykey` hook.
#### `stream.destroy([error])`

@@ -119,0 +124,0 @@

@@ -430,1 +430,19 @@ const tape = require('tape')

})
tape('can close by discovery key', function (t) {
const a = new Protocol(true)
const b = new Protocol(false, {
ondiscoverykey (discoveryKey) {
b.close(discoveryKey)
}
})
a.open(KEY, {
onclose () {
t.pass('channel closed')
t.end()
}
})
a.pipe(b).pipe(a)
})
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