Commit Graph

1995 Commits

Author SHA1 Message Date
RMidhunSuresh
8e08916502
Remove magic string 2023-03-14 16:21:29 +05:30
RMidhunSuresh
65c0afb027
Rename class 2023-03-14 15:59:13 +05:30
RMidhunSuresh
d70dd660c5
Refactor code
1. Remove unused properties from base stage
2. Split UserData into fields
3. Write getter for channel prop
2023-03-14 15:42:02 +05:30
RMidhunSuresh
dedf64d011
Base stage class does not need disposable 2023-03-14 14:28:33 +05:30
RMidhunSuresh
806e672806
Convert console.log to logger calls 2023-03-14 14:21:07 +05:30
RMidhunSuresh
fd96d5843d
Throw error if verification was cancelled 2023-03-14 14:13:57 +05:30
RMidhunSuresh
9c82dd7ce3
Refactor code 2023-03-14 00:54:00 +05:30
RMidhunSuresh
720585b8f2
Write unit tests 2023-03-13 21:17:22 +05:30
Bruno Windels
780dfeb199 WIP 2023-03-13 09:15:49 +01:00
Bruno Windels
760da6277a remove unused transaction 2023-03-09 09:08:01 +01:00
RMidhunSuresh
1f8fb93ba2
Implement timeout and cancel 2023-03-07 23:38:04 +05:30
Bruno Windels
a69246fb5a return undefined if we don't have the signing key 2023-03-07 14:40:11 +01:00
RMidhunSuresh
0b51fc0168
Throw specific error when cancelled 2023-03-07 17:27:27 +05:30
Bruno Windels
a065189836 delay signature validation of cross-signing keys until calculating trust
always store them, if not we'll think that the user hasn't uploaded
the cross-signing keys if we don't store them in spite of invalid or
missing signature.
2023-03-07 11:00:52 +01:00
Bruno Windels
bae18c037f return enum explaining user trust level rather than boolean 2023-03-07 10:53:32 +01:00
RMidhunSuresh
b3cc07cf1e
Accept verification from device message 2023-03-06 16:22:45 +05:30
RMidhunSuresh
4540ba2f37
Implement send ready stage 2023-03-05 15:25:09 +05:30
RMidhunSuresh
c9b462c803
Implement mac and done stage 2023-03-04 22:30:53 +05:30
Bruno Windels
e00d02a599 fix ts error 2023-03-03 16:18:30 +01:00
Bruno Windels
4c7f784911 implement verifying signaturs for user trust (green shield/red shield) 2023-03-03 15:21:37 +01:00
Bruno Windels
774efc17d9 extract method to sign key, as most params are always the same 2023-03-03 12:15:54 +01:00
Bruno Windels
eff495c36d also delete old crossSigningKeys field on userIdentities 2023-03-03 11:57:29 +01:00
Bruno Windels
08984ad1bc log amount of marked user identities in migration 2023-03-03 11:57:15 +01:00
Bruno Windels
2563aa23e1 actually write modified values in migration 2023-03-03 11:56:51 +01:00
Bruno Windels
c747d5f228 rename deviceTrackingStatus to keysTrackingStatus
as this field also reflects the tracking status of the cross-signing
keys for a given user.
2023-03-03 11:34:09 +01:00
Bruno Windels
7d806b03b3 mark all existing user identities outdated as cross-signing keys missing 2023-03-03 11:33:19 +01:00
Bruno Windels
1dc3acad03 use enum for device tracking status 2023-03-02 17:32:46 +01:00
Bruno Windels
3a303ff84d cleanup comments 2023-03-02 17:15:05 +01:00
Bruno Windels
34b113b26e don't upload pre-existing signatures when signing 2023-03-02 17:14:50 +01:00
Bruno Windels
504d869b38 provide correct user id for signing key owner when signing other user 2023-03-02 17:14:27 +01:00
Bruno Windels
20a6fcda72 don't allow signing own user 2023-03-02 17:14:05 +01:00
Bruno Windels
4dce93e5ef make sure the key property doesn't leak out of the storage layer
as it ends up in the value we're signing and uploading,
corrupting the signature
2023-03-02 17:13:15 +01:00
Bruno Windels
a9412aa57c fix import paths after TS conversion 2023-03-02 17:12:56 +01:00
Bruno Windels
daf66e1d6c implement signing users and other devices 2023-03-02 15:02:42 +01:00
RMidhunSuresh
683e055757
WIP 2023-03-01 16:59:24 +05:30
Bruno Windels
b8fb2b6df1 Store device keys in format needed to sign/verify, convert to TS
In order to sign and verify signatures of design keys, we need
to have them in the format as they are uploaded and downloaded
from the homeserver. So, like the cross-signing keys, we store
them in locally in the same format to avoid constant convertions.

I also renamed deviceIdentities to deviceKeys, analogue to
crossSigningKeys. In order to prevent mistakes in this refactor,
I also converted DeviceTracker to typescript.
2023-02-28 17:25:01 +01:00
Bruno Windels
151090527b Store cross-signing keys in format as returned from server, in separate store
This will make it easier to sign and verify signatures with these keys,
as the signed value needs to have the same layout when signing and
for every verification.
2023-02-28 14:07:55 +01:00
RMidhunSuresh
b6041cd20c
Channel WIP 2023-02-27 23:33:05 +05:30
RMidhunSuresh
e46b760fb7
Remove log 2023-02-27 23:32:05 +05:30
RMidhunSuresh
ed4eb9bde0
Emit event from DeviceMessageHandler 2023-02-27 23:31:30 +05:30
RMidhunSuresh
75688cf6f3
REFACTOR: Extract methods and functions 2023-02-22 13:01:58 +05:30
RMidhunSuresh
af918e3df0
Remove comment 2023-02-22 13:01:34 +05:30
RMidhunSuresh
5e1dca946b
Free olmSas after all stages have completed 2023-02-22 13:00:36 +05:30
RMidhunSuresh
3321859ae6
Add more stages 2023-02-22 12:03:03 +05:30
RMidhunSuresh
e6ea003bef
WIP +1 2023-02-17 17:18:17 +05:30
RMidhunSuresh
d81864e901
WIP 2023-02-16 21:41:33 +05:30
RMidhunSuresh
772d91f924
WIP 2023-02-16 11:27:43 +05:30
Bruno Windels
71d7dcb0ca store self-signing keys on userIdentity 2023-02-14 16:26:55 +01:00
Bruno Windels
693640d222 implement signing our own device 2023-02-14 16:25:32 +01:00
Bruno Windels
103ae1e789 fix unit tests 2023-02-14 13:24:26 +01:00
Bruno Windels
fdce098245 create cross-signing class, support deriving msk from 4s stored privkey
and check if they match the publicized one and then trust it
2023-02-14 12:12:20 +01:00
Bruno Windels
ce5b27f4b8 support fetching the master signing key for a user in the device tracker 2023-02-14 12:11:59 +01:00
Bruno Windels
2043541f56 fix missing free in key backup 2023-02-10 17:36:14 +01:00
Bruno Windels
7c1117ddd4 keep token in memory to compare stored token with after /messages
and don't look at response.start as it can be different as
the format can change after a server upgrade while
(still pointing at the same location)
2023-02-10 14:08:35 +01:00
Bruno Windels
83d1ea05a1 fix unit test 2023-02-10 11:22:13 +01:00
Bruno Windels
f9fa59609f fix local variable usage after extracting method 2023-02-10 08:48:10 +01:00
Bruno Windels
4a46c98d12 don't assume the call handler is always set in device message handler 2023-02-09 11:57:45 +01:00
Bruno Windels
22a8182266 feature-gate calls everywhere in the app 2023-02-09 11:57:30 +01:00
Bruno Windels
d5929d9ebe make features available in Client and Session 2023-02-09 11:53:39 +01:00
Bruno Windels
fe5794a4bc don't clear options as error boundary may fire after dispose 2023-02-07 23:26:02 +01:00
Bruno Windels
928419502e no point in ref'ing an item on its parent 2023-02-07 22:44:43 +01:00
Bruno Windels
b6c7bbb05c
Merge pull request #1016 from vector-im/calls-fix-1012
Calls: Emit update after sending signalling message + other error fixes
2023-02-07 22:03:36 +01:00
Bruno Windels
dd89aab516 fix typescript error in unit test 2023-02-07 20:19:06 +01:00
Bruno Windels
5ad3f0c671 look at signalingState when even is fired, not later when it may have changed 2023-02-07 20:11:35 +01:00
Bruno Windels
3ff91639c6 log signalingState on negotiationneeded 2023-02-07 20:07:16 +01:00
Bruno Windels
5c2889aa5b show DOM errors on the member error boundary rather than one for call
gives a bit more context
2023-02-07 19:59:13 +01:00
Bruno Windels
7114428b23 now that the dom handler uses an error boundary, don't need this anymore 2023-02-07 19:57:42 +01:00
Bruno Windels
a49c9c17c0
Merge pull request #1017 from vector-im/bwindels/fix-1015
Improve `seq` handling to prevent queue blocking for call signalling messages
2023-02-07 19:50:55 +01:00
Bruno Windels
0fa9d193d9 fix comment typo 2023-02-07 19:42:43 +01:00
Bruno Windels
7f9d64c972 improve logging of arrival of to_device call signalling messages 2023-02-07 19:42:20 +01:00
Bruno Windels
ddb5865ccb actually forgot to dispose peerCall here when replacing 2023-02-07 15:00:56 +01:00
Bruno Windels
02108c69dc remove debug logging 2023-02-07 15:00:45 +01:00
Bruno Windels
f67fb7add6 add unit test for this particular error case 2023-02-07 14:58:57 +01:00
Bruno Windels
e39dd176a4 remove debug logging 2023-02-07 14:58:32 +01:00
RMidhunSuresh
496dfee593
Catch error in promise chain 2023-02-07 19:25:48 +05:30
RMidhunSuresh
6d800ff359
WIP 2023-02-07 19:15:36 +05:30
Bruno Windels
5f4ad30d03 don't block if it does happen that we have processed a message too early
allow dequeueing if the first seq in the queue is actually lower
than what we already processed. Normally should not happen,
but the bug fixed in the previous commit was aggravated by
this behavior, so be more lenient here.
2023-02-07 14:43:28 +01:00
Bruno Windels
39e9a43a1b be strict about the first seq being 0
otherwise if first 2 messages are delivered in reverse order,
the queue gets blocked
2023-02-07 14:42:44 +01:00
Bruno Windels
cadeae98bc prevent ignored signaling messages from blocking the queue
signaling messages get ignored when they are not for the
currently active call id. In that case we currently don't
advance the lastProcessedSeqNr counter, as we had a problem
before where the counter would be brought out of sync with
seq numbers for other call ids.
However when we've previously processed a signalling message
(e.g. the counter is not undefined) and the first message in the queue
is to be ignored, it will prevent the subsequent messages from being
dequeued as their seq number is more than 1 away from the last
processed seq. This adds an additional counter for ignored seq numbers
that is also used to see if the next message is only 1 away from
the next seq value.

I am adding logging as well here to have a better overview in the future
2023-02-07 14:18:14 +01:00
RMidhunSuresh
7eae171ac9
Emit after sending signalling message 2023-02-06 17:12:39 +05:30
RMidhunSuresh
09e67ec21c
Deal with race in a better way 2023-02-02 18:39:19 +05:30
RMidhunSuresh
de57e07982
Wait for room to come through sync 2023-02-02 15:26:38 +05:30
RMidhunSuresh
9a6d15a72b
Fix unwanted toast appearing when opening client 2023-01-31 16:49:58 +05:30
Bruno Windels
825602a04a dispose local media here when returning early as join takes ownership 2023-01-27 10:12:36 +01:00
Bruno Windels
c8bb5fffb0 don't allow to join a call using a foci 2023-01-27 10:12:22 +01:00
Bruno Windels
365157449e cleanup loops here to not get keys 2023-01-27 10:02:13 +01:00
Bruno Windels
43dea3bfdc detect calls using a foci 2023-01-27 10:01:53 +01:00
Bruno Windels
90ba35da7a listen for members.size changes in CallTile and emit update so memberCount binding updates
also be consistent to not emit updates on call object when changing members map
2023-01-26 14:50:46 +01:00
Bruno Windels
0a9f533421 Merge branch 'bwindels/calls' into bwindels/calltile-ui 2023-01-26 13:27:29 +01:00
Bruno Windels
725757e235 Merge branch 'bwindels/calls' into calls-show-toast 2023-01-26 11:50:52 +01:00
Bruno Windels
043ad98866 element call also terminates prompt calls, so do so too 2023-01-24 23:33:04 +01:00
Bruno Windels
e140a4ba64 element call puts string in terminated, not a boolean 2023-01-24 23:33:04 +01:00
RMidhunSuresh
fa5cb684b0
WIP 2023-01-24 13:51:17 +05:30
Bruno Windels
1df8d31ab5 show call duration in tile 2023-01-23 17:06:33 +01:00
Bruno Windels
3bb889ed9c WIP 2023-01-23 14:53:08 +01:00
Bruno Windels
2bd37970ba each LocalMedia own their streams, so a copy should have their own clone 2023-01-20 17:34:15 +01:00
Bruno Windels
590e9500c1 clone localMedia,so we don't remove audio track from stream sent to peer 2023-01-20 17:33:16 +01:00
Bruno Windels
6645f8f43b remove debug throw 2023-01-20 16:50:15 +01:00
Bruno Windels
b2feaf2b4e fix mixing up params, causing us to call onUpdate on params rather than vm 2023-01-20 16:50:07 +01:00
Bruno Windels
920fedae5e merge master into bwindels/calls 2023-01-20 16:24:38 +01:00
Bruno Windels
2408850678 emit change before logging 2023-01-19 11:33:21 +01:00
Bruno Windels
3842f450dd ensure errors caught by boundary are logged in calls code 2023-01-19 11:30:23 +01:00
Bruno Windels
dfaaf6d234 cleanup reply code a bit, have only 1 path to send message 2023-01-19 09:54:07 +01:00
Bruno Windels
e33209b747 start logging in view model and pass it on to model methods (calls+room) 2023-01-19 09:54:02 +01:00
Bruno Windels
1e4180a71f add error boundary to GroupCall 2023-01-19 09:48:59 +01:00
Bruno Windels
7f9edbb742 this can be private 2023-01-19 09:46:19 +01:00
Bruno Windels
b1687d7115 introduce error boundary in call member 2023-01-19 09:46:19 +01:00
RMidhunSuresh
1cd6540476
Don't use getter here 2023-01-17 14:32:02 +05:30
RMidhunSuresh
ce5c5779bd
Set mute -> mute 2023-01-17 14:24:20 +05:30
RMidhunSuresh
c064336e35
Create localPreviewMedia in GroupCall.setMedia 2023-01-16 15:28:50 +05:30
RMidhunSuresh
f6c94ecc5a
WIP 2023-01-16 13:41:47 +05:30
Bruno Windels
cb0f803276 make this code a bit clearer 2023-01-06 12:05:34 +01:00
Bruno Windels
fcb4f2a62d fix microphone audio being played back through local video preview 2023-01-06 12:05:11 +01:00
Bruno Windels
e26eb30b82 rename m.expires_ts to expires_ts to be compatible with MSC/Element 2023-01-05 15:47:01 +01:00
Eric Eastwood
087a4ad7ce Add copy permalink action 2022-11-10 20:53:14 -06:00
Bruno Windels
e4049c962a
Merge pull request #920 from vector-im/bwindels/fetch-sender-keys-without-tracking-room
Fix keys not being fetched to verify senders when the room isn't tracked yet.
2022-11-10 17:27:55 +00:00
Bruno Windels
155f4beba8 add devicesForUser to fetch devices for untracked room
and use it when fetching senders to verify.
2022-11-10 17:53:11 +01:00
Bruno Windels
3d5a733267 split up _devicesForUserIds to reuse with different outdated criteria 2022-11-10 17:51:40 +01:00
Bruno Windels
c78bed846e create unknown userIdentity when processing /keys/query response
this can happen when the room isn't tracked yet, which is a use case
we add support for in the next commit to verify senders that we don't
know about yet (e.g. when the room isn't tracked).
2022-11-10 17:28:18 +01:00
Bruno Windels
31579b4945 when tracking room, check roomId isn't on user we shouldn't share with 2022-11-10 17:26:50 +01:00
Bruno Windels
860f435855 log session afterSyncCompleted with normal log level 2022-11-10 17:26:21 +01:00
Bruno Windels
47d557b38d expand comment how to handle race here 2022-11-10 17:20:59 +01:00
Bruno Windels
32835e26b9 adjust query for finding all state events of a type
we were looking for state events with state key between \0 and \u10FFFF
but an empty state key is also valid and would come before \0,
so allow empty state keys at the beginning of the range and include them
in the result by opening the lower bound.
2022-11-10 14:12:22 +01:00
Bruno Windels
ec4413550b apply method rename (and catch errors) 2022-11-08 07:59:26 +01:00
Bruno Windels
f18aac017a
Merge pull request #819 from Kaki-In/recalculate_dm
Deleting leaving Heroes
2022-11-04 09:29:00 +00:00
Bruno Windels
cc70d44752
Merge pull request #913 from vector-im/bwindels/verify-unfetched-roomkey-senders
Verify unfetched roomkey senders
2022-11-04 09:04:41 +00:00
Bruno Windels
6c73c31735 take any decryption result, as it might now have a device to verify with 2022-11-03 17:32:01 +01:00
Bruno Windels
dd7bbe89ac put detached logs in correct log item 2022-11-03 16:37:53 +01:00
Bruno Windels
dfede83c0b log verifying senders in own item 2022-11-03 16:37:38 +01:00
Bruno Windels
2582600249 await operation, otherwise it keeps running during next sync 2022-11-03 16:37:20 +01:00
Bruno Windels
25c8f1cf04 always return a promise from this method, even if nothing to verify 2022-11-03 16:36:31 +01:00
Bruno Windels
cd5343414a fix lint 2022-10-28 17:16:32 +02:00
Bruno Windels
6123d794da also fetch unknown sender keys after decrypting entries outside of sync 2022-10-28 16:55:36 +02:00
Bruno Windels
dc25f96e73 update observed events as well 2022-10-28 16:55:20 +02:00
Bruno Windels
218d25d973 fix typo 2022-10-28 16:50:01 +02:00
Bruno Windels
d0122d17c0 don't assume timeline is open as have an await since last check 2022-10-28 16:49:33 +02:00
Bruno Windels
6dbcd46d80 cleanup of ctor 2022-10-28 16:31:00 +02:00
Bruno Windels
fcb1546fba fetch keys as part of afterSyncCompleted step
remove needsAfterSyncCompleted step as well, performance difference
should be neglible
2022-10-28 16:25:31 +02:00
Bruno Windels
9c13b2b4a4 add method to fetch missing sender keys 2022-10-28 16:09:03 +02:00
Bruno Windels
c544819b42 rename and refactor method to verify locally known senders a bit
to differentiate with method to come for verifying senders that need to
be fetched still, and also allow reuse of verification logic by said new
method.

Also get rid of roomTracked flag in DecryptionResult as once we fetch
unknown senders (in commit to come), we should now always have a device,
unless the device isn't known on the server,
in which case we should shout.
2022-10-28 15:35:31 +02:00
Paulo Pinto
ad02c1625f Encode SSO redirect URL as it may contain multiple query parameters
If the returnURL contains multiple query parameters (e.g. http://localhost:3000?foo=bar&bar=baz), the homeserver would fail to correctly parse the URL, and only the first query parameter would be kept.

This is not an issue with the homeserver since the URL cannot be parsed in an unambiguous way, as the resulting URL would be:

https://example.com/_matrix/client/r0/login/sso/redirect?redirectUrl=http://localhost:3000?foo=bar&bar=baz

It's not possible to know whether the bar parameter is part of the "parent" URL, or part of the redirectUrl parameter.

----

To fix this, we now encode the redirectUrl parameter, which results in:

https://example.com/_matrix/client/r0/login/sso/redirect?redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Fparent.html%3Ffoo%3Dbar%26bar%3Dbaz

This URL is correctly parsed by synapse.
2022-10-27 15:42:24 +01:00
Robert Long
e9b8cfbd9e Member should be expired if there's no expires at key 2022-10-18 13:42:01 -07:00
Eric Eastwood
9ad5dd752c
Make no content PL fallback to 0 (#863)
Make no `content` PL fallback to `0`. A valid PL event will have `content` but when you're just stubbing a PL event with an empty object `{}`, it doesn't need to exist and we can just as easily fallback to `0` PL level.

Split off from https://github.com/vector-im/hydrogen-web/pull/653

Changes necessary for https://github.com/matrix-org/matrix-public-archive/pull/57
2022-10-17 15:59:24 -05:00
Eric Eastwood
b4f4636555
Clarify that we no-op because if it's already aborted, that's what we wanted to do anyway (#861)
Split off from https://github.com/vector-im/hydrogen-web/pull/653
2022-10-17 15:56:34 -05:00
Bruno Windels
d37965ef91 return promise from _createSessionAfterAuth 2022-10-14 20:08:26 +02:00
Bruno Windels
4d5f202d94
Merge pull request #889 from vector-im/login_with_access_token
Add abiity to setup session immediately after registration without using /login
2022-10-14 08:54:52 +00:00
Bruno Windels
1f8a591cf6 dont need extra log depth 2022-10-14 10:28:42 +02:00
Bruno Windels
f46d2c1bf5 make startWithFinishedRegistration more broadly useful 2022-10-14 10:17:32 +02:00
RMidhunSuresh
dcba6d1500
Split method 2022-10-11 18:05:54 +05:30
RMidhunSuresh
a448c0218d
Fix missing semicolon 2022-10-11 18:01:54 +05:30