-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: Add curve_key and sender_data_type columns to inboundgroupses…
…sions table/store
- Loading branch information
1 parent
6e9f344
commit 833ff32
Showing
6 changed files
with
210 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
crates/matrix-sdk-indexeddb/src/crypto_store/migrations/v11_to_v12.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2024 The Matrix.org Foundation C.I.C. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! Migration code that moves from inbound_group_sessions2 to | ||
//! inbound_group_sessions3, shrinking the values stored in each record. | ||
use indexed_db_futures::IdbKeyPath; | ||
use web_sys::DomException; | ||
|
||
use crate::crypto_store::{keys, migrations::do_schema_upgrade, Result}; | ||
|
||
/// Perform the schema upgrade v11 to v12, adding an index on | ||
/// `(curve_key, sender_data_type)` to `inbound_group_sessions3`. | ||
pub(crate) async fn schema_add(name: &str) -> Result<(), DomException> { | ||
do_schema_upgrade(name, 12, |_, transaction, _| { | ||
let object_store = transaction.object_store(keys::INBOUND_GROUP_SESSIONS_V3)?; | ||
|
||
object_store.create_index( | ||
keys::INBOUND_GROUP_SESSIONS_CURVE_KEY_INDEX, | ||
&IdbKeyPath::str_sequence(&["curve_key", "sender_data_type"]), | ||
)?; | ||
|
||
Ok(()) | ||
}) | ||
.await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...k-sqlite/migrations/crypto_store/009_inbound_group_session_curve_key_sender_data_type.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ALTER TABLE "inbound_group_session" | ||
ADD COLUMN "curve_key" BLOB; | ||
|
||
ALTER TABLE "inbound_group_session" | ||
ADD COLUMN "sender_data_type" INTEGER; | ||
|
||
CREATE INDEX "inbound_group_session_curve_key_sender_data_type_idx" | ||
ON "inbound_group_session" ("curve_key", "sender_data_type"); |
Oops, something went wrong.