socket.io-with-pgp
transparent socket.io surcouche who encrypt and sign your messages transparently
Last updated 2 years ago by drulac .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install socket.io-with-pgp 
SYNC missed versions from official npm registry.

socket.io-with-PGP

transparent socket.io surcouche who encrypt and sign your messages transparently

var io = require('socket.io')(6336);
var SocketWithPGP = require('socket.io-with-pgp');
var SocketWithGet = require('socket.io-with-get');

try{
	(async ()=>{

		io.on('connection', async function(socket){
			let client = new SocketWithPGP(socket, async (client)=>{
				client = new SocketWithGet(client);

				client.on('ping', (data, cb)=>{
					cb(data);
				});

				client.get("name", {}, (err, data)=>{
					console.log(data);
				});
			});

			await client.generateKeys(512, { name:'Jon Smith', email:'jon@example.com' }, "secret passphrase");
		});


		var soc = require('socket.io-client')('http://localhost:6336');
		let socket = new SocketWithPGP(soc, async (soc)=>{

			socket = new SocketWithGet(socket);

			socket.get("ping", {start: new Date().getTime()}, (err, data)=>{
				let pingTime = new Date().getTime() - data.start;
				console.log(pingTime+" ms");
			});

			socket.on('name', (data, cb)=>{
				cb("My name is Jhon... Jhon Doe...");
			});
		});
		await socket.generateKeys(512, { name:'Jon Smith', email:'jon@example.com' }, "secret passphrase");

	})();
}catch(e){
	throw e;
}

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |