mafintosh / webrtc-swarm

Create a swarm of p2p connections using webrtc and a signalhub
MIT License
380 stars 60 forks source link

Choose UUID + Wrap/Unwrap Signaling Data #6

Closed perguth closed 8 years ago

perguth commented 8 years ago

Added generic wrapping and unwrapping functions and the ability to manually set the UUID. Together that can be used to implement a whitelist and/or encryption of the signaling data.

After playing around a while mainly trying to authenticate peers and encrypt signaling data this seems to be the most generic but still workable implementation.

New options at one glance:

opts = {
  uuid: 'string',
  wrap: function (data, channel),
  unwrap: function (data, channel)  // if return value falsy: data gets dropped
}

There is no debug message when unwrap fails. I thought that message can/should be thrown by the unwrap function itself.

All changes are backward compatible.

perguth commented 8 years ago

Using those changes I took a shoot at building a wrapper that adds whitelisting and authenticated encryption of the signaling data here: https://github.com/peermusic/secure-webrtc-swarm

mafintosh commented 8 years ago

2.3.0 - happy new year :tada:

perguth commented 8 years ago

Happy new year :tada: