Commit Graph

327 Commits

Author SHA1 Message Date
Bruno Windels
cc4da5c7a7 fix ts errors with latest tsc 4.x version (as used on CI) 2023-03-28 18:14:09 +02:00
Bruno Windels
762a91bd16 don't reuse existing transaction to read from 4S, as webcrypto terminates idb transactions 2023-03-24 13:42:19 +01:00
Bruno Windels
dd59f37dce WIP2 2023-03-21 18:24:46 +01:00
Bruno Windels
780dfeb199 WIP 2023-03-13 09:15:49 +01:00
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
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
1dc3acad03 use enum for device tracking status 2023-03-02 17:32:46 +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
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
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
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
920fedae5e merge master into bwindels/calls 2023-01-20 16:24:38 +01: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
47d557b38d expand comment how to handle race here 2022-11-10 17:20:59 +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
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
Bruno Windels
6f0e781b49 WIP 2022-09-26 19:15:13 +02:00
Bruno Windels
7ce5cdfc4a prevent concurrent calls of OlmEncryption.encrypt to OOM olm wasm heap
This is being triggered by connecting to many call members at once,
while encrypting the signaling messages. This keeps many olm.Session
objects into memory at the same time, which makes olm run out of
wasm heap memory.
2022-09-22 13:19:56 +02:00
Bruno Windels
cb0ac846c7 remove obsolete comment 2022-07-29 16:22:01 +02:00
Bruno Windels
62b3a67e33 write unit tests for correctly reading history visibility when needed 2022-07-28 17:09:41 +02:00
Bruno Windels
319ec37864 fix typos preventing to load the history visibility 2022-07-28 11:44:50 +02:00
Bruno Windels
0df66b5aea track room before listing user ids when sharing key 2022-07-27 12:06:55 +02:00
Bruno Windels
f18520a2fe let loadMembers use own txn in case members haven't been fetched yet
if they haven't, it will need a network request, meaning that the txn
will get closed, so we can't reuse it afterwards
2022-07-27 11:39:50 +02:00
Bruno Windels
50b6ee91d7 don't need history visibility here 2022-07-27 11:39:36 +02:00
Bruno Windels
544afef902 test adding and removing when tracking multiple rooms 2022-07-26 17:41:26 +02:00
Bruno Windels
dd878bb8d6 also take rejecting invites into account to remove user identity 2022-07-26 16:58:07 +02:00
Bruno Windels
dea3852425 add some tests for sharing keys with invitees 2022-07-26 16:57:28 +02:00
Bruno Windels
4c17612b05 allow passing txn to loadMembers so we can do it as part of sync txn
to rewrite useridentities upon receiving new history visibility
2022-07-26 16:53:02 +02:00
Bruno Windels
a23df8a545 pass history visibility to device tracker
and delegate adding and removing members to share keys with to it
2022-07-22 17:49:59 +02:00
Bruno Windels
17f42f523a add write method for when history visibility changes
also returning added and removed user ids
2022-07-22 17:49:26 +02:00
Bruno Windels
f6011f3f34 take history visibility into account in device tracker
and return added and removed userids to their userIdentity for the given
room, so room encryption can share and discard the keys for them
2022-07-22 17:48:26 +02:00
Bruno Windels
86c0e9e669 logic for whether a key should be shared by membership and h. visibility 2022-07-22 17:46:53 +02:00
Bruno Windels
f337940202 this migration shouldn't be needed anymore
and undoes the export of addRoomToIdentity, which is somewhat internal
2022-07-22 17:46:29 +02:00
Bruno Windels
c8a8eb10b5 get user ids for sharing a new key when the message is sent
rather than when the key happens to get sent
2022-07-20 15:21:33 +02:00
Bruno Windels
d79e5f7806 create key share operations for invitees when history visibility=invited 2022-07-20 15:20:23 +02:00
Bruno Windels
a014740e72 don't throw when we can't encrypt, just fall back to sending unencrypted 2022-06-01 15:55:43 +02:00
Bruno Windels
9efe294a79 fetch and verify keys on olm call signalling message 2022-06-01 15:29:24 +02:00