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. "change" whenever the state of the request object has changed.

Type Parameters

Hierarchy

Constructors

Properties

_accepting: boolean = false
_cancelled: boolean = false
_cancellingUserId?: string
_chosenMethod: null | string = null
_declining: boolean = false
_observeOnly: boolean = false
_phase: Phase
_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 | Timeout = null
verificationMethods: Map<string, typeof VerificationBase>
verifierHasFinished: boolean = false

Accessors

Methods

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

    Returns

    resolves when the event has been sent.

    Parameters

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

    Returns Promise<void>

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

    Returns

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

    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>

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

    Returns

    whether or not the other party said the supported the method

    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

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

    Returns

    whether the event is valid and should be passed to handleEvent

    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

Generated using TypeDoc