From 5f5ef7ee6cc6dc634cc6adbede0602492490a85d Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Tue, 6 Oct 2020 06:19:50 +0200 Subject: [PATCH] feat: remove support for SECIO (#3295) BREAKING CHANGE: this removes support for SECIO making Noise the only security transport. Closes https://github.com/ipfs/js-ipfs/issues/3210 Co-authored-by: achingbrain --- examples/custom-libp2p/index.js | 4 ++-- examples/custom-libp2p/package.json | 2 +- examples/custom-libp2p/test.js | 4 ++-- packages/ipfs-core/package.json | 1 - packages/ipfs-core/src/runtime/libp2p-browser.js | 4 +--- packages/ipfs-core/src/runtime/libp2p-nodejs.js | 4 +--- packages/ipfs-core/test/libp2p.spec.js | 2 +- packages/ipfs/README.md | 1 - packages/ipfs/package-list.json | 1 - 9 files changed, 8 insertions(+), 15 deletions(-) diff --git a/examples/custom-libp2p/index.js b/examples/custom-libp2p/index.js index 0d144db1f9..5ca0a0d1bf 100644 --- a/examples/custom-libp2p/index.js +++ b/examples/custom-libp2p/index.js @@ -7,7 +7,7 @@ const MulticastDNS = require('libp2p-mdns') const Bootstrap = require('libp2p-bootstrap') const KadDHT = require('libp2p-kad-dht') const MPLEX = require('libp2p-mplex') -const SECIO = require('libp2p-secio') +const { NOISE } = require('libp2p-noise') /** * Options for the libp2p bundle @@ -49,7 +49,7 @@ const libp2pBundle = (opts) => { MPLEX ], connEncryption: [ - SECIO + NOISE ], peerDiscovery: [ MulticastDNS, diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json index ad6b87387b..eb6e328bc4 100644 --- a/examples/custom-libp2p/package.json +++ b/examples/custom-libp2p/package.json @@ -16,7 +16,7 @@ "libp2p-kad-dht": "^0.20.0", "libp2p-mdns": "^0.15.0", "libp2p-mplex": "^0.10.0", - "libp2p-secio": "^0.13.0", + "libp2p-noise": "^2.0.1", "libp2p-tcp": "^0.15.0" }, "devDependencies": { diff --git a/examples/custom-libp2p/test.js b/examples/custom-libp2p/test.js index 0e527f69bd..fbed8f8cb5 100644 --- a/examples/custom-libp2p/test.js +++ b/examples/custom-libp2p/test.js @@ -5,7 +5,7 @@ const execa = require('execa') const Libp2p = require('libp2p') const TCP = require('libp2p-tcp') const MPLEX = require('libp2p-mplex') -const SECIO = require('libp2p-secio') +const { NOISE } = require('libp2p-noise') const PeerId = require('peer-id') const uint8ArrayToString = require('uint8arrays/to-string') @@ -41,7 +41,7 @@ async function test () { MPLEX ], connEncryption: [ - SECIO + NOISE ] } }) diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 84f3612980..a16bc0da69 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -97,7 +97,6 @@ "libp2p-mplex": "^0.10.0", "libp2p-noise": "^2.0.1", "libp2p-record": "^0.9.0", - "libp2p-secio": "^0.13.1", "libp2p-tcp": "^0.15.1", "libp2p-webrtc-star": "^0.20.1", "libp2p-websockets": "^0.14.0", diff --git a/packages/ipfs-core/src/runtime/libp2p-browser.js b/packages/ipfs-core/src/runtime/libp2p-browser.js index ae00d3f9a4..0cbc337354 100644 --- a/packages/ipfs-core/src/runtime/libp2p-browser.js +++ b/packages/ipfs-core/src/runtime/libp2p-browser.js @@ -4,7 +4,6 @@ const WS = require('libp2p-websockets') const WebRTCStar = require('libp2p-webrtc-star') const Multiplex = require('libp2p-mplex') const { NOISE } = require('libp2p-noise') -const SECIO = require('libp2p-secio') const KadDHT = require('libp2p-kad-dht') const GossipSub = require('libp2p-gossipsub') const ipnsUtils = require('../ipns/routing/utils') @@ -25,8 +24,7 @@ module.exports = () => { Multiplex ], connEncryption: [ - NOISE, - SECIO + NOISE ], peerDiscovery: [], dht: KadDHT, diff --git a/packages/ipfs-core/src/runtime/libp2p-nodejs.js b/packages/ipfs-core/src/runtime/libp2p-nodejs.js index b00578a415..cc90a492a6 100644 --- a/packages/ipfs-core/src/runtime/libp2p-nodejs.js +++ b/packages/ipfs-core/src/runtime/libp2p-nodejs.js @@ -6,7 +6,6 @@ const WS = require('libp2p-websockets') const KadDHT = require('libp2p-kad-dht') const GossipSub = require('libp2p-gossipsub') const Multiplex = require('libp2p-mplex') -const SECIO = require('libp2p-secio') const { NOISE } = require('libp2p-noise') const ipnsUtils = require('../ipns/routing/utils') @@ -26,8 +25,7 @@ module.exports = () => { Multiplex ], connEncryption: [ - NOISE, - SECIO + NOISE ], peerDiscovery: [ MulticastDNS diff --git a/packages/ipfs-core/test/libp2p.spec.js b/packages/ipfs-core/test/libp2p.spec.js index 99b8aacaa6..45c4a31383 100644 --- a/packages/ipfs-core/test/libp2p.spec.js +++ b/packages/ipfs-core/test/libp2p.spec.js @@ -7,7 +7,7 @@ const PeerId = require('peer-id') const Libp2p = require('libp2p') const EE = require('events') const libp2pComponent = require('../src/components/libp2p') -const Crypto = require('libp2p-secio') +const { NOISE: Crypto } = require('libp2p-noise') class DummyTransport { get [Symbol.toStringTag] () { diff --git a/packages/ipfs/README.md b/packages/ipfs/README.md index 04aa44f550..46bca5bbd3 100644 --- a/packages/ipfs/README.md +++ b/packages/ipfs/README.md @@ -185,7 +185,6 @@ List of the main packages that make up the IPFS ecosystem. | [`libp2p-kad-dht`](//github.com/libp2p/js-libp2p-kad-dht) | [![npm](https://img.shields.io/npm/v/libp2p-kad-dht.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-kad-dht/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-kad-dht.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-kad-dht) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-kad-dht/master)](https://travis-ci.com/libp2p/js-libp2p-kad-dht) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-kad-dht/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-kad-dht) | [Vasco Santos](mailto:vasco.santos@moxy.studio) | | [`libp2p-mdns`](//github.com/libp2p/js-libp2p-mdns) | [![npm](https://img.shields.io/npm/v/libp2p-mdns.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-mdns/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-mdns.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-mdns) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-mdns/master)](https://travis-ci.com/libp2p/js-libp2p-mdns) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-mdns/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-mdns) | [Jacob Heun](mailto:jacobheun@gmail.com) | | [`libp2p-bootstrap`](//github.com/libp2p/js-libp2p-bootstrap) | [![npm](https://img.shields.io/npm/v/libp2p-bootstrap.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-bootstrap/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-bootstrap.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-bootstrap) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-bootstrap/master)](https://travis-ci.com/libp2p/js-libp2p-bootstrap) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-bootstrap/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-bootstrap) | [Vasco Santos](mailto:vasco.santos@moxy.studio) | -| [`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) | | [`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-tcp`](//github.com/libp2p/js-libp2p-tcp) | [![npm](https://img.shields.io/npm/v/libp2p-tcp.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-tcp/releases) | [![Deps](https://david-dm.org/libp2p/js-libp2p-tcp.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-tcp) | [![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-tcp/master)](https://travis-ci.com/libp2p/js-libp2p-tcp) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-tcp/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-tcp) | [Jacob Heun](mailto:jacobheun@gmail.com) | | [`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) | diff --git a/packages/ipfs/package-list.json b/packages/ipfs/package-list.json index 6d237ca9de..0dcf92686b 100644 --- a/packages/ipfs/package-list.json +++ b/packages/ipfs/package-list.json @@ -42,7 +42,6 @@ ["libp2p/js-libp2p-kad-dht", "libp2p-kad-dht"], ["libp2p/js-libp2p-mdns", "libp2p-mdns"], ["libp2p/js-libp2p-bootstrap", "libp2p-bootstrap"], - ["libp2p/js-libp2p-secio", "libp2p-secio"], ["NodeFactoryIo/js-libp2p-noise", "libp2p-noise"], ["libp2p/js-libp2p-tcp", "libp2p-tcp"], ["libp2p/js-libp2p-webrtc-star", "libp2p-webrtc-star"],