Skip to content
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
383 commits
Select commit Hold shift + click to select a range
7534a3c
use rest api for getUsersOfRoomWithoutKey
cardoso Sep 2, 2025
328bf15
add some type annotations
cardoso Sep 2, 2025
c2befab
add more history
cardoso Sep 2, 2025
13d94cf
fix warnings
cardoso Sep 2, 2025
263bb4a
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 3, 2025
33717df
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 4, 2025
2677e2e
add more history
cardoso Sep 4, 2025
cd67e17
bip39
cardoso Sep 4, 2025
6239bd9
add more history
cardoso Sep 4, 2025
ec2bdfd
add more history
cardoso Sep 4, 2025
67910bc
add more history
cardoso Sep 4, 2025
a096b7d
add more history
cardoso Sep 4, 2025
b570045
add more history
cardoso Sep 4, 2025
90cc5da
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 4, 2025
1f0ef12
simplify key agreement
cardoso Sep 4, 2025
970359f
simplify subscription changed
cardoso Sep 4, 2025
b7abc67
move subscription changed to room
cardoso Sep 4, 2025
8ab94c3
remove dead code
cardoso Sep 4, 2025
00878c3
fix formatting
cardoso Sep 4, 2025
74be31f
hoist key export
cardoso Sep 4, 2025
83a5870
don't ignore error
cardoso Sep 4, 2025
135a8a4
hoist wait for room
cardoso Sep 4, 2025
91394a1
remove dead code
cardoso Sep 4, 2025
63be7e0
fix flaky test
cardoso Sep 4, 2025
f57b0f0
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 4, 2025
84fbf87
remove adapters from notes
cardoso Sep 5, 2025
6ec2a80
simplify persist keys
cardoso Sep 5, 2025
ad48037
remove playwright workflow
cardoso Sep 5, 2025
9fadf22
use rest api for requesting subscription keys
cardoso Sep 5, 2025
c475e9f
stopClient doesn't need to be async
cardoso Sep 5, 2025
a29343b
aes-cbc backwards compat (wip)
cardoso Sep 5, 2025
833d0bb
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 5, 2025
b9a612a
reset own keys api
cardoso Sep 5, 2025
2039982
state READY -> KEYS_RECEIVED
cardoso Sep 5, 2025
4385b4e
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 6, 2025
4e118d5
add more history
cardoso Sep 6, 2025
8efc67d
fix initial handshake
cardoso Sep 6, 2025
33b8445
add more history
cardoso Sep 6, 2025
bad7af8
reduce logs
cardoso Sep 6, 2025
1b9539c
comment out duplicate room waiting
cardoso Sep 6, 2025
1818341
make tests run independent of cwd
cardoso Sep 6, 2025
af1ba41
remove unneeded shouldConvertReceivedMessages method
cardoso Sep 6, 2025
9d8cab6
update state diagrams
cardoso Sep 6, 2025
8b1e559
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 8, 2025
3651328
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 8, 2025
9bf3345
remove querystring and url imports
cardoso Sep 8, 2025
24f86f4
fix group key id
cardoso Sep 9, 2025
a45801d
revert some changes
cardoso Sep 9, 2025
91e9212
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 9, 2025
d9886dd
revert some changes
cardoso Sep 9, 2025
2bf1748
fix unit test
cardoso Sep 9, 2025
e37a774
revert some stuff
cardoso Sep 9, 2025
c2d9ad1
log error on decoding private key
cardoso Sep 10, 2025
cd067c7
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 10, 2025
4567149
improve logging
cardoso Sep 10, 2025
4509612
parse payload
cardoso Sep 10, 2025
8497882
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 10, 2025
6dcca49
e2ee v2 format
cardoso Sep 10, 2025
5ab11a1
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 10, 2025
7d857dc
fix lastMessage decryption
cardoso Sep 11, 2025
483f04e
fix decrypt desktop notifications
cardoso Sep 11, 2025
3558150
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 11, 2025
59246e6
improve logging
cardoso Sep 11, 2025
fb68b21
improve tracing
cardoso Sep 11, 2025
7a28884
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 12, 2025
667aee0
upgrade mnemonic word count to 12
cardoso Sep 12, 2025
9736533
remove separate package
cardoso Sep 12, 2025
ca0665e
clean up
cardoso Sep 12, 2025
4133051
remove separate package pt 2
cardoso Sep 12, 2025
cc75cf1
update readme
cardoso Sep 12, 2025
c3e34a7
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 12, 2025
25e890e
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 12, 2025
a4886c9
fix last message decryption
cardoso Sep 13, 2025
a515b9c
simplify logger
cardoso Sep 13, 2025
5fe1f6e
simplify decrypt
cardoso Sep 13, 2025
c04d3eb
rename key_id -> kid
cardoso Sep 14, 2025
d46de6f
fix passphrase entropy
cardoso Sep 14, 2025
a64bc5b
revert package.json changes
cardoso Sep 15, 2025
71cfec6
revert more changes
cardoso Sep 15, 2025
1e884a9
revert more changes
cardoso Sep 15, 2025
c9721ed
revert yarn.lock
cardoso Sep 15, 2025
10b0214
formatting
cardoso Sep 15, 2025
b836b21
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 15, 2025
b2139ef
fix pinned message decryption
cardoso Sep 15, 2025
a6f2857
quick fix for old keys
cardoso Sep 15, 2025
8f7ba75
Merge branch 'develop' into e2e-crypto-core
dougfabris Sep 15, 2025
c474fc1
add some more logging
cardoso Sep 15, 2025
4ae569b
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 15, 2025
9fbc1cd
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 16, 2025
4ae6ca1
add more history
cardoso Sep 16, 2025
a8cf5b4
chore: add more history
cardoso Sep 16, 2025
3bf31df
chore: keep trace inside log group
cardoso Sep 16, 2025
ac86fca
chore: add more history
cardoso Sep 16, 2025
94a26a4
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 16, 2025
ad2ea1a
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 16, 2025
cad05df
feat: support any length of prefix
cardoso Sep 16, 2025
9974c98
add encode operation
cardoso Sep 16, 2025
a1f6bce
Merge branch 'develop' into e2e-crypto-core
cardoso Sep 16, 2025
abd7039
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 17, 2025
3d22cae
chore: use @rocket.chat/base64
cardoso Sep 17, 2025
5bb5759
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 18, 2025
b94a411
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 18, 2025
8ae46f9
backwards compat first pass
cardoso Sep 18, 2025
3114815
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 18, 2025
c231af9
separate pbkdf2 logic
cardoso Sep 18, 2025
25df556
binary codec
cardoso Sep 18, 2025
dbfb1ab
Merge branch 'develop' into e2e-crypto-core
cardoso Sep 19, 2025
de5d4ea
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 19, 2025
03f7b89
chore: undo test changes
cardoso Sep 19, 2025
128cc91
Merge branch 'develop' into e2e-crypto-core
cardoso Sep 22, 2025
3637374
fix: lint errors
cardoso Sep 22, 2025
3fe56bd
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 22, 2025
532b10c
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 22, 2025
b53e205
chore: improve logging
cardoso Sep 22, 2025
6e22d4e
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 22, 2025
a1e033f
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 23, 2025
ce52cde
restore test file
cardoso Sep 23, 2025
27083c0
chore: remove Meteor.userId from e2ee
cardoso Sep 23, 2025
174285b
Merge branch 'develop' into e2e-crypto-core
cardoso Sep 23, 2025
38e1d83
remove unused cache
cardoso Sep 23, 2025
6b6d756
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 23, 2025
d8b86b6
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 23, 2025
020e8f9
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 24, 2025
ab8868f
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 24, 2025
bab8ed2
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 25, 2025
e4e5109
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 25, 2025
01b11ab
chore: remove unneedded EJSON.parse
cardoso Sep 25, 2025
8089fff
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 25, 2025
761a535
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 26, 2025
9a324d6
fix: native federation merge tweaks
cardoso Sep 26, 2025
6298157
fix: typings
cardoso Sep 26, 2025
74ff78a
Merge branch 'develop' into e2e-crypto-core
cardoso Sep 26, 2025
710ba57
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 29, 2025
88898b5
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 29, 2025
861a532
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 29, 2025
fa4ae9c
fix: support text in content
cardoso Sep 29, 2025
4a6abd4
fix: legacy test
cardoso Sep 29, 2025
74b9606
chore: use pre-baked data for legacy e2ee test
cardoso Sep 30, 2025
bc0fabb
test: remove unneeded api call
cardoso Sep 30, 2025
d5019b5
test: mobile content compatibility
cardoso Sep 30, 2025
f5f8718
chore: move AES logic to dedicated file
cardoso Sep 30, 2025
dffbad3
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Sep 30, 2025
85822f6
chore: move RSA logic to separate file
cardoso Sep 30, 2025
d602906
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Oct 1, 2025
a1d4318
fix: file upload
cardoso Oct 1, 2025
beecd4b
fix: file upload (2)
cardoso Oct 2, 2025
79f17bf
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Oct 2, 2025
40d9587
fix: getInstanceByRoomId
cardoso Oct 2, 2025
38244be
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 2, 2025
1b95d32
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 3, 2025
04416f3
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Oct 4, 2025
453d99a
fix: remove some span attributes
cardoso Oct 4, 2025
c668f9a
fix: add more validation
cardoso Oct 5, 2025
ce51598
fix: add validation to v2 payload decoding
cardoso Oct 5, 2025
e083e96
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 6, 2025
3717119
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 6, 2025
db56fbd
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 7, 2025
65fa476
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 7, 2025
d069195
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 7, 2025
e4e77fd
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 8, 2025
d391910
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 8, 2025
fe6610e
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Oct 10, 2025
903bb62
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 10, 2025
bd0bb72
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 11, 2025
c0801bf
fix: support v2 format in chat.update endpoint
cardoso Oct 11, 2025
5929d53
fix: lint errors
cardoso Oct 11, 2025
20bad63
fix: throw error on Binary.toArrayBuffer if character is multi-byte
cardoso Oct 13, 2025
7498580
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Oct 13, 2025
bd20698
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 14, 2025
dba9555
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 14, 2025
0cd16e6
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 15, 2025
14eee06
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 15, 2025
a364e81
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 15, 2025
72f6909
feat(e2ee): Refactor PBKDF2 utilities into granular functions
cardoso Oct 15, 2025
633e0cb
test(e2ee): Add unit tests for PBKDF2 utility functions
cardoso Oct 15, 2025
40820a4
feat(e2ee): Introduce `Codec` interface and `PrefixedBase64` codec
cardoso Oct 15, 2025
d6c467b
feat(e2ee): Implement `Keychain` for E2EE private key management
cardoso Oct 15, 2025
78799db
test(e2ee): Add unit tests for Keychain class
cardoso Oct 15, 2025
feed8f0
refactor(e2ee): Integrate `PrefixedBase64` codec into `E2ERoom`
cardoso Oct 15, 2025
6d3134d
refactor(e2ee): Integrate `Keychain` into `E2E` class
cardoso Oct 15, 2025
34aa35b
test(e2e): Update E2E tests and user fixtures for E2EE changes
cardoso Oct 15, 2025
fc567d5
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 15, 2025
02f39d1
Merge branch 'e2e-crypto-core' into chore/pbkdf2
cardoso Oct 15, 2025
6f0cebc
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 16, 2025
5f2de11
Merge branch 'e2e-crypto-core' into chore/pbkdf2
cardoso Oct 16, 2025
6010471
fix(e2e): correct E2EE passphrase management test structure
cardoso Oct 16, 2025
96ef239
refactor(e2ee): enhance cryptographic key type definitions
cardoso Oct 16, 2025
08a4d28
refactor(e2ee): narrow key type for `encrypt` function
cardoso Oct 16, 2025
f730434
test(e2ee): update `pbkdf2` tests for stricter type assertions
cardoso Oct 16, 2025
c427898
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 16, 2025
0789bb3
Merge branch 'e2e-crypto-core' into chore/pbkdf2
cardoso Oct 16, 2025
bf8a1a8
docs(e2ee): Clarify IStoredKeyV1 binary format with JSDoc
cardoso Oct 16, 2025
b3d273c
refactor(e2ee): Standardize encrypted key storage with EncryptedKey.e…
cardoso Oct 16, 2025
da8f9cd
chore(e2e-tests): Enable E2E key reset for passphrase management tests
cardoso Oct 16, 2025
8921927
docs(e2ee): Clarify stored key format comments
cardoso Oct 16, 2025
7447423
refactor(e2ee): Refine `Codec` type to support specific encode return…
cardoso Oct 16, 2025
cffa28c
refactor(e2ee): Standardize `EncryptedKey` representation and seriali…
cardoso Oct 16, 2025
7c2f43d
refactor(e2ee): Update keychain encryption for new `IStoredKeyV2` for…
cardoso Oct 16, 2025
19b72aa
test(e2ee): Add `base64Length` utility and update keychain tests
cardoso Oct 16, 2025
86097b0
chore: Apply minor formatting and whitespace consistency
cardoso Oct 16, 2025
1aba286
refactor(e2ee): Mark PBKDF2 algorithm name as readonly
cardoso Oct 16, 2025
ca2de37
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 16, 2025
2b637cc
Merge branch 'e2e-crypto-core' into chore/pbkdf2
cardoso Oct 16, 2025
6c8b65b
chore(e2ee): group keychain tests within a describe block
cardoso Oct 16, 2025
119e1f8
refactor(e2e): improve organization of passphrase management E2E tests
cardoso Oct 16, 2025
604aa59
Merge pull request #37243 from RocketChat/chore/pbkdf2
cardoso Oct 16, 2025
1d88713
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 16, 2025
d71d344
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Oct 17, 2025
568b979
chore: format
cardoso Oct 17, 2025
80f56cc
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 17, 2025
d94b372
refactor: ICodec interface
cardoso Oct 17, 2025
959aa2d
refactor: Keychain codec handling to a class-based implementation
cardoso Oct 17, 2025
5917c21
feat: PrefixedBase64 codec and tests; update imports to use it
cardoso Oct 17, 2025
c3c8c9f
refactor: AES CryptoKey types and importKey/encrypt/decrypt signatures
cardoso Oct 17, 2025
ee4f885
refactor: update call sites for AES encrypt/decrypt
cardoso Oct 17, 2025
9a381a2
test: binary codec
cardoso Oct 17, 2025
f055eec
chore: runtime and typings cleanups
cardoso Oct 17, 2025
ac7794b
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 17, 2025
abd959f
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 17, 2025
4580b0a
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 17, 2025
67b2a3c
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 17, 2025
aa8a325
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 17, 2025
50682f0
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 18, 2025
2c4410f
fix: federation conflict
cardoso Oct 20, 2025
ea6bc17
fix: formatting
cardoso Oct 20, 2025
e90e176
fix: typings
cardoso Oct 20, 2025
d034005
chore: add aes tests
cardoso Oct 20, 2025
6b964a2
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 20, 2025
aef5162
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 20, 2025
2afaa65
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 20, 2025
973bf98
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 21, 2025
e07ccdb
refactor: use ICodec interface (encode/decode) and update tests
cardoso Oct 21, 2025
d985a32
refactor: remove ByteBuffer-based helpers and file-reader helper
cardoso Oct 21, 2025
9b0644b
refactor: use Binary.encode/decode and replace removed helpers
cardoso Oct 21, 2025
ec7b32b
refactor: E2EE class behaviors, key handling, and key export/import
cardoso Oct 21, 2025
6e4354e
refactor: RSA module types and JWK import/export, and add RSA tests
cardoso Oct 21, 2025
f9753cb
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 22, 2025
44e85a5
chore: move crypto primitives to own folder
cardoso Oct 22, 2025
07f1158
fix: formatting
cardoso Oct 22, 2025
7e68273
refactor: type-safe crypto
cardoso Oct 22, 2025
81801bc
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 22, 2025
5c13a8e
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 23, 2025
65c7a72
fix: remove unneeded async
cardoso Oct 24, 2025
bb68cbf
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 24, 2025
de56c66
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 25, 2025
e38c9fe
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 27, 2025
7de2048
Merge branch 'develop' into e2e-crypto-core
cardoso Oct 27, 2025
62e2ff7
chore: remove dangling comment
cardoso Oct 27, 2025
b41a00e
chore: improve pbkdf2 types
cardoso Oct 27, 2025
6c48c94
chore(jest): webcrypto in client setup
cardoso Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/meteor/app/lib/server/functions/notifications/desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export async function notifyDesktopUser({
...('t' in message && {
t: message.t,
}),
...('content' in message && {
content: message.content,
}),
},
name,
audioNotificationValue,
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/app/message-pin/server/pinMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export async function pinMessage(message: IMessage, userId: string, pinnedAt?: D
text: originalMessage.msg,
author_name: originalMessage.u.username,
author_icon: getUserAvatarURL(originalMessage.u.username),
content: originalMessage.content,
ts: originalMessage.ts,
attachments: attachments.map(recursiveRemove),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ export const useDesktopNotification = () => {
return;
}

if (notification.payload.message?.t === 'e2e') {
const { message } = notification.payload;

if (message.t === 'e2e' && message.content) {
const e2eRoom = await e2e.getInstanceByRoomId(notification.payload.rid);
if (e2eRoom) {
notification.text = (await e2eRoom.decrypt(notification.payload.message.msg)).text;
const decrypted = await e2eRoom.decrypt(message.content);
// TODO(@cardoso): review backward compatibility
notification.text = decrypted.msg ?? '';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useSetting, usePermission, useEndpoint } from '@rocket.chat/ui-contexts
import { act, renderHook, waitFor } from '@testing-library/react';

import { OtrRoomState } from '../../../app/otr/lib/OtrRoomState';
import { E2EEState } from '../../lib/e2ee/E2EEState';
import { e2e } from '../../lib/e2ee/rocketchat.e2e';
import { useRoom, useRoomSubscription } from '../../views/room/contexts/RoomContext';
import { useE2EEState } from '../../views/room/hooks/useE2EEState';
Expand Down Expand Up @@ -70,7 +69,7 @@ describe('useE2EERoomAction', () => {
(useSetting as jest.Mock).mockReturnValue(true);
(useRoom as jest.Mock).mockReturnValue(mockRoom);
(useRoomSubscription as jest.Mock).mockReturnValue(mockSubscription);
(useE2EEState as jest.Mock).mockReturnValue(E2EEState.READY);
(useE2EEState as jest.Mock).mockReturnValue('READY');
(usePermission as jest.Mock).mockReturnValue(true);
(useEndpoint as jest.Mock).mockReturnValue(jest.fn().mockResolvedValue({ success: true }));
(e2e.isReady as jest.Mock).mockReturnValue(true);
Expand Down
12 changes: 2 additions & 10 deletions apps/meteor/client/hooks/roomActions/useE2EERoomAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';

import { OtrRoomState } from '../../../app/otr/lib/OtrRoomState';
import { E2EEState } from '../../lib/e2ee/E2EEState';
import { E2ERoomState } from '../../lib/e2ee/E2ERoomState';
import { getRoomTypeTranslation } from '../../lib/getRoomTypeTranslation';
import { useRoom, useRoomSubscription } from '../../views/room/contexts/RoomContext';
import type { RoomToolboxActionConfig } from '../../views/room/contexts/RoomToolboxContext';
Expand All @@ -23,7 +21,7 @@ export const useE2EERoomAction = () => {
const subscription = useRoomSubscription();
const e2eeState = useE2EEState();
const e2eeRoomState = useE2EERoomState(room._id);
const isE2EEReady = e2eeState === E2EEState.READY || e2eeState === E2EEState.SAVE_PASSWORD;
const isE2EEReady = e2eeState === 'READY' || e2eeState === 'SAVE_PASSWORD';
const readyToEncrypt = isE2EEReady || room.encrypted;
const permittedToToggleEncryption = usePermission('toggle-room-e2e-encryption', room._id);
const permittedToEditRoom = usePermission('edit-room', room._id);
Expand All @@ -34,13 +32,7 @@ export const useE2EERoomAction = () => {
const { otrState } = useOTR();

const isE2EERoomNotReady = () => {
if (
e2eeRoomState === E2ERoomState.NO_PASSWORD_SET ||
e2eeRoomState === E2ERoomState.NOT_STARTED ||
e2eeRoomState === E2ERoomState.DISABLED ||
e2eeRoomState === E2ERoomState.ERROR ||
e2eeRoomState === E2ERoomState.WAITING_KEYS
) {
if (e2eeRoomState === 'NOT_STARTED' || e2eeRoomState === 'DISABLED' || e2eeRoomState === 'ERROR' || e2eeRoomState === 'WAITING_KEYS') {
return true;
}

Expand Down
10 changes: 1 addition & 9 deletions apps/meteor/client/lib/e2ee/E2EEState.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
export enum E2EEState {
NOT_STARTED = 'NOT_STARTED',
DISABLED = 'DISABLED',
LOADING_KEYS = 'LOADING_KEYS',
READY = 'READY',
SAVE_PASSWORD = 'SAVE_PASSWORD',
ENTER_PASSWORD = 'ENTER_PASSWORD',
ERROR = 'ERROR',
}
export type E2EEState = 'NOT_STARTED' | 'DISABLED' | 'LOADING_KEYS' | 'READY' | 'SAVE_PASSWORD' | 'ENTER_PASSWORD' | 'ERROR';
21 changes: 9 additions & 12 deletions apps/meteor/client/lib/e2ee/E2ERoomState.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
export enum E2ERoomState {
NO_PASSWORD_SET = 'NO_PASSWORD_SET',
NOT_STARTED = 'NOT_STARTED',
DISABLED = 'DISABLED',
HANDSHAKE = 'HANDSHAKE',
ESTABLISHING = 'ESTABLISHING',
CREATING_KEYS = 'CREATING_KEYS',
WAITING_KEYS = 'WAITING_KEYS',
KEYS_RECEIVED = 'KEYS_RECEIVED',
READY = 'READY',
ERROR = 'ERROR',
}
export type E2ERoomState =
| 'NOT_STARTED'
| 'DISABLED'
| 'ESTABLISHING'
| 'CREATING_KEYS'
| 'WAITING_KEYS'
| 'KEYS_RECEIVED'
| 'READY'
| 'ERROR';
37 changes: 37 additions & 0 deletions apps/meteor/client/lib/e2ee/binary.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Binary } from './binary';

describe('Binary', () => {
describe('toString', () => {
it('should convert ArrayBuffer to string', () => {
const array = new Uint8Array([72, 101, 108, 108, 111]); // "Hello"
const result = Binary.encode(array.buffer);
expect(result).toBe('Hello');
});

it('should handle empty ArrayBuffer', () => {
const buffer = new ArrayBuffer(0);
const result = Binary.encode(buffer);
expect(result).toBe('');
});
});

describe('toArrayBuffer', () => {
it('should convert string to ArrayBuffer', () => {
const str = 'Hello';
const buffer = Binary.decode(str);
const uint8 = new Uint8Array(buffer);
expect(Array.from(uint8)).toEqual([72, 101, 108, 108, 111]);
});

it('should handle empty string', () => {
const str = '';
const buffer = Binary.decode(str);
expect(buffer.byteLength).toBe(0);
});

it('should throw RangeError for illegal char code', () => {
const str = 'Hello\u0100'; // Character with char code 256
expect(() => Binary.decode(str)).toThrowErrorMatchingInlineSnapshot(`"illegal char code: 256"`);
});
});
});
32 changes: 32 additions & 0 deletions apps/meteor/client/lib/e2ee/binary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { ICodec } from './codec';

export const Binary: ICodec<string, ArrayBuffer> = {
encode(buffer: ArrayBuffer): string {
const uint8 = new Uint8Array(buffer);
const CHUNK_SIZE = 8192; // Process in chunks for performance
let result = '';
for (let i = 0; i < uint8.length; i += CHUNK_SIZE) {
const chunk = uint8.subarray(i, i + CHUNK_SIZE);
result += String.fromCharCode(...chunk);
}
return result;
},
decode(str: string): ArrayBuffer {
// Create a Uint8Array of the same length as the string.
// This will be a view on the new ArrayBuffer.
const buffer = new ArrayBuffer(str.length);
const uint8 = new Uint8Array(buffer);

// Iterate through the string, getting the character code for each
// character and setting it as the value for the corresponding byte.
for (let i = 0; i < str.length; i++) {
const charCode = str.charCodeAt(i);
if (charCode > 0xff) {
throw new RangeError(`illegal char code: ${charCode}`);
}
uint8[i] = charCode;
}

return buffer;
},
};
4 changes: 4 additions & 0 deletions apps/meteor/client/lib/e2ee/codec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ICodec<TIn, TOut, TEnc = TIn> {
decode: (data: TIn) => TOut;
encode: (data: TOut) => TEnc;
}
144 changes: 144 additions & 0 deletions apps/meteor/client/lib/e2ee/content.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import { decodeEncryptedContent } from './content';
import { importKey, decrypt, type Key } from './crypto/aes';

describe('content', () => {
const msgv1web = Object.freeze({
_id: 'JfAxN6Ncsw2XS9eiY',
rid: '68dad82a10815056615446aa',
e2eMentions: {
e2eUserMentions: [],
e2eChannelMentions: [],
},
content: Object.freeze({
algorithm: 'rc.v1.aes-sha2',
ciphertext: '32c9e7917b78LHjHfqLMeDn+2UK1PhD/soFe8CVwvFdLkslcfxNHby4=',
}),
t: 'e2e',
ts: {
$date: '2025-09-29T19:07:07.908Z',
},
u: {
_id: 'bm4cAAcN92jgXe2jN',
username: 'alice',
name: 'alice',
},
msg: '',
_updatedAt: {
$date: '2025-09-29T19:07:07.929Z',
},
urls: [],
mentions: [],
channels: [],
});

const msgv1mob = Object.freeze({
_id: 'AZF8Myj605B3f7ZPL',
rid: '68dad82a10815056615446aa',
msg: '32c9e7917b783JpM8aOVludqIRzx+DOqjEU9Mj3NUWb+/GLRl7sdkvTtCMChH1LBjMjJJvVJ6Rlw4dI8BYFftZWiCOiR7TPwriCoSPiZ7dY5C4H2q8MVSdR95ZiyG7eWQ5j5/rxzAYsSWDA9LkumW8JBb+WQ1hD9JMfQd4IXtlFMnaDgEhZhe/s=',
t: 'e2e',
e2e: 'pending',
e2eMentions: {
e2eUserMentions: [],
e2eChannelMentions: [],
},
content: Object.freeze({
algorithm: 'rc.v1.aes-sha2',
ciphertext:
'32c9e7917b783JpM8aOVludqIRzx+DOqjEU9Mj3NUWb+/GLRl7sdkvTtCMChH1LBjMjJJvVJ6Rlw4dI8BYFftZWiCOiR7TPwriCoSPiZ7dY5C4H2q8MVSdR95ZiyG7eWQ5j5/rxzAYsSWDA9LkumW8JBb+WQ1hD9JMfQd4IXtlFMnaDgEhZhe/s=',
}),
ts: {
$date: '2025-09-29T19:28:35.261Z',
},
u: {
_id: 'RQTYT5RJoDKZFwDhk',
username: 'bob',
name: 'bob',
},
_updatedAt: {
$date: '2025-09-29T19:28:35.274Z',
},
urls: [],
mentions: [],
channels: [],
});

describe('v1 messages', () => {
let key: Key<{ name: 'AES-CBC'; length: 128 }>;

beforeAll(async () => {
key = await importKey({
alg: 'A128CBC',
ext: true,
k: 'qb8In0Rpa9nwSusvxxDcbQ',
key_ops: ['encrypt', 'decrypt'],
kty: 'oct',
});
});

test('parse v1 web message', async () => {
const parsed = decodeEncryptedContent(msgv1web.content);
const decrypted = await decrypt(key, parsed);
expect(decrypted).toMatchInlineSnapshot(`"{"msg":"hello"}"`);
});

test('parse v1 mobile message', async () => {
const parsed = decodeEncryptedContent(msgv1mob.content);
const decrypted = await decrypt(key, parsed);
expect(decrypted).toMatchInlineSnapshot(
`"{"_id":"AZF8Myj605B3f7ZPL","text":"world","userId":"RQTYT5RJoDKZFwDhk","ts":{"$date":1759174115076}}"`,
);
});

test('parse v1 mobile message from msg field', async () => {
const parsed = decodeEncryptedContent(msgv1mob.msg);
const decrypted = await decrypt(key, parsed);
expect(decrypted).toMatchInlineSnapshot(
`"{"_id":"AZF8Myj605B3f7ZPL","text":"world","userId":"RQTYT5RJoDKZFwDhk","ts":{"$date":1759174115076}}"`,
);
});
});

const msgv2web = Object.freeze({
_id: 'h6sXWTiKcWfcgkhgo',
rid: '68c9da1b0427bc33b429207e',
e2eMentions: {
e2eUserMentions: [],
e2eChannelMentions: [],
},
content: Object.freeze({
algorithm: 'rc.v2.aes-sha2',
kid: 'f46d2864-0384-4a87-8815-51fba2cad216',
iv: 'wXbYQ8q9sYRCHtNp',
ciphertext: 'cIDO9mXzCCrrl/wORP0Jf6oWeusqzSCXVGGvY7CHrA==',
}),
t: 'e2e',
ts: {
$date: '2025-09-30T18:05:30.876Z',
},
u: {
_id: 'Ctk47kkuzJihnmvZE',
username: 'alice',
name: 'Alice',
},
msg: '',
_updatedAt: {
$date: '2025-09-30T18:05:30.887Z',
},
urls: [],
mentions: [],
channels: [],
});

test('parse v2 web message', async () => {
const parsed = decodeEncryptedContent(msgv2web.content);
const key = await importKey({
alg: 'A256GCM',
ext: true,
k: '9o1xoHt4OamRJvnaLna-5akUb5L98S_iWYGGaXPZ1Yg',
key_ops: ['encrypt', 'decrypt'],
kty: 'oct',
});
const decrypted = await decrypt(key, parsed);
expect(decrypted).toMatchInlineSnapshot(`"{"msg":"hello"}"`);
});
});
Loading
Loading