Skip to content

Commit acc84e6

Browse files
committed
update comment line
1 parent f9eb762 commit acc84e6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/hooks/useSendMessage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const useSendMessage = () => {
3535

3636
let encryptedMessage = messageContent.text;
3737

38-
// If the e2e feature of the client is enabled and the message is not generated by the system
38+
// Encrypt message with RSA; If the tenant enabled E2E encryption and it's not a system message
3939
if (e2e && !message.system) {
4040
const room = rooms.find((room) => room.roomId === roomId);
4141

@@ -58,7 +58,7 @@ const useSendMessage = () => {
5858
}
5959
}
6060

61-
// AES encryption is the standard encryption method and encrypts every messages. It encrypts data by creating IV
61+
// AES encryption is the standard encryption method and encrypts every messages. It encrypts data by generating IV.
6262
const iv = forge.random.getBytesSync(16);
6363
encryptedMessage = aesEncrypt({
6464
key: secretKey,

src/utils/SocketController.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const SocketController = () => {
214214
const handleMessage = (data: DataProps) => {
215215
try {
216216
const { message: messageData, iv } = data;
217-
// decrypt the encrypted message
217+
// Decrypt, encrypted message with AES
218218
const decryptedMessage: MessageInfoProps = JSON.parse(
219219
aesDecrypt({
220220
key: secretKey,
@@ -227,7 +227,13 @@ const SocketController = () => {
227227
const { roomId } = decryptedMessage;
228228
const room = rooms.find(({ roomId: Id }) => Id === roomId);
229229

230-
// If the e2e feature of the client is enabled, the active user has a private key, the room is a one-to-one room (not a group), and the message is not generated by the system
230+
/**
231+
* If the tenant enabled E2E encryption and
232+
* It's not a system message and
233+
* The active user has a private key and
234+
* The room is not a community room (one-to-one room)
235+
* Decrypt RSA message
236+
*/
231237
if (
232238
e2e &&
233239
selfUser?.privateKey &&

0 commit comments

Comments
 (0)