-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from hmerritt/dev/2.0.0
Major refactor v2.0.0
- Loading branch information
Showing
24 changed files
with
2,795 additions
and
681 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.{js,json,yml}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.yarn/** linguist-vendored | ||
/.yarn/releases/* binary | ||
/.yarn/plugins/**/* binary | ||
/.pnp.* binary linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.env | ||
.env.local | ||
|
||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
bundle/* | ||
output/* | ||
bundle.js | ||
output.js | ||
bundle.js.map | ||
output.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,64 @@ | ||
# Discord Encryption | ||
|
||
> We're back baby :) | ||
An experimental encryption solution for Discord using [BetterDiscord](https://github.com/rauenzi/BetterDiscordApp/releases) | ||
|
||
## Features | ||
|
||
Adds ability to encrypt / decrypt messages on discord using a set password | ||
- Utilizes AES-256 encryption via the [stanford javascript crypto library](https://github.com/bitwiseshiftleft/sjcl) | ||
- Per-chat PSK | ||
- PSK saved as md5 (cleartext passwords not present in localStorage) | ||
- Messages are decrypted the moment they are receved with little to no delay | ||
- Encrypted messages appear as green | ||
- Messages that fail to be decrypted (most likely due to an incorrect password) display a message and appear as red | ||
|
||
- Utilizes AES-256 encryption via the [stanford javascript crypto library](https://github.com/bitwiseshiftleft/sjcl) | ||
- Per-chat PSK | ||
- PSK saved as md5 (cleartext passwords not present in localStorage) | ||
- Messages are decrypted the moment they are receved with little to no delay | ||
- Encrypted messages appear as green | ||
- Messages that fail to be decrypted (most likely due to an incorrect password) display a message and appear as red | ||
|
||
![Context](https://i.imgur.com/aKGUqEn.png) | ||
![Context](https://i.imgur.com/FqfRAAO.png) | ||
|
||
## How to use | ||
|
||
### Install | ||
- Install Discord | ||
- Install BetterDiscord | ||
- Navigate to Discord Preferences -> BD/Plugins -> Open Plugin Folder | ||
- Place 'encryption.plugin.js' in BetterDiscord's plugin folder | ||
- Enable encryption in the BD/Plugins preference pane. | ||
|
||
- Install Discord | ||
- Install BetterDiscord | ||
- Navigate to Discord Preferences -> BD/Plugins -> Open Plugin Folder | ||
- Place 'encryption.plugin.js' in BetterDiscord's plugin folder | ||
- Enable encryption in the BD/Plugins preference pane. | ||
|
||
> It may ask to install an additional plugin `0PluginLibrary.plugin` which is required - It should install itself if you click `download`. | ||
![Context](https://i.imgur.com/H2Z7N7I.png) | ||
![Context](https://i.imgur.com/Ea0AdqO.png) | ||
### Usage | ||
- To toggle the encryption simply click the lock icon. You will be prompted for a password, if none is found for the chat channel. | ||
- Received messages are decrypted automatically | ||
- To view or change the encryption password simply right-click the lock icon and an input box will appear - passwords are automatically saved as you type | ||
|
||
![Context](https://i.imgur.com/Zumi9SZ.png) | ||
### Usage | ||
|
||
## Bugs | ||
- To toggle the encryption simply click the lock icon. You will be prompted for a password, if none is found for the chat channel. | ||
- Received messages are decrypted automatically | ||
- To view or change the encryption password simply right-click the lock icon and an input box will appear - passwords are automatically saved as you type | ||
|
||
![Context](https://i.imgur.com/Zumi9SZ.png) | ||
|
||
### Encrypted Message | ||
|
||
![Context](https://i.imgur.com/s8CYNJK.png) | ||
|
||
### Decrypted Message | ||
|
||
![Context](https://i.imgur.com/CCqW5aj.png) | ||
|
||
## Development | ||
|
||
This plugin uses [`rollup`](https://rollupjs.org/) to bundle what's in `src` into the final `encryption.plugin.js` script. | ||
|
||
Getting `rollup` to work with `BetterDiscord` was a **gamechanger** as it allows the plugin to use multiple src files instead of just one. This makes development much nicer. | ||
|
||
How to build Build: | ||
|
||
``` | ||
$ yarn && yarn build | ||
``` | ||
|
||
> This runs both `rollup`, and a `build-patch` script to add the required `BetterDiscord` META tags. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const fs = require('fs'); | ||
const os = require('os'); | ||
const pathfs = require('path'); | ||
const prependFile = require('prepend-file'); | ||
|
||
const isDev = process.argv?.[2] === 'dev'; | ||
const pluginOutputFile = pathfs.join(__dirname, '../', 'encryption.plugin.js'); | ||
const betterDiscordPluginDir = `C:/Users/${os.userInfo().username}/AppData/Roaming/BetterDiscord/plugins`; | ||
|
||
const main = async () => { | ||
console.log(`> Patching build`); | ||
|
||
console.log(`> Adding META data to plugin output file`); | ||
await prependFile(pluginOutputFile, `/** | ||
* @name Encryption | ||
* @description Message encryption using AES-256 | ||
* @author hmerritt | ||
* @website https://github.com/hmerritt/discord-encryption | ||
* @source https://raw.githubusercontent.com/hmerritt/discord-encryption/master/encryption.plugin.js | ||
*/ | ||
`); | ||
|
||
if (isDev) { | ||
console.log(`> Copy output file to betterDiscord plugin directory`); | ||
fs.copyFileSync(pluginOutputFile, `${betterDiscordPluginDir}/encryption.plugin.js`); | ||
} | ||
|
||
console.log('> Patching complete :)'); | ||
}; | ||
|
||
(async () => { | ||
await main(); | ||
process.exit(); | ||
})(); |
Oops, something went wrong.