diff --git a/.aegir.js b/.aegir.js index 326c69dc..0853beda 100644 --- a/.aegir.js +++ b/.aegir.js @@ -6,7 +6,7 @@ const Peers = require('./test/fixtures/peers') const PeerId = require('peer-id') const WebSockets = require('libp2p-websockets') const Muxer = require('libp2p-mplex') -const Crypto = require('libp2p-secio') +const { NOISE: Crypto } = require('libp2p-noise') const pipe = require('it-pipe') let libp2p diff --git a/README.md b/README.md index 0f83af16..7dc561aa 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ List of packages currently in existence for libp2p | [`libp2p-webrtc-star`](//github.com/libp2p/js-libp2p-webrtc-star) | [![npm](https://img.shields.io/npm/v/libp2p-webrtc-star.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-webrtc-star/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-webrtc-star.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-webrtc-star) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-webrtc-star/master)](https://travis-ci.com/libp2p/js-libp2p-webrtc-star) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-webrtc-star/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-webrtc-star) | [Vasco Santos](mailto:vasco.santos@moxy.studio) | | [`libp2p-websockets`](//github.com/libp2p/js-libp2p-websockets) | [![npm](https://img.shields.io/npm/v/libp2p-websockets.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-websockets/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-websockets.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-websockets) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-websockets/master)](https://travis-ci.com/libp2p/js-libp2p-websockets) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-websockets/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-websockets) | [Jacob Heun](mailto:jacobheun@gmail.com) | | **secure channels** | +| [`libp2p-noise`](//github.com/NodeFactoryIo/js-libp2p-noise) | [![npm](https://img.shields.io/npm/v/libp2p-noise.svg?maxAge=86400&style=flat-square)](//github.com/NodeFactoryIo/js-libp2p-noise/releases) | [![Deps](https://david-dm.org/NodeFactoryIo/js-libp2p-noise.svg?style=flat-square)](https://david-dm.org/NodeFactoryIo/js-libp2p-noise) | [![Travis CI](https://flat.badgen.net/travis/NodeFactoryIo/js-libp2p-noise/master)](https://travis-ci.com/NodeFactoryIo/js-libp2p-noise) | [![codecov](https://codecov.io/gh/NodeFactoryIo/js-libp2p-noise/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/NodeFactoryIo/js-libp2p-noise) | N/A | | [`libp2p-secio`](//github.com/libp2p/js-libp2p-secio) | [![npm](https://img.shields.io/npm/v/libp2p-secio.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-secio/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-secio.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-secio) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-secio/master)](https://travis-ci.com/libp2p/js-libp2p-secio) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-secio/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-secio) | [Friedel Ziegelmayer](mailto:dignifiedquire@gmail.com) | | **stream multiplexers** | | [`libp2p-mplex`](//github.com/libp2p/js-libp2p-mplex) | [![npm](https://img.shields.io/npm/v/libp2p-mplex.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-mplex/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-mplex.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-mplex) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-mplex/master)](https://travis-ci.com/libp2p/js-libp2p-mplex) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-mplex/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-mplex) | [Vasco Santos](mailto:vasco.santos@moxy.studio) | diff --git a/doc/CONFIGURATION.md b/doc/CONFIGURATION.md index fe1c10f2..59c9a9fe 100644 --- a/doc/CONFIGURATION.md +++ b/doc/CONFIGURATION.md @@ -94,6 +94,7 @@ If you want to know more about libp2p stream multiplexing, you should read the f Some available connection encryption protocols: +- [NodeFactoryIo/js-libp2p-noise](https://github.com/NodeFactoryIo/js-libp2p-noise) - [libp2p/js-libp2p-secio](https://github.com/libp2p/js-libp2p-secio) If none of the available connection encryption mechanisms fulfills your needs, you can create a libp2p compatible one. A libp2p connection encryption protocol just needs to be compliant with the [Crypto Interface](https://github.com/libp2p/js-interfaces/tree/master/src/crypto). diff --git a/doc/GETTING_STARTED.md b/doc/GETTING_STARTED.md index c9a772de..216110c4 100644 --- a/doc/GETTING_STARTED.md +++ b/doc/GETTING_STARTED.md @@ -69,23 +69,23 @@ If you want to know more about libp2p transports, you should read the following Encryption is an important part of communicating on the libp2p network. Every connection must be encrypted to help ensure security for everyone. As such, Connection Encryption (Crypto) is a required component of libp2p. -There are a growing number of Crypto modules being developed for libp2p. As those are released they will be tracked in the [Connection Encryption section of the configuration readme](./CONFIGURATION.md#connection-encryption). For now, we are going to configure our node to use the `libp2p-secio` module, which is widely supported across the various libp2p implementations. +There are a growing number of Crypto modules being developed for libp2p. As those are released they will be tracked in the [Connection Encryption section of the configuration readme](./CONFIGURATION.md#connection-encryption). For now, we are going to configure our node to use the `libp2p-noise` module. ```sh -npm install libp2p-secio +npm install libp2p-noise ``` -With `libp2p-secio` installed, we can add it to our existing configuration by importing it and adding it to the `modules.connEncryption` array: +With `libp2p-noise` installed, we can add it to our existing configuration by importing it and adding it to the `modules.connEncryption` array: ```js const Libp2p = require('libp2p') const WebSockets = require('libp2p-websockets') -const SECIO = require('libp2p-secio') +const { NOISE } = require('libp2p-noise') const node = await Libp2p.create({ modules: { transport: [WebSockets], - connEncryption: [SECIO] + connEncryption: [NOISE] } }) ``` diff --git a/package-list.json b/package-list.json index c5f2e376..f59f9c58 100644 --- a/package-list.json +++ b/package-list.json @@ -22,6 +22,7 @@ ["libp2p/js-libp2p-websockets", "libp2p-websockets"], "secure channels", + ["NodeFactoryIo/js-libp2p-noise", "libp2p-noise"], ["libp2p/js-libp2p-secio", "libp2p-secio"], "stream multiplexers", diff --git a/package.json b/package.json index c002f34b..4ae6f2cb 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,7 @@ "libp2p-gossipsub": "^0.4.0", "libp2p-kad-dht": "^0.19.1", "libp2p-mdns": "^0.14.1", + "libp2p-noise": "^1.1.0", "libp2p-mplex": "^0.9.5", "libp2p-secio": "^0.12.4", "libp2p-tcp": "^0.14.1", diff --git a/test/dialing/direct.node.js b/test/dialing/direct.node.js index bb93d94b..536cf5ec 100644 --- a/test/dialing/direct.node.js +++ b/test/dialing/direct.node.js @@ -9,7 +9,7 @@ const { expect } = chai const sinon = require('sinon') const Transport = require('libp2p-tcp') const Muxer = require('libp2p-mplex') -const Crypto = require('libp2p-secio') +const { NOISE: Crypto } = require('libp2p-noise') const multiaddr = require('multiaddr') const PeerId = require('peer-id') const delay = require('delay') diff --git a/test/dialing/direct.spec.js b/test/dialing/direct.spec.js index 9d9f1f4a..69b54ecc 100644 --- a/test/dialing/direct.spec.js +++ b/test/dialing/direct.spec.js @@ -11,7 +11,7 @@ const pWaitFor = require('p-wait-for') const delay = require('delay') const Transport = require('libp2p-websockets') const Muxer = require('libp2p-mplex') -const Crypto = require('libp2p-secio') +const { NOISE: Crypto } = require('libp2p-noise') const multiaddr = require('multiaddr') const PeerId = require('peer-id') const AggregateError = require('aggregate-error') diff --git a/test/upgrading/upgrader.spec.js b/test/upgrading/upgrader.spec.js index d70e8b65..47169079 100644 --- a/test/upgrading/upgrader.spec.js +++ b/test/upgrading/upgrader.spec.js @@ -13,7 +13,7 @@ const pipe = require('it-pipe') const { collect } = require('streaming-iterables') const pSettle = require('p-settle') const Transport = require('libp2p-websockets') -const Crypto = require('libp2p-secio') +const { NOISE: Crypto } = require('libp2p-noise') const Protector = require('../../src/pnet') const swarmKeyBuffer = Buffer.from(require('../fixtures/swarm.key')) diff --git a/test/utils/base-options.browser.js b/test/utils/base-options.browser.js index d437b580..c9c570ed 100644 --- a/test/utils/base-options.browser.js +++ b/test/utils/base-options.browser.js @@ -2,7 +2,7 @@ const Transport = require('libp2p-websockets') const Muxer = require('libp2p-mplex') -const Crypto = require('libp2p-secio') +const { NOISE: Crypto } = require('libp2p-noise') module.exports = { modules: { diff --git a/test/utils/base-options.js b/test/utils/base-options.js index 8b7fb535..25ea441b 100644 --- a/test/utils/base-options.js +++ b/test/utils/base-options.js @@ -2,7 +2,7 @@ const Transport = require('libp2p-tcp') const Muxer = require('libp2p-mplex') -const Crypto = require('libp2p-secio') +const { NOISE: Crypto } = require('libp2p-noise') module.exports = { modules: { diff --git a/test/utils/mockConnection.js b/test/utils/mockConnection.js index 4d47dc70..d77253b8 100644 --- a/test/utils/mockConnection.js +++ b/test/utils/mockConnection.js @@ -31,7 +31,7 @@ module.exports = async (properties = {}) => { upgraded: Date.now() }, direction: 'outbound', - encryption: '/secio/1.0.0', + encryption: '/noise', multiplexer: '/mplex/6.7.0' }, newStream: (protocols) => {