Socket
Socket
Sign inDemoInstall

ipfs-pubsub-1on1

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-pubsub-1on1 - npm Package Compare versions

Comparing version 0.0.8-360b964.0 to 0.0.8-5e2b754.0

.github/workflows/npm-publish.yml

2

package.json
{
"name": "ipfs-pubsub-1on1",
"version": "0.0.8-360b964.0",
"version": "0.0.8-5e2b754.0",
"description": "1-to-1 communication channel over IPFS Pubsub between two peers",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -1,2 +0,1 @@

import path from 'path'
import EventEmitter from 'events'

@@ -58,3 +57,3 @@ import PROTOCOL from './protocol.js'

if (this._closed) return
let m = encode(message)
const m = encode(message)
await this._ipfs.pubsub.publish(this._id, m)

@@ -61,0 +60,0 @@ }

@@ -14,3 +14,3 @@ export default async (ipfs, peersToWait, topic, isClosed) => {

return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
const interval = setInterval(async () => {

@@ -17,0 +17,0 @@ try {

import path from 'path'
import rmrf from 'rimraf'
import assert from 'assert'
import pMapSeries from 'p-map-series'
import {

@@ -15,12 +14,4 @@ connectPeers,

import Channel from '../src/direct-channel.js'
import getPeerID from '../src/get-peer-id.js'
import PROTOCOL from '../src/protocol.js'
// IPFS instances used in these tests
const ipfsPaths = [
'./tmp/peer1/ipfs',
'./tmp/peer2/ipfs',
'./tmp/peer3/ipfs'
]
Object.keys(testAPIs).forEach(API => {

@@ -30,3 +21,2 @@ describe(`DirectChannel ${API}`, function () {

const instances = []
let ipfsd1, ipfsd2, ipfsd3, ipfs1, ipfs2, ipfs3

@@ -138,3 +128,3 @@

return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
c1.on('error', reject)

@@ -162,3 +152,3 @@ c2.on('error', reject)

await c1.send('hello1')
c1.send('hello1')
})

@@ -170,7 +160,5 @@ })

it('connects the peers', async () => {
let c1, c2
const c1 = await Channel.open(ipfs1, id2)
const c2 = await Channel.open(ipfs2, id1)
c1 = await Channel.open(ipfs1, id2)
c2 = await Channel.open(ipfs2, id1)
let peers = await ipfs1.pubsub.peers(c1.id)

@@ -197,3 +185,3 @@ // assert.deepEqual(peers, [])

return new Promise(async (resolve, reject) => {
return async () => {
assert.equal(c1._closed, false)

@@ -210,3 +198,2 @@ assert.equal(c1._isClosed(), false)

c2.close()
const topics2 = await ipfs2.pubsub.ls()
assert.deepEqual(topics1, [])

@@ -221,5 +208,4 @@ assert.equal(c2._closed, true)

assert.deepEqual(peers2, [])
resolve()
}, 200)
})
}
})

@@ -245,5 +231,5 @@

it('throws an error if pubsub is not supported by given IPFS instance', async () => {
let c, err
let err
try {
c = await Channel.open({}, id2)
await Channel.open({}, id2)
} catch (e) {

@@ -257,5 +243,5 @@ err = e

it('throws an error if receiver ID was not given', async () => {
let c, err
let err
try {
c = await Channel.open(ipfs1)
await Channel.open(ipfs1)
} catch (e) {

@@ -262,0 +248,0 @@ err = e

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc