Skip to content

Commit

Permalink
Add mark_all_tracked_users_as_dirty (#143)
Browse files Browse the repository at this point in the history
This is required for SSS in Element-Web.
  • Loading branch information
kegsay authored Sep 17, 2024
1 parent 05450de commit e3997ec
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 55 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
`SenderIdentityPreviouslyVerified` to allow the application to distinguish
between the different reasons that the sender identity is not trusted.

**Other changes**

- Add `OlmMachine.markAllTrackedUsersAsDirty` to invalidate the device lists
for all known users. This is required for [MSC4186](https://github.com/matrix-org/matrix-spec-proposals/pull/4186)
clients as the server may give up trying to persist device list updates for
the client at some point, after which the client must treat all devices as dirty.

- Update matrix-rust-sdk to `2408df8bf`. No changes relevant to these bindings.

# matrix-sdk-crypto-wasm v8.0.0

**BREAKING CHANGES**
Expand Down
68 changes: 13 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ impl OlmMachine {
})
}

/// Mark all tracked users as dirty.
///
/// All users *whose device lists we are tracking* are flagged as needing a
/// key query. Users whose devices we are not tracking are ignored.
#[wasm_bindgen(js_name = "markAllTrackedUsersAsDirty")]
pub async fn mark_all_tracked_users_as_dirty(&self) -> Result<(), JsError> {
self.inner.mark_all_tracked_users_as_dirty().await?;
Ok(())
}

/// Handle to-device events and one-time key counts from a sync
/// response.
///
Expand Down
5 changes: 5 additions & 0 deletions tests/machine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ describe(OlmMachine.name, () => {
}
});

test("can mark all tracked users as dirty", async () => {
const m = await machine();
await m.markAllTrackedUsersAsDirty();
});

test("can get own user identity", async () => {
const m = await machine();
let _ = m.bootstrapCrossSigning(true);
Expand Down

0 comments on commit e3997ec

Please sign in to comment.