Signal Exchange
WebRTC signal exchange by public key.
npm install signal-exchange
Signal exchange uses ECDH public keys as identifiers in the exchange. This means that peers can "call" each other using public keys and encrypt the offer messages through the exchange.
const SimplePeer = const signalExchange = const sodi = // Generate keypairs w/ sodi.let user1 = sodilet user2 = sodi let send1 = let send2 = let peer1 = initiator:true trickle:falsepeer1
signalExchange([url], privateKey, publicKey, onOffer)
Returns a send
function.
- url (optional) The url of the peer exchange. Defaults to
wss://signalexchange.now.sh
a public exchange hosted on zeit. - privateKey (required) hex encoded private key.
- publicKey (required) hex encoded public key.
- onOffer (required) function handler for signals sent to your public key
onOffer(signal)
- signal Object
- to hex encoded public key.
- from hex encoded public key.
- offer decrypted offer object, can be passed directly to SimplePeer.
send(publicKey, offer)
- publicKey (required) hex encoded public key.
- offer (required) offer object from SimplePeer.