From 3f95934250fe60ad54a70dcc8836468116ba68f5 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 18 Aug 2021 15:26:18 +1000 Subject: [PATCH] Replace deprecated package for libp2p-noise --- .cspell.json | 1 + package-lock.json | 155 +++++++++++++++++++++++----------------------- package.json | 2 +- src/lib/waku.ts | 4 +- 4 files changed, 82 insertions(+), 80 deletions(-) diff --git a/.cspell.json b/.cspell.json index 499e87d912..a7f7f5ffdb 100644 --- a/.cspell.json +++ b/.cspell.json @@ -8,6 +8,7 @@ "bitjson", "bitauth", "bufbuild", + "chainsafe", "cimg", "ciphertext", "circleci", diff --git a/package-lock.json b/package-lock.json index d50285af27..d8acb5da2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,11 @@ "requires": true, "packages": { "": { + "name": "js-waku", "version": "0.10.0", "license": "MIT OR Apache-2.0", "dependencies": { + "@chainsafe/libp2p-noise": "^4.0.0", "axios": "^0.21.1", "debug": "^4.3.1", "ecies-geth": "^1.5.2", @@ -18,7 +20,6 @@ "libp2p-bootstrap": "^0.13.0", "libp2p-gossipsub": "^0.10.0", "libp2p-mplex": "^0.10.4", - "libp2p-noise": "^4.0.0", "libp2p-tcp": "^0.17.0", "libp2p-websockets": "^0.16.0", "multiaddr": "^10.0.0", @@ -2133,6 +2134,46 @@ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==" }, + "node_modules/@chainsafe/libp2p-noise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@chainsafe/libp2p-noise/-/libp2p-noise-4.0.0.tgz", + "integrity": "sha512-Q9gcC1IzN8/aQQXl/ntRbldTD/3c35j5lK5guIKEB+QU/Ogi0EyaihkL3YGx9QrSiFTyz0ABlSfxA0Wxfw5R1A==", + "dependencies": { + "@stablelib/chacha20poly1305": "^1.0.1", + "@stablelib/hkdf": "^1.0.1", + "@stablelib/sha256": "^1.0.1", + "@stablelib/x25519": "^1.0.1", + "debug": "^4.3.1", + "it-buffer": "^0.1.1", + "it-length-prefixed": "^5.0.2", + "it-pair": "^1.0.0", + "it-pb-rpc": "^0.1.9", + "it-pipe": "^1.1.0", + "libp2p-crypto": "^0.19.0", + "peer-id": "^0.15.0", + "protobufjs": "^6.10.1", + "uint8arrays": "^2.0.5" + } + }, + "node_modules/@chainsafe/libp2p-noise/node_modules/peer-id": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.15.2.tgz", + "integrity": "sha512-3OMbup76F28gKsQK4rGheEJHwosnJGe2+Obsf1xFaS9DpUaG9/JK0rtguWVLbrkxPclsCceci8g3/ulg8jsORA==", + "dependencies": { + "class-is": "^1.1.0", + "libp2p-crypto": "^0.19.0", + "minimist": "^1.2.5", + "multiformats": "^9.3.0", + "protobufjs": "^6.10.2", + "uint8arrays": "^2.0.5" + }, + "bin": { + "peer-id": "src/bin.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@cnakazawa/watch": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", @@ -15386,46 +15427,6 @@ "varint": "^6.0.0" } }, - "node_modules/libp2p-noise": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/libp2p-noise/-/libp2p-noise-4.0.0.tgz", - "integrity": "sha512-DCXRKh9Y4pkw4HEWKPpZbeoROilZA1nrQMHIVrJ4JDEMUKVRucJc9GZTFNzo4yJUZ+ayQAlrfbUARiPPFbpfng==", - "dependencies": { - "@stablelib/chacha20poly1305": "^1.0.1", - "@stablelib/hkdf": "^1.0.1", - "@stablelib/sha256": "^1.0.1", - "@stablelib/x25519": "^1.0.1", - "debug": "^4.3.1", - "it-buffer": "^0.1.1", - "it-length-prefixed": "^5.0.2", - "it-pair": "^1.0.0", - "it-pb-rpc": "^0.1.9", - "it-pipe": "^1.1.0", - "libp2p-crypto": "^0.19.0", - "peer-id": "^0.15.0", - "protobufjs": "^6.10.1", - "uint8arrays": "^2.0.5" - } - }, - "node_modules/libp2p-noise/node_modules/peer-id": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.15.1.tgz", - "integrity": "sha512-EoZig26nzPt922s1D/EOe2vJY3D1NCl/+G8rzI99G4HOrUcM94DI5MV8EWLv3ra5j9R/6n7TLgQIpZm2hpBaAA==", - "dependencies": { - "class-is": "^1.1.0", - "libp2p-crypto": "^0.19.0", - "minimist": "^1.2.5", - "multiformats": "^9.3.0", - "protobufjs": "^6.10.2", - "uint8arrays": "^2.0.5" - }, - "bin": { - "peer-id": "src/bin.js" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/libp2p-tcp": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/libp2p-tcp/-/libp2p-tcp-0.17.1.tgz", @@ -26602,6 +26603,42 @@ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==" }, + "@chainsafe/libp2p-noise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@chainsafe/libp2p-noise/-/libp2p-noise-4.0.0.tgz", + "integrity": "sha512-Q9gcC1IzN8/aQQXl/ntRbldTD/3c35j5lK5guIKEB+QU/Ogi0EyaihkL3YGx9QrSiFTyz0ABlSfxA0Wxfw5R1A==", + "requires": { + "@stablelib/chacha20poly1305": "^1.0.1", + "@stablelib/hkdf": "^1.0.1", + "@stablelib/sha256": "^1.0.1", + "@stablelib/x25519": "^1.0.1", + "debug": "^4.3.1", + "it-buffer": "^0.1.1", + "it-length-prefixed": "^5.0.2", + "it-pair": "^1.0.0", + "it-pb-rpc": "^0.1.9", + "it-pipe": "^1.1.0", + "libp2p-crypto": "^0.19.0", + "peer-id": "^0.15.0", + "protobufjs": "^6.10.1", + "uint8arrays": "^2.0.5" + }, + "dependencies": { + "peer-id": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.15.2.tgz", + "integrity": "sha512-3OMbup76F28gKsQK4rGheEJHwosnJGe2+Obsf1xFaS9DpUaG9/JK0rtguWVLbrkxPclsCceci8g3/ulg8jsORA==", + "requires": { + "class-is": "^1.1.0", + "libp2p-crypto": "^0.19.0", + "minimist": "^1.2.5", + "multiformats": "^9.3.0", + "protobufjs": "^6.10.2", + "uint8arrays": "^2.0.5" + } + } + } + }, "@cnakazawa/watch": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", @@ -36957,42 +36994,6 @@ "varint": "^6.0.0" } }, - "libp2p-noise": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/libp2p-noise/-/libp2p-noise-4.0.0.tgz", - "integrity": "sha512-DCXRKh9Y4pkw4HEWKPpZbeoROilZA1nrQMHIVrJ4JDEMUKVRucJc9GZTFNzo4yJUZ+ayQAlrfbUARiPPFbpfng==", - "requires": { - "@stablelib/chacha20poly1305": "^1.0.1", - "@stablelib/hkdf": "^1.0.1", - "@stablelib/sha256": "^1.0.1", - "@stablelib/x25519": "^1.0.1", - "debug": "^4.3.1", - "it-buffer": "^0.1.1", - "it-length-prefixed": "^5.0.2", - "it-pair": "^1.0.0", - "it-pb-rpc": "^0.1.9", - "it-pipe": "^1.1.0", - "libp2p-crypto": "^0.19.0", - "peer-id": "^0.15.0", - "protobufjs": "^6.10.1", - "uint8arrays": "^2.0.5" - }, - "dependencies": { - "peer-id": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.15.1.tgz", - "integrity": "sha512-EoZig26nzPt922s1D/EOe2vJY3D1NCl/+G8rzI99G4HOrUcM94DI5MV8EWLv3ra5j9R/6n7TLgQIpZm2hpBaAA==", - "requires": { - "class-is": "^1.1.0", - "libp2p-crypto": "^0.19.0", - "minimist": "^1.2.5", - "multiformats": "^9.3.0", - "protobufjs": "^6.10.2", - "uint8arrays": "^2.0.5" - } - } - } - }, "libp2p-tcp": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/libp2p-tcp/-/libp2p-tcp-0.17.1.tgz", diff --git a/package.json b/package.json index 3e45650197..402d34e455 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "node": ">=14" }, "dependencies": { + "@chainsafe/libp2p-noise": "^4.0.0", "axios": "^0.21.1", "debug": "^4.3.1", "ecies-geth": "^1.5.2", @@ -68,7 +69,6 @@ "libp2p-bootstrap": "^0.13.0", "libp2p-gossipsub": "^0.10.0", "libp2p-mplex": "^0.10.4", - "libp2p-noise": "^4.0.0", "libp2p-tcp": "^0.17.0", "libp2p-websockets": "^0.16.0", "multiaddr": "^10.0.0", diff --git a/src/lib/waku.ts b/src/lib/waku.ts index c3c1fe9c2c..e010addace 100644 --- a/src/lib/waku.ts +++ b/src/lib/waku.ts @@ -1,3 +1,5 @@ +import { bytes } from '@chainsafe/libp2p-noise/dist/src/@types/basic'; +import { Noise } from '@chainsafe/libp2p-noise/dist/src/noise'; import debug from 'debug'; import Libp2p, { Connection, Libp2pModules, Libp2pOptions } from 'libp2p'; import Bootstrap from 'libp2p-bootstrap'; @@ -5,8 +7,6 @@ import { MuxedStream } from 'libp2p-interfaces/dist/src/stream-muxer/types'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: No types available import Mplex from 'libp2p-mplex'; -import { bytes } from 'libp2p-noise/dist/src/@types/basic'; -import { Noise } from 'libp2p-noise/dist/src/noise'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: No types available import Websockets from 'libp2p-websockets';