Commit graph

72 commits

Author SHA1 Message Date
Tulir Asokan
3a6249bf08 dependencies: update go-util 2024-07-13 16:45:02 +03:00
Tulir Asokan
74c0110ee0 misc: remove some local functions in favor of generic ones 2024-07-02 11:20:21 +03:00
Tulir Asokan
0b07ae9942 Ignore conflicts when inserting withheld group sessions 2024-05-26 18:27:48 +03:00
Tulir Asokan
5afa391317 Refactor MarkTrackedUsersOutdated to use single query 2024-05-26 18:26:04 +03:00
Tulir Asokan
b196541e98 Fix crypto_secrets table schema 2024-05-26 00:58:17 +03:00
Sumner Evans
d0de43f395
crypto/sql_store: don't take sender key on group session methods
Fixes compatibility with the Store interface.

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:32:57 -06:00
Sumner Evans
34ef1b3705
crypto/sql_store: don't check sender_key in GetGroupSession
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:32:57 -06:00
Sumner Evans
5490cc6aee
crypto/sql_store: add logging on PutGroupSession
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:32:57 -06:00
Sumner Evans
0439180737
crypto/sql_store: fix a couple places where the error value is unused
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 10:32:11 -06:00
Toni Spets
66ba71153e Remove withheld keys when scanning all IGS rows 2024-02-16 12:27:33 +02:00
Toni Spets
11c2907f2e Database level support for key backup versioning
This doesn't plumb anything in yet but adds the columns and types for an
external implementation.

Key backup version is now typed.
2024-02-01 13:22:32 +02:00
Toni Spets
e08ed23845 Fix SQL CryptoStore GetSecret error handling 2024-02-01 13:15:55 +02:00
Toni Spets
8dc80b3178 Share room keys to known devices on request
If we have shared a session with a device once, allow asking for it
again.
2024-01-26 13:52:25 +02:00
Toni Spets
94664f1c8a Secret sharing implementation 2024-01-24 12:56:46 +02:00
Toni Spets
a3883fcf6f Allow disabling automatic key fetching for Olm machine
Many crypto operations in the Olm machine have a possible side effect of
fetching keys from the server if they are missing. This may be undesired
in some special cases.

To tracking which users need key fetching, CryptoStore now exposes APIs
to mark and query the status.
2024-01-12 14:12:47 +02:00
Tulir Asokan
25bc36bc7a Add more contexts everywhere 2024-01-07 22:45:02 +02:00
Joakim Recht
02e4140236 Make funcs in the SyncStore interface return errors
This should have been done in #144, but I forgot it. When context is being propagated, the context might be cancelled at any point, which will result in an error that needs to be handled.
2023-12-22 12:56:45 +01:00
Joakim Recht
753cdb2e1c
Add context parameter to all client and bridge API functions (#144) 2023-12-15 16:23:31 +02:00
Tulir Asokan
bb4427e528 Move dbutil to util package 2023-08-05 18:04:09 +03:00
Max Sandholm
6728ac523c Add option to delete outdated inbound keys
(keys which lack the metadata about when they're safe to delete)
2023-06-22 09:09:19 +03:00
Tulir Asokan
e45bdbb8b0 Add better messages when trying to decrypt with withheld session 2023-05-09 14:15:18 +03:00
Tulir Asokan
2ba7be081c Don't redact old megolm sessions
Old meaning received before message index tracking was implemented
2023-04-13 17:22:46 +03:00
Tulir Asokan
afc9ea70a8 Fix finding sender key of group session 2023-04-12 16:19:19 +03:00
Tulir Asokan
87d2cbdfe6 Fix mistakes and change db upgrade message 2023-04-12 12:27:55 +03:00
Tulir Asokan
00090f6e78 Delete expired keys periodically 2023-04-11 13:13:45 +03:00
Tulir Asokan
f81350e603 Only redact non-redacted megolm sessions 2023-04-11 12:56:00 +03:00
Tulir Asokan
6879d6b693 Delete megolm sessions when receiving new one and when session is fully used 2023-04-11 11:42:13 +03:00
Tulir Asokan
20df20d25a Ratchet inbound sessions on decrypt and delete outbound on ack 2023-04-10 16:27:05 +03:00
Tulir Asokan
cea59a6781 Change megolm session max_age to milliseconds 2023-03-23 16:45:17 +02:00
Tulir Asokan
4291333836 Add log with details when trying to validate duplicate message indexes 2023-03-15 01:30:57 +02:00
Tulir Asokan
a7f1f1e3b6 Add simplified crypto helper for clients
Fixes #19
Fixes #2
2023-02-19 03:22:14 +02:00
Tulir Asokan
1c6e96bc66 Remove unnecessary proxy db upgrade method 2022-12-03 20:43:12 +02:00
Toni Spets
1971adf86b Add slow rows iteration logging 2022-10-27 21:56:52 +03:00
Tulir Asokan
cbeaaf99a1 Only include non-null sessions when listing megolm sessions 2022-09-21 23:51:22 +03:00
Tulir Asokan
79a4b6d54d Remove SQLite special casing in PutDevices
It's automatically handled by dbutil now
2022-08-14 18:54:46 +03:00
Tulir Asokan
f4ba0afd59 Wrap connections and remove maulogger dependency in dbutil
Connection wrapper includes query time logging and replacing $x with ?x on SQLite
2022-08-11 18:47:28 +03:00
Tulir Asokan
02113b6a0f Add go vet to pre-commit 2022-08-04 19:44:57 +03:00
Tulir Asokan
d1d7f999f7 Move DeviceIdentity and Fingerprint to id package 2022-07-05 11:56:45 +03:00
Tulir Asokan
6dec43b195 Make ValidateMessageIndex atomic 2022-07-04 17:09:17 +03:00
Tulir Asokan
be145c9d30 Optimize IsKeySignedBy and remove GetSignaturesForKeyBy 2022-07-04 15:26:18 +03:00
Tulir Asokan
9162944672 Add cross-signing TOFU support 2022-06-23 14:42:05 +03:00
Tulir Asokan
d837786ba4 Keep deleted devices in database 2022-06-22 21:29:27 +03:00
Tulir Asokan
6d5a9d184c Make required trust level in e2be configurable 2022-06-22 20:05:22 +03:00
Tulir Asokan
84b8982d07 Stop using nulls in mx_state_store and fix some error checks 2022-05-31 11:38:07 +03:00
Tulir Asokan
ffd56c83ab Fix some mistakes 2022-05-22 01:16:44 +03:00
Tulir Asokan
d578d1a610 Move a bunch of stuff from mautrix-whatsapp
Moved parts:
* Appservice SQL state store
* Bridge crypto helper
* Database upgrade framework
* Bridge startup flow

Other changes:
* Improved database upgrade framework
  * Now primarily using static SQL files compiled with go:embed
* Moved appservice SQL state store to using membership enum on Postgres
2022-05-22 00:50:33 +03:00
Tulir Asokan
db165c9885 Fix FindDeviceByKey SQL query
Closes #65
2022-02-16 20:55:09 +02:00
Tulir Asokan
95662fc3f0 Fix sorting of olm sessions 2021-12-22 22:56:31 +02:00
Tulir Asokan
087644889b Stop using non-existent device_id field when handling olm messages 2021-12-03 17:47:41 +02:00
Tulir Asokan
e0ec08ac84 Remove pq dependency 2021-11-02 20:08:03 +02:00