diff --git a/package.json b/package.json index cc54062b..deb9c4cc 100644 --- a/package.json +++ b/package.json @@ -49,37 +49,37 @@ }, "homepage": "https://github.com/libp2p/js-libp2p-webrtc-star#readme", "devDependencies": { - "aegir": "^23.0.0", + "aegir": "^25.1.0", "chai": "^4.2.0", "dirty-chai": "^2.0.1", "electron-webrtc": "~0.3.0", - "libp2p-interfaces": "libp2p/js-interfaces#skip-abort-while-reading", + "libp2p-interfaces": "^0.4.0", "p-wait-for": "^3.1.0", "sinon": "^9.0.0", + "uint8arrays": "^1.1.0", "wrtc": "^0.4.3" }, "dependencies": { "@hapi/hapi": "^18.4.0", "@hapi/inert": "^5.2.2", "abortable-iterator": "^3.0.0", - "buffer": "^5.6.0", "class-is": "^1.1.0", "debug": "^4.1.1", "err-code": "^2.0.0", "ipfs-utils": "^2.3.0", "it-pipe": "^1.0.1", - "libp2p-utils": "^0.1.0", - "libp2p-webrtc-peer": "^9.7.2", - "mafmt": "^7.0.1", + "libp2p-utils": "^0.2.0", + "libp2p-webrtc-peer": "^10.0.1", + "mafmt": "^8.0.0", "menoetius": "0.0.2", "minimist": "^1.2.0", - "multiaddr": "^7.1.0", + "multiaddr": "^8.0.0", "p-defer": "^3.0.0", - "peer-id": "~0.13.12", + "peer-id": "^0.14.0", "prom-client": "^12.0.0", "socket.io": "^2.3.0", "socket.io-client": "^2.3.0", - "stream-to-it": "^0.2.0", + "stream-to-it": "^0.2.2", "streaming-iterables": "^5.0.2" }, "contributors": [ diff --git a/src/socket-to-conn.js b/src/socket-to-conn.js index 6cd865b4..0ef48800 100644 --- a/src/socket-to-conn.js +++ b/src/socket-to-conn.js @@ -2,7 +2,6 @@ const abortable = require('abortable-iterator') const toIterable = require('stream-to-it') -const { Buffer } = require('buffer') const { CLOSE_TIMEOUT } = require('./constants') const toMultiaddr = require('libp2p-utils/src/ip-port-to-multiaddr') @@ -41,7 +40,7 @@ module.exports = (socket, options = {}) => { await sink((async function * () { for await (const chunk of source) { // Convert BufferList to Buffer - yield Buffer.isBuffer(chunk) ? chunk : chunk.slice() + yield chunk instanceof Uint8Array ? chunk : chunk.slice() } })()) } catch (err) { diff --git a/test/sig-server.js b/test/sig-server.js index 3ebef844..17947589 100644 --- a/test/sig-server.js +++ b/test/sig-server.js @@ -1,10 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const io = require('socket.io-client') const multiaddr = require('multiaddr') diff --git a/test/transport/dial.js b/test/transport/dial.js index b4174558..e24d4dcd 100644 --- a/test/transport/dial.js +++ b/test/transport/dial.js @@ -3,13 +3,11 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multiaddr = require('multiaddr') const pipe = require('it-pipe') const { collect } = require('streaming-iterables') +const uint8ArrayFromString = require('uint8arrays/from-string') module.exports = (create) => { describe('dial', () => { @@ -57,7 +55,7 @@ module.exports = (create) => { this.timeout(20 * 1000) const conn = await ws1.dial(ws2._signallingAddr) - const data = Buffer.from('some data') + const data = uint8ArrayFromString('some data') const values = await pipe( [data], conn, diff --git a/test/transport/discovery.js b/test/transport/discovery.js index cb069e1e..ec2967f0 100644 --- a/test/transport/discovery.js +++ b/test/transport/discovery.js @@ -2,10 +2,7 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multiaddr = require('multiaddr') module.exports = (create) => { diff --git a/test/transport/filter.js b/test/transport/filter.js index eddefdc4..84c4249f 100644 --- a/test/transport/filter.js +++ b/test/transport/filter.js @@ -1,10 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multiaddr = require('multiaddr') diff --git a/test/transport/instance.spec.js b/test/transport/instance.spec.js index 8e83391a..33cba9af 100644 --- a/test/transport/instance.spec.js +++ b/test/transport/instance.spec.js @@ -1,10 +1,7 @@ /* eslint-env mocha */ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const WebRTCStar = require('../../src') diff --git a/test/transport/listen.js b/test/transport/listen.js index 93f56aa4..1533a027 100644 --- a/test/transport/listen.js +++ b/test/transport/listen.js @@ -2,10 +2,7 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multiaddr = require('multiaddr') module.exports = (create) => { diff --git a/test/transport/reconnect.node.js b/test/transport/reconnect.node.js index c8e6c5ad..5fb9ce8c 100644 --- a/test/transport/reconnect.node.js +++ b/test/transport/reconnect.node.js @@ -2,10 +2,7 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multiaddr = require('multiaddr') const sigServer = require('../../src/sig-server') diff --git a/test/transport/track.js b/test/transport/track.js index 218e2de8..c444b12c 100644 --- a/test/transport/track.js +++ b/test/transport/track.js @@ -3,10 +3,7 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multiaddr = require('multiaddr') const pipe = require('it-pipe') const pWaitFor = require('p-wait-for') diff --git a/test/utils.spec.js b/test/utils.spec.js index a08fa89d..73ce9537 100644 --- a/test/utils.spec.js +++ b/test/utils.spec.js @@ -2,10 +2,7 @@ 'use strict' -const chai = require('chai') -const dirtyChai = require('dirty-chai') -const expect = chai.expect -chai.use(dirtyChai) +const { expect } = require('aegir/utils/chai') const multiaddr = require('multiaddr') const { cleanMultiaddr } = require('../src/utils') const { cleanUrlSIO } = require('../src/utils')