A device represents a E2EE capable client of an user.

Properties

algorithms: any[]

Get the list of algorithms this device supports.

Returns Array<EncryptionAlgorithm>.

curve25519Key: undefined | Curve25519PublicKey

Get the Curve25519 key of the given device.

deviceId: DeviceId

The unique ID of the device.

displayName: undefined | string

Get the human readable name of the device.

ed25519Key: undefined | Ed25519PublicKey

Get the Ed25519 key of the given device.

isDehydrated: boolean

Whether or not the device is a dehydrated device.

keys: Map<any, any>

Get a map containing all the device keys.

localTrustState: LocalTrust

Get the trust state of the device.

signatures: Signatures

Get a map containing all the device signatures.

userId: UserId

The user ID of the device owner.

Methods

  • Encrypt a to-device message to be sent to this device, using Olm encryption.

    Prior to calling this method you must ensure that an Olm session is available for the target device. This can be done by calling OlmMachine.getMissingSessions.

    The caller is responsible for sending the encrypted event to the target device. If multiple messages are encrypted for the same device using this method they should be sent in the same order as they are encrypted.

    Returns

    Returns a promise for a JSON string containing the content of an encrypted event, which be used to create the payload for a /sendToDevice API.

    Parameters

    • event_type: string
    • content: any

    Returns Promise<string>

  • Timestamp representing the first time this device has been seen (in milliseconds).

    Returns bigint

  • Returns void

  • Is the device locally marked as blacklisted?

    Blacklisted devices won’t receive any group sessions.

    Returns boolean

  • Is this device cross-signed by its owner?

    Returns boolean

  • Is this device considered to be verified using cross signing.

    Returns boolean

  • Is the device deleted?

    Returns boolean

  • Is the device locally marked as trusted?

    Returns boolean

  • Is this device considered to be verified.

    This method returns true if either the is_locally_trusted method returns true or if the is_cross_signing_trusted method returns true.

    Returns boolean

  • Request an interactive verification with this device.

    Returns a 2-element array [VerificationRequest, ToDeviceRequest].

    Parameters

    • Optionalmethods: any[]

    Returns any[]

  • 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.

    trust_state represents the new trust state that should be set for the device.

    Parameters

    Returns Promise<any>

  • Mark this device as verified. Works only if the device is owned by the current user.

    Returns a signature upload request that needs to be sent out.

    Returns Promise<any>