Skip to content

Commit

Permalink
review: update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Dec 19, 2024
1 parent 839d7a6 commit e60bc88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# UNRELEASED

- Update matrix-rusk-sdk to `512a2d2662f9d`.
- Update matrix-rusk-sdk to `e99939db857ca`.
- The published package is now a proper dual CommonJS/ESM package.
- The WebAssembly module is now loaded using `fetch` on Web platforms, reducing
Expand All @@ -17,10 +18,8 @@

- Expose new API `DehydratedDevices.getDehydratedDeviceKey`, `DehydratedDevices.saveDehydratedDeviceKey`
and `DehydratedDevices.deleteDehydratedDeviceKey` to store/load the dehydrated device pickle key.
This allows client to automatically rotate the dehydrated device to avoid one-time-keys exhaustion and
to_device accumulation. `DehydratedDevices.keysForUpload` and `DehydratedDevices.rehydrate` now use the
`DehydratedDeviceKey` as parameter instead of a raw UInt8Array.
Use `DehydratedDeviceKey::createKeyFromArray` to migrate.
`DehydratedDevices.keysForUpload` and `DehydratedDevices.rehydrate` now use the `DehydratedDeviceKey` as parameter
instead of a raw UInt8Array.Use `DehydratedDeviceKey::createKeyFromArray` to migrate.

# matrix-sdk-crypto-wasm v11.0.0

Expand Down
9 changes: 2 additions & 7 deletions src/dehydrated_devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl From<InnerDehydratedDeviceKey> for DehydratedDeviceKey {

#[wasm_bindgen]
impl DehydratedDevices {
/// Create a new [`DehydratedDevice`] which can be uploaded to the server.
/// Create a new {@link DehydratedDevice} which can be uploaded to the server.
#[wasm_bindgen]
pub async fn create(&self) -> Result<DehydratedDevice, JsError> {
Ok(self.inner.create().await?.into())
Expand Down Expand Up @@ -89,20 +89,15 @@ impl DehydratedDevices {
/// Get the cached dehydrated device key if any.
///
/// `None` if the key was not previously cached (via
/// [`DehydratedDevices::save_dehydrated_device_key`]).
/// {@link DehydratedDevices.saveDehydratedDeviceKey}).
///
/// Should be used to periodically rotate the dehydrated device to avoid
/// OTK exhaustion and accumulation of to_device messages.
#[wasm_bindgen(js_name = "getDehydratedDeviceKey")]
pub async fn get_dehydrated_device_key(&self) -> Result<Option<DehydratedDeviceKey>, JsError> {
let key = self.inner.get_dehydrated_device_pickle_key().await?;
Ok(key.map(DehydratedDeviceKey::from))
}

/// Store the dehydrated device key in the crypto store.
///
/// This is useful if the client wants to periodically rotate dehydrated
/// devices to avoid OTK exhaustion and accumulated to_device problems.
#[wasm_bindgen(js_name = "saveDehydratedDeviceKey")]
pub async fn save_dehydrated_device_key(
&self,
Expand Down

0 comments on commit e60bc88

Please sign in to comment.