From d86c05efb355dec8f43fd8dbe88ed094f21686bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 2 Sep 2020 15:08:24 +0200 Subject: [PATCH] crypto: Add a fixme to the sqlite store since it's not storing forwarding chains. --- matrix_sdk_crypto/src/olm/group_sessions.rs | 6 +++++- matrix_sdk_crypto/src/store/sqlite.rs | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/matrix_sdk_crypto/src/olm/group_sessions.rs b/matrix_sdk_crypto/src/olm/group_sessions.rs index 30d6aec9..729bf5c6 100644 --- a/matrix_sdk_crypto/src/olm/group_sessions.rs +++ b/matrix_sdk_crypto/src/olm/group_sessions.rs @@ -162,6 +162,7 @@ impl InboundGroupSession { sender_key: self.sender_key.to_string(), signing_key: self.signing_key.to_string(), room_id: (&*self.room_id).clone(), + forwarding_chains: self.forwarding_chains.lock().await.clone(), } } @@ -189,7 +190,7 @@ impl InboundGroupSession { sender_key: Arc::new(pickle.sender_key), signing_key: Arc::new(pickle.signing_key), room_id: Arc::new(pickle.room_id), - forwarding_chains: Arc::new(Mutex::new(None)), + forwarding_chains: Arc::new(Mutex::new(pickle.forwarding_chains)), }) } @@ -292,6 +293,9 @@ pub struct PickledInboundGroupSession { pub signing_key: String, /// The id of the room that the session is used in. pub room_id: RoomId, + /// The list of claimed ed25519 that forwarded us this key. Will be None if + /// we dirrectly received this session. + pub forwarding_chains: Option>, } /// The typed representation of a base64 encoded string of the GroupSession pickle. diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index 1e6577eb..4cd905f8 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -399,6 +399,9 @@ impl SqliteStore { sender_key, signing_key, room_id: RoomId::try_from(room_id)?, + // Fixme we need to store/restore these once we get support + // for key requesting/forwarding. + forwarding_chains: None, }; Ok(InboundGroupSession::from_pickle( @@ -791,6 +794,10 @@ impl CryptoStore for SqliteStore { let mut connection = self.connection.lock().await; let session_id = session.session_id(); + // FIXME we need to store/restore the forwarding chains. + // FIXME this should be converted so it accepts an array of sessions for + // the key import feature. + query( "INSERT INTO inbound_group_sessions ( session_id, account_id, sender_key, signing_key,