Skip to content

laggingreflex/socket.io-encrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

socket.io-encrypt

Patches socket.emit and and socket.on functions to send encrypted and decrypt messages using cryptr.

Install

npm i socket.io-encrypt

Usage

client

const SocketIO = require('socket.io-client')
const encrypt = require('socket.io-encrypt')

const socket = SocketIO(SERVER_URL)
encrypt('secret')(socket)

socket.emit('message', {/* will be encrypted */})

server

const SocketIO = require('socket.io')
const encrypt = require('socket.io-encrypt')

const io = SocketIO({})
io.use(encrypt(secret))

io.on('connect', socket => {

  socket.on('message', data /* decrypted */ => { ... })
  socket.on('error', console.error /* handle decryption errors */)

})

About

Send encrypted and decrypt messages

Resources

Stars

Watchers

Forks

Packages

No packages published