diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2019-02-06 17:57:10 -0500 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2019-02-06 17:57:10 -0500 |
commit | 82486371738a130322f3a1829bc4b49f79c1a3e4 (patch) | |
tree | 58bd97eb0df9acc2c23cd2b52dd706b11506ff58 /synapse/storage/e2e_room_keys.py | |
parent | return proper error codes for some 404s (diff) | |
download | synapse-82486371738a130322f3a1829bc4b49f79c1a3e4.tar.xz |
add new endpoint to update backup versions
Diffstat (limited to 'synapse/storage/e2e_room_keys.py')
-rw-r--r-- | synapse/storage/e2e_room_keys.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/synapse/storage/e2e_room_keys.py b/synapse/storage/e2e_room_keys.py index 45cebe61d1..9a3aec759e 100644 --- a/synapse/storage/e2e_room_keys.py +++ b/synapse/storage/e2e_room_keys.py @@ -298,6 +298,27 @@ class EndToEndRoomKeyStore(SQLBaseStore): "create_e2e_room_keys_version_txn", _create_e2e_room_keys_version_txn ) + def update_e2e_room_keys_version(self, user_id, version, info): + """Update a given backup version + + Args: + user_id(str): the user whose backup version we're updating + version(str): the version ID of the backup version we're updating + info(dict): the new backup version info to store + """ + + return self._simple_update( + table="e2e_room_keys_versions", + keyvalues={ + "user_id": user_id, + "version": version, + }, + updatevalues={ + "auth_data": json.dumps(info["auth_data"]), + }, + desc="update_e2e_room_keys_version" + ) + def delete_e2e_room_keys_version(self, user_id, version=None): """Delete a given backup version of the user's room keys. Doesn't delete their actual key data. |