Interface Verifier

A Verifier is responsible for performing the verification using a particular method, such as via QR code or SAS (emojis).

A verifier object can be created by calling VerificationRequest.beginVerification; one is also created automatically when a m.key.verification.start event is received for an existing VerificationRequest.

Once a verifier object is created, the verification can be started by calling the Verifier#verify method.

interface Verifier {
    get hasBeenCancelled(): boolean;
    get userId(): string;
    addListener<T>(event, listener): this;
    cancel(e): void;
    emit<T>(event, ...args): boolean;
    emit<T>(event, ...args): boolean;
    emitPromised<T>(event, ...args): Promise<boolean>;
    emitPromised<T>(event, ...args): Promise<boolean>;
    getReciprocateQrCodeCallbacks(): null | ShowQrCodeCallbacks;
    getShowSasCallbacks(): null | ShowSasCallbacks;
    listenerCount(event): number;
    listeners(event): Function[];
    off<T>(event, listener): this;
    on<T>(event, listener): this;
    once<T>(event, listener): this;
    prependListener<T>(event, listener): this;
    prependOnceListener<T>(event, listener): this;
    rawListeners(event): Function[];
    removeAllListeners(event?): this;
    removeListener<T>(event, listener): this;
    verify(): Promise<void>;
}

Hierarchy (view full)

Implemented by

Accessors

  • get hasBeenCancelled(): boolean
  • Returns true if the verification has been cancelled, either by us or the other side.

    Returns boolean

Methods

  • Get the details for reciprocating QR code verification, if one is in progress

    Returns null, unless this verifier is for reciprocating a QR-code-based verification (ie, the other user has already scanned our QR code), and we are waiting for the user to confirm.

    Returns null | ShowQrCodeCallbacks

  • Adds the listener function to the end of the listeners array for the event named event.

    No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added, and called, multiple times.

    By default, event listeners are invoked in the order they are added. The TypedEventEmitter#prependListener method can be used as an alternative to add the event listener to the beginning of the listeners array.

    Type Parameters

    Parameters

    Returns this

    a reference to the EventEmitter, so that calls can be chained.

  • Removes all listeners, or those of the specified event.

    It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

    Parameters

    Returns this

    a reference to the EventEmitter, so that calls can be chained.

  • Start the key verification, if it has not already been started.

    This means sending a m.key.verification.start if we are the first responder, or a m.key.verification.accept if the other side has already sent a start event.

    Returns Promise<void>

    Promise which resolves when the verification has completed, or rejects if the verification is cancelled or times out.

Generated using TypeDoc