Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9db4c1b

Browse files
authored
Add flags to /versions about whether new rooms are encrypted by default. (#8343)
1 parent 14b5b48 commit 9db4c1b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

changelog.d/8343.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add flags to the `/versions` endpoint that includes whether new rooms default to using E2EE.

synapse/rest/client/versions.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import logging
2020
import re
2121

22+
from synapse.api.constants import RoomCreationPreset
2223
from synapse.http.servlet import RestServlet
2324

2425
logger = logging.getLogger(__name__)
@@ -31,6 +32,20 @@ def __init__(self, hs):
3132
super(VersionsRestServlet, self).__init__()
3233
self.config = hs.config
3334

35+
# Calculate these once since they shouldn't change after start-up.
36+
self.e2ee_forced_public = (
37+
RoomCreationPreset.PUBLIC_CHAT
38+
in self.config.encryption_enabled_by_default_for_room_presets
39+
)
40+
self.e2ee_forced_private = (
41+
RoomCreationPreset.PRIVATE_CHAT
42+
in self.config.encryption_enabled_by_default_for_room_presets
43+
)
44+
self.e2ee_forced_trusted_private = (
45+
RoomCreationPreset.TRUSTED_PRIVATE_CHAT
46+
in self.config.encryption_enabled_by_default_for_room_presets
47+
)
48+
3449
def on_GET(self, request):
3550
return (
3651
200,
@@ -62,6 +77,10 @@ def on_GET(self, request):
6277
"org.matrix.msc2432": True,
6378
# Implements additional endpoints as described in MSC2666
6479
"uk.half-shot.msc2666": True,
80+
# Whether new rooms will be set to encrypted or not (based on presets).
81+
"io.element.e2ee_forced.public": self.e2ee_forced_public,
82+
"io.element.e2ee_forced.private": self.e2ee_forced_private,
83+
"io.element.e2ee_forced.trusted_private": self.e2ee_forced_trusted_private,
6584
},
6685
},
6786
)

0 commit comments

Comments
 (0)