End to End Encryption on Discord

in #discord6 years ago

encryption.png

*Disclaimer this is for educational use only and I do not take responsibility for anything that you may choose to do with this code

The engineers and developers at Discord are very, very clever people. Being so clever begs the question “Why don’t they provide E2E encryption?”. Well, in the age where information is money the answer is very clear.

In Discord’s TOS they state very clearly that any messages or information passed over their system voluntarily will become their property. If you read message boards across the internet they will say that they won’t encrypt for your safety because there are bad people doing bad things. Well, that is true.. but “Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety.” — Benjamin Franklin

I went on to try and figure out what I could do about this for myself, and for anyone else who loves privacy and encryption and I present to you my solution.

This solution is for the Desktop version, and although not tested browser version of the Discord service.

The brilliant minds at Discord decided to make the desktop application in Electron. Which is basically just a chromium browser.

So you may be astounded to find out when you complete step one.

Step One:

Open your discord application and press CTRL+SHIFT+I

This will bring up the chrome developer tools. Yep. All those interesting tools used for debugging applications built right into your desktop client.

Step Two:

Click the tab that says “Console”.

This console gives you direct access into the javascript powering your discord client. Through this we can upload our own custom script that will allow us to communicate via encryption.

Step Three:

**Copy the code from the following link: **

Code

Step Four:

Update the following line on the script:

var SECRET_KEY = “CREATE YOUR OWN SECRET KEY HERE”

Whatever secret key you choose the people you want to be able to see your messages in your servers will also need to know this key, and update their copy of the code as well.

Step 5:

Paste all of the code into the console terminal and hit enter.

Viola!

By using the prefix == your messages will be encrypted. The code will automatically decrypt any encrypted messages sent to you (as long as you have the appropriate key for the code).

The magic in this code is to intercept XHR requests leaving your browser and encrypt the content as seen here:

(function(send) {

    XMLHttpRequest.prototype.send = function(data) {

        if (data) {

           var jsn = JSON.parse(data)

           if(jsn.content.toString().substring(0,2) == PREFIX) {

           plaintxt = jsn.content.substring(2)

           jsn.content = "eMsg: " + CryptoJS.AES.encrypt(plaintxt, SECRET_KEY).toString();

          data = JSON.stringify(jsn)

          }

      }

    send.call(this, data);

};

Use at your own risk I do not know if this breaks Discords TOS, but I’m betting they want your data.

Sort:  

Thank you for contributing to the Gaming Community on Steemit. You have been given an upvote by @steemgg. For more inspiration, visit our platform Steemgg, the first html5 gaming platform built on the Steem blockchain.
Vote for bobdos Witness

Thank you so much for sharing this amazing post with us!

Have you heard about Partiko? It’s a really convenient mobile app for Steem! With Partiko, you can easily see what’s going on in the Steem community, make posts and comments (no beneficiary cut forever!), and always stayed connected with your followers via push notification!

Partiko also rewards you with Partiko Points (3000 Partiko Point bonus when you first use it!), and Partiko Points can be converted into Steem tokens. You can earn Partiko Points easily by making posts and comments using Partiko.

We also noticed that your Steem Power is low. We will be very happy to delegate 15 Steem Power to you once you have made a post using Partiko! With more Steem Power, you can make more posts and comments, and earn more rewards!

If that all sounds interesting, you can:

Thank you so much for reading this message!

Congratulations @pacewindu! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.19
TRX 0.14
JST 0.029
BTC 64112.50
ETH 3174.45
USDT 1.00
SBD 2.54