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

@chainsafe/libp2p-noise

Package Overview
Dependencies
Maintainers
3
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chainsafe/libp2p-noise - npm Package Compare versions

Comparing version 10.0.0 to 10.0.1

2

dist/src/crypto/streaming.js
import { NOISE_MSG_MAX_LENGTH_BYTES, NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG } from '../constants.js';
import { uint16BEEncode } from '../encoder.js';
// Returns generator that encrypts payload from the user

@@ -12,2 +13,3 @@ export function encryptStream(handshake) {

const data = handshake.encrypt(chunk.subarray(i, end), handshake.session);
yield uint16BEEncode(data.byteLength);
yield data;

@@ -14,0 +16,0 @@ }

7

dist/src/encoder.d.ts
import type { bytes } from './@types/basic.js';
import type { MessageBuffer } from './@types/handshake.js';
import type { LengthDecoderFunction, LengthEncoderFunction } from 'it-length-prefixed';
export declare const uint16BEEncode: LengthEncoderFunction;
import type { LengthDecoderFunction } from 'it-length-prefixed';
export declare const uint16BEEncode: {
(value: number): Uint8Array;
bytes: number;
};
export declare const uint16BEDecode: LengthDecoderFunction;

@@ -6,0 +9,0 @@ export declare function encode0(message: MessageBuffer): bytes;

import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter';
import type { NoiseInit } from './noise.js';
import type { NoiseExtensions } from './proto/payload.js';
export * from './crypto.js';
export * from './crypto/stablelib.js';
export declare function noise(init?: NoiseInit): () => ConnectionEncrypter;
export declare function noise(init?: NoiseInit): () => ConnectionEncrypter<NoiseExtensions>;
//# sourceMappingURL=index.d.ts.map
import { pbStream } from 'it-pb-stream';
import { duplexPair } from 'it-pair/duplex';
import { pipe } from 'it-pipe';
import { encode, decode } from 'it-length-prefixed';
import { decode } from 'it-length-prefixed';
import { NOISE_MSG_MAX_LENGTH_BYTES } from './constants.js';

@@ -112,4 +112,3 @@ import { stablelib } from './crypto/stablelib.js';

await pipe(secure, // write to wrapper
encryptStream(handshake), // data is encrypted
encode({ lengthEncoder: uint16BEEncode }), // prefix with message length
encryptStream(handshake), // encrypt data + prefix with message length
network, // send to the remote peer

@@ -116,0 +115,0 @@ decode({ lengthDecoder: uint16BEDecode }), // read message length prefix

{
"name": "@chainsafe/libp2p-noise",
"version": "10.0.0",
"version": "10.0.1",
"author": "ChainSafe <info@chainsafe.io>",

@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT",

@@ -5,2 +5,3 @@ import type { Transform } from 'it-stream-types'

import { NOISE_MSG_MAX_LENGTH_BYTES, NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG } from '../constants.js'
import { uint16BEEncode } from '../encoder.js'

@@ -18,2 +19,4 @@ // Returns generator that encrypts payload from the user

const data = handshake.encrypt(chunk.subarray(i, end), handshake.session)
yield uint16BEEncode(data.byteLength)
yield data

@@ -20,0 +23,0 @@ }

@@ -5,3 +5,3 @@ import { concat as uint8ArrayConcat } from 'uint8arrays/concat'

import type { MessageBuffer } from './@types/handshake.js'
import type { LengthDecoderFunction, LengthEncoderFunction } from 'it-length-prefixed'
import type { LengthDecoderFunction } from 'it-length-prefixed'

@@ -16,3 +16,3 @@ const allocUnsafe = (len: number): Uint8Array => {

export const uint16BEEncode: LengthEncoderFunction = (value: number) => {
export const uint16BEEncode = (value: number): Uint8Array => {
const target = allocUnsafe(2)

@@ -19,0 +19,0 @@ new DataView(target.buffer, target.byteOffset, target.byteLength).setUint16(0, value, false)

import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter'
import { Noise } from './noise.js'
import type { NoiseInit } from './noise.js'
import type { NoiseExtensions } from './proto/payload.js'
export * from './crypto.js'
export * from './crypto/stablelib.js'
export function noise (init: NoiseInit = {}): () => ConnectionEncrypter {
export function noise (init: NoiseInit = {}): () => ConnectionEncrypter<NoiseExtensions> {
return () => new Noise(init)
}

@@ -6,3 +6,3 @@ import type { PeerId } from '@libp2p/interface-peer-id'

import { pipe } from 'it-pipe'
import { encode, decode } from 'it-length-prefixed'
import { decode } from 'it-length-prefixed'
import type { Duplex } from 'it-stream-types'

@@ -177,4 +177,3 @@ import type { bytes } from './@types/basic.js'

secure, // write to wrapper
encryptStream(handshake), // data is encrypted
encode({ lengthEncoder: uint16BEEncode }), // prefix with message length
encryptStream(handshake), // encrypt data + prefix with message length
network, // send to the remote peer

@@ -181,0 +180,0 @@ decode({ lengthDecoder: uint16BEDecode }), // read message length prefix

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

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

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