Commit graph

182 commits

Author SHA1 Message Date
Bruno Windels 993a86ddb2 convert SessionBackup to typescript and pass in keyloader 2022-01-20 11:16:08 +01:00
Bruno Windels c6c1d3b3d8 refactor logout in client so we don't need a fully loaded session
instead, we pass the session id in
this will make it easier to first dispose the client when leaving the
/session/<id> and just creating a client without fully loading it
to log out. This way sync is already not running anymore.
2022-01-17 16:29:01 +01:00
Bruno Windels fe26f48c47 rename SessionContainer to Client 2021-12-22 17:09:52 +01:00
RMidhunSuresh b2efcb9515 Convert SecretStorage.js to ts 2021-12-03 11:36:51 +05:30
RMidhunSuresh dd4704b818 Fix imports 2021-12-03 11:36:49 +05:30
Bruno Windels 9042520916
Merge pull request #595 from vector-im/ts-conversion-matrix-push
Convert /matrix/push to typescript
2021-12-02 09:28:59 +01:00
RMidhunSuresh 3d9fbb685a Convert Pusher.js to ts 2021-11-25 13:23:05 +05:30
RMidhunSuresh 1549d8add0 Convert LockMap to ts 2021-11-17 20:28:44 +05:30
Bruno Windels bffe34fe0a await write key 2021-11-03 02:20:27 +01:00
Bruno Windels a8022077f6 add minimal logging 2021-11-03 02:20:11 +01:00
Bruno Windels 8a36eb4532 check mac of dehydrated key to match default 4s key mac before adopting 2021-11-03 02:07:57 +01:00
Bruno Windels 567cdd5510 WIP for enabling session backup from dehydration key 2021-10-29 19:17:31 +02:00
Bruno Windels 44a26fd340 key backup: add disable button,and enabling add dehydrated device option 2021-10-29 15:48:28 +02:00
Bruno Windels c3dfdde626 be forgiving when dispose has already been called 2021-10-28 12:04:42 +02:00
Bruno Windels bef12c7a8f prevent double free on olm account when logging out
by ensuring we only dispose the e2ee/Account once, as well as
the Session and other classes
2021-10-28 11:48:25 +02:00
Bruno Windels 68a6113c26 add logout button to session load error screen 2021-10-28 11:47:31 +02:00
Bruno Windels e3378d5636 use correct device_id in signatures for dehydrating device
completely replace device id for dehydrating device
so we don't have to pass it down the stack
2021-10-27 18:08:50 +02:00
Bruno Windels c89e414bb5 WIP3 2021-10-27 15:08:53 +02:00
Bruno Windels 718b410253 WIP2 2021-10-27 10:26:36 +02:00
Bruno Windels faf4ea6434 WIP 2021-10-26 18:47:46 +02:00
Bruno Windels f998041748 add logout button in settings 2021-10-26 12:49:31 +02:00
Bruno Windels 6d8ec69a4d fix lint 2021-10-22 18:01:17 +02:00
Bruno Windels 66a93ee108 adapt Session and RoomEncryption to megolm/Decryption API changes 2021-10-22 17:48:53 +02:00
Bruno Windels 77d10c93d6 convert groupby and megolm decryption utils to typescript 2021-10-21 14:40:51 +02:00
Bruno Windels a0f443ccc3
Merge pull request #521 from DanilaFe/typescript-observable
Start migrating Observable code to TypeScript.
2021-10-01 09:54:29 +02:00
Danila Fedorin a7360f409e Rename ObservableValue to TypeScript 2021-09-29 17:42:57 -07:00
Bruno Windels e0b9a3fa50 create e2ee identity also when storage got cleared without backup 2021-09-29 20:07:42 +02:00
Bruno Windels c7b47bb8d6 fix homeServer misspelling to homeserver across the project 2021-08-23 19:26:39 +02:00
Bruno Windels 3724fc6765 log join network call 2021-05-18 11:49:16 +02:00
Bruno Windels 9679058081 allow to join room by id or alias 2021-05-18 11:05:31 +02:00
Bruno Windels b30b62416c add option to forget archived room 2021-05-12 15:38:54 +02:00
Bruno Windels 1738a0ea3c need to create archived room when leaving, otherwise it isn't stored 2021-05-11 16:58:16 +02:00
Bruno Windels 8b8214cd1b reference count archived rooms and keep track of active ones
so we don't create two instances for the same id, one for sync, and one
for displaying, and hence updates from sync being pushed on a different
instance than the one displaying, and not updating the view.
2021-05-11 16:09:58 +02:00
Bruno Windels 965700272b remove archivedRoom map, it's unused and just complicating for now 2021-05-11 16:09:01 +02:00
Bruno Windels 99d5467ad1 make archived room part of sync lifecycle (draft) 2021-05-10 18:42:30 +02:00
Bruno Windels 6bb8e2fa43 allow loading an archived room 2021-05-07 13:10:10 +02:00
Bruno Windels 1b83ae7d8a allow observing the room status 2021-05-07 13:09:38 +02:00
Bruno Windels 243d105aad support getting the room status for a room: invited, joined or archived 2021-05-07 13:08:39 +02:00
Bruno Windels 644698aed7 remove room from room list when leaving 2021-05-06 14:15:47 +02:00
Bruno Windels 89461bf69a do all collection removal from sync rather than hand callbacks to invite 2021-05-06 14:15:47 +02:00
Bruno Windels aaf4e79a73 make media repo available on invite 2021-04-27 11:01:33 +02:00
Bruno Windels 847738a76c set invite on left room so we can detect a vm refresh is needed 2021-04-23 18:05:14 +02:00
Bruno Windels 0cc95f5083 first draft of InviteViewModel 2021-04-21 15:45:51 +02:00
Bruno Windels 465e0c191f add logging to accepting or rejecting an invite 2021-04-21 15:31:55 +02:00
Bruno Windels bb1c64e1ac add left panel tile view model for invites
and track in-progress state in Invite so it is shared by left panel
and open invite
2021-04-20 19:01:40 +02:00
Bruno Windels ee98eaa640 restore invites when loading the session 2021-04-20 18:09:48 +02:00
Bruno Windels a072426e07 integrate invites into the sync lifecycle and expose them on session 2021-04-20 17:39:46 +02:00
Bruno Windels 81a35639ba add Invite class
calculating the room name, avatar, etc ...
with empty accept and reject methods for now
2021-04-20 16:21:27 +02:00
Bruno Windels c06659c0be support checking if pusher is still present on server 2021-04-01 14:59:46 +02:00
Bruno Windels 3313d0623a thinko with push checks 2021-03-23 18:20:23 +01:00
Bruno Windels 630e61a674 support enabling/disabling push notifs on a session 2021-03-23 18:20:23 +01:00
Bruno Windels 0b211e8e1c simplify this code now that it is only doing one thing 2021-03-09 12:27:51 +01:00
Bruno Windels e97ed9ae45 fix session test, just barely 2021-03-05 17:03:12 +01:00
Bruno Windels e0d14207ac make opening a txn async again
as we'll need to await a bogus request first thing after opening the txn

funny enough, we originally made it sync to accommodate the same bug
in safari, but that didn't prevent any microtask being awaited
before scheduling a request in the calling code closing the txn.

We'll await a bogus request within the transaction class now so it
doesn't depend on the calling code
2021-03-04 19:47:02 +01:00
Bruno Windels fb446167f6 make new sync room keys available during decryption of same sync 2021-03-02 19:39:04 +01:00
Bruno Windels 57bb75e864 log login & loading a session 2021-02-23 19:22:25 +01:00
Bruno Windels ef1e867dee no need for keys in the iteration 2021-02-23 19:20:58 +01:00
Bruno Windels 94cc8b99b0 don't need to check this actually, sync response should be there 2021-02-22 11:21:56 +01:00
Bruno Windels f0d9d13f4e don't assume device lists are set in sync response 2021-02-22 11:20:51 +01:00
Bruno Windels 08622699f6 more logging for device messages 2021-02-18 19:56:47 +01:00
Bruno Windels c5c0a181ff move check for devicelists up in Session.writeSync, and more logging 2021-02-18 19:56:10 +01:00
Bruno Windels f321968ac3 add more sync logging 2021-02-18 12:44:19 +01:00
Bruno Windels d39c3812b2
Merge pull request #231 from vector-im/bwindels/logs
Structured logging
2021-02-17 10:19:46 +00:00
Bruno Windels bbab1e9ecc move base64/58 encoding into platform
fixes https://github.com/vector-im/hydrogen-web/issues/99
2021-02-12 16:01:54 +01:00
Bruno Windels e515548037 add some comments while debugging a problem 2021-02-11 21:08:06 +01:00
Bruno Windels e49639fda2 move textencoder/decoder into platform 2021-02-11 17:29:48 +01:00
Bruno Windels 0c70a67ebb pass platform to room
as we'll need it to access crypto and creating blobs
2020-11-11 10:47:19 +01:00
Bruno Windels 03351d2e1f extract platform class to put all platform specific code in 2020-10-26 15:44:11 +01:00
Bruno Windels f214c53fa9 add @internal and other comments to Session 2020-10-23 12:59:40 +02:00
Bruno Windels df8eed14aa expose whether we already have a 4s key,to show the 4s setup in settings
it's a tri-state of null/false/true with null meaning we need to
go online first to know as only then we try to setup session backup
2020-10-23 12:57:47 +02:00
Bruno Windels df72e829bf setup session backup as part of start method, so we know we're online
also don't upload OTKs in case of existing account until
catchup sync has happened
2020-10-23 12:22:52 +02:00
Bruno Windels 6f82d81f39 better session backup ui 2020-10-19 18:29:13 +02:00
Bruno Windels 974f77a71d WIP 2020-10-16 18:06:20 +02:00
Bruno Windels 7def542e21 fix test 2020-10-06 12:19:47 +02:00
Bruno Windels 300529b7c5 write sync token first
in case we get a TransactionInactiveError,
we have at least written the sync token
and won't repeat the same sync request
2020-10-01 14:38:54 +02:00
Bruno Windels 76381fbca1 open storage transactions synchronously
this (almost) makes it work in some browsers that otherwise
have throw a TransactionInactiveError on the first operation
you try to do on a store.
2020-09-28 16:06:41 +02:00
Bruno Windels 4a0173e90f only run decryptPending if needed 2020-09-24 10:53:51 +02:00
Bruno Windels 137f55b44d manage request scheduler in session container
so we can start it before sync does its first request,
which otherwise gets aborted because the scheduler hasn't started yet
2020-09-22 16:39:41 +02:00
Bruno Windels 85b451ffa1 can't rename named params like this 2020-09-22 15:49:43 +02:00
Bruno Windels 5660e0f4f0 rename send scheduler to request scheduler 2020-09-22 15:49:35 +02:00
Bruno Windels 0a00d4c865 use hsApi wrapper that handles rate-limiting instead of send scheduler 2020-09-22 13:43:18 +02:00
Bruno Windels d7c25e3106 move MediaRepository out of HomeServerApi
so HomeServerApi becomes easier to wrap, only having methods
that return a RequestResult.
2020-09-22 13:40:38 +02:00
Bruno Windels c9ee5a5db2 stay in catchup mode as long as there are device messages
this implements https://github.com/vector-im/element-web/issues/2782

it also implements 0 timeout for catchup, getting rid of the
catching up with your convo banner for 30s upon reconnection.
2020-09-21 17:57:01 +02:00
Bruno Windels 015c6b1c70 interpret unreported signed_curve25519 as 0 OTKs 2020-09-21 17:56:23 +02:00
Bruno Windels da780d0aa2 delay backup 10s if missing session event came from sync 2020-09-18 13:11:02 +02:00
Bruno Windels ed913ca24b add dispose to room encryption 2020-09-18 13:08:18 +02:00
Bruno Windels 7d6fcfafa8 pass olm, better naming, don't reuse var 2020-09-17 18:55:39 +02:00
Bruno Windels 494c5cbcf0 notify UI when we need session backup 2020-09-17 18:00:00 +02:00
Bruno Windels a205ae8841 fixes 2020-09-17 17:57:12 +02:00
Bruno Windels 9d622434fb integrate session backup with session class 2020-09-17 15:58:46 +02:00
Bruno Windels 7f97c540fb obsolete comment, this is already the case 2020-09-17 14:20:42 +02:00
Bruno Windels abfde76e24 store account data in storage
needs a resync, need to think how to handle this
2020-09-17 10:39:51 +02:00
Bruno Windels 00eade1c16 add crypto driver with primitives needed for 4S & session backup 2020-09-17 10:19:09 +02:00
Bruno Windels 96119b4e58 load all pending operations when starting the session, pass to room 2020-09-11 14:41:40 +02:00
Bruno Windels 0dece5b04f make continuation logic work well with pending events
- don't use display name to compare but user id
   (pending doesn't have display name yet)
 - use current time as timestamp
2020-09-11 11:43:40 +02:00
Bruno Windels e0d9d703b7 offload olm account creation in worker 2020-09-11 10:43:17 +02:00
Bruno Windels af36c71a59 load worker in main and pass paths so it works both on compiled and non-compiled 2020-09-10 18:41:23 +02:00
Bruno Windels 94b0cfbd72 add prepareSync and afterPrepareSync steps to sync, run decryption in it 2020-09-10 12:11:43 +02:00
Bruno Windels 212efe823c fix memberlist not containing all members
we were using the prev_batch of the last sync to pass to
/members, but this points at the timeline *before* the last
sync, so wouldn't contain all members. Use the sync token instead.
2020-09-09 09:50:03 +02:00
Bruno Windels 1aa044667c try sending out pending room keys after first sync 2020-09-08 14:39:07 +02:00