Struct matrix_sdk::identities::Device[][src]

pub struct Device { /* fields omitted */ }
This is supported on encryption only.
Expand description

A device represents a E2EE capable client or device of an user.

A device is backed by device keys that are uploaded to the server.

Implementations

Request an interactive verification with this Device.

Returns a VerificationRequest object that can be used to control the verification flow.

The default methods that are supported are m.sas.v1 and m.qr_code.show.v1, if this isn’t desirable the request_verification_with_methods() method can be used to override this. m.qr_code.show.v1 is only avaliable if the qrcode feature is enabled, which it is by default.

Examples

let device = client.get_device(&alice, "DEVICEID".into()).await?;

if let Some(device) = device {
    let verification = device.request_verification().await?;
}

Request an interactive verification with this Device.

Returns a VerificationRequest object that can be used to control the verification flow.

Arguments

  • methods - The verification methods that we want to support. Must be non-empty.

Panics

This method will panic if methods is empty.

Examples

let device = client.get_device(&alice, "DEVICEID".into()).await?;

// We don't want to support showing a QR code, we only support SAS
// verification
let methods = vec![VerificationMethod::SasV1];

if let Some(device) = device {
    let verification = device.request_verification_with_methods(methods).await?;
}
👎 Deprecated since 0.4.0:

directly starting a verification is deprecated in the spec. Users should instead use request_verification()

Start an interactive verification with this Device

Returns a SasVerification object that represents the interactive verification flow.

This method has been deprecated in the spec and the request_verification() method should be used instead.

Examples

let device = client.get_device(&alice, "DEVICEID".into()).await?;

if let Some(device) = device {
    let verification = device.start_verification().await?;
}

Manually verify this device.

This method will attempt to sign the device using our private cross signing key.

This method will always fail if the device belongs to someone else, we can only sign our own devices.

It can also fail if we don’t have the private part of our self-signing key.

The state of our private cross signing keys can be inspected using the Client::cross_signing_status() method.

Examples

let device = client.get_device(&alice, "DEVICEID".into()).await?;

if let Some(device) = device {
    device.verify().await?;
}

Is the device considered to be verified.

A device is considered to be verified, either if it’s locally trusted, or if it’s signed by the appropriate cross signing key.

If the device belongs to our own userk, the device needs to be signed by our self-signing key and our own user identity needs to be verified.

If the device belongs to some other user, the device needs to be signed by the users signing key and the user identity of the user needs to be verified.

let user = client.get_user_identity(&alice).await?;

if let Some(user) = user {
    if user.verified() {
        println!("User {} is verified", user.user_id().as_str());
    } else {
        println!("User {} is not verified", user.user_id().as_str());
    }
}

Set the local trust state of the device to the given state.

This won’t affect any cross signing trust state, this only sets a flag marking to have the given trust state.

Arguments

  • trust_state - The new trust state that should be set for the device.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.