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

Commit

Permalink
Add flags to /versions about whether new rooms are encrypted by defau…
Browse files Browse the repository at this point in the history
…lt. (#8343)
  • Loading branch information
clokep committed Sep 18, 2020
1 parent 14b5b48 commit 9db4c1b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/8343.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add flags to the `/versions` endpoint that includes whether new rooms default to using E2EE.
19 changes: 19 additions & 0 deletions synapse/rest/client/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import logging
import re

from synapse.api.constants import RoomCreationPreset
from synapse.http.servlet import RestServlet

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

# Calculate these once since they shouldn't change after start-up.
self.e2ee_forced_public = (
RoomCreationPreset.PUBLIC_CHAT
in self.config.encryption_enabled_by_default_for_room_presets
)
self.e2ee_forced_private = (
RoomCreationPreset.PRIVATE_CHAT
in self.config.encryption_enabled_by_default_for_room_presets
)
self.e2ee_forced_trusted_private = (
RoomCreationPreset.TRUSTED_PRIVATE_CHAT
in self.config.encryption_enabled_by_default_for_room_presets
)

def on_GET(self, request):
return (
200,
Expand Down Expand Up @@ -62,6 +77,10 @@ def on_GET(self, request):
"org.matrix.msc2432": True,
# Implements additional endpoints as described in MSC2666
"uk.half-shot.msc2666": True,
# Whether new rooms will be set to encrypted or not (based on presets).
"io.element.e2ee_forced.public": self.e2ee_forced_public,
"io.element.e2ee_forced.private": self.e2ee_forced_private,
"io.element.e2ee_forced.trusted_private": self.e2ee_forced_trusted_private,
},
},
)
Expand Down

0 comments on commit 9db4c1b

Please sign in to comment.