mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-20 10:55:09 +03:00
Merge pull request #3426 from matrix-org/dbkr/e2e_by_default
Server-enforced e2e for private rooms
This commit is contained in:
commit
7735eee41d
2 changed files with 13 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright 2014-2016 OpenMarket Ltd
|
# Copyright 2014-2016 OpenMarket Ltd
|
||||||
# Copyright 2017 Vector Creations Ltd
|
# Copyright 2017 Vector Creations Ltd
|
||||||
|
# Copyright 2018 New Vector Ltd
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -70,6 +71,7 @@ class EventTypes(object):
|
||||||
CanonicalAlias = "m.room.canonical_alias"
|
CanonicalAlias = "m.room.canonical_alias"
|
||||||
RoomAvatar = "m.room.avatar"
|
RoomAvatar = "m.room.avatar"
|
||||||
GuestAccess = "m.room.guest_access"
|
GuestAccess = "m.room.guest_access"
|
||||||
|
Encryption = "m.room.encryption"
|
||||||
|
|
||||||
# These are used for validation
|
# These are used for validation
|
||||||
Message = "m.room.message"
|
Message = "m.room.message"
|
||||||
|
|
|
@ -46,12 +46,14 @@ class RoomCreationHandler(BaseHandler):
|
||||||
"history_visibility": "shared",
|
"history_visibility": "shared",
|
||||||
"original_invitees_have_ops": False,
|
"original_invitees_have_ops": False,
|
||||||
"guest_can_join": True,
|
"guest_can_join": True,
|
||||||
|
"encryption_alg": "m.megolm.v1.aes-sha2",
|
||||||
},
|
},
|
||||||
RoomCreationPreset.TRUSTED_PRIVATE_CHAT: {
|
RoomCreationPreset.TRUSTED_PRIVATE_CHAT: {
|
||||||
"join_rules": JoinRules.INVITE,
|
"join_rules": JoinRules.INVITE,
|
||||||
"history_visibility": "shared",
|
"history_visibility": "shared",
|
||||||
"original_invitees_have_ops": True,
|
"original_invitees_have_ops": True,
|
||||||
"guest_can_join": True,
|
"guest_can_join": True,
|
||||||
|
"encryption_alg": "m.megolm.v1.aes-sha2",
|
||||||
},
|
},
|
||||||
RoomCreationPreset.PUBLIC_CHAT: {
|
RoomCreationPreset.PUBLIC_CHAT: {
|
||||||
"join_rules": JoinRules.PUBLIC,
|
"join_rules": JoinRules.PUBLIC,
|
||||||
|
@ -373,6 +375,15 @@ class RoomCreationHandler(BaseHandler):
|
||||||
content=content,
|
content=content,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if "encryption_alg" in config:
|
||||||
|
send(
|
||||||
|
etype=EventTypes.Encryption,
|
||||||
|
state_key="",
|
||||||
|
content={
|
||||||
|
'algorithm': config["encryption_alg"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RoomContextHandler(BaseHandler):
|
class RoomContextHandler(BaseHandler):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
Loading…
Reference in a new issue