Commit Graph

284 Commits

Author SHA1 Message Date
Krille 07ceee4171
refactor: Let bootstrap throw custom Exception InvalidPassphraseException so it is easier to catch 2023-05-30 09:41:10 +02:00
Malin Errenst cc377202da fix: remove deprecated sender_key occurrences 2023-05-08 09:12:14 +00:00
Nicolas Werner 4abefa906b
fix: Always wait for account data to load before returning SSSS status
Otherwise it would be possible, that we haven't loaded account data, so
we return that cross-signing is disabled and then we load it and return
a different result. Might fix the sentry issue for that.
2023-05-03 17:11:00 +02:00
Krille 2c14af9a8b
fix: Reactions are sent encrypted 2023-05-03 13:01:10 +02:00
Krille 05c945b042 fix: Last message set incorrectly on all session key received
This fixes a bug that the
last message was sent
incorrectly when a session
key received for example
from the key backup. It may
fix several issues like the
last message is set as a
very old one or the last
message is not decrypted.
2023-01-18 11:46:32 +01:00
Krille 9d9b1e38ec Merge branch 'krille/store-after-decrypted-last-event' into 'main'
fix: Store decrypted last event in store

See merge request famedly/company/frontend/famedlysdk!1197
2022-12-21 08:24:39 +00:00
Krille Fear 49703f5808 fix: Store decrypted last event in store 2022-12-21 08:43:52 +01:00
Christian Pauly 2f1696bff8 chore: Bump version 2022-12-14 09:00:08 +01:00
Christian Pauly c66d2edb5e refactor: Key manager megolm handling to make key generation more efficient 2022-12-14 08:59:36 +01:00
Reza 7da56ee212 fix: minor stuff 2022-11-24 11:00:10 +01:00
Reza f969a733f1 fix: minor stuff 2022-11-24 10:48:17 +01:00
Reza dd4d0696b3 fix: do not pass the verified device list 2022-11-24 10:19:52 +01:00
Reza 8f37466295 fix: minor stuff 2022-11-24 09:33:36 +01:00
Reza 10cf979877 fix: minor stuff 2022-11-23 19:28:08 +01:00
Reza 44f862b966 feat: start verification with the verified device 2022-11-23 13:43:57 +01:00
The one with the braid 50288698a8 Merge branch 'braid/cute-events' into 'main'
feat: support MSC 3935: cute events

See merge request famedly/company/frontend/famedlysdk!1168
2022-11-21 08:53:44 +00:00
TheOneWithTheBraid 476963069a feat: support MSC 3935: cute events
- add cute event skeletron (`im.fluffychat.cute_events`)
- add cute events to default command batch
- this way, all SDK users can profit from cute events
- supported events: `hug`, `googly_eyes`, `cuddle`

Fixes:
https://rail.chat/@AgathaSorceress@eldritch.cafe/109336005433123570

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
2022-11-21 09:17:07 +01:00
Nicolas Werner dbac5d83dc fix: recover from very unlikely key upload errors
Usually we store the keys we want to upload first, then upload them,
then store, that we uploaded them. So that should be fool proof.

But.

In some cases the filesyste lies to us and the database change isn't
actually persisted yet. That can happen when someone turns of their
phone aprubtly for example. In that case we generate new OTKs with the
same id. Uploading that will fail, since they already exist server side.
We can work around that by manually claiming them and removing them
locally.
2022-11-15 17:18:29 +01:00
Christian Pauly 67fd9cd00e refactor: Improve error handling for no olm session found exception
Finding no olm session can
happen quiet often when there
are dead devices in a room.
We do not need to print the
whole stacktrace then.
2022-11-08 14:02:37 +01:00
Christian Pauly 0a6a813804 refactor: Get rid of unnecessary type cast 2022-11-07 11:09:20 +01:00
Christian Pauly da8ebe85ef fix: Do not try to decrypt redacted events 2022-10-28 12:25:35 +02:00
Nicolas Werner c8a97ce7f8 Merge branch 'krille/on-secret-stored-stream' into 'main'
feat: Add onSecretStored StreamController to SSSS

Closes #331

See merge request famedly/company/frontend/famedlysdk!1135
2022-09-20 07:42:04 +00:00
Christian Pauly f0356532be feat: Add onSecretStored StreamController to SSSS 2022-09-19 15:15:27 +02:00
Christian Pauly 403824b261 feat: Store original event 2022-09-19 09:40:42 +02:00
Christian Pauly 3976b0f1e2 refactor: Avoid using private types in public api 2022-08-30 11:55:17 +02:00
Krille Fear d30d1a8cf9 Merge branch 'nico/dehydrated-devices' into 'main'
feat: support dehydrated devices

Closes #315

See merge request famedly/company/frontend/famedlysdk!1111
2022-08-29 13:18:02 +00:00
Nicolas Werner dd1f61c29e feat: support dehydrated devices 2022-08-29 13:05:55 +02:00
Christian Pauly 81e55ade67 feat: Allow auto request keys via key sharing requests 2022-08-28 13:59:34 +02:00
Christian Pauly 994faf1012 fix: Decrypt of last event might make an old message as last event
We should only decrypt the
last message in  room if it is
the current last message.
By just fetching the state
we might bring up an old
encrypted message which
is not really the last event.
2022-08-21 14:10:29 +02:00
Nicolas Werner a47833ab80 Merge branch 'nico/lints' into 'main'
feat: switch from pedantic to lints

See merge request famedly/company/frontend/famedlysdk!1094
2022-08-15 14:15:51 +00:00
Nicolas Werner 6555f36d6d feat: switch from pedantic to lints 2022-08-15 14:15:51 +00:00
Christian Pauly 527bcc63ad refactor: Add reference to itself in bootstrap onUpdate callback 2022-08-12 15:23:32 +02:00
Lanna Michalke 05ff61ac86 chore: introduce native implementations
- adds Client.nativeImplementations
 - deprecates Client.compute

Allows to properly implement accelerated native operations in web

Signed-off-by: Lanna Michalke <l.michalke@famedly.com>
2022-07-28 13:30:22 +02:00
Christian Pauly 7885281c72 refactor: Use import sorter and ci templates 2022-07-21 15:44:04 +02:00
Nicolas Werner 6e211f5a81 fix: race conditions in the SDK and its tests 2022-07-13 00:36:49 +00:00
Krille Fear 3f3d4d38d6 refactor: Migrate to Matrix Api Lite 1.0.0 2022-05-17 22:50:04 +00:00
Christian Pauly 5fbd0a73a4 chore: Make sure account data and device keys is loaded when using isCached 2022-05-12 13:48:13 +02:00
Christian Pauly bce45cbf2b refactor: Remove old deprecations
They have been lived long
enough and the next version
will have breaking changes
anyway.
2022-04-22 12:44:45 +02:00
h.carnot 2cd4eb5e2c fix: remove pendaing outbound group session creation on completed or errored 2022-03-24 13:52:28 +01:00
Christian Pauly f1d422b89a fix: Dont encrypt reactions
This fixes that server
sends notifications for reactions.
2022-03-15 08:42:53 +01:00
Lanna Michalke cab03aa73b fix: Allow unpadded base64 decoding 2022-01-11 09:02:34 +00:00
Krille Fear 3bce8b4489 refactor: Remove unnecessary type checks and imports 2021-12-23 11:46:45 +01:00
Sorunome 872bc04674
fix(ssss): Strip all whitespace characters from recovery keys upon decode
Previously we stripped all spaces off of the recovery when decoding it,
so that we could format the recovery key nicely. It turns out, however,
that some element flavours also format with linebreaks, leading to the
user having to manually remove them. We fix this by just stripping *all*
whitespace off of the recovery key.
2021-12-05 12:19:22 +01:00
Krille Fear 03418bfe8b chore: Enable E2EE recovery by default
We have disabled it by default to
prevent using workarounds as
long time solutions and to not
miss bugs. But in a federated
context we can not be sure that
we all Matrix clients are ever
bug free and we have now the
onEncryptionError Stream
anyway.
2021-11-25 15:48:17 +01:00
Krille Fear f3775fa5ba fix: Decrypt last event of a room 2021-11-22 10:18:44 +01:00
Krille Fear 048b7faba0 fix: JSON parsing in decryptRoomEvent method
This makes the use of the
event content null safe and
type safe which fixes a
regression when sessionId is
null.
2021-11-10 09:19:40 +01:00
Krille Fear 9be87918f1 refactor: Make room in Event class not nullable 2021-11-04 14:21:04 +01:00
td 3130931f0d Merge branch 'krille/dont-upload-keys-after-logout' into 'main'
fix: Do not upload keys after logout

Closes #213

See merge request famedly/company/frontend/famedlysdk!866
2021-10-29 13:21:01 +00:00
Krille Fear 176dbbeda9 fix: Do not upload keys after logout
This should fix a race condition where uploading keys is still ongoing
after user has already logged out.
2021-10-28 16:46:45 +02:00
Nicolas Werner 7d78233bf0
refactor: remove literal boolean comparisons leftover from nullsafety conversion 2021-10-28 14:40:22 +02:00
Nicolas Werner 6e20c53b01
refactor: remove redundant null checks 2021-10-28 14:32:09 +02:00
Nicolas Werner ebd5bc3d24
refactor: make room nullsafe 2021-10-28 00:54:25 +02:00
Nicolas Werner fb0a84d7b2
refactor: make client nullsafe 2021-10-25 16:34:02 +02:00
Nicolas Werner 17fd1f22b3 refactor: make event nullsafe 2021-10-25 10:10:25 +00:00
Krille Fear d2ee73f96f chore: Bump version 2021-10-25 11:19:45 +02:00
Krille Fear 7a85d52d93 fix: Remove unnecessary null check 2021-10-25 11:11:55 +02:00
Nicolas Werner 60956bde00 chore: port the remaining encryption files to nullsafety 2021-10-13 13:58:21 +00:00
Lukas Lihotzki a7818bbd0f refactor: null safety for all utils 2021-10-05 15:41:25 +02:00
Lukas Lihotzki 4bd659fd56 style: remove unneeded trailing comma 2021-09-30 15:53:43 +02:00
Lukas Lihotzki 85004e1faf refactor: capture member variables as finals 2021-09-30 15:53:43 +02:00
Lukas Lihotzki 41d905ca60 refactor: use more ?. 2021-09-30 15:53:43 +02:00
Nicolas Werner 71e5ec1bb5 style: use map entry with explicit types over cast 2021-09-30 12:58:37 +00:00
Nicolas Werner 6f7f7100e1 fix: use explicit type in fold instead of cast 2021-09-30 12:58:37 +00:00
Nicolas Werner 7dd176c278 fix: apply review feedback 2021-09-30 12:58:37 +00:00
Nicolas Werner 08bbb3f6f5 fix: prefer ! over ? 2021-09-30 12:58:37 +00:00
Nicolas Werner d15c71e5b3 fix: pre vs postcrement confusion 2021-09-30 12:58:37 +00:00
Nicolas Werner e5682fcb91 refactor: remove clientid from encryption code 2021-09-30 12:58:37 +00:00
Nicolas Werner 1c838e3be8 fix: Cleanup nullsafe encryption a bit 2021-09-30 12:58:37 +00:00
Nicolas Werner a196b53219 refactor: nullsafe encryption 2021-09-30 12:58:37 +00:00
Krille Fear 62fe7a1704 fix: New verification requests on requesting history
If requesting history happens to contain a m.key.verification.request we currently create a new key verification object and push it to the client.
This fixes it.
2021-09-27 14:51:25 +02:00
Jayesh Nirve 77ca7523d0 refactor: remove unused clientId 2021-09-24 16:05:05 +02:00
Sorunome b41c7b1bc6
fix: Don't re-play m.dummy to_device events
If both ends had m.dummy events queued as last messages an an olm
session corrupted, then the clients landed in an infinite game of
ping-pong. It was so stable, that the clients could have won the
ping-pong world championships!
2021-09-21 10:05:51 +02:00
Sorunome fe9145d580 fix: missing null check 2021-09-18 07:50:45 +00:00
Sorunome 0611ea1495
fix: Auto-reply key requests 2021-09-16 22:14:41 +02:00
Christian Pauly 00771fc209 refactor: _updateUserDeviceKeys method 2021-09-13 14:58:07 +02:00
Nicolas Werner e000fbf9be fix: compilation against newer matrix_api_lite 2021-09-10 16:40:40 +02:00
Christian Pauly 630203e7b6 fix: Check if database got disposed in keyManager 2021-09-03 15:05:34 +02:00
Christian Pauly 9c1f79359e refactor: Replace all logic regarding sortOrder
The current implementation of sortOrder can be made way more easier now
by just keeping the sortOrder of the list
and the timelineFragments in the hiveStore. This needed a huge
change but mostly removes a lot of code which can be done
way more easy now. This also needed some rewriting of the setState logic and changes to
the prevEvent calculation. This solution should also be more stable.
More information:
https://www.reddit.com/r/fluffychat/comments/pfnlhq/the_sort_order_of_matrix_timelines/
2021-09-02 07:13:38 +00:00
Christian Pauly fb62307730 fix: Check if client is disposed in a callback
This fixed an edge case in the tests.
2021-09-02 06:43:06 +00:00
Christian Pauly 9b7474e2f2 refactor: Update to dart 2.12 and opt out in all files
This also adds some missing license headers, I have detected while
using license header search&replace to add the
null safety opt out
2021-08-18 08:09:39 +02:00
Sorunome 98b0bd4322 feat: Add a way to get a verification request by its transaction id
A client might find the need to get the verification request object by
its transaction id, to be able to e.g. display for in-room verification
an "accept verification request" button easily.
2021-08-17 15:03:30 +00:00
Marcus f91f662c75 chore: update to matrix_sdk_lite 0.4.1 2021-08-05 12:10:45 +00:00
Nicolas Werner 08c808562b fix: Typo in key backup requests
This may lead to messages not decrypting after interactive verification,
which would make the user manually press the request keys button.
2021-08-03 13:18:15 +00:00
Nicolas Werner 162436cc8d fix: accidental OTK uploads on internal fakeSync 2021-08-02 20:52:09 +02:00
Christian Pauly e8d511a371 fix: Missing null checks in syncUpdate handling 2021-07-27 10:49:50 +02:00
Lukas Lihotzki 46b2f8898e fix: use TryGet.optional 2021-07-26 15:33:36 +02:00
Lukas Lihotzki 8665f092f4 chore: matrix_api_lite 0.4.0 2021-07-26 14:54:22 +02:00
Nicolas Werner 179f73db3a fix: Upload OTKs if the otk_count field is missing
fixes #180
2021-07-26 09:47:05 +02:00
Christian Pauly 209035ffbd refactor: Use official Dart isolates
The isolates package is discontinued and not compatible
with the newest Dart version.
dart:isolate is not an option because importing this
library makes it impossible to run the matrix
SDK on dart web native. It just won't
build. So we now just depend on
that the flutter app pass through the compute method.
2021-07-21 12:34:43 +02:00
Christian Pauly 99c900be9c fix: Add missing null check
With Synapse 1.38 SyncUpdate.accountData is null if it is empty.
2021-07-19 09:18:23 +02:00
Christian Pauly 69b52ba85b refactor: Move pedantic to dev_dependencies
The unawaited method from the pedantic package was a historic solution
for the case that you dont want to await a future in an async function.
But now we can do this with just a comment which
is the recommended way to do this now.
This makes it possible to have pedantic as a dev_dependency which means just one dependency less.
2021-06-18 10:15:59 +02:00
Christian Pauly c0c7f68bf3 chore: Rename to matrix 2021-06-18 09:58:25 +02:00
Christian Pauly 9631cea83a feat: Add toJson method for StoredInboundGroupSession 2021-06-01 12:51:17 +02:00
Christian Pauly c3d47b16c6 CI: Use correct image 2021-05-25 10:46:34 +02:00
Christian Pauly c66e35c16c refactor: Create a clean database API 2021-05-20 07:36:03 +00:00
Lukas Lihotzki c196610998 chore: operation names from OpenAPI spec 2021-05-12 13:56:16 +02:00
Lukas Lihotzki fdf650abd5 refactor: avoid if-condition based on bit value 2021-04-26 18:48:54 +02:00
Lukas Lihotzki b4f755388a refactor: high-level loops 2021-04-19 18:58:59 +02:00
Christian Pauly ffef732103 refactor: enable more linter rules
enable prefer_final_locals and prefer_final_in_for_each linter rules
2021-04-14 10:29:29 +02:00
Lukas Lihotzki 545ce26e39 style: fix format and lint 2021-04-12 14:49:03 +02:00