Class VerificationRequest<C>

State machine for verification requests. Things that differ based on what channel is used to send and receive verification events are put in InRoomChannel or ToDeviceChannel.

Deprecated

Avoid direct references: instead prefer Crypto.VerificationRequest.

Type Parameters

Hierarchy (view full)

Implements

Constructors

Properties

_accepting: boolean = false
_cancelled: boolean = false
_cancellingUserId?: string
_chosenMethod: null | string = null
_declining: boolean = false
_observeOnly: boolean = false
_qrCodeData: null | QRCodeData = null
_verifier?: VerificationBase<any, any>
channel: C
client: MatrixClient
commonMethods: string[] = []
eventsByThem: Map<string, MatrixEvent> = ...
eventsByUs: Map<string, MatrixEvent> = ...
requestReceivedAt: null | number = null
timeoutTimer: null | number = null
verificationMethods: Map<string, typeof VerificationBase>
verifierHasFinished: boolean = false

Accessors

  • get initiatedByMe(): boolean
  • Whether this request was initiated by the syncing user. For InRoomChannel, this is who sent the .request event. For ToDeviceChannel, this is who sent the .start event

    Returns boolean

  • get transactionId(): undefined | string
  • Unique ID for this verification request.

    An ID isn't assigned until the first message is sent, so this may be undefined in the early phases.

    Returns undefined | string

Methods

  • Cancels the request, sending a cancellation to the other party

    Parameters

    • params: {
          code: undefined | string;
          reason: undefined | string;
      } = {}
      • code: undefined | string

        the error code to send the cancellation with

      • reason: undefined | string

        the error reason to send the cancellation with

    Returns Promise<void>

    resolves when the event has been sent.

  • Changes the state of the request and verifier in response to a key verification event.

    Parameters

    • type: string

      the "symbolic" event type, as returned by the getEventType function on the channel.

    • event: MatrixEvent

      the event to handle. Don't call getType() on it but use the type parameter instead.

    • isLiveEvent: boolean

      whether this is an even received through sync or not

    • isRemoteEcho: boolean

      whether this is the remote echo of an event sent by the same device

    • isSentByUs: boolean

      whether this event is sent by a party that can accept and/or observe the request like one of our peers. For InRoomChannel this means any device for the syncing user. For ToDeviceChannel, just the syncing device.

    Returns Promise<void>

    a promise that resolves when any requests as an answer to the passed-in event are sent.

  • Checks whether the other party supports a given verification method. This is useful when setting up the QR code UI, as it is somewhat asymmetrical: if the other party supports SCAN_QR, we should show a QR code in the UI, and vice versa. For methods that need to be supported by both ends, use the methods property.

    Parameters

    • method: string

      the method to check

    • force: boolean = false

      to check even if the phase is not ready or started yet, internal usage

    Returns boolean

    whether or not the other party said the supported the method

  • Stateless validation logic not specific to the channel. Invoked by the same static method in either channel.

    Parameters

    • type: string

      the "symbolic" event type, as returned by the getEventType function on the channel.

    • event: MatrixEvent

      the event to validate. Don't call getType() on it but use the type parameter instead.

    • client: MatrixClient

      the client to get the current user and device id from

    Returns boolean

    whether the event is valid and should be passed to handleEvent

Generated using TypeDoc