summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-12-05 17:54:48 +0000
committerHubert Chathi <hubert@uhoreg.ca>2018-08-12 18:23:10 -0400
commit0bc4627a731d0edd437905a5b07e85421c7553d8 (patch)
tree7645aadbb7bd9d8f210d6fc44cd8e821816b6ca0 /synapse/storage
parenttotal WIP skeleton for /room_keys API (diff)
downloadsynapse-0bc4627a731d0edd437905a5b07e85421c7553d8.tar.xz
interim WIP checkin; doesn't build yet
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/e2e_room_keys.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/synapse/storage/e2e_room_keys.py b/synapse/storage/e2e_room_keys.py
index 9f6d47e1b6..903dc083f8 100644
--- a/synapse/storage/e2e_room_keys.py
+++ b/synapse/storage/e2e_room_keys.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 from twisted.internet import defer
 
 from synapse.util.caches.descriptors import cached
@@ -77,6 +78,9 @@ class EndToEndRoomKeyStore(SQLBaseStore):
         )
 
 
+    # XXX: this isn't currently used and isn't tested anywhere
+    # it could be used in future for bulk-uploading new versions of room_keys
+    # for a user or something though.
     def set_e2e_room_keys(self, user_id, version, room_keys):
 
         def _set_e2e_room_keys_txn(txn):
@@ -131,3 +135,19 @@ class EndToEndRoomKeyStore(SQLBaseStore):
         sessions = {}
         sessions['rooms'][roomId]['sessions'][session_id] = row for row in rows;
         defer.returnValue(sessions);
+
+    @defer.inlineCallbacks
+    def delete_e2e_room_keys(self, user_id, version, room_id, session_id):
+
+        keyvalues={
+            "user_id": user_id,
+            "version": version,
+        }
+        if room_id: keyvalues['room_id'] = room_id
+        if session_id: keyvalues['session_id'] = session_id
+
+        yield self._simple_delete(
+            table="e2e_room_keys",
+            keyvalues=keyvalues,
+            desc="delete_e2e_room_keys",
+        )