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

2131 Commits

Author SHA1 Message Date
Richard van der Hoff
25ccd6bc6d Make Crypto._processReceivedRoomKeyRequests async
This is slightly complicated by the fact that it's initiated from a synchronous
process which we don't want to make async (processing the /sync response) and
we want to avoid racing two copies of the processor.
2017-08-07 17:13:09 +01:00
Richard van der Hoff
14ad32bcd2 Make Crypto.importRoomKeys async 2017-08-07 17:13:09 +01:00
Richard van der Hoff
9ab9b9d75a Make crypto._signObject async 2017-08-07 17:13:09 +01:00
Richard van der Hoff
b7a3c4557f Make crypto.getOlmSessionsForUser async
This is snever used anywhere (it's mosdly for debug), so this is trivial
2017-08-07 17:13:08 +01:00
Richard van der Hoff
86ad75d27b Merge pull request #508 from matrix-org/rav/async_crypto_event_handling
Refactor handling of crypto events for async
2017-07-26 09:07:59 +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
c055765bfe Merge pull request #509 from rav/async_crypto/async_decryption 2017-07-26 07:09:12 +01:00
Richard van der Hoff
d8f486fc0d Verbose logging to see what's up with indexeddb (#514)
In an attempt to see why our tests sometimes time out, add a load of logging to
confirm exactly where it is happening.
2017-07-25 11:38:27 +01:00
Luke Barnard
06eea71a37 Add rawDisplayName to RoomMember (#513)
* Add rawDisplayName to RoomMember

This will at first be the `userId`, but when the members membership event is set, `rawDisplayName` will be assigned to the raw `displayname` of the membership event. This deliberately avoids disambiguation so that clients can disambiguate themselves (via a tooltip or otherwise).

* Clarify docs
2017-07-24 17:35:53 +01:00
Richard van der Hoff
3effb9ec29 Merge pull request #511 from matrix-org/rav/async_to_bluebird
Transform `async` functions to bluebird promises
2017-07-24 10:26:26 +01:00
David Baker
6603a2300b Merge pull request #512 from matrix-org/dbkr/groupview_edit
Add more group APIs
2017-07-24 10:00:06 +01:00
David Baker
ed029fe348 More useful doc 2017-07-24 09:55:04 +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
8a4a1dfadf Transform async functions to bluebird promises
Now that we use transform-runtime instead of regenerator-runtime, we need to
use the async-to-bluebird transform to make sure that `async` functions get
transformed into bluebird promises.
2017-07-21 15:59:30 +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
86f2c86440 Add MatrixEvent.attemptDecryption
... and use it from both MatrixClient and the megolm re-decryption code.

This will help us avoid races when decryption is asynchronous.
2017-07-21 14:41:22 +01:00
Richard van der Hoff
cfb29f1339 Refactor handling of crypto events for async
We're going to need to handle m.room.crypto events asynchronously, so
restructure the way we do that.
2017-07-21 14:41:01 +01:00
Richard van der Hoff
63a28d8e34 Fix lint in /sync 2017-07-21 14:41:01 +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
055590c0c6 Add more group APIs 2017-07-21 11:13:27 +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
David Baker
34adaae5af Add helpfully named variable for old timeline 2017-07-20 14:17:14 +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
David Baker
ff685e33d5 clarify comment 2017-07-20 11:00:50 +01:00
David Baker
2999603b28 more commentage 2017-07-20 10:43:47 +01:00
Richard van der Hoff
32d8f4b084 Fix jsdoc failure on async code (#506)
We need jsdoc 3.5 to support the async/await syntax.
2017-07-20 09:45:37 +01:00
Richard van der Hoff
0fb0c1b71b Use babel transform-runtime instead of regenerator-runtime (#505)
Attempting to use the regnerator-runtime ourselves led to a fight with riot-web
about whether `global.regeneratorRuntime` could be defined. By using the
transform-runtime plugin, references to `global.regeneratorRuntime` which are
created by the transform-regenerator plugin are turned into references to an
imported module, which works much better.

(The full tragic tale went as follows:

- riot-web uses transform-runtime, which adds an import of
  `regenerator-runtime` to index.js
- `regenerator-runtime`:
   - loads `regenerator-runtime/runtime`, which defines
     `global.regeneratorRuntime`
   - then clears the global property and returns the regeneratorRuntime object
     as the exported value from the module
- later, the js-sdk tried to import `regenerator-runtime/runtime`, which then
  did nothing because the module had already been loaded once.

For added fun, this only manifested itself when riot-web and js-sdk shared an
instance of the `regenerator-runtime` package, which happens on proper builds,
but not a normal development setup.)
2017-07-20 09:18:37 +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
Richard van der Hoff
986fb12543 Fix some typos in comments 2017-07-19 21:13:06 +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
8ac15068ee more comments 2017-07-19 16:24:42 +01:00
David Baker
5e4cd6cf11 Add hopefully clearer comments 2017-07-19 16:20:40 +01:00
David Baker
39d694de8c No longer need RoomState 2017-07-19 14:58:18 +01:00
David Baker
342f5c01e0 Update tests for new resetLiveTimeline interface 2017-07-19 14:54:18 +01:00
David Baker
f91293c6c5 Set the start state of the new timeline correctly 2017-07-19 14:52:27 +01:00
David Baker
1ce4977a70 get state events before we nuke the roomstate 2017-07-19 12:00:04 +01:00
David Baker
f4b25b59e5 Lint 2017-07-19 11:56:58 +01:00
David Baker
b33a47e253 Fix member events breaking on timeline reset, 2
Re-use the same RoomState from the old live timeline so we re-use
all the same member objects etc, so all the listeners stay attached
2017-07-19 11:49:20 +01:00
Richard van der Hoff
ccd4d4263d Changelog: breaking e2e changes 2017-07-18 23:35:33 +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
Richard van der Hoff
5688286a79 Merge pull request #495 from matrix-org/rav/fix_key_requests_race
Fix spamming of key-share-requests
2017-07-17 11:56:05 +01:00
David Baker
7eb10ab7ac Merge pull request #500 from matrix-org/rav/upload_progress
Add progress handler to `uploadContent`
2017-07-14 17:18:41 +01:00
Richard van der Hoff
34b31865c5 Add progress handler to uploadContent
bluebird doesn't support promise progression (or rather, it does, but it's
heavily deprecated and doesn't use the same API as q), so replace the
(undocumented) promise progression on uploadFile with a callback.
2017-07-14 16:51:43 +01:00
Richard van der Hoff
f1c5b632cc Deflake the matrixclient syncing tests (#498)
All of these tests were vulnerable to a race wherein we would flush the /sync
request, but the client had not yet processed the results before we checked
them. We can solve all of this by waiting for the client to emit a "sync"
event.
2017-07-14 16:09:28 +01:00
Richard van der Hoff
04ca0ac2b5 Give the megolm tests longer to complete
All that crypto stuff takes a while, so give it longer than 100ms.
2017-07-14 15:22:08 +01:00