diff --git a/src/public/main.js b/src/public/main.js index a55d294..cce34f9 100644 --- a/src/public/main.js +++ b/src/public/main.js @@ -22,6 +22,7 @@ $(function() { var $messages = $('.messages'); // Messages area var $inputMessage = $('.inputMessage'); // Input message input box var $key = $('#key'); + var $genKey = $('#new_key'); var $chatPage = $('.chat.page'); // The chatroom page @@ -253,6 +254,11 @@ $(function() { $inputMessage.focus(); }); + $genKey.click(function () { + var key = CryptoJS.SHA3(Math.random().toString(36).substring(7)).toString(); + $key.val(key); + }); + // Socket events // Whenever the server emits 'login', log the login message diff --git a/src/views/index.mustache b/src/views/index.mustache index e96d5ba..362e379 100644 --- a/src/views/index.mustache +++ b/src/views/index.mustache @@ -31,7 +31,10 @@
This is your chat encryption key. Anyone who is in this chat room must use the same key to decrypt chat messages. This key is NOT stored nor transmitted to the server. If the key does not match, other clients will see encrypted messages. You may change the key as many times as you want.
+This chat encryption key is randomly generated by every client. Clients must use the same chat key to decrypt chat messages. This key is NOT STORED nor transmitted to the server. Regardless if the room URL was shared, chat messages will appear as hash values until the same key is used between clients. You may change the key as many times as you want.
+