You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@libp2p/multistream-select

Package Overview
Dependencies
Maintainers
6
Versions
663
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/multistream-select - npm Package Compare versions

Comparing version

to
3.1.1

1

dist/src/constants.d.ts
export declare const PROTOCOL_ID = "/multistream/1.0.0";
export declare const MAX_PROTOCOL_LENGTH = 1024;
//# sourceMappingURL=constants.d.ts.map
export const PROTOCOL_ID = '/multistream/1.0.0';
// Conforming to go-libp2p
// See https://github.com/multiformats/go-multistream/blob/master/multistream.go#L297
export const MAX_PROTOCOL_LENGTH = 1024;
//# sourceMappingURL=constants.js.map

5

dist/src/multistream.js

@@ -9,2 +9,3 @@ import { Uint8ArrayList } from 'uint8arraylist';

import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
import { MAX_PROTOCOL_LENGTH } from './constants.js';
const NewLine = uint8ArrayFromString('\n');

@@ -58,4 +59,4 @@ export function encode(buffer) {

};
const buf = await pipe(input, lp.decode({ onLength }), async (source) => await first(source));
if (buf == null) {
const buf = await pipe(input, lp.decode({ onLength, maxDataLength: MAX_PROTOCOL_LENGTH }), async (source) => await first(source));
if (buf == null || buf.length === 0) {
throw errCode(new Error('no buffer returned'), 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE');

@@ -62,0 +63,0 @@ }

{
"name": "@libp2p/multistream-select",
"version": "3.1.0",
"version": "3.1.1",
"description": "JavaScript implementation of multistream-select",

@@ -150,3 +150,3 @@ "license": "Apache-2.0 OR MIT",

"it-first": "^1.0.6",
"it-handshake": "^4.0.1",
"it-handshake": "^4.1.2",
"it-length-prefixed": "^8.0.2",

@@ -153,0 +153,0 @@ "it-merge": "^1.0.4",

export const PROTOCOL_ID = '/multistream/1.0.0'
// Conforming to go-libp2p
// See https://github.com/multiformats/go-multistream/blob/master/multistream.go#L297
export const MAX_PROTOCOL_LENGTH = 1024

@@ -15,2 +15,3 @@

import type { MultistreamSelectInit } from '.'
import { MAX_PROTOCOL_LENGTH } from './constants.js'

@@ -77,7 +78,7 @@ const NewLine = uint8ArrayFromString('\n')

input,
lp.decode({ onLength }),
lp.decode({ onLength, maxDataLength: MAX_PROTOCOL_LENGTH }),
async (source) => await first(source)
)
if (buf == null) {
if (buf == null || buf.length === 0) {
throw errCode(new Error('no buffer returned'), 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE')

@@ -84,0 +85,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet