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

View File

@ -10,7 +10,7 @@ define({
'Available commands: \n' + 'Available commands: \n' +
' /generate Generate a random room id \n' + ' /generate Generate a random room id \n' +
' /join RoomId Joins a room \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' + ' /nick NickName Sets an optinal nickname \n' +
' /key OurStrongPassphrase Sets the password used for \n' + ' /key OurStrongPassphrase Sets the password used for \n' +
' encryption/decryption \n' + ' encryption/decryption \n' +
@ -25,7 +25,7 @@ define({
'</li> ', '</li> ',
default_nick: 'Anonymous', default_nick: 'Anonymous',
post: { post: {
info: '<li>INF> <i class="info">{text}</i></li>', info: '<li>INF> <i class="info">{text}</i></li>',
server: '<li>SRV> <i class="server">{text}</i></li>', server: '<li>SRV> <i class="server">{text}</i></li>',