summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorTravis Ralston <travisr@matrix.org>2021-12-28 20:31:10 -0700
committerTravis Ralston <travisr@matrix.org>2021-12-28 20:31:10 -0700
commit73d91b5d34f4df5f6a1ff668113d6a844ad65d8d (patch)
tree2ce890b5045ef17c4c71a219aa76053ad1fa62b0 /synapse/config
parentMerge remote-tracking branch 'origin/rei/as_device_masquerading_msc3202' into... (diff)
parentNewsfile (diff)
downloadsynapse-travis/alt-todev-masq-otk-fbkey.tar.xz
Merge remote-tracking branch 'origin/rei/msc3202_otks_fbks' into anoa/e2e_as_internal_testing github/travis/alt-todev-masq-otk-fbkey travis/alt-todev-masq-otk-fbkey
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/appservice.py13
-rw-r--r--synapse/config/experimental.py6
2 files changed, 18 insertions, 1 deletions
diff --git a/synapse/config/appservice.py b/synapse/config/appservice.py
index e4bb7224a4..c77f4058b3 100644
--- a/synapse/config/appservice.py
+++ b/synapse/config/appservice.py
@@ -167,6 +167,16 @@ def _load_appservice(
 
     supports_ephemeral = as_info.get("de.sorunome.msc2409.push_ephemeral", False)
 
+    # Opt-in flag for the MSC3202-specific transactional behaviour.
+    # When enabled, appservice transactions contain the following information:
+    #  - device One-Time Key counts
+    #  - device unused fallback key usage states
+    msc3202_transaction_extensions = as_info.get("org.matrix.msc3202", False)
+    if not isinstance(msc3202_transaction_extensions, bool):
+        raise ValueError(
+            "The `org.matrix.msc3202` option should be true or false if specified."
+        )
+
     return ApplicationService(
         token=as_info["as_token"],
         hostname=hostname,
@@ -175,8 +185,9 @@ def _load_appservice(
         hs_token=as_info["hs_token"],
         sender=user_id,
         id=as_info["id"],
-        supports_ephemeral=supports_ephemeral,
         protocols=protocols,
         rate_limited=rate_limited,
         ip_range_whitelist=ip_range_whitelist,
+        supports_ephemeral=supports_ephemeral,
+        msc3202_transaction_extensions=msc3202_transaction_extensions,
     )
diff --git a/synapse/config/experimental.py b/synapse/config/experimental.py
index d19165e5b4..058abeb194 100644
--- a/synapse/config/experimental.py
+++ b/synapse/config/experimental.py
@@ -66,3 +66,9 @@ class ExperimentalConfig(Config):
         self.msc3202_device_masquerading_enabled: bool = experimental.get(
             "msc3202_device_masquerading", False
         )
+
+        # Portion of MSC3202 related to transaction extensions:
+        # sending one-time key counts and fallback key usage to application services.
+        self.msc3202_transaction_extensions: bool = experimental.get(
+            "msc3202_transaction_extensions", False
+        )