summary refs log tree commit diff
path: root/synapse/handlers/device.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove legacy code of single user device resync api (#15418)Alok Kumar Singh2023-04-211-53/+5
| | | | | * Removed single-user resync usage and updated it to use multi-user counterpart Signed-off-by: Alok Kumar Singh alokaks601@gmail.com
* Delete pushers after calling on_logged_out module hook on device delete (#15410)Mathieu Velten2023-04-141-2/+4
|
* Don't keep old stream_ordering_to_exterm around (#15382)Erik Johnston2023-04-061-0/+10
|
* Revert pruning of old devices (#15360)Erik Johnston2023-03-311-1/+1
| | | | | | | | | * Revert "Fix registering a device on an account with lots of devices (#15348)" This reverts commit f0d8f66eaaacfa75bed65bc5d0c602fbc5339c85. * Revert "Delete stale non-e2e devices for users, take 3 (#15183)" This reverts commit 78cdb72cd6b0e007c314d9fed9f629dfc5b937a6.
* Delete stale non-e2e devices for users, take 3 (#15183)Erik Johnston2023-03-291-1/+1
| | | | | This should help reduce the number of devices e.g. simple bots the repeatedly login rack up. We only delete non-e2e devices as they should be safe to delete, whereas if we delete e2e devices for a user we may accidentally break their ability to receive e2e keys for a message.
* Make cleaning up pushers depend on the device_id instead of the token_id ↵Quentin Gliech2023-03-241-0/+2
| | | | | | | | | | | | | | (#15280) This makes it so that we rely on the `device_id` to delete pushers on logout, instead of relying on the `access_token_id`. This ensures we're not removing pushers on token refresh, and prepares for a world without access token IDs (also known as the OIDC). This actually runs the `set_device_id_for_pushers` background update, which was forgotten in #13831. Note that for backwards compatibility it still deletes pushers based on the `access_token` until the background update finishes.
* Faster joins: Refactor handling of servers in room (#14954)Sean Quah2023-02-031-0/+1
| | | | | | | | | | | | | | Ensure that the list of servers in a partial state room always contains the server we joined off. Also refactor `get_partial_state_servers_at_join` to return `None` when the given room is no longer partial stated, to explicitly indicate when the room has partial state. Otherwise it's not clear whether an empty list means that the room has full state, or the room is partial stated, but the server we joined off told us that there are no servers in the room. Signed-off-by: Sean Quah <seanq@matrix.org>
* Use StrCollection in place of Collection[str] in (most) handlers code. (#14922)Patrick Cloke2023-01-261-3/+3
| | | | Due to the increased safety of StrCollection over Collection[str] and Sequence[str].
* Enable Faster Remote Room Joins against worker-mode Synapse. (#14752)reivilibre2023-01-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Enable Complement tests for Faster Remote Room Joins on worker-mode * (dangerous) Add an override to allow Complement to use FRRJ under workers * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> * Fix race where we didn't send out replication notification * MORE HACKS * Fix get_un_partial_stated_rooms_token to take instance_name * Fix bad merge * Remove warning * Correctly advance un_partial_stated_room_stream * Fix merge * Add another notify_replication * Fixups * Create a separate ReplicationNotifier * Fix test * Fix portdb * Create a separate ReplicationNotifier * Fix test * Fix portdb * Fix presence test * Newsfile * Apply suggestions from code review * Update changelog.d/14752.misc Co-authored-by: Erik Johnston <erik@matrix.org> * lint Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> Co-authored-by: Erik Johnston <erik@matrix.org>
* Implement MSC3890: Remotely silence local notifications (#14775)Andrew Morgan2023-01-131-1/+10
|
* Batch up replication requests to request the resyncing of remote users's ↵reivilibre2023-01-101-26/+98
| | | | devices. (#14716)
* Revert the deletion of stale devices due to performance issues. (#14662)reivilibre2022-12-121-32/+1
|
* Limit the number of devices we delete at once (#14649)Erik Johnston2022-12-091-1/+3
|
* Delete stale non-e2e devices for users, take 2 (#14595)Erik Johnston2022-12-091-1/+30
| | | | | This should help reduce the number of devices e.g. simple bots the repeatedly login rack up. We only delete non-e2e devices as they should be safe to delete, whereas if we delete e2e devices for a user we may accidentally break their ability to receive e2e keys for a message.
* Faster remote room joins: stream the un-partial-stating of rooms over ↵reivilibre2022-12-051-1/+1
| | | | replication. [rei:frrj/streams/unpsr] (#14473)
* Revert "POC delete stale non-e2e devices for users (#14038)" (#14582)David Robertson2022-11-291-12/+1
|
* POC delete stale non-e2e devices for users (#14038)Erik Johnston2022-11-291-1/+12
| | | | | | | | This should help reduce the number of devices e.g. simple bots the repeatedly login rack up. We only delete non-e2e devices as they should be safe to delete, whereas if we delete e2e devices for a user we may accidentally break their ability to receive e2e keys for a message. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Add a type hint for `get_device_handler()` and fix incorrect types. (#14055)Patrick Cloke2022-11-221-15/+50
| | | | | This was the last untyped handler from the HomeServer object. Since it was being treated as Any (and thus unchecked) it was being used incorrectly in a few places.
* Track unconverted device list outbound pokes using a position instead (#14516)Sean Quah2022-11-221-3/+27
| | | | | | | | | | | | | | | | | | | | | When a local device list change is added to `device_lists_changes_in_room`, the `converted_to_destinations` flag is set to `FALSE` and the `_handle_new_device_update_async` background process is started. This background process looks for unconverted rows in `device_lists_changes_in_room`, copies them to `device_lists_outbound_pokes` and updates the flag. To update the `converted_to_destinations` flag, the database performs a `DELETE` and `INSERT` internally, which fragments the table. To avoid this, track unconverted rows using a `(stream ID, room ID)` position instead of the flag. From now on, the `converted_to_destinations` column indicates rows that need converting to outbound pokes, but does not indicate whether the conversion has already taken place. Closes #14037. Signed-off-by: Sean Quah <seanq@matrix.org>
* When restarting a partial join resync, prioritise the server which actioned ↵David Robertson2022-10-181-1/+4
| | | | a partial join (#14126)
* Optimise get_rooms_for_user (drop with_stream_ordering) (#13787)Nick Mills-Barrett2022-09-291-4/+2
|
* Handle local device list updates during partial join (#13934)Erik Johnston2022-09-281-2/+82
|
* Handle remote device list updates during partial join (#13913)Erik Johnston2022-09-281-0/+62
| | | | | | | c.f. #12993 (comment), point 3 This stores all device list updates that we receive while partial joins are ongoing, and processes them once we have the full state. Note: We don't actually process the device lists in the same ways as if we weren't partially joined. Instead of updating the device list remote cache, we simply notify local users that a change in the remote user's devices has happened. I think this is safe as if the local user requests the keys for the remote user and we don't have them we'll simply fetch them as normal.
* Faster room joins: Avoid blocking `/keys/changes` (#13888)Sean Quah2022-09-231-2/+5
| | | | | | | | | Part of the work for #12993. Once #12993 is fully resolved, we expect `/keys/changes` to behave sensibly when joined to a room with partial state. Signed-off-by: Sean Quah <seanq@matrix.org>
* Send device list updates out to servers in partially joined rooms (#13874)Sean Quah2022-09-231-1/+5
| | | | | | | | | | | Use the provided list of servers in the room from the `/send_join` response, since we will not know which users are in the room. This isn't sufficient to ensure that all remote servers receive the right device list updates, since the `/send_join` response may be inaccurate or we may calculate the membership state of new users in the room incorrectly. Signed-off-by: Sean Quah <seanq@matrix.org>
* Fix bug in device list caching when remote users leave rooms (#13749)Sean Quah2022-09-141-11/+0
| | | | | | | | | | | | When a remote user leaves the last room shared with the homeserver, we have to mark their device list as unsubscribed, otherwise we would hold on to a stale device list in our cache. Crucially, the device list would remain cached even after the remote user rejoined the room, which could lead to E2EE failures until the next change to the remote user's device list. Fixes #13651. Signed-off-by: Sean Quah <seanq@matrix.org>
* Cancel the processing of key query requests when they time out. (#13680)reivilibre2022-09-071-0/+3
|
* Update `get_users_in_room` mis-use to get hosts with dedicated ↵Eric Eastwood2022-08-241-2/+6
| | | | | `get_current_hosts_in_room` (#13605) See https://github.com/matrix-org/synapse/pull/13575#discussion_r953023755
* Implement MSC3852: Expose `last_seen_user_agent` to users for their own ↵Andrew Morgan2022-08-191-1/+8
| | | | devices; also expose to Admin API (#13549)
* Add missing types to opentracing. (#13345)Patrick Cloke2022-07-211-4/+4
| | | After this change `synapse.logging` is fully typed.
* Use new `device_list_changes_in_room` table when getting device list changes ↵Erik Johnston2022-06-171-17/+52
| | | | (#13045)
* Consolidate the logic of delete_device/delete_devices. (#12970)Patrick Cloke2022-06-071-31/+2
| | | | | | | | By always using delete_devices and sometimes passing a list with a single device ID. Previously these methods had gotten out of sync with each other and it seems there's little benefit to the single-device variant.
* Wait for lazy join to complete when getting current state (#12872)Erik Johnston2022-06-011-1/+1
|
* Rename storage classes (#12913)Erik Johnston2022-05-311-2/+2
|
* Add a background job to automatically delete stale devices (#12855)Brendan Abolivier2022-05-271-1/+29
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Additional constants for EDU types. (#12884)Patrick Cloke2022-05-271-2/+3
| | | Instead of hard-coding strings in many places.
* Fix up `state_store` naming (#12871)Erik Johnston2022-05-251-2/+4
|
* Make sure `prev_ids` defaults to empty list (#12829)Carl Bordum Hansen2022-05-251-0/+4
| | | Signed-off-by: Carl Bordum Hansen <carl@bordum.dk>
* Add `StreamKeyType` class and replace string literals with constants (#12567)Andrew Morgan2022-05-161-2/+5
|
* Mark remote device list updates as already handled (#12557)Erik Johnston2022-04-261-2/+3
|
* Comment out dodgy log-kv (#12554)David Robertson2022-04-261-3/+6
|
* Only send out device list updates for our own users (#12465)Erik Johnston2022-04-141-3/+7
| | | Broke in #12365
* Process device list updates asynchronously (#12365)Erik Johnston2022-04-121-28/+0
|
* Refactor and convert `Linearizer` to async (#12357)Sean Quah2022-04-051-1/+1
| | | | | | | | | | | Refactor and convert `Linearizer` to async. This makes a `Linearizer` cancellation bug easier to fix. Also refactor to use an async context manager, which eliminates an unlikely footgun where code that doesn't immediately use the context manager could forget to release the lock. Signed-off-by: Sean Quah <seanq@element.io>
* Track device list updates per room. (#12321)Erik Johnston2022-04-041-12/+120
| | | | | | | | | | | | | | This is a first step in dealing with #7721. The idea is basically that rather than calculating the full set of users a device list update needs to be sent to up front, we instead simply record the rooms the user was in at the time of the change. This will allow a few things: 1. we can defer calculating the set of remote servers that need to be poked about the change; and 2. during `/sync` and `/keys/changes` we can avoid also avoid calculating users who share rooms with other users, and instead just look at the rooms that have changed. However, care needs to be taken to correctly handle server downgrades. As such this PR writes to both `device_lists_changes_in_room` and the `device_lists_outbound_pokes` table synchronously. In a future release we can then bump the database schema compat version to `69` and then we can assume that the new `device_lists_changes_in_room` exists and is handled. There is a temporary option to disable writing to `device_lists_outbound_pokes` synchronously, allowing us to test the new code path does work (and by implication upgrading to a future release and downgrading to this one will work correctly). Note: Ideally we'd do the calculation of room to servers on a worker (e.g. the background worker), but currently only master can write to the `device_list_outbound_pokes` table.
* Remove unnecessary pass statements. (#12206)Patrick Cloke2022-03-111-2/+0
|
* Spread out sending device lists to remote hosts (#12132)Erik Johnston2022-03-041-1/+1
|
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-2/+2
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Notify users, rather than rooms, of device list updates (#11905)Andrew Morgan2022-02-121-5/+3
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Cache empty responses from `/user/devices` (#11587)David Robertson2022-01-051-1/+9
| | | If we've never made a request to a remote homeserver, we should cache the response---even if the response is "this user has no devices".
* Make `get_device` return None if the device doesn't exist rather than ↵reivilibre2021-12-131-4/+6
| | | | | raising an exception. (#11565) Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Save the OIDC session ID (sid) with the device on login (#11482)Quentin Gliech2021-12-061-0/+8
| | | As a step towards allowing back-channel logout for OIDC.
* Improve docstrings for methods related to sending EDUs to application ↵Andrew Morgan2021-10-211-0/+4
| | | | services (#11138)
* Add type hints to `synapse.storage.databases.main.client_ips` (#10972)Sean Quah2021-10-121-2/+13
|
* Remove the deprecated BaseHandler. (#11005)Patrick Cloke2021-10-081-5/+5
| | | | | | | | The shared ratelimit function was replaced with a dedicated RequestRatelimiter class (accessible from the HomeServer object). Other properties were copied to each sub-class that inherited from BaseHandler.
* Require type hints in the handlers module. (#10831)Patrick Cloke2021-09-201-1/+1
| | | | | | | Adds missing type hints to methods in the synapse.handlers module and requires all methods to have type hints there. This also removes the unused construct_auth_difference method from the FederationHandler.
* Use inline type hints in `handlers/` and `rest/`. (#10382)Jonathan de Jong2021-07-161-7/+7
|
* Clear the resync bit after resyncing device lists (#9867)Richard van der Hoff2021-04-221-0/+7
| | | Fixes #9866.
* Remove `synapse.types.Collection` (#9856)Richard van der Hoff2021-04-221-2/+1
| | | This is no longer required, since we have dropped support for Python 3.5.
* Fix (final) Bugbear violations (#9838)Jonathan de Jong2021-04-201-8/+5
|
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Add type hints to expiring cache. (#9730)Patrick Cloke2021-04-061-2/+2
|
* Import HomeServer from the proper module. (#9665)Patrick Cloke2021-03-231-1/+1
|
* only save remote cross-signing keys if they're different from the current ↵Hubert Chathi2021-03-171-4/+18
| | | | | ones (#9634) Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Fix bad naming of storage function (#9637)Erik Johnston2021-03-171-1/+1
| | | | | | We had two functions named `get_forward_extremities_for_room` and `get_forward_extremeties_for_room` that took different paramters. We rename one of them to avoid confusion.
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-10/+20
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Add type hints to E2E handler. (#9232)Patrick Cloke2021-01-281-6/+6
| | | This finishes adding type hints to the `synapse.handlers` module.
* Add typing information to the device handler. (#8407)Patrick Cloke2020-10-071-35/+54
|
* Add support for MSC2697: Dehydrated devices (#8380)Hubert Chathi2020-10-071-2/+82
| | | | This allows a user to store an offline device on the server and then restore it at a subsequent login.
* Various clean ups to room stream tokens. (#8423)Erik Johnston2020-09-291-3/+1
|
* Create function to check for long names in devices (#8364)Dionysis Grigoropoulos2020-09-221-6/+24
| | | | | | | | | * Create a new function to verify that the length of a device name is under a certain threshold. * Refactor old code and tests to use said function. * Verify device name length during registration of device * Add a test for the above Signed-off-by: Dionysis Grigoropoulos <dgrig@erethon.com>
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-2/+2
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Make `StreamToken.room_key` be a `RoomStreamToken` instance. (#8281)Erik Johnston2020-09-111-7/+5
|
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Move and rename `get_devices_with_keys_by_user` (#8204)Richard van der Hoff2020-09-011-1/+3
| | | | | | | | | | | | | | | | | | * Move `get_devices_with_keys_by_user` to `EndToEndKeyWorkerStore` this seems a better fit for it. This commit simply moves the existing code: no other changes at all. * Rename `get_devices_with_keys_by_user` to better reflect what it does. * get_device_stream_token abstract method To avoid referencing fields which are declared in the derived classes, make `get_device_stream_token` abstract, and define that in the classes which define `_device_list_id_gen`.
* Fix TypeError in synapse.notifier (#7880)Erik Johnston2020-07-171-0/+8
| | | Fixes #7774
* Convert device handler to async/await (#7871)Patrick Cloke2020-07-171-136/+105
|
* Fix "There was no active span when trying to log." error (#7698)Erik Johnston2020-06-151-0/+1
|
* Replace iteritems/itervalues/iterkeys with native versions. (#7692)Patrick Cloke2020-06-151-8/+6
|
* Process cross-signing keys when resyncing device lists (#7594)Brendan Abolivier2020-06-011-1/+57
| | | It looks like `user_device_resync` was ignoring cross-signing keys from the results received from the remote server. This patch fixes this, by processing these keys using the same process `_handle_signing_key_updates` does (and effectively factor that part out of that function).
* Don't fail all of an iteration of the device list retry loop on error (#7609)Brendan Abolivier2020-06-011-15/+21
| | | Without this patch, if an error happens which isn't caught by `user_device_resync`, then `_maybe_retry_device_resync` would fail, without retrying the next users in the iteration. This patch fixes this so that it now only logs an error in this case.
* Retry to sync out of sync device lists (#7453)Brendan Abolivier2020-05-211-7/+73
| | | | | | | | | | | When a call to `user_device_resync` fails, we don't currently mark the remote user's device list as out of sync, nor do we retry to sync it. https://github.com/matrix-org/synapse/pull/6776 introduced some code infrastructure to mark device lists as stale/out of sync. This commit uses that code infrastructure to mark device lists as out of sync if processing an incoming device list update makes the device handler realise that the device list is out of sync, but we can't resync right now. It also adds a looping call to retry all failed resync every 30s. This shouldn't cause too much spam in the logs as this commit also removes the "Failed to handle device list update for..." warning logs when catching `NotRetryingDestination`. Fixes #7418
* Convert auth handler to async/await (#7261)Patrick Cloke2020-04-151-4/+8
|
* Add explanatory commentAndrew Morgan2020-03-301-1/+2
|
* blackDavid Baker2020-03-301-1/+3
|
* Just add own user ID to the list we track device changes forDavid Baker2020-03-301-3/+5
|
* Fix undefined variable & remove debug loggingDavid Baker2020-03-271-10/+2
|
* blackDavid Baker2020-03-271-4/+4
|
* Always send the user updates to their own device listDavid Baker2020-03-271-3/+16
| | | | | This will allow clients to notify users about new devices even if the user isn't in any rooms (yet).
* Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-211-1/+1
| | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Reject device display names that are too long (#6882)Patrick Cloke2020-02-101-1/+13
| | | | | | | | * Reject device display names that are too long. Too long is currently defined as 100 characters in length. * Add a regression test for rejecting a too long device display name.
* Add support for putting fed user query API on workers (#6873)Erik Johnston2020-02-071-19/+16
|
* Check sender_key matches on inbound encrypted events. (#6850)Erik Johnston2020-02-051-1/+7
| | | If they don't then the device lists are probably out of sync.
* Merge branch 'develop' into cross-signing_federationHubert Chathi2019-10-311-3/+4
|\
| * Merge pull request #6294 from matrix-org/erikj/add_state_storageErik Johnston2019-10-311-1/+2
| |\ | | | | | | Add StateGroupStorage interface
| | * Port to use state storageErik Johnston2019-10-301-1/+2
| | |
| * | Remove usage of deprecated logger.warn method from codebase (#6271)Andrew Morgan2019-10-311-2/+2
| |/ | | | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
* | update to work with newer code, and fix formattingHubert Chathi2019-10-221-1/+1
| |
* | implement federation parts of cross-signingHubert Chathi2019-10-221-1/+12
|/
* Merge branch 'develop' into cross-signing_keysHubert Chathi2019-09-041-2/+63
|\
| * Opentrace device lists (#5853)Jorik Schellekens2019-09-031-2/+63
| | | | | | Trace device list changes.
* | Merge branch 'cross-signing_hidden' into cross-signing_keysHubert Chathi2019-08-011-85/+87
|\|
| * Update the device list cache when keys/query is called (#5693)Jorik Schellekens2019-07-291-72/+78
| |
| * Replace returnValue with return (#5736)Amber Brown2019-07-231-13/+9
| |
* | allow uploading keys for cross-signingHubert Chathi2019-07-251-0/+17
|/
* Rename get_users_whose_devices_changedErik Johnston2019-06-261-1/+1
|
* Refactor get_user_ids_changed to pull less from DBErik Johnston2019-06-261-6/+6
| | | | | | | | | | | When a client asks for users whose devices have changed since a token we used to pull *all* users from the database since the token, which could easily be thousands of rows for old tokens. This PR changes this to only check for changes for users the client is actually interested in. Fixes #5553
* Run Black. (#5482)Amber Brown2019-06-201-63/+49
|
* Merge pull request #4829 from matrix-org/erikj/device_list_seen_updatesErik Johnston2019-03-081-3/+7
|\ | | | | When re-syncing device lists reset the state
| * When re-syncing device lists reset the stateErik Johnston2019-03-071-3/+7
| | | | | | | | | | | | | | We keep track of what stream IDs we've seen so that we know what updates we've handled or missed. If we re-sync we don't know if the updates we've seen are included in the re-sync (there may be a race), so we should reset the seen updates.
* | Add some debug logging for device list handlingErik Johnston2019-03-071-2/+38
|/
* Allow /keys/{changes,query} API to run on workerErik Johnston2019-03-041-2/+2
|
* Split DeviceHandler into master and workerErik Johnston2019-03-041-168/+174
|
* pep8Erik Johnston2019-02-181-1/+5
|
* Correctly handle HttpResponseExceptionErik Johnston2019-02-181-4/+4
|
* Correctly handle RequestSendFailed exceptionsErik Johnston2019-02-141-2/+2
| | | | This mainly reduces the number of exceptions we log.
* don't store more remote device lists if they have more than 1K devices (#4397)Richard van der Hoff2019-01-161-0/+19
|
* Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678)Amber Brown2018-08-101-1/+1
|
* s/becuase/because/gMatthew Hodgson2018-07-101-1/+1
|
* run isortAmber Brown2018-07-091-7/+9
|
* Consistently use six's iteritems and wrap lazy keys/values in list() if ↵Amber Brown2018-05-311-2/+2
| | | | they're not meant to be lazy (#3307)
* replace some iteritems with sixAdrian Tschira2018-05-191-6/+8
| | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
* replace old style error catching with 'as' keywordNotAFile2018-03-151-3/+3
| | | | | | | This is both easier to read and compatible with python3 (not that that matters) Signed-off-by: Adrian Tschira <nota@notafile.com>
* s/replication_client/federation_client/Erik Johnston2018-03-131-1/+1
|
* Split replication layer into twoErik Johnston2018-03-131-2/+1
|
* Split out edu/query registration to a separate classErik Johnston2018-03-131-2/+4
|
* Add federation_domain_whitelist option (#2820)Matthew Hodgson2018-01-221-0/+4
| | | | | | Add federation_domain_whitelist gives a way to restrict which domains your HS is allowed to federate with. useful mainly for gracefully preventing a private but internet-connected HS from trying to federate to the wider public Matrix network
* Delete devices in various logout situationsRichard van der Hoff2017-11-291-1/+19
| | | | | | | | | | | | | Make sure that we delete devices whenever a user is logged out due to any of the following situations: * /logout * /logout_all * change password * deactivate account (by the user or by an admin) * invalidate access token from a dynamic module Fixes #2672.
* Merge remote-tracking branch 'origin/develop' into ↵David Baker2017-11-011-2/+0
|\ | | | | | | rav/refactor_accesstoken_delete
| * Remove the last vestiges of refresh_tokensRichard van der Hoff2017-10-311-2/+0
| |
* | Move access token deletion into auth handlerRichard van der Hoff2017-11-011-2/+3
|/ | | | | | | Also move duplicated deactivation code into the auth handler. I want to add some hooks when we deactivate an access token, so let's bring it all in here so that there's somewhere to put it.
* Correctly handle leaving room in /key/changesErik Johnston2017-09-181-13/+12
|
* Fix typoErik Johnston2017-09-151-1/+1
|
* Handle joining/leaving rooms in /keys/changesErik Johnston2017-09-131-1/+38
|
* Add left section to /keys/changesErik Johnston2017-09-081-6/+16
|
* Send down device list change notif when member leaves/rejoins roomErik Johnston2017-09-071-1/+1
|
* Fix up client ips to read from pending dataErik Johnston2017-06-271-2/+2
|
* CommentErik Johnston2017-05-051-0/+6
|
* Add comment and TODOErik Johnston2017-05-051-0/+6
|
* Handle exceptions thrown in handling remote device list updatesErik Johnston2017-05-051-1/+16
|
* Don't recreate so many setsErik Johnston2017-03-161-8/+6
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2017-03-141-0/+34
|\ | | | | | | erikj/public_list_speed
| * Implement _simple_delete_many_txn, use it to delete devicesLuke Barnard2017-03-131-0/+34
| | | | | | | | | | | | (But this doesn't implement the same for deleting access tokens or e2e keys. Also respond to code review.
* | Get current state by using current_state_events tableErik Johnston2017-03-101-1/+1
|/
* Don't keep around old stream IDs foreverErik Johnston2017-03-031-2/+9
|
* SpellingErik Johnston2017-03-031-2/+2
|
* Fix device list update to not constantly resyncErik Johnston2017-03-011-46/+115
|
* Fix bugs in the /keys/changes apiRichard van der Hoff2017-02-141-9/+29
| | | | | | | | | | | | | | | * `get_forward_extremeties_for_room` takes a numeric `stream_ordering`. We were passing a `RoomStreamToken`, which meant that it returned the *current* extremities, rather than those corresponding to the `from_token`. However: * `get_state_ids_for_events` required a second ('types') parameter; this meant that a `TypeError` was thrown and we ended up acting as though there was *no* prev state. * `get_state_ids_for_events` actually returns a map from event_id to state dictionary - just looking up the state keys in it again meant that we acted as though there was no prev state. We now check if each member's state has changed since *any* of the extremities. Also add/fix some comments.
* Measure new device list stuffErik Johnston2017-02-021-0/+4
|
* Use new get_users_who_share_room_with_userErik Johnston2017-02-021-11/+13
|
* Use stream_ordering_to_exterm for /keys/changesErik Johnston2017-02-021-9/+9
|
* Doc argsErik Johnston2017-02-011-0/+7
|
* Include newly joined users in /keys/changes APIErik Johnston2017-02-011-4/+35
|
* Implement /keys/changesErik Johnston2017-02-011-0/+16
|
* Use get_users_in_room and declare it iterableErik Johnston2017-01-301-1/+1
|
* Hook device list updates to replicationErik Johnston2017-01-271-16/+0
|
* Better nameErik Johnston2017-01-271-1/+3
|
* Handle users leaving roomsErik Johnston2017-01-261-1/+16
|
* Add commentsErik Johnston2017-01-261-3/+16
|
* Implement device key caching over federationErik Johnston2017-01-261-12/+73
|
* Fix up sending of m.device_list_update edusErik Johnston2017-01-251-0/+1
|
* Add basic implementation of local device list changesErik Johnston2017-01-251-12/+53
|
* make device IDs more useful for human disambiguationMatthew Hodgson2016-09-131-1/+1
|
* PEP8Richard van der Hoff2016-08-031-1/+1
|
* Default device_display_name to nullRichard van der Hoff2016-08-031-1/+1
| | | | | | It turns out that it's more useful to return a null device display name (and let clients decide how to handle it: eg, falling back to device_id) than using a constant string like "unknown device".
* Delete e2e keys on device deleteRichard van der Hoff2016-07-271-0/+4
|
* Delete refresh tokens when deleting devicesRichard van der Hoff2016-07-261-2/+4
|
* Implement updating devicesRichard van der Hoff2016-07-261-0/+24
| | | | You can update the displayname of devices now.
* Implement deleting devicesRichard van der Hoff2016-07-261-1/+26
|
* make /devices return a listRichard van der Hoff2016-07-211-5/+5
| | | | Turns out I specced this to return a list of devices rather than a dict of them
* Fix PEP8 errorsRichard van der Hoff2016-07-211-1/+1
|
* Implement GET /device/{deviceId}Richard van der Hoff2016-07-211-9/+37
|
* GET /devices endpointRichard van der Hoff2016-07-201-0/+27
| | | | | | | implement a GET /devices endpoint which lists all of the user's devices. It also returns the last IP where we saw that device, so there is some dancing to fish that out of the user_ips table.
* Add device_id support to /loginRichard van der Hoff2016-07-181-0/+71
Add a 'devices' table to the storage, as well as a 'device_id' column to refresh_tokens. Allow the client to pass a device_id, and initial_device_display_name, to /login. If login is successful, then register the device in the devices table if it wasn't known already. If no device_id was supplied, make one up. Associate the device_id with the access token and refresh token, so that we can get at it again later. Ensure that the device_id is copied from the refresh token to the access_token when the token is refreshed.