0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-17 05:13:50 +01:00

allow auth_data to be any JSON instead of a string

This commit is contained in:
Hubert Chathi 2018-08-21 10:38:00 -04:00
parent 4f7064f6b5
commit 8550a7e9c2

View file

@ -15,6 +15,7 @@
from twisted.internet import defer from twisted.internet import defer
from synapse.api.errors import StoreError from synapse.api.errors import StoreError
import simplejson as json
from ._base import SQLBaseStore from ._base import SQLBaseStore
@ -215,7 +216,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
else: else:
this_version = version this_version = version
return self._simple_select_one_txn( result = self._simple_select_one_txn(
txn, txn,
table="e2e_room_keys_versions", table="e2e_room_keys_versions",
keyvalues={ keyvalues={
@ -228,6 +229,8 @@ class EndToEndRoomKeyStore(SQLBaseStore):
"auth_data", "auth_data",
), ),
) )
result["auth_data"] = json.loads(result["auth_data"])
return result
return self.runInteraction( return self.runInteraction(
"get_e2e_room_keys_version_info", "get_e2e_room_keys_version_info",
@ -264,7 +267,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
"user_id": user_id, "user_id": user_id,
"version": new_version, "version": new_version,
"algorithm": info["algorithm"], "algorithm": info["algorithm"],
"auth_data": info["auth_data"], "auth_data": json.dumps(info["auth_data"]),
}, },
) )