1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00
Commit Graph

177 Commits

Author SHA1 Message Date
J. Ryan Stinnett
14b42abfa4 Re-check key backup status on version mismatch
This ensures we will report the updated status when consumer code asks for it.

Fixes part of https://github.com/vector-im/riot-web/issues/8048.
2019-01-09 04:07:58 -06:00
J. Ryan Stinnett
2b734b8e69 Emit for key backup failures
Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
2018-12-14 15:17:22 +00:00
J. Ryan Stinnett
c5f6f87a6c Add await to ensure we wait for backup errors
Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
2018-12-14 15:17:22 +00:00
David Baker
66cdb62a3d Reorganize key backup flow
This will allow the key backup flow to propagate errors for things like version
mismatches more easily.

In addition, it raises the limit of keys sent per request from 10 to 200 to cut
down on the number of requests.
2018-12-14 15:17:10 +00:00
J. Ryan Stinnett
6cf9563441 Avoid checking key backup status if guest
Fixes vector-im/riot-web#7839.

Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
2018-12-12 22:26:01 +00:00
David Baker
6db8dd620d Fix https://github.com/matrix-org/matrix-js-sdk/pull/792 2018-11-28 16:11:28 +00:00
David Baker
4e66a2d436 Don't re-establish sessions with unknown devices
as it won't work
2018-11-28 15:53:13 +00:00
David Baker
d99a22d68d Update to new API
Also fix test & remove debug logging from test
2018-11-16 14:46:18 +00:00
David Baker
907cf19f05 Merge remote-tracking branch 'origin/develop' into dbkr/e2e_backups 2018-11-15 16:35:52 +00:00
David Baker
ebf20d5b2c Don't force more than one new session per device per hour 2018-11-14 14:20:55 +00:00
David Baker
6c413bba48 Typo + exit if session was never shared 2018-11-13 12:15:33 +00:00
David Baker
d74ed508f9 Restart broken Olm sessions
* Start a new Olm sessions with a device when we get an undecryptable
   message on it.
 * Send a dummy message on that sessions such that the other end knows
   about it.
 * Re-send any outstanding keyshare requests for that device.

Also includes a unit test for megolm that isn't very related but came
out as a result anyway.

Includes https://github.com/matrix-org/matrix-js-sdk/pull/776
Fixes https://github.com/vector-im/riot-web/issues/3822
2018-11-08 19:09:28 +00:00
David Baker
0477f354c9 Fix key forwarded count
It's exported in snake case
2018-10-31 19:45:29 +00:00
David Baker
63e9f794c7 Remove unnecessary if 2018-10-31 18:37:38 +00:00
David Baker
7c0b910d7a remove unnecessary isFinite check 2018-10-31 18:36:55 +00:00
David Baker
6de213483c Change getDeviceByIdentityKey() to just the 2 arg version 2018-10-31 18:31:56 +00:00
David Baker
2814932845 lint 2018-10-30 12:36:03 +00:00
David Baker
e51d2dd36a Fix a few e2e backup bits
* Don't _maybeSendKeyBackup() as soon as we enable them: we shouldn't
   have anything to send anyway until we mark all sessions for backup,
   which we do just afterwards, so leave that to trigger the upload
   (otherwise the uploading triggered by backupAll just returns
   straight away because a backup is already in progress).
 * Pass delay & retry params to _maybeSendKeyBackup(): we want the
   all-key upload to happen straight away so pass in delay=0, and
   we also don't want to retry on a timer if the the user is waiting.
 * If we fail due to an HTTP 400 or similar, don't swallow the error.
 * Use the right indexeddb store
2018-10-30 11:45:19 +00:00
David Baker
243bab7036 Merge branch 'dbkr/stop_devicelist' into dbkr/e2e_backups 2018-10-25 19:03:57 +01:00
David Baker
88b39f4b67 Stop devicelist when client is stopped
To avoid the devicelist trying to save after the client has been
stopped

Hopefully will fix random test failures on node 11.
2018-10-25 19:00:03 +01:00
David Baker
5e8061f846 Merge remote-tracking branch 'origin/develop' into dbkr/e2e_backups 2018-10-25 17:33:48 +01:00
David Baker
59070c2af6 Merge remote-tracking branch 'origin/develop' into dbkr/wasm 2018-10-25 15:29:41 +01:00
André Jaenisch
f41060c39a Replace console.log with loglevel logger. Fixes #332
Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
2018-10-24 00:48:57 +02:00
Hubert Chathi
434ac86090 properly fill out the is_verified and first_message_index fields 2018-10-19 10:51:19 -04:00
Hubert Chathi
d49c0a1bcb more de-linting and fixing 2018-10-12 14:28:31 -04:00
Hubert Chathi
9b12c22823 de-lint plus some minor fixes 2018-10-12 10:38:10 -04:00
Hubert Chathi
3957006fae Merge remote-tracking branch 'upstream/dbkr/e2e_backups' into e2e_backups 2018-10-11 14:01:26 -04:00
Hubert Chathi
da65f43983 wrap backup sending in a try, and add delays 2018-10-10 19:31:28 -04:00
David Baker
ada4b6ef16 Lint 2018-10-09 15:46:12 +01:00
Hubert Chathi
258adda67c retry key backups when they fail 2018-10-04 15:19:20 -04:00
David Baker
35d584c67b Remove outdated comment 2018-10-04 13:05:45 +01:00
David Baker
ce2058aea9 Merge branch 'dbkr/wasm' into dbkr/e2e_backups 2018-10-02 16:54:36 +01:00
David Baker
33ad65a105 Don't assume Olm will be available from start
By doing `Olm = global.Olm` on script load, we require that Olm is
available right from the start, which isn't really necessary. As
long as it appears some time before we actually want to use it,
this is fine (we can probably assume it's not going to go away
again..?)

This means Riot doesn't need to faff about making sure olm is
loaded before starting anything else.
2018-09-26 16:39:22 +01:00
David Baker
c556ca40b1 Support Olm with WebAssembly
wasm Olm has a new interface: it now has an init method that needs
to be called and the promise it returns waited on before the Olm
module is used. Support that, and allow Crypto etc to be imported
whether Olm is enabled or not. Change whether olm is enabled to
be async since now it will be unavailable if the async module init
fails. Don't call getOlmVersion() until the Olm.init() is done.
2018-09-25 17:49:54 +01:00
David Baker
3af9af96ea More linting 2018-09-17 19:31:37 +01:00
David Baker
e789747834 Check sigs on e2e backup & enable it if we can 2018-09-14 17:06:27 +01:00
David Baker
3838fab788 WIP e2e key backup support
Continues from uhoreg's branch
2018-09-13 17:01:05 +01:00
David Baker
72bd51f26e Merge remote-tracking branch 'origin/develop' into uhoreg-e2e_backups 2018-09-11 12:02:47 +01:00
David Baker
8f98504183 jsdoc 2018-08-29 18:11:53 +01:00
David Baker
1b77ee0ef4 Pass through function to discard megolm session
To make debugging crypto slightly faster
2018-08-29 18:06:45 +01:00
Bruno Windels
ad71bb30ac add comment back as we kept flag in the end 2018-08-27 11:51:29 +02:00
Bruno Windels
362bf1895d restore inhibitDeviceQuery param to avoid breaking change 2018-08-27 11:12:00 +02:00
Bruno Windels
7d00c0bd5a make LL/non-LL flow in Crypto more alike by always going through _roomDeviceTrackingState 2018-08-27 10:54:08 +02:00
Bruno Windels
7247762b60 Also support not lazy-loading members in Crypto 2018-08-27 10:54:08 +02:00
Bruno Windels
21e0c79f7d Revert "Revert "Lazy loading: don't block on setting up room crypto""
This reverts commit 5cf2ebea4f.
2018-08-27 10:54:08 +02:00
Bruno Windels
78b08bfef2 fix var declaration 2018-08-27 10:48:11 +02:00
Bruno Windels
ae7e90dc2f do config comparison first to keep original error message 2018-08-27 10:39:14 +02:00
Bruno Windels
0028bfbfc7 fix lint 2018-08-24 18:42:48 +02:00
Bruno Windels
60c9c403bd Improve setRoomEncryption guard against multiple m.room.encryption state events
we were only bailing out when receiving a non JSON-identical m.room.encryption event.
When receiving an identical event, the algorithm in _roomEncryptors would be reset,
generating a new megolm session every time this happens (there is a LL synapse bug
where this happens on every sync).

As the _roomList is backed by indexeddb you might already have a config without the algorithm being present though,
so we first check for the room encryptor algorithm being present. If so, always bail out as setRoomEncryption was
already called for the given room.

If no algorithm is present, still check if the config is not being changed.
Also setup the roomlist and room encryption synchronously before awaiting
the indexeddb operation to store the room encryption config in roomlist.
2018-08-24 18:28:38 +02:00
David Baker
ec5fff2046 Merge branch 'e2e_backups' of git://github.com/uhoreg/matrix-js-sdk into uhoreg-e2e_backups 2018-08-24 13:29:29 +01:00