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 6.1.1 to 6.2.0

13

dist/src/handshake-xx.js

@@ -0,1 +1,2 @@

import { InvalidCryptoExchangeError, UnexpectedPeerError } from '@libp2p/interfaces/connection-encrypter/errors';
import { decode0, decode1, decode2, encode0, encode1, encode2 } from './encoder.js';

@@ -34,3 +35,3 @@ import { XX } from './handshakes/xx.js';

if (!valid) {
throw new Error('xx handshake stage 0 validation fail');
throw new InvalidCryptoExchangeError('xx handshake stage 0 validation fail');
}

@@ -48,3 +49,3 @@ logger('Stage 0 - Responder received first message.');

if (!valid) {
throw new Error('xx handshake stage 1 validation fail');
throw new InvalidCryptoExchangeError('xx handshake stage 1 validation fail');
}

@@ -63,3 +64,3 @@ logger('Stage 1 - Initiator received the message.');

const err = e;
throw new Error(`Error occurred while verifying signed payload: ${err.message}`);
throw new UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`);
}

@@ -89,3 +90,3 @@ logger('All good with the signature!');

if (!valid) {
throw new Error('xx handshake stage 2 validation fail');
throw new InvalidCryptoExchangeError('xx handshake stage 2 validation fail');
}

@@ -101,3 +102,3 @@ logger('Stage 2 - Responder received the message, finished handshake.');

const err = e;
throw new Error(`Error occurred while verifying signed payload: ${err.message}`);
throw new UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`);
}

@@ -120,3 +121,3 @@ }

if (!session.cs1 || !session.cs2) {
throw new Error('Handshake not completed properly, cipher state does not exist.');
throw new InvalidCryptoExchangeError('Handshake not completed properly, cipher state does not exist.');
}

@@ -123,0 +124,0 @@ if (this.isInitiator) {

@@ -137,4 +137,5 @@ import { pbStream } from 'it-pb-stream';

const err = e;
err.message = `Error occurred during XX Fallback handshake: ${err.message}`;
logger(err);
throw new Error(`Error occurred during XX Fallback handshake: ${err.message}`);
throw err;
}

@@ -155,4 +156,6 @@ return handshake;

catch (e) {
const err = e;
throw new Error(`Error occurred during XX handshake: ${err.message}`);
if (e instanceof Error) {
e.message = `Error occurred during XX handshake: ${e.message}`;
throw e;
}
}

@@ -159,0 +162,0 @@ return handshake;

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

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

"dependencies": {
"@libp2p/interfaces": "^1.3.14",
"@libp2p/crypto": "^0.22.9",
"@libp2p/interfaces": "^2.0.1",
"@libp2p/logger": "^1.1.2",

@@ -87,11 +88,11 @@ "@libp2p/peer-collections": "^1.0.0",

"devDependencies": {
"@libp2p/crypto": "^0.22.9",
"@libp2p/peer-id-factory": "^1.0.8",
"aegir": "^37.0.11",
"@libp2p/interface-compliance-tests": "^2.0.1",
"aegir": "^37.0.15",
"benchmark": "^2.1.4",
"events": "^3.3.0",
"microtime": "^3.0.0",
"mkdirp": "^1.0.4",
"protons": "^3.0.3",
"mkdirp": "^1.0.4",
"sinon": "^13.0.1",
"sinon": "^14.0.0",
"util": "^0.12.4"

@@ -98,0 +99,0 @@ },

import type { PeerId } from '@libp2p/interfaces/peer-id'
import { InvalidCryptoExchangeError, UnexpectedPeerError } from '@libp2p/interfaces/connection-encrypter/errors'
import type { ProtobufStream } from 'it-pb-stream'

@@ -74,3 +75,3 @@ import type { bytes, bytes32 } from './@types/basic.js'

if (!valid) {
throw new Error('xx handshake stage 0 validation fail')
throw new InvalidCryptoExchangeError('xx handshake stage 0 validation fail')
}

@@ -89,3 +90,3 @@ logger('Stage 0 - Responder received first message.')

if (!valid) {
throw new Error('xx handshake stage 1 validation fail')
throw new InvalidCryptoExchangeError('xx handshake stage 1 validation fail')
}

@@ -104,3 +105,3 @@ logger('Stage 1 - Initiator received the message.')

const err = e as Error
throw new Error(`Error occurred while verifying signed payload: ${err.message}`)
throw new UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`)
}

@@ -129,3 +130,3 @@ logger('All good with the signature!')

if (!valid) {
throw new Error('xx handshake stage 2 validation fail')
throw new InvalidCryptoExchangeError('xx handshake stage 2 validation fail')
}

@@ -141,3 +142,3 @@ logger('Stage 2 - Responder received the message, finished handshake.')

const err = e as Error
throw new Error(`Error occurred while verifying signed payload: ${err.message}`)
throw new UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`)
}

@@ -166,3 +167,3 @@ }

if (!session.cs1 || !session.cs2) {
throw new Error('Handshake not completed properly, cipher state does not exist.')
throw new InvalidCryptoExchangeError('Handshake not completed properly, cipher state does not exist.')
}

@@ -169,0 +170,0 @@

@@ -195,4 +195,5 @@ import type { PeerId } from '@libp2p/interfaces/peer-id'

const err = e as Error
err.message = `Error occurred during XX Fallback handshake: ${err.message}`
logger(err)
throw new Error(`Error occurred during XX Fallback handshake: ${err.message}`)
throw err
}

@@ -226,5 +227,7 @@

}
} catch (e) {
const err = e as Error
throw new Error(`Error occurred during XX handshake: ${err.message}`)
} catch (e: unknown) {
if (e instanceof Error) {
e.message = `Error occurred during XX handshake: ${e.message}`
throw e
}
}

@@ -231,0 +234,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

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