Skip to content

Commit

Permalink
fix: replace node buffers with uint8arrays (#42)
Browse files Browse the repository at this point in the history
* fix: replace node buffers with uint8arrays

BREAKING CHANGES:

- All deps of this module now use uint8arrays in place of node buffers

* chore: bump deps

Co-authored-by: Jacob Heun <jacobheun@gmail.com>
  • Loading branch information
achingbrain and jacobheun committed Aug 23, 2020
1 parent 08e03d0 commit ef57641
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
},
"homepage": "https://github.com/libp2p/interop#readme",
"devDependencies": {
"aegir": "^22.0.0",
"aegir": "^26.0.0",
"chai": "^4.2.0",
"chai-bytes": "~0.1.2",
"chai-bytes": "^0.1.2",
"chai-checkmark": "^1.0.1",
"cross-env": "^7.0.0",
"dirty-chai": "^2.0.1",
"go-libp2p-dep": "~0.8.1",
"libp2p-daemon": "^0.4.0",
"libp2p-daemon-client": "^0.4.0",
"multiaddr": "^7.2.1",
"go-libp2p-dep": "^0.8.1",
"libp2p-daemon": "^0.5.0",
"libp2p-daemon-client": "^0.5.0",
"multiaddr": "^8.0.0",
"p-retry": "^4.2.0",
"rimraf": "^3.0.0"
},
Expand All @@ -54,8 +54,9 @@
"Mantas Vidutis <mantas.a.vidutis@gmail.com>"
],
"dependencies": {
"cids": "~0.8.0",
"cids": "^1.0.0",
"debug": "^4.1.1",
"execa": "^4.0.0"
"execa": "^4.0.0",
"uint8arrays": "^1.1.0"
}
}
6 changes: 4 additions & 2 deletions test/dht/content-fetching/go2go.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ chai.use(require('dirty-chai'))
chai.use(require('chai-bytes'))
const expect = chai.expect

const uint8ArrayFromString = require('uint8arrays/from-string')

const spawnDaemons = require('../../utils/spawnDaemons')

describe.skip('dht.contentFetching', () => {
Expand Down Expand Up @@ -36,8 +38,8 @@ describe.skip('dht.contentFetching', () => {
it('go peer to go peer', async function () {
this.timeout(10 * 1000)

const key = 'keyA'
const value = Buffer.from('hello data')
const key = uint8ArrayFromString('keyA')
const value = uint8ArrayFromString('hello data')

await daemons[0].client.dht.put(key, value)

Expand Down
6 changes: 4 additions & 2 deletions test/dht/content-fetching/go2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ chai.use(require('dirty-chai'))
chai.use(require('chai-bytes'))
const expect = chai.expect

const uint8ArrayFromString = require('uint8arrays/from-string')

const spawnDaemons = require('../../utils/spawnDaemons')

describe.skip('dht.contentFetching', () => {
Expand Down Expand Up @@ -36,8 +38,8 @@ describe.skip('dht.contentFetching', () => {
it('go peer to js peer', async function () {
this.timeout(10 * 1000)

const key = 'keyA'
const value = Buffer.from('hello data')
const key = uint8ArrayFromString('keyA')
const value = uint8ArrayFromString('hello data')

await daemons[0].client.dht.put(key, value)

Expand Down
6 changes: 4 additions & 2 deletions test/dht/content-fetching/js2go.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ chai.use(require('dirty-chai'))
chai.use(require('chai-bytes'))
const expect = chai.expect

const uint8ArrayFromString = require('uint8arrays/from-string')

const spawnDaemons = require('../../utils/spawnDaemons')

describe.skip('dht.contentFetching', () => {
Expand Down Expand Up @@ -36,8 +38,8 @@ describe.skip('dht.contentFetching', () => {
it('js peer to go peer', async function () {
this.timeout(10 * 1000)

const key = 'keyA'
const value = Buffer.from('hello data')
const key = uint8ArrayFromString('keyA')
const value = uint8ArrayFromString('hello data')

await daemons[0].client.dht.put(key, value)

Expand Down
6 changes: 4 additions & 2 deletions test/dht/content-fetching/js2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ chai.use(require('dirty-chai'))
chai.use(require('chai-bytes'))
const expect = chai.expect

const uint8ArrayFromString = require('uint8arrays/from-string')

const spawnDaemons = require('../../utils/spawnDaemons')

describe('dht.contentFetching', () => {
Expand Down Expand Up @@ -36,8 +38,8 @@ describe('dht.contentFetching', () => {
it('js peer to js peer', async function () {
this.timeout(10 * 1000)

const key = 'keyA'
const value = Buffer.from('hello data')
const key = uint8ArrayFromString('keyA')
const value = uint8ArrayFromString('hello data')

await daemons[0].client.dht.put(key, value)

Expand Down
4 changes: 3 additions & 1 deletion test/pubsub/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ chai.use(require('dirty-chai'))
chai.use(require('chai-bytes'))
const expect = chai.expect

const uint8ArrayFromString = require('uint8arrays/from-string')

exports.pubsubTest = async (daemons) => {
const topic = 'test-topic'
const data = Buffer.from('test-data')
const data = uint8ArrayFromString('test-data')

const subscribeIterator = await daemons[1].client.pubsub.subscribe(topic)
const subscriber = async () => {
Expand Down

0 comments on commit ef57641

Please sign in to comment.