This guide is intended for developers who want to contribute to the project. It is not intended for users who want to use the project.
Clone the cloak repository:
git clone https://github.com/cloak-dev/cloak
Clone the docs repository:
git clone https://github.com/cloak-dev/docs
Any modern browser should work. In particular, the WebCrypto API must be available.
Read our blog post on how end-to-end encryption works.
The core of Cloak is the E2EE
class, which is responsible for maintaing key-pairs, and provides methods to perform ECDH, as well as AES-CTR encryption and decryption.
The Cloak
class is then responsible for hooking into the chat application, and using the E2EE
class to encrypt and decrypt messages.
Hooking into the chat application goes two ways:
-
Hooking into the "send" button, and encrypting the message before it is sent.
-
Hooking into the websocket connection, and decrypting the message before it is displayed.
You may ask, how does key exchange happen? Do the users need to do it manually out of band?
No! The key exchange is handled by cloak itself using the message hooking mechanism itself. This is received by the cloak instance in the receivers end, and the key exchange is completed.
If you want to contribute to the project, you can do so by:
- Opening an issue on the cloak repository.
- Adding support for a new chat application. (see below)
- Contributing to the documentation
- Contributing to the blog
To add support for a new chat application, you need to do the following:
- Create a new file in the
scripts
directory, and name it after the chat application. For example, if you are adding support for Discord, you would name the filediscord.js
. - Write a hook that hooks into the chat application's "send" button, and encrypts the message before it is sent using the
E2EE
class. You can use thescripts/basic.js
file as a reference. - Write a hook that hooks into the chat application's websocket connection, and decrypts the message before it is displayed using the
E2EE
class. You can use thescripts/basic.js
file as a reference. - You may add hooks for images, files and any other type of message as well.
- Test your code, using the test chat server provided.
- Open a pull request.
The core of Cloak is closed to contributions. This is because we want to ensure that the core of Cloak is secure, and we don't want to compromise on that. However, we are open to contributions to the chat application hooks, and the documentation.