Skip to content

Commit 2a04b51

Browse files
authored
fix: update to new interfaces (#218)
libp2p/js-libp2p-interfaces#294 made the outbound peer id optional in the connection encrypter interface so apply that change to the noise codebase.
1 parent 77a95fd commit 2a04b51

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,20 @@
8787
"uint8arrays": "^3.1.0"
8888
},
8989
"devDependencies": {
90-
"@libp2p/daemon-client": "2.0.4",
90+
"@libp2p/daemon-client": "^3.0.1",
9191
"@libp2p/daemon-server": "^3.0.0",
9292
"@libp2p/interface-connection-encrypter-compliance-tests": "^2.0.1",
93-
"@libp2p/interop": "^2.1.0",
93+
"@libp2p/interop": "^3.0.1",
9494
"@libp2p/mplex": "^5.0.0",
9595
"@libp2p/peer-id-factory": "^1.0.8",
9696
"@libp2p/tcp": "^3.0.3",
97-
"@multiformats/multiaddr": "^10.3.3",
97+
"@multiformats/multiaddr": "^11.0.3",
9898
"aegir": "^37.3.0",
9999
"benchmark": "^2.1.4",
100100
"execa": "^6.1.0",
101101
"go-libp2p": "^0.0.6",
102102
"iso-random-stream": "^2.0.2",
103-
"libp2p": "0.39.1",
103+
"libp2p": "0.39.2",
104104
"mkdirp": "^1.0.4",
105105
"p-defer": "^4.0.0",
106106
"protons": "^5.1.0",

src/noise.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class Noise implements INoiseConnection {
5656
* @param {PeerId} remotePeer - PeerId of the remote peer. Used to validate the integrity of the remote peer.
5757
* @returns {Promise<SecuredConnection>}
5858
*/
59-
public async secureOutbound (localPeer: PeerId, connection: Duplex<Uint8Array>, remotePeer: PeerId): Promise<SecuredConnection> {
59+
public async secureOutbound (localPeer: PeerId, connection: Duplex<Uint8Array>, remotePeer?: PeerId): Promise<SecuredConnection> {
6060
const wrappedConnection = pbStream(
6161
connection,
6262
{

test/interop.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createServer } from '@libp2p/daemon-server'
44
import { createClient } from '@libp2p/daemon-client'
55
import { createLibp2p, Libp2pOptions } from 'libp2p'
66
import { TCP } from '@libp2p/tcp'
7-
import { Multiaddr } from '@multiformats/multiaddr'
7+
import { multiaddr } from '@multiformats/multiaddr'
88
import { path as p2pd } from 'go-libp2p'
99
import { execa } from 'execa'
1010
import pDefer from 'p-defer'
@@ -18,7 +18,7 @@ import { Noise } from '../src/index.js'
1818

1919
async function createGoPeer (options: SpawnOptions): Promise<Daemon> {
2020
const controlPort = Math.floor(Math.random() * (50000 - 10000 + 1)) + 10000
21-
const apiAddr = new Multiaddr(`/ip4/0.0.0.0/tcp/${controlPort}`)
21+
const apiAddr = multiaddr(`/ip4/0.0.0.0/tcp/${controlPort}`)
2222

2323
const log = logger(`go-libp2p:${controlPort}`)
2424

@@ -82,7 +82,7 @@ async function createJsPeer (options: SpawnOptions): Promise<Daemon> {
8282
}
8383

8484
const node = await createLibp2p(opts)
85-
const server = await createServer(new Multiaddr('/ip4/0.0.0.0/tcp/0'), node as any)
85+
const server = await createServer(multiaddr('/ip4/0.0.0.0/tcp/0'), node as any)
8686
await server.start()
8787

8888
return {

0 commit comments

Comments
 (0)