diff --git a/packages/rocketchat-sharedsecret/package.js b/packages/rocketchat-sharedsecret/package.js
new file mode 100644
index 000000000000..4371ff0846a0
--- /dev/null
+++ b/packages/rocketchat-sharedsecret/package.js
@@ -0,0 +1,21 @@
+Package.describe({
+ name: 'rocketchat:sharedsecret',
+ version: '0.0.1',
+ summary: 'RocketChat libraries',
+ git: ''
+});
+
+Package.onUse(function(api) {
+ api.versionsFrom('1.0');
+
+ api.use([
+ 'coffeescript',
+ 'rocketchat:lib@0.0.1'
+ ]);
+
+ api.use(['jparker:crypto-aes'], ['server','client']);
+
+ api.addFiles('sharedsecret.coffee', ['server','client']);
+});
+
+Package.onTest(function(api) {});
diff --git a/packages/rocketchat-sharedsecret/sharedsecret.coffee b/packages/rocketchat-sharedsecret/sharedsecret.coffee
new file mode 100644
index 000000000000..19b72c746ad3
--- /dev/null
+++ b/packages/rocketchat-sharedsecret/sharedsecret.coffee
@@ -0,0 +1,82 @@
+SharedSecret = []
+
+if (Meteor.isServer)
+ class EncryptMessage
+ constructor: (message) ->
+ currentUser = Meteor.user()._id
+ currentRoomId = message.rid
+
+ if(SharedSecret? && SharedSecret[currentUser]? && SharedSecret[currentUser][currentRoomId]?)
+ currentSecret = SharedSecret[currentUser][currentRoomId]
+ encrypted = CryptoJS.AES.encrypt(message.msg, currentSecret)
+ message.msg = encrypted.toString()
+
+ #urls
+ if(message.urls)
+ for urls in message.urls
+ urls.url = CryptoJS.AES.encrypt(urls.url, currentSecret).toString()
+
+ message.encrypted = true
+
+ return message
+
+ class HandleSlashCommand
+ constructor: (command, params, item) ->
+ if(command == "setsecretkey")
+ currentUser = Meteor.user()._id
+ currentRoomId = item.rid
+ secret = params
+
+ if(secret == "off")
+ secret = null
+
+ if(SharedSecret[currentUser]?)
+ SharedSecret[currentUser][currentRoomId] = secret
+ else
+ SharedSecret[currentUser] = []
+ SharedSecret[currentUser][currentRoomId] = secret
+
+ RocketChat.callbacks.add 'beforeSaveMessage', EncryptMessage, 9999 #LAST
+ RocketChat.slashCommands.add 'setsecretkey', HandleSlashCommand
+
+if (Meteor.isClient)
+ class DecryptMessage
+ constructor: (message) ->
+ if(message.encrypted)
+ currentRoomId = message.rid
+ currentSecret = localStorage.getItem("rocket.chat.sharedSecretKey.#{currentRoomId}")
+
+ if(currentSecret?)
+ decrypted = CryptoJS.AES.decrypt(message.msg, currentSecret).toString(CryptoJS.enc.Utf8)
+
+ if(decrypted == "")
+ message.msg = "~ encrypted message ~"
+ message.html = "~ encrypted message ~"
+ else
+ lockImage = "/images/lock8.png"
+ message.msg = " " + decrypted
+ message.html = " " + decrypted
+
+ #urls
+ if(message.urls)
+ for urls in message.urls
+ urls.url = CryptoJS.AES.decrypt(urls.url, currentSecret).toString(CryptoJS.enc.Utf8)
+ else
+ message.msg = "~ encrypted message ~"
+ message.html = "~ encrypted message ~"
+
+ return message
+
+ class HandleSlashCommand
+ constructor: (command, params, item) ->
+ if(command == "setsecretkey")
+ secret = params
+ if(secret == "off")
+ secret = null
+ currentRoomId = item.rid
+ localStorage.setItem("rocket.chat.sharedSecretKey.#{currentRoomId}", secret)
+
+
+
+ RocketChat.callbacks.add 'renderMessage', DecryptMessage, -9999 #FIRST
+ RocketChat.slashCommands.add 'setsecretkey', HandleSlashCommand