Home

Awesome

secure-webrtc-swarm

A wrapper around webrtc-swarm that adds peer whitelisting and authenticated asymmetric encryption of the WebRTC signaling data using that is passed among peers via signalhub using TweetNaCl.js (see crypto-ratchet.md).

Install

npm install https://github.com/peermusic/secure-webrtc-swarm.git

Usage

var nacl = require('tweetnacl')
var signalhub = require('signalhub')
var swarm = require('secure-webrtc-swarm')

var hub = signalhub('swarm-example', ['http://yourdomain.com'])
var keyPair = nacl.box.keyPair()

var sw = swarm(hub, keyPair)

sw.on('peer', function (peer, id) {
  console.log('connected to a new peer:', id)
  console.log('total peers:', sw.peers.length)
})

Adding inviting peers works by modifying the sw object or already providing the relevant information while setting sw up. See the example for reference.

License

MIT