1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00
Commit Graph

1904 Commits

Author SHA1 Message Date
David Baker
16c062c069 Start first incremental sync request early (#629)
* Start first incremental sync request early

So it can run while we process our sync data.
2018-03-16 15:22:06 +00:00
David Baker
64396de0dc Fix duplicated state events in timeline from peek
When joining a room we were peeking into, we duplicated all the
state events into the timeline. Put back the old behaviour of just
setting them as state events, with copious commentary on how wrong
this seems.
2018-03-15 17:35:18 +00:00
David Baker
a0578efeb9 fix tests 2018-03-08 13:52:48 +00:00
David Baker
bdf6fcb222 Fix tests 2018-02-26 16:53:17 +00:00
David Baker
ec27bb5131 Merge pull request #612 from matrix-org/dbkr/dont_clone_events
Stop cloning events when adding to state
2018-02-20 18:08:35 +00:00
David Baker
ec5cfe4ee9 Stop cloning events when adding to state
As comment hopefully explains.

On my test account:
Before: 394657 MatrixEvents, 53MB shallow size
After: 198863 MatrixEvents, 27MB shallow size
2018-02-20 16:45:20 +00:00
David Baker
8aa68b3dc1 lint 2018-02-20 11:09:32 +00:00
David Baker
e810ee7750 Add test for fixed state misbehaviour 2018-02-20 11:06:33 +00:00
David Baker
8b649cec8d All the copyrights 2018-01-18 11:52:27 +00:00
David Baker
461acbcc81 More test fixing
* Change test for new storage layer
 * Always store device keys we download, even if we weren't
   tracking the user.
2018-01-17 18:49:33 +00:00
David Baker
5bab8647b6 Fix device tracking with initial /sync
* Check whether we share an e2e room with user IDs in the 'left'
   field of /keys/changes: there's no guarantee we no longer share
   any e2e rooms with these users
 * Reset everyone's tracking status on an initial sync - just
   re-fetching device lists for all users we're currently tracking
   isn't good enough since room memberships may have changed.
 * Fix typo in test
2018-01-17 16:03:46 +00:00
David Baker
585ea14a23 more lint 2018-01-17 09:58:56 +00:00
David Baker
5a0997ded5 lint 2018-01-17 09:52:01 +00:00
David Baker
0174c5674f Make tests pass, finally.
Mostly making tests aware of new storage format or making them
force it to be written. Also some bugfixes like we didn't json
encode some things in the localstorage store and we didn't
correctly check the promise when requesting device data saves.
2018-01-16 17:57:49 +00:00
David Baker
27d28b8247 More test fixing
Allow localstorage store to take a localstorage impl, make TestClient
pass a cryptostore & fix True/true typo
2018-01-15 16:27:28 +00:00
David Baker
110f43a246 Make DeviceList test pass
Includes making saveIfDirty() return a promise in case you care
about when changes got saved (which the test does).
2018-01-15 15:21:39 +00:00
David Baker
e6dd573e8a Fix test (needs a cryptostore now) 2017-12-06 19:42:01 +00:00
Matthew Hodgson
fb75134179 unbreak tests 2017-11-06 15:17:06 +00:00
Hubert Chathi
8f252992e4 keep track of event ID and timestamp of decrypted messages
This is to avoid false positives when detecting replay attacks.

fixes: vector-im/riot-web#3712

Signed-off-by: Hubert Chathi <hubert@uhoreg.ca>
2017-10-11 23:27:36 -04:00
Richard van der Hoff
1a55f550c0 Handle 'left' users in the deviceList mananagement
When we no longer share any rooms with a given user, the server will stop
sending us updates on their device list, and will (once synapse is updated)
send us a notification of that fact via the 'left' field in the device_lists
field in /sync, or the response from /keys/changes.
2017-09-08 15:40:26 +01:00
Richard van der Hoff
ca8674e0de Factor out devicelist integration tests to a separate file
There's a fuzzy line between the megolm tests and the devicelist ones, but
since I want to add more tests for devicelists, we might as well put the ones
which are definitely about devicelists in their own file
2017-09-08 11:54:16 +01:00
Richard van der Hoff
ca91fba071 Crypto test: Bump the timeout when waiting for Ali to claim keys
This failed a test, so let's just bump up the timeout a bit more.
2017-08-16 21:02:52 +01:00
Richard van der Hoff
9f2fce4d87 Try harder to wait for megolm decryption
Ok, this *really* ought to fix the racy test.
2017-08-16 19:01:47 +01:00
Richard van der Hoff
12212409c7 Hopefully, fix racy megolm test
I couldn't repro the failure locally, but this looks like it should fix the
test failures.
2017-08-15 19:09:50 +01:00
Richard van der Hoff
f00558d840 Merge remote-tracking branch 'origin/develop' into rav/async_crypto/1 2017-08-15 18:31:02 +01:00
Richard van der Hoff
e8be38ce5a Add delays to tests to wait for things to decrypt
Prepare for some refactoring which will add an extra tick to decryption by
adding some `awaitDecryption` calls in the integration tests.
2017-08-14 18:39:45 +01:00
Richard van der Hoff
38c9a05a0c Make Event.attemptDecryption return useful promises
Even if a decryption attempt is in progress, return a promise which blocks
until the attempt is complete.
2017-08-14 18:38:29 +01:00
Richard van der Hoff
8a0f73bf81 Make some OlmDevice megolm methods async
* OlmDevice.hasInboundSessionKeys
* OlmDevice.getInboundGroupSessionKey

The latter means that MegolmDecryption.shareKeysWithDevice takes longer before
it sends out the keyshare, so means the unit test needed an update
2017-08-10 15:01:56 +01:00
Richard van der Hoff
c870930bc0 Add delays to tests to wait for things to decrypt
Prepare for some refactoring which will add an extra tick to decryption by
adding some `awaitDecryption` calls in the integration tests.
2017-08-10 15:01:56 +01:00
Richard van der Hoff
6613ee6b0d Make crypto.decryptMessage return decryption results
... instead of having it call event.setClearData.

The main advantage of this is that it fixes a race condition, wherein apps
could see `event.isDecrypting()` to be true, but in fact the event had been
decrypted (and there was no `Event.decrypted` event on its way).

We're also fixing another race, wherein if the first attempt to decrypt failed,
a call to `attemptDecryption` would race against the first call and a second
attempt to decrypt would never happen.

This also gives a cleaner interface to MatrixEvent, at the expense of making
the `megolm` unit test a bit more hoop-jumpy.
2017-08-10 13:05:35 +01:00
Richard van der Hoff
906bf88450 Merge remote-tracking branch 'origin/develop' into rav/async_crypto/olmlib 2017-08-09 18:11:48 +01:00
Richard van der Hoff
aff32afefa Make olmlib.encryptMessageForDevice async 2017-08-09 10:46:18 +01:00
Richard van der Hoff
18f75ec61c make algorithm.hasKeysForKeyRequest async 2017-08-08 18:26:31 +01:00
Richard van der Hoff
ab8d06bb86 Make tests wait for syncs to happen
Add lots of calls to `syncPromise` to cope with the fact that sync responses
are now handled asynchronously, which makes them prone to races otherwise.

Also a quick sanity-check in crypto to make one of the test failures less
cryptic.
2017-08-08 10:58:19 +01:00
Richard van der Hoff
9ab9b9d75a Make crypto._signObject async 2017-08-07 17:13:09 +01:00
Richard van der Hoff
b40473aa3b Fix broken event-emitter test
We need to wait for two syncs, not just one, here.
2017-07-26 07:27:08 +01:00
Richard van der Hoff
3bd5ffc5cd Fix broken crypto test
Now that sync takes a bit longer to send out Event events, the encrypted events
have already been decrypted by the time the test sees them - so we no longer
need to await their decryption.
2017-07-26 07:20:02 +01:00
Richard van der Hoff
10aafd3738 Merge branch 'develop' into rav/async_crypto_event_handling 2017-07-26 07:11:48 +01:00
Richard van der Hoff
b497bc5eb9 Fix broken test: wait for sync to complete 2017-07-21 16:04:53 +01:00
Richard van der Hoff
8bbf14acbf Let event decryption be asynchronous
Once everything moves to indexeddb, it's going to require callbacks and the
like, so let's make the decrypt API asynchronous in preparation.
2017-07-21 14:41:22 +01:00
Richard van der Hoff
d37cbb10a5 Merge pull request #507 from matrix-org/rav/fix_racy_cancellation_test
Retrying test: wait for localEchoUpdated event
2017-07-21 13:19:55 +01:00
David Baker
6aaac45468 Merge pull request #504 from matrix-org/dbkr/fix_member_events_timeline_reset_2
Fix member events breaking on timeline reset, 2
2017-07-20 14:25:41 +01:00
Richard van der Hoff
9c6f004f7f Retrying test: wait for localEchoUpdated event
We need to wait for the js-sdk to have an opportunity to process the 400 from
the /send/ request before checking the event state
2017-07-20 13:12:21 +01:00
Richard van der Hoff
2ac34dbab0 Merge pull request #503 from matrix-org/rav/async_crypto/public_api
Make bits of the js-sdk api asynchronous
2017-07-19 21:14:40 +01:00
krombel
e686eb750f use device_one_time_keys_count transmitted by /sync (#493)
Where it is available, use the one_time_keys_count returned by /sync instead of polling the server for it.

This was added to synapse in matrix-org/synapse#2237.
2017-07-19 16:27:05 +01:00
David Baker
342f5c01e0 Update tests for new resetLiveTimeline interface 2017-07-19 14:54:18 +01:00
Richard van der Hoff
2ff9a36eed Make a number of the crypto APIs asynchronous
Make the following return Promises:

* `MatrixClient.getStoredDevicesForUser`
* `MatrixClient.getStoredDevice`
* `MatrixClient.setDeviceVerified`
* `MatrixClient.setDeviceBlocked`
* `MatrixClient.setDeviceKnown`
* `MatrixClient.getEventSenderDeviceInfo`
* `MatrixClient.isEventSenderVerified`
* `MatrixClient.importRoomKeys`

Remove `listDeviceKeys` altogether: it's been deprecated for ages, and since
applications are going to have to be changed anyway, they might as well use its
replacement (`getStoredDevices`).
2017-07-18 23:35:33 +01:00
Richard van der Hoff
d1e91cd702 Add MatrixClient.initCrypto
initialising the crypto layer needs to become asynchronous. Rather than making
`sdk.createClient` asynchronous, which would break every single app in the
world, add `initCrypto`, which will only break those attempting to do e2e (and
in a way which will fall back to only supporting unencrypted events).
2017-07-18 23:35:33 +01:00
Richard van der Hoff
e2599071c5 Merge pull request #499 from matrix-org/rav/omfg_when_will_it_end
Yet more js-sdk test deflakification
2017-07-17 11:57:05 +01:00
Richard van der Hoff
fc38b89aee Merge pull request #497 from matrix-org/rav/yet_another_flakey_test
Fix racy 'matrixclient retrying' test
2017-07-17 11:56:39 +01:00