Encryption of nicknames

This commit is contained in:
Hexagon 2014-09-18 19:48:17 +02:00
parent 6972d3be6a
commit 4a6aa47eec
3 changed files with 18 additions and 6 deletions

View File

@ -1,4 +1,16 @@
cryptalk
About
========
Encrypted instant chat
Cryptalk is a Node.js based encrypted instant chat
Installation
========
Clone this repo
Install Node.js, preferably the latest version, then pull express.io and
node-uuid from npm.
```npm install node

View File

@ -149,7 +149,7 @@ define('cryptalk', {
socket.emit('message:send', {
room: room,
msg: $.AES.encrypt(buffer, room + key).toString(),
nick: nick
nick: (nick && nick != undefined) ? $.AES.encrypt(nick, room + key).toString() : false
});
// Adn the the buffer
@ -184,7 +184,7 @@ define('cryptalk', {
.on('message:send', function (data) {
var decrypted = $.AES.decrypt(data.msg, room + key),
sanitized = $.escapeHtml(decrypted),
nick = (data.nick == undefined || !data.nick ) ? templates.default_nick : $.escapeHtml(data.nick);
nick = (data.nick == undefined || !data.nick ) ? templates.default_nick : $.escapeHtml($.AES.decrypt(data.nick, room + key));
if (!decrypted) {
post('error', templates.messages.unable_to_decrypt);