VerificationRequest
Defined in: src/crypto-api/verification.ts:23
An incoming, or outgoing, request to verify a user or a device via cross-signing.
Extends
Section titled “Extends”TypedEventEmitter<VerificationRequestEvent,VerificationRequestEventHandlerMap>
Accessors
Section titled “Accessors”accepting
Section titled “accepting”Get Signature
Section titled “Get Signature”get accepting():
boolean
Defined in: src/crypto-api/verification.ts:70
True if we have started the process of sending an m.key.verification.ready (but have not necessarily received
the remote echo which causes a transition to VerificationPhase.Ready.
Returns
Section titled “Returns”boolean
cancellationCode
Section titled “cancellationCode”Get Signature
Section titled “Get Signature”get cancellationCode():
string|null
Defined in: src/crypto-api/verification.ts:161
If this request has been cancelled, the cancellation code (e.g m.user) which is responsible for cancelling
this verification.
Returns
Section titled “Returns”string | null
cancellingUserId
Section titled “cancellingUserId”Get Signature
Section titled “Get Signature”get cancellingUserId():
string|undefined
Defined in: src/crypto-api/verification.ts:168
The id of the user that cancelled the request.
Only defined when phase is Cancelled
Returns
Section titled “Returns”string | undefined
chosenMethod
Section titled “chosenMethod”Get Signature
Section titled “Get Signature”get chosenMethod():
string|null
Defined in: src/crypto-api/verification.ts:89
the method picked in the .start event
Returns
Section titled “Returns”string | null
declining
Section titled “declining”Get Signature
Section titled “Get Signature”get declining():
boolean
Defined in: src/crypto-api/verification.ts:76
True if we have started the process of sending an m.key.verification.cancel (but have not necessarily received
the remote echo which causes a transition to VerificationPhase.Cancelled).
Returns
Section titled “Returns”boolean
initiatedByMe
Section titled “initiatedByMe”Get Signature
Section titled “Get Signature”get initiatedByMe():
boolean
Defined in: src/crypto-api/verification.ts:47
True if this request was initiated by the local client.
For in-room verifications, the initiator is who sent the m.key.verification.request event.
For to-device verifications, the initiator is who sent the m.key.verification.start event.
Returns
Section titled “Returns”boolean
isSelfVerification
Section titled “isSelfVerification”Get Signature
Section titled “Get Signature”get isSelfVerification():
boolean
Defined in: src/crypto-api/verification.ts:56
True if the other party in this request is one of this user’s own devices.
Returns
Section titled “Returns”boolean
methods
Section titled “methods”Get Signature
Section titled “Get Signature”get methods():
string[]
Defined in: src/crypto-api/verification.ts:86
once the phase is Started (and !initiatedByMe) or Ready: common methods supported by both sides
Returns
Section titled “Returns”string[]
otherDeviceId
Section titled “otherDeviceId”Get Signature
Section titled “Get Signature”get otherDeviceId():
string|undefined
Defined in: src/crypto-api/verification.ts:53
For verifications via to-device messages: the ID of the other device. Otherwise, undefined.
Returns
Section titled “Returns”string | undefined
otherUserId
Section titled “otherUserId”Get Signature
Section titled “Get Signature”get otherUserId():
string
Defined in: src/crypto-api/verification.ts:50
The user id of the other party in this request
Returns
Section titled “Returns”string
pending
Section titled “pending”Get Signature
Section titled “Get Signature”get pending():
boolean
Defined in: src/crypto-api/verification.ts:64
True if the request has sent its initial event and needs more events to complete
(ie it is in phase Requested, Ready or Started).
Returns
Section titled “Returns”boolean
Get Signature
Section titled “Get Signature”get phase():
VerificationPhase
Defined in: src/crypto-api/verification.ts:59
current phase of the request.
Returns
Section titled “Returns”roomId
Section titled “roomId”Get Signature
Section titled “Get Signature”get roomId():
string|undefined
Defined in: src/crypto-api/verification.ts:39
For an in-room verification, the ID of the room.
For to-device verifictions, undefined.
Returns
Section titled “Returns”string | undefined
timeout
Section titled “timeout”Get Signature
Section titled “Get Signature”get timeout():
number|null
Defined in: src/crypto-api/verification.ts:83
The remaining number of ms before the request will be automatically cancelled.
null indicates that there is no timeout
Returns
Section titled “Returns”number | null
transactionId
Section titled “transactionId”Get Signature
Section titled “Get Signature”get transactionId():
string|undefined
Defined in: src/crypto-api/verification.ts:32
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
Section titled “Returns”string | undefined
verifier
Section titled “verifier”Get Signature
Section titled “Get Signature”get verifier():
Verifier|undefined
Defined in: src/crypto-api/verification.ts:147
The verifier which is doing the actual verification, once the method has been established.
Only defined when the phase is Started.
Returns
Section titled “Returns”Verifier | undefined
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]
accept()
Section titled “accept()”accept():
Promise<void>
Defined in: src/crypto-api/verification.ts:107
Accepts the request, sending a .ready event to the other party
Returns
Section titled “Returns”Promise<void>
Promise which resolves when the event has been sent.
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 | Change
Parameters
Section titled “Parameters”T
listener
Section titled “listener”Listener<Change, VerificationRequestEventHandlerMap, T>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”cancel()
Section titled “cancel()”cancel(
params?):Promise<void>
Defined in: src/crypto-api/verification.ts:117
Cancels the request, sending a cancellation to the other party
Parameters
Section titled “Parameters”params?
Section titled “params?”Details for the cancellation, including reason (defaults to “User declined”), and code
(defaults to m.user). Deprecated: this parameter is ignored by the Rust cryptography implementation.
string
reason?
Section titled “reason?”string
Returns
Section titled “Returns”Promise<void>
Promise which resolves when the event has been sent.
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 Change
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerificationRequestEventHandlerMap[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 Change
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerificationRequestEventHandlerMap[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 Change
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerificationRequestEventHandlerMap[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 Change
Parameters
Section titled “Parameters”T
The name of the event to emit
…Parameters<VerificationRequestEventHandlerMap[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”generateQRCode()
Section titled “generateQRCode()”generateQRCode():
Promise<Uint8ClampedArray<ArrayBufferLike> |undefined>
Defined in: src/crypto-api/verification.ts:155
Generate the data for a QR code allowing the other device to verify this one, if it supports it.
Only returns data once phase is VerificationPhase.Ready and the other party can scan a QR code;
otherwise returns undefined.
Returns
Section titled “Returns”Promise<Uint8ClampedArray<ArrayBufferLike> | undefined>
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
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”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”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 | Change
Parameters
Section titled “Parameters”T
listener
Section titled “listener”Listener<Change, VerificationRequestEventHandlerMap, 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 | Change
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<Change, VerificationRequestEventHandlerMap, 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 | Change
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<Change, VerificationRequestEventHandlerMap, 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”otherPartySupportsMethod()
Section titled “otherPartySupportsMethod()”otherPartySupportsMethod(
method):boolean
Defined in: src/crypto-api/verification.ts:100
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
Section titled “Parameters”method
Section titled “method”string
the method to check
Returns
Section titled “Returns”boolean
true if the other party said they supported the method
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 | Change
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<Change, VerificationRequestEventHandlerMap, 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 | Change
Parameters
Section titled “Parameters”T
The name of the event.
listener
Section titled “listener”Listener<Change, VerificationRequestEventHandlerMap, 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”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?”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 | Change
Parameters
Section titled “Parameters”T
listener
Section titled “listener”Listener<Change, VerificationRequestEventHandlerMap, 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
scanQRCode()
Section titled “scanQRCode()”scanQRCode(
qrCodeData):Promise<Verifier>
Defined in: src/crypto-api/verification.ts:141
Start a QR code verification by providing a scanned QR code for this verification flow.
Validates the QR code, and if it is ok, sends an m.key.verification.start event with method set to
m.reciprocate.v1, to tell the other side the scan was successful.
See also VerificationRequest#startVerification which can be used to start other verification methods.
Parameters
Section titled “Parameters”qrCodeData
Section titled “qrCodeData”Uint8ClampedArray
the decoded QR code.
Returns
Section titled “Returns”Promise<Verifier>
A verifier; call .verify() on it to wait for the other side to complete the verification flow.
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
startVerification()
Section titled “startVerification()”startVerification(
method):Promise<Verifier>
Defined in: src/crypto-api/verification.ts:128
Send an m.key.verification.start event to start verification via a particular method.
This is normally used when starting a verification via emojis (ie, method is set to m.sas.v1).
Parameters
Section titled “Parameters”method
Section titled “method”string
the name of the verification method to use.
Returns
Section titled “Returns”Promise<Verifier>
The verifier which will do the actual verification.