Verifier
Defined in: src/crypto-api/verification.ts:232
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.
Extends
Section titled “Extends”Accessors
Section titled “Accessors”hasBeenCancelled
Section titled “hasBeenCancelled”Get Signature
Section titled “Get Signature”get hasBeenCancelled():
boolean
Defined in: src/crypto-api/verification.ts:236
Returns true if the verification has been cancelled, either by us or the other side.
Returns
Section titled “Returns”boolean
userId
Section titled “userId”Get Signature
Section titled “Get Signature”get userId():
string
Defined in: src/crypto-api/verification.ts:241
The ID of the other user in the verification process.
Returns
Section titled “Returns”string
Methods
Section titled “Methods”[captureRejectionSymbol]()?
Section titled “[captureRejectionSymbol]()?”
optional[captureRejectionSymbol]<K>(error,event, …args):void
Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:103
Type Parameters
Section titled “Type Parameters”K
Parameters
Section titled “Parameters”Error
string | symbol
…AnyRest
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”TypedEventEmitter.[captureRejectionSymbol]
addListener()
Section titled “addListener()”addListener<
T>(event,listener):this
Defined in: src/models/typed-event-emitter.ts:70
Alias for on.
Type Parameters
Section titled “Type Parameters”T extends EventEmitterEvents | VerifierEvent
Parameters
Section titled “Parameters”T
listener
Section titled “listener”Listener<VerifierEvent, VerifierEventHandlerMap, T>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”cancel()
Section titled “cancel()”cancel(
e):void
Defined in: src/crypto-api/verification.ts:262
Cancel a verification.
We will send an m.key.verification.cancel if the verification is still in flight. The verification promise
will reject, and a VerifierEvent.Cancel will be emitted.
Parameters
Section titled “Parameters”Error
the reason for the cancellation.
Returns
Section titled “Returns”void
emit()
Section titled “emit()”Call Signature
Section titled “Call Signature”emit<
T>(event, …args):boolean
Defined in: src/models/typed-event-emitter.ts:86
Synchronously calls each of the listeners registered for the event named
event, in the order they were registered, passing the supplied arguments
to each.
Type Parameters
Section titled “Type Parameters”T extends VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerifierEventHandlerMap[T]>
Arguments to pass to the listener
Returns
Section titled “Returns”boolean
true if the event had listeners, false otherwise.
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”emit<
T>(event, …args):boolean
Defined in: src/models/typed-event-emitter.ts:87
Synchronously calls each of the listeners registered for the event named
event, in the order they were registered, passing the supplied arguments
to each.
Type Parameters
Section titled “Type Parameters”T extends VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerifierEventHandlerMap[T]>
Arguments to pass to the listener
Returns
Section titled “Returns”boolean
true if the event had listeners, false otherwise.
Inherited from
Section titled “Inherited from”emitPromised()
Section titled “emitPromised()”Call Signature
Section titled “Call Signature”emitPromised<
T>(event, …args):Promise<boolean>
Defined in: src/models/typed-event-emitter.ts:98
Similar to emit but calls all listeners within a Promise.all and returns the promise chain
Type Parameters
Section titled “Type Parameters”T extends VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerifierEventHandlerMap[T]>
Arguments to pass to the listener
Returns
Section titled “Returns”Promise<boolean>
true if the event had listeners, false otherwise.
Inherited from
Section titled “Inherited from”TypedEventEmitter.emitPromised
Call Signature
Section titled “Call Signature”emitPromised<
T>(event, …args):Promise<boolean>
Defined in: src/models/typed-event-emitter.ts:102
Similar to emit but calls all listeners within a Promise.all and returns the promise chain
Type Parameters
Section titled “Type Parameters”T extends VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerifierEventHandlerMap[T]>
Arguments to pass to the listener
Returns
Section titled “Returns”Promise<boolean>
true if the event had listeners, false otherwise.
Inherited from
Section titled “Inherited from”TypedEventEmitter.emitPromised
eventNames()
Section titled “eventNames()”eventNames(): (
string|symbol)[]
Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();myEE.on('foo', () => {});myEE.on('bar', () => {});
const sym = Symbol('symbol');myEE.on(sym, () => {});
console.log(myEE.eventNames());// Prints: [ 'foo', 'bar', Symbol(symbol) ]Returns
Section titled “Returns”(string | symbol)[]
v6.0.0
Inherited from
Section titled “Inherited from”getMaxListeners()
Section titled “getMaxListeners()”getMaxListeners():
number
Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
Section titled “Returns”number
v1.0.0
Inherited from
Section titled “Inherited from”TypedEventEmitter.getMaxListeners
getReciprocateQrCodeCallbacks()
Section titled “getReciprocateQrCodeCallbacks()”getReciprocateQrCodeCallbacks():
ShowQrCodeCallbacks|null
Defined in: src/crypto-api/verification.ts:278
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
Section titled “Returns”ShowQrCodeCallbacks | null
getShowSasCallbacks()
Section titled “getShowSasCallbacks()”getShowSasCallbacks():
ShowSasCallbacks|null
Defined in: src/crypto-api/verification.ts:270
Get the details for an SAS verification, if one is in progress
Returns null, unless this verifier is for a SAS-based verification and we are waiting for the user to confirm
the SAS matches.
Returns
Section titled “Returns”ShowSasCallbacks | null
listenerCount()
Section titled “listenerCount()”listenerCount(
event):number
Defined in: src/models/typed-event-emitter.ts:115
Returns the number of listeners listening to the event named event.
Parameters
Section titled “Parameters”EventEmitterEvents | VerifierEvent
The name of the event being listened for
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”TypedEventEmitter.listenerCount
listeners()
Section titled “listeners()”listeners(
event):Function[]
Defined in: src/models/typed-event-emitter.ts:122
Returns a copy of the array of listeners for the event named event.
Parameters
Section titled “Parameters”EventEmitterEvents | VerifierEvent
Returns
Section titled “Returns”Function[]
Inherited from
Section titled “Inherited from”off<
T>(event,listener):this
Defined in: src/models/typed-event-emitter.ts:129
Alias for removeListener
Type Parameters
Section titled “Type Parameters”T extends EventEmitterEvents | VerifierEvent
Parameters
Section titled “Parameters”T
listener
Section titled “listener”Listener<VerifierEvent, VerifierEventHandlerMap, T>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”on<
T>(event,listener):this
Defined in: src/models/typed-event-emitter.ts:150
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 prependListener method can be used as an alternative to add the event listener to the beginning of the listeners array.
Type Parameters
Section titled “Type Parameters”T extends EventEmitterEvents | VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<VerifierEvent, VerifierEventHandlerMap, T>
The callback function
Returns
Section titled “Returns”this
a reference to the EventEmitter, so that calls can be chained.
Inherited from
Section titled “Inherited from”once()
Section titled “once()”once<
T>(event,listener):this
Defined in: src/models/typed-event-emitter.ts:169
Adds a one-time listener function for the event named event. The
next time event is triggered, this listener is removed and then invoked.
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The prependOnceListener method can be used as an alternative to add the event listener to the beginning of the listeners array.
Type Parameters
Section titled “Type Parameters”T extends EventEmitterEvents | VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<VerifierEvent, VerifierEventHandlerMap, T>
The callback function
Returns
Section titled “Returns”this
a reference to the EventEmitter, so that calls can be chained.
Inherited from
Section titled “Inherited from”prependListener()
Section titled “prependListener()”prependListener<
T>(event,listener):this
Defined in: src/models/typed-event-emitter.ts:186
Adds the listener function to the beginning 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.
Type Parameters
Section titled “Type Parameters”T extends EventEmitterEvents | VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<VerifierEvent, VerifierEventHandlerMap, T>
The callback function
Returns
Section titled “Returns”this
a reference to the EventEmitter, so that calls can be chained.
Inherited from
Section titled “Inherited from”TypedEventEmitter.prependListener
prependOnceListener()
Section titled “prependOnceListener()”prependOnceListener<
T>(event,listener):this
Defined in: src/models/typed-event-emitter.ts:202
Adds a one-timelistener function for the event named event to the beginning of the listeners array.
The next time event is triggered, this listener is removed, and then invoked.
Type Parameters
Section titled “Type Parameters”T extends EventEmitterEvents | VerifierEvent
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<VerifierEvent, VerifierEventHandlerMap, T>
The callback function
Returns
Section titled “Returns”this
a reference to the EventEmitter, so that calls can be chained.
Inherited from
Section titled “Inherited from”TypedEventEmitter.prependOnceListener
rawListeners()
Section titled “rawListeners()”rawListeners(
event):Function[]
Defined in: src/models/typed-event-emitter.ts:243
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
Parameters
Section titled “Parameters”EventEmitterEvents | VerifierEvent
Returns
Section titled “Returns”Function[]
Inherited from
Section titled “Inherited from”TypedEventEmitter.rawListeners
removeAllListeners()
Section titled “removeAllListeners()”removeAllListeners(
event?):this
Defined in: src/models/typed-event-emitter.ts:219
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
Section titled “Parameters”event?
Section titled “event?”EventEmitterEvents | VerifierEvent
The name of the event. If undefined, all listeners everywhere are removed.
Returns
Section titled “Returns”this
a reference to the EventEmitter, so that calls can be chained.
Inherited from
Section titled “Inherited from”TypedEventEmitter.removeAllListeners
removeListener()
Section titled “removeListener()”removeListener<
T>(event,listener):this
Defined in: src/models/typed-event-emitter.ts:232
Removes the specified listener from the listener array for the event named event.
Type Parameters
Section titled “Type Parameters”T extends EventEmitterEvents | VerifierEvent
Parameters
Section titled “Parameters”T
listener
Section titled “listener”Listener<VerifierEvent, VerifierEventHandlerMap, T>
Returns
Section titled “Returns”this
a reference to the EventEmitter, so that calls can be chained.
Inherited from
Section titled “Inherited from”TypedEventEmitter.removeListener
setMaxListeners()
Section titled “setMaxListeners()”setMaxListeners(
n):this
Defined in: node_modules/.pnpm/@types+node@22.20.0/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”this
v0.3.5
Inherited from
Section titled “Inherited from”TypedEventEmitter.setMaxListeners
verify()
Section titled “verify()”verify():
Promise<void>
Defined in: src/crypto-api/verification.ts:252
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
Section titled “Returns”Promise<void>
Promise which resolves when the verification has completed, or rejects if the verification is cancelled or times out.