From 4a6aa47eecbc825a5f96431250e01946e5f207c8 Mon Sep 17 00:00:00 2001 From: Hexagon Date: Thu, 18 Sep 2014 19:48:17 +0200 Subject: [PATCH] Encryption of nicknames --- README.md | 16 ++++++++++++++-- public/js/cryptalk_modules/cryptalk.js | 4 ++-- public/js/cryptalk_modules/templates.js | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8b99aec..6217661 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/public/js/cryptalk_modules/cryptalk.js b/public/js/cryptalk_modules/cryptalk.js index 0d8122f..4eab40d 100644 --- a/public/js/cryptalk_modules/cryptalk.js +++ b/public/js/cryptalk_modules/cryptalk.js @@ -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); diff --git a/public/js/cryptalk_modules/templates.js b/public/js/cryptalk_modules/templates.js index d26b6ea..1aa9d59 100644 --- a/public/js/cryptalk_modules/templates.js +++ b/public/js/cryptalk_modules/templates.js @@ -10,7 +10,7 @@ define({ 'Available commands: \n' + ' /generate Generate a random room id \n' + ' /join RoomId Joins a room \n' + - ' /leave Leaves the current room \n' + + ' /leave Leaves the current room \n' + ' /nick NickName Sets an optinal nickname \n' + ' /key OurStrongPassphrase Sets the password used for \n' + ' encryption/decryption \n' + @@ -25,7 +25,7 @@ define({ ' ', default_nick: 'Anonymous', - + post: { info: '
  • INF> {text}
  • ', server: '
  • SRV> {text}
  • ',