Skip to content

yakirKahana/ee2ee.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy end-to-end encryption

⚠️ Disclaimer ⚠️

I am NOT a cryptography expert. This library provides only basic encryption.

this library uses AES-GCM 256bit

Usage

link the file to your HTML

<script src="./ee2ee.min.js"></script>

initialization:

let alice = new ee2e();

After initialization, your public key will generate automatically and will be stored in

 alice.dh.publicExported

After you send the public key to the recipient, they'll need to generate the shared key

//from the recipient's (bob) side:
bob.dh.generateSharedKey(alicePublicKey);

Keep in mind

both sides need to send and receive each other's public key

//getting bob's public key
alice.dh.generateSharedKey(bobPublicKey);

after the secret key is generated, you can encrypt by using the encrypt function

let encryptedMsgToAlice = bob.encrypt('Hi Alice, How are you?');

and dycrypt by using the decrypt function

//decrypting bob's message
let msgFromBob = alice.decrypt(bobsEncryptedMsg);
// msgFromBob == "Hi Alice, How are you?"

build from source

git clone /~https://github.com/yakirKahana/ee2ee.js.git
cd ee2ee.js
npm install
npm run build