An end-to-end ecrypted instant messaging application built on MERN Stack.
- The User registers with two input fields:
username(unique for all users)password
- SHA256 Hash function comes into play with this two fields, creating these datas:
auth = SHA256(username + password);- This gets saved onto the database, and will be used to authenticate user
without storing the password.
- This gets saved onto the database, and will be used to authenticate user
passphrase = SHA256(auth + password);- This is stored locally only. This serves as the passphrase seed for generating
the user's private key and public key.
- This is stored locally only. This serves as the passphrase seed for generating
privateKey = generateRSAKey(passphrase, 1024);- Creates a 1024 bit RSA private key, used to generate public key, this is not
sent to the server.
- Creates a 1024 bit RSA private key, used to generate public key, this is not
publicKey = publicKeyString(privateKey);- Derives a public key from the private key, this is sent onto the server and saved
for everyone to see and able to send messages privately.
- Derives a public key from the private key, this is sent onto the server and saved
- The User Logins with
usernameandpasswordauth = SHA256(username + password)for authentication- if success, jwt token will be saved locally and the
passphrasefor generating
the keys.
- if success, jwt token will be saved locally and the
- Global Channel (Not Encrypted)
- Clients sends
msgObjcontainingsenderName,message, andtimestampon plain text
and"global"as the msgObj'schannel - Client fetches all msgObj with
channel === "globalas filter, and displaying them in
asc order based on their timestamp. * Styling: IfsenderName === username, chatbubble will be displayed on the left side
and be labeled sent byYou.
- Clients sends
- Private Channels (Encrypted e2e)
- The User chooses someone to chat on a private channel
userPublicKeyandotherUserPublicKeyhashed with md5 will be their converstation's
privatechannelId.channelId = "0eRdpe5e7718b338fy12g130f6cb3f24"
- When The User sends a message, it creates 2 encrypted copies before it's sent to server.
- msgObj is encrypted with the
userPublicKey.name,message, andtimestampfields are all encrypted.
Adds apbkHashfield which is aSHA256hash of the public key used to encrypt the msgObj. _pbkHash = 5ccd628243718daagr5a2a10444c2a30b5f51016dd12382f8af6f2dffa721- The User will be the only one who can decrypt and read this message.
- msgObj is encrypted with The
otherUserPublicKey. Same fields encrypted, same field added.- otherUser will be the only one who can decrypt and read this message.
- Two encrypted copies: One encrypted with the sender's public key and one with the recipient's public key
- msgObj is encrypted with the
- Client fetches all msgObj with
channel === "0eRdpe5e7718b338fy12g130f6cb3f24"andpbkHash === 5ccd628243718daagr5a2a10444c2a30b5f51016dd12382f8af6f2dffa721as filter, and displaying them in asc
order based on their timestamp. * This will only fetch msgObjects encrypted using theuserPublicKeywhich can then be decrypted
usinguserPrivateKey
- The User chooses someone to chat on a private channel
Alice and Bob exchanges public keys with each other, when Alice sends a message to Bob she encrypts it with Bob's
Public Key and another copy with her publicKey. Bob does the same when he sends his messages. Alice then fetches
all messages on their channel that was encrypted using her public key and decrypts the conversation with her private
key then displayed on the client.
Cryptography, Assymetric Encryption, RSA, Hash Functions, WebDev, Javascript, NodeJs, ReactJs, ExpressJS, MongoDB, WebSockets