Skip to main content

Module dehydrated_devices

Module dehydrated_devices 

Source
Available on crate feature e2e-encryption only.
Expand description

High-level interface for Dehydrated Devices (MSC3814).

A dehydrated device is a virtual device the homeserver keeps on the user’s behalf while no live device is online. Senders can encrypt to it using the same Olm session establishment as for any other device. When a new device comes online it rehydrates: it pulls the private parts of the virtual device back down, decrypts them with a pickle key, drains the queued to-device events, and imports the room keys they carry.

§Lifecycle

  1. is_supported: cheap probe of the homeserver.
  2. create: build a fresh dehydrated device and upload it. The pickle key is supplied by the caller; storage and rotation of the pickle key are an application concern.
  3. rehydrate: pull the existing dehydrated device, decrypt with the pickle key, absorb queued to-device events, and delete the device.
  4. delete: remove the current dehydrated device without rehydrating.

§Example

let dehydrated = client.encryption().dehydrated_devices();

if !dehydrated.is_supported().await? {
    return Ok(());
}

// The pickle key comes from Secret Storage: only the key that encrypted
// the existing device can rehydrate it. `start` manages that round trip.
dehydrated.rehydrate(&pickle_key).await?;
dehydrated.create(None, &pickle_key).await?;

Structs§

DehydratedDevices
High-level handle returned by Encryption::dehydrated_devices.
StartDehydration
Named future returned by DehydratedDevices::start.

Enums§

DehydratedDeviceError
Errors that can occur while managing dehydrated devices.
DehydratedDeviceEvent
Lifecycle events emitted by DehydratedDevices.