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 4.3.2 to 4.4.0

5

index.js

@@ -210,2 +210,7 @@ var events = require('events')

Protocol.parseDiscoveryKey = function (buf) {
if (buf[0] !== 0) throw Error('Invalid message')
return messages.Open.decode(buf, 1).feed
}
Protocol.prototype.finalize = function () {

@@ -212,0 +217,0 @@ this._encode.push(null)

3

package.json
{
"name": "hypercore-protocol",
"version": "4.3.2",
"version": "4.4.0",
"description": "Stream that implements the hypercore protocol",

@@ -23,2 +23,3 @@ "main": "index.js",

"devDependencies": {
"length-prefixed-message": "^3.0.3",
"standard": "^7.1.0",

@@ -25,0 +26,0 @@ "tape": "^4.5.1"

@@ -31,2 +31,6 @@ # hypercore-protocol

#### `var k = protocol.parseDiscoveryKey(buf)`
Parse the discovery key encoded in `buf` which is the first varint message taken from a hypercore feed stream.
#### `var p = protocol([options], [onopen])`

@@ -33,0 +37,0 @@

var tape = require('tape')
var protocol = require('./')
var lpm = require('length-prefixed-message')

@@ -7,2 +8,13 @@ var key = Buffer('12345678123456781234567812345678')

tape('parse discovery key', function (t) {
t.plan(1)
var stream = protocol()
var channel = stream.open(key)
lpm.read(stream, function (buf) {
var parsed = protocol.parseDiscoveryKey(buf)
t.deepEqual(parsed, channel.discoveryKey)
})
})
tape('open channel', function (t) {

@@ -9,0 +21,0 @@ t.plan(3)

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