summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-07-26 23:38:12 +0100
committerRichard van der Hoff <richard@matrix.org>2016-07-26 23:38:12 +0100
commit2e3d90d67c8255300b226d6d2fdc2acef80e58ba (patch)
treed47084218dcb2e4047482627956c4b03d8fbd86d /synapse/storage
parentMerge pull request #953 from matrix-org/rav/requester (diff)
downloadsynapse-2e3d90d67c8255300b226d6d2fdc2acef80e58ba.tar.xz
Make the device id on e2e key upload optional
We should now be able to get our device_id from the access_token, so the
device_id on the upload request is optional. Where it is supplied, we should
check that it matches.

For active access_tokens without an associated device_id, we ought to register
the device in the devices table.

Also update the table on upgrade so that all of the existing e2e keys are
associated with real devices.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/schema/delta/33/devices_for_e2e_keys.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/storage/schema/delta/33/devices_for_e2e_keys.sql b/synapse/storage/schema/delta/33/devices_for_e2e_keys.sql
new file mode 100644
index 0000000000..2908c4d232
--- /dev/null
+++ b/synapse/storage/schema/delta/33/devices_for_e2e_keys.sql
@@ -0,0 +1,19 @@
+/* Copyright 2016 OpenMarket Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
+
+-- make sure that we have a device record for each set of E2E keys, so that the
+-- user can delete them if they like.
+INSERT INTO devices
+    SELECT user_id, device_id, "unknown device" FROM e2e_device_keys_json;