Experimental
The widget api to use for communication.
The capabilities the widget client will request.
The room id the widget is associated with.
The configuration options for this client.
Whether to send a content loaded widget action immediately after initial setup.
Set to false
if the widget uses waitForIFrameLoad=true
(in this case the client does not expect a content loaded action at all),
or if the the widget wants to send the ContentLoaded
action at a later point in time after the initial setup.
Optional
cachedOptional
callProtected
Optional
canProtected
canPrivate
Readonly
capabilitiesThe capabilities the widget client will request.
Protected
Optional
checkProtected
Optional
clientProtected
Optional
clientProtected
Optional
clientProtected
Optional
clientOptional
cryptoThe libolm crypto implementation, if it is in use.
This should not be used. Instead, use the methods exposed directly on this class or (where they are available) via getCrypto.
Protected
Optional
cryptoProtected
Optional
exportedProtected
fallbackICEServerOptional
groupOptional
idOptional
identityReadonly
ignoredProtected
isReadonly
isPrivate
Optional
lifecycleOptional
livekitReadonly
matrixRTCProtected
mediaProtected
notifProtected
ongoingProtected
peekOptional
pickleEncryption key used for encrypting sensitive data (such as e2ee keys) in storage.
As supplied in the constructor via IMatrixClientCreateOpts#pickleKey.
If unset, either a hardcoded key or no encryption at all is used, depending on the Crypto implementation.
this should be a private property.
Protected
pushOptional
pushPrivate
Optional
roomPrivate
Readonly
roomThe room id the widget is associated with.
Optional
roomOptional
schedulerProtected
Optional
serverProtected
sessionProtected
Optional
syncProtected
Optional
syncPrivate
syncProtected
syncedProtected
turnProtected
turnProtected
txnProtected
Optional
verificationPrivate
Readonly
widgetThe widget api to use for communication.
Private
Readonly
widgetStatic
Readonly
RESTORE_Access the server-side secret storage API for this client.
Gets a set of room IDs in common with another user.
Note: This endpoint is unstable, and can throw an Error
.
Check progress on MSC2666 for more details.
The userId to check.
Promise which resolves to an array of rooms
Private
ackAlias for TypedEventEmitter#on.
Promise which resolves: an empty object {}
Add a key for encrypting secrets.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
the algorithm used by the key
the options for the algorithm. The properties used depend on the algorithm given.
Optional
keyName: stringthe name of the key. If not given, a random name will be generated.
An object with: keyId: the ID of the key keyInfo: details about the key (iv, mac, passphrase)
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#addKey.
Add a 3PID to your homeserver account. This API does not use an identity server, as the homeserver is expected to handle 3PID ownership validation.
A object with 3PID validation data from having called
account/3pid/<medium>/requestToken
on the homeserver.
Promise which resolves: to an empty object {}
Begin a key verification.
the verification method to use
the user to verify keys with
the device to verify
a verification object
Use requestVerification
instead.
Bind a 3PID for discovery onto an identity server via the homeserver. The identity server handles 3PID ownership validation and the homeserver records the new binding to track where all 3PIDs for the account are bound.
A object with 3PID validation data from having called
validate/<medium>/requestToken
on the identity server. It should also
contain id_server
and id_access_token
fields as well.
Promise which resolves: to an empty object {}
Bootstrap cross-signing by creating keys if needed. If everything is already set up, then no changes are made, so this is safe to run to ensure cross-signing is ready for use.
This function:
Prefer CryptoApi.bootstrapCrossSigning
.
Bootstrap Secure Secret Storage if needed by creating a default key. If everything is already set up, then no changes are made, so this is safe to run to ensure secret storage is ready for use.
This function
Protected
buildConstruct a SyncApiOptions for this client, suitable for passing into the SyncApi constructor
Looks up the public Matrix ID mappings for multiple 3PIDs.
Array of arrays containing [medium, address]
The access_token
field of the Identity
Server /account/register
response (see registerWithIdentityServer).
Promise which resolves: Lookup results from IS.
Cancel a room key request for this event if one is ongoing and resend the request.
event of which to cancel and resend the room key request.
A promise that will resolve when the key request is queued
Cancel a queued or unsent event.
Event to cancel
Error if the event is not in QUEUED, NOT_SENT or ENCRYPTING state
Cancel a file upload in progress
The object returned from uploadContent
true if canceled, otherwise false
Checks that a given cross-signing private key matches a given public key. This can be used by the getCrossSigningKey callback to verify that the private key it is about to supply is the one that was requested.
The private key
The public key
true if the key matches, otherwise false
Check whether a given device is trusted.
The cross-signing API is currently UNSTABLE and may change without notice.
The ID of the user whose devices is to be checked.
The ID of the device to check
Force a re-check of the local key backup status against what's on the server.
Object with backup info (as returned by getKeyBackupVersion) in backupInfo and trust information (as returned by isKeyBackupTrusted) in trustInfo.
Check the copy of our cross-signing key that we have in the device list and see if we can get the private key. If so, mark it as trusted.
Optional
opts: ICheckOwnCrossSigningTrustOptsICheckOwnCrossSigningTrustOpts object
Unneeded for the new crypto
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#checkKey.
Checks that a given secret storage private key matches a given public key. This can be used by the getSecretStorageKey callback to verify that the private key it is about to supply is the one that was requested.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
The private key
The public key
true if the key matches, otherwise false
The use of asymmetric keys for SSSS is deprecated. Use SecretStorage.ServerSideSecretStorage#checkKey for symmetric keys.
Check whether a given user is trusted.
The cross-signing API is currently UNSTABLE and may change without notice.
The ID of the user to check.
Claim one-time keys
a list of [userId, deviceId] pairs
desired key type
Optional
timeout: numberthe time (in milliseconds) to wait for keys from remote servers
Promise which resolves: result object. Rejects: with an error response (MatrixError).
Creates a new call. The place*Call methods on the returned call can be used to actually place a call
The room the call is to be placed in.
the call or null if the browser doesn't support calling.
Creates a new dehydrated device (without queuing periodic dehydration)
the dehydration key
Information about the key. Primarily for information about how to generate the key from a passphrase.
Optional
deviceDisplayName: stringThe device display name for the dehydrated device.
the device id of the newly created dehydrated device
Create a new filter.
The HTTP body for the request
Promise which resolves to a Filter object.
Creates a new group call and sends the associated state event to alert other members that the room now has a group call.
The room the call is to be placed in.
Optional
dataChannelsEnabled: booleanOptional
dataChannelOptions: IGroupCallDataChannelOptionsCreate a new key backup version and enable it, using the information return from prepareKeyBackupVersion.
Info object from prepareKeyBackupVersion
Object with 'version' param indicating the version created
Makes a request to /messages with the appropriate lazy loading filter set. XXX: if we do get rid of scrollback (as it's not used at the moment), we could inline this method again in paginateEventTimeline as that would then be the only call-site
Create a recovery key from a user-supplied passphrase.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
Optional
password: stringPassphrase string that can be entered by the user when restoring the backup as an alternative to entering the recovery key. Optional.
Object with public key metadata, encoded private recovery key which should be disposed of after displaying to the user, and raw private key to avoid round tripping if needed.
Create a new room.
a list of options to pass to the /createRoom API.
Promise which resolves: {room_id: {string}}
Makes a request to /messages with the appropriate lazy loading filter set. XXX: if we do get rid of scrollback (as it's not used at the moment), we could inline this method again in paginateEventTimeline as that would then be the only call-site
the maximum amount of events the retrieve
'f' or 'b'
Optional
timelineFilter: Filterthe timeline filter to pass
Deactivates the logged-in account. Obviously, further calls that require authorisation should fail after this method is called. The state of the MatrixClient object is not affected: it is up to the caller to either reset or destroy the MatrixClient after this method succeeds.
Optional
auth: AuthDictOptional. Auth data to supply for User-Interactive auth.
Optional
erase: booleanOptional. If set, send as erase
attribute in the
JSON request body, indicating whether the account should be erased. Defaults
to false.
Promise which resolves: On success, the empty object
Deactivates a user using Synapse's administrator API. This function is implementation specific and may change as a result.
the User ID to deactivate.
the deactivate response - see Synapse docs for information.
Attempts to decrypt an event
The event to decrypt
Optional
options: IDecryptOptionsA decryption promise
Optional
version: stringOptional
version: stringOptional
version: stringPromise which resolves: an empty object {}
The threepid medium (eg. 'email')
The threepid address (eg. 'bob@example.com') this must be as returned by getThreePids.
Promise which resolves: The server response on success (generally the empty JSON object)
Query the server to see if it is forcing encryption to be enabled for a given room preset, based on the /versions response.
The name of the preset to check.
true if the server is forcing encryption for the preset.
Download the keys for a list of users and stores the keys in the session store.
The users to fetch.
Optional
forceDownload: booleanAlways download the keys even if cached.
A promise which resolves to a map userId->deviceId->DeviceInfo
Prefer CryptoApi.getUserDeviceInfo
Download device keys
list of users to get keys for
sync token to pass in the query request, to help the HS give the most recent results
Optional
token?: stringPromise which resolves: result object. Rejects: with an error response (MatrixError).
Synchronously calls each of the listeners registered for the event named
event
, in the order they were registered, passing the supplied arguments
to each.
The name of the event to emit
Rest
...args: Parameters<ClientEventHandlerMap[T]>Arguments to pass to the listener
true
if the event had listeners, false
otherwise.
Rest
...args: Parameters<ClientEventHandlerMap[T]>Similar to emit
but calls all listeners within a Promise.all
and returns the promise chain
The name of the event to emit
Rest
...args: Parameters<ClientEventHandlerMap[T]>Arguments to pass to the listener
true
if the event had listeners, false
otherwise.
Rest
...args: Parameters<ClientEventHandlerMap[T]>Enable backing up of keys, using data previously returned from getKeyBackupVersion.
Backup information object as returned by getKeyBackupVersion
Promise which resolves when complete.
Do not call this directly. Instead call CryptoApi.checkKeyBackupAndEnable.
Protected
encryptencrypts the event if necessary; adds the event to the queue, or sends it; marks the event as sent/unsent
returns a promise which resolves with the result of the send request
Encrypts and sends a given object via Olm to-device messages to a given set of devices.
list of deviceInfo objects representing the devices to send to
fields to include in the encrypted payload
Promise which
resolves once the message has been encrypted and sent to the given
userDeviceMap, and returns the { contentMap, deviceInfoByDeviceId }
of the successfully sent messages.
Get a list containing all of the room keys
This should be encrypted before returning it to the user.
a promise which resolves to a list of session export objects
Fetches relations for a given event
the room of the event
the id of the event
the rel_type of the relations requested
Optional
eventType: null | stringthe event type of the relations requested
options with optional values for the request.
the response, with chunk, prev_batch and, next_batch.
Finds a DM verification request that is already in progress for the given room id
the room to use for verification
the VerificationRequest that is in progress, if any
Marks all group sessions as needing to be backed up without scheduling them to upload in the background.
(This is done automatically as part of CryptoApi.resetKeyBackup, so there is probably no need to call this manually.)
Promise which resolves to the number of sessions requiring a backup.
Forces the current outbound group session to be discarded such that another one will be created next time an event is sent.
The ID of the room to discard the session for
Prefer CryptoApi.forceDiscardSession
:
Get account data event of given type for the current user.
The event type
The contents of the given account data event
Get account data event of given type for the current user. This variant gets account data directly from the homeserver if the local store is not ready, which can be useful very early in startup before the initial sync.
The event type
Promise which resolves: The contents of the given account data event.
Get the callback set via setCanResetTimelineCallback
.
The callback or null
Gets the capabilities of the homeserver. Always returns an object of capability keys and their options, which may be empty.
True to ignore any cached values.
Promise which resolves to the capabilities of the homeserver
The app may wish to see if we have a key cached without triggering a user interaction.
Access the crypto API for this client.
If end-to-end encryption has been enabled for this client (via initCrypto or initRustCrypto),
returns an object giving access to the crypto API. Otherwise, returns undefined
.
Whether to trust a others users signatures of their devices. If false, devices will only be considered 'verified' if we have verified that device individually (effectively disabling cross-signing).
Default: true
True if trusting cross-signed devices
Get the current default key ID for encrypting secrets.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
The default key ID or null if no default key ID is set
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#getDefaultKeyId.
Get the current dehydrated device, if any
A promise of an object containing the dehydrated device
Get the Ed25519 key for this device
base64-encoded ed25519 key. Null if crypto is disabled.
Prefer CryptoApi.getOwnDeviceKeys
Get information about the encryption of an event
event to be checked
The event information.
Optional
options: MapperOptsGet e2e information on the device that sent an event
event to be checked
Get an EventTimeline for the given event
If the EventTimelineSet object already has the given event in its store, the corresponding timeline will be returned. Otherwise, a /context request is made, and used to construct an EventTimeline. If the event does not belong to this EventTimelineSet then undefined will be returned.
The timelineSet to look for the event in, must be bound to a room
The ID of the event to look for
Promise which resolves: EventTimeline including the given event
Get the fallback URL to use for unknown interactive-auth stages.
the type of stage being attempted
the auth session ID provided by the homeserver
HS URL to hit to for the fallback interface
Retrieve a filter.
The user ID of the filter owner
The filter ID to retrieve
True to allow cached filters to be returned. Default: True.
Promise which resolves: a Filter object
whether to blacklist all unverified devices by default
Prefer direct access to CryptoApi.globalBlacklistUnverifiedDevices:
value = client.getCrypto().globalBlacklistUnverifiedDevices;
Get account info from the identity server. This is useful as a neutral check to verify that other APIs are likely to approve access by testing that the token is valid, terms have been agreed, etc.
The access_token
field of the Identity
Server /account/register
response (see registerWithIdentityServer).
Promise which resolves: an object with account info.
Gets the V2 hashing information from the identity server. Primarily useful for lookups.
The access token for the identity server.
The hashing information for the identity server.
Retrieve membership info. for a room.
ID of the room to get membership for
Promise which resolves: A list of currently joined users and their profile data.
Promise which resolves: A list of the user's current rooms
true if the client is configured to back up keys to the server, otherwise false. If we haven't completed a successful check of key backup status yet, returns null.
Prefer direct access to CryptoApi.getActiveSessionBackupVersion:
let enabled = (await client.getCrypto().getActiveSessionBackupVersion()) !== null;
Get information about the current key backup from the server.
Performs some basic validity checks on the shape of the result, and raises an error if it is not as expected.
Note: there is no (supported) way to distinguish between "failure to talk to the server" and "another client uploaded a key backup version using an algorithm I don't understand.
Information object from API, or null if no backup is present on the server.
Ask the server for a list of users who have changed their device lists between a pair of sync tokens
Promise which resolves: result object. Rejects: with an error response (MatrixError).
Get an EventTimeline for the latest events in the room. This will just
call /messages
to get the latest message in the room, then use
client.getEventTimeline(...)
to construct a new timeline from it.
The timelineSet to find or add the timeline to
Promise which resolves: EventTimeline timeline with the latest events in the room
Gets the local aliases for the room. Note: this includes all local aliases, unlike the curated list from the m.room.canonical_alias state event.
The room ID to get local aliases for.
Promise which resolves: an object with an aliases
property, containing an array of local aliases
Get the config for the media repository.
Promise which resolves with an object containing the config.
Return the global notification EventTimelineSet, if any
the globl notification EventTimelineSet
Gets a bearer token from the homeserver that the user can present to a third party in order to prove their ownership of the Matrix account they are logged into.
Promise which resolves: Token object
Get outgoing room key request for this event if there is one.
The event to check for
A room key request, or null if there is none
The user to get presence for
Promise which resolves: The presence state for this user.
Optional
info: stringThe kind of info to retrieve (e.g. 'displayname', 'avatar_url').
Promise which resolves: TODO
Obtain a dict of actions which should be performed for this event according to the push rules for this user. Caches the dict on the event.
The event to get push actions for.
forces to recalculate actions for an event Useful when an event just got decrypted
A dict of actions to perform.
Obtain a dict of actions which should be performed for this event according to the push rules for this user. Caches the dict on the event.
The event to get push actions for.
forces to recalculate actions for an event Useful when an event just got decrypted
A dict of actions to perform.
Get the push rules for the account from the server.
Promise which resolves to the push rules.
Get the room for the given room ID. This function will return a valid room for any room for which a Room event has been emitted. Note in particular that other events, eg. RoomState.members will be emitted for a room before this function will return the given room.
The room ID
The Room or null if it doesn't exist or there is no data store.
Get the visibility of a room in the current HS's room directory
Promise which resolves: TODO
Fetches or paginates a room hierarchy as defined by MSC2946.
Falls back gracefully to sourcing its data from getSpaceSummary
if this API is not yet supported by the server.
The ID of the space-room to use as the root of the summary.
Optional
limit: numberThe maximum number of rooms to return per page.
Optional
maxDepth: numberThe maximum depth in the tree from the root room to return.
Whether to only return rooms with suggested=true.
Optional
fromToken: stringThe opaque token to paginate a previous request.
the response, with next_batch & rooms fields.
Get room info for the given alias.
The room alias to resolve.
Promise which resolves: Object with room_id and servers.
Fetches the summary of a room as defined by an initial version of MSC3266 and implemented in Synapse Proposed at https://github.com/matrix-org/matrix-doc/pull/3266
The ID or alias of the room to get the summary of.
Optional
via: string[]The list of servers which know about the room if only an ID was provided.
Promise which resolves: to an object keyed by tagId with objects containing a numeric order field.
Determines the history of room upgrades for a given room, as far as the client can see. Returns an array of Rooms where the first entry is the oldest and the last entry is the newest (likely current) room. If the provided room is not found, this returns an empty list. This works in both directions, looking for older and newer rooms of the given room.
The room ID to search from
If true, the function will only return rooms which can be proven to be linked. For example, rooms which have a create event pointing to an old room which the client is not aware of or doesn't have a matching tombstone would not be returned.
if true, look for m.room.predecessor state events as well as create events, and prefer predecessor events where they exist (MSC3946).
An array of rooms representing the upgrade history.
Return the provided scheduler, if any.
The scheduler or undefined
Get a secret from storage.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
the name of the secret
the contents of the secret
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#get.
The URL to redirect to after the HS authenticates with the SSO.
The type of SSO login we are doing (sso or cas). Defaults to 'sso'.
Optional
idpId: stringThe ID of the Identity Provider being targeted, optional.
Optional
action: SSOActionthe SSO flow to indicate to the IdP, optional.
The HS URL to hit to begin the SSO login process.
Get the cross signing information for a given user.
The cross-signing API is currently UNSTABLE and may change without notice.
the user ID to get the cross-signing info for.
the cross signing information for the user.
Get the stored device key for a user id and device id
the user to list keys for.
unique identifier for the device
device or null
Prefer CryptoApi.getUserDeviceInfo
Get the stored device keys for a user id
the user to list keys for.
list of devices
Prefer CryptoApi.getUserDeviceInfo
Returns the additional data object associated with the current sync state, or null if there is no such data. Sync errors, if available, are put in the 'error' key of this object.
Get information on how a specific place on a third party protocol may be reached.
The protocol given in getThirdpartyProtocols()
Protocol-specific parameters, as given in the response to getThirdpartyProtocols()
Optional
searchPromise which resolves to the result object
Get information on how a specific user on a third party protocol may be reached.
The protocol given in getThirdpartyProtocols()
Optional
params: QueryDictProtocol-specific parameters, as given in the response to getThirdpartyProtocols()
Promise which resolves to the result object
Get the TURN servers for this homeserver.
The servers or an empty list.
Get a preview of the given URL as of (roughly) the given point in time, described as an object with OpenGraph keys and associated values. Attributes may be synthesized where actual OG metadata is lacking. Caches results to prevent hammering the server.
The URL to get preview data for
The preferred point in time that the preview should describe (ms since epoch). The preview returned will either be the most recent one preceding this timestamp if available, or failing that the next most recent available preview.
Promise which resolves: Object of OG metadata.
Returns all to-device verification requests that are already in progress for the given user id
the ID of the user to query
the VerificationRequests that are in progress
Get the API versions supported by the server, along with any unstable APIs it supports
The server /versions response
Retrieve all rooms that should be displayed to the user This is essentially getRooms() with some rooms filtered out, eg. old versions of rooms that have been replaced or (in future) other rooms that have been marked at the protocol level as not to be displayed to the user.
if true, look for an m.room.predecessor state event and use it if found (MSC3946).
A list of rooms, or an empty list if there is no data store.
Check whether we have a key with a given ID.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
Optional
keyId: stringThe ID of the key to check for. Defaults to the default key ID if not provided.
Whether we have the key.
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#hasKey.
Performs a hashed lookup of addresses against the identity server. This is only supported on identity servers which have at least the version 2 API.
An array of 2 element arrays.
The first element of each pair is the address, the second is the 3PID medium.
Eg: ["email@example.org", "email"]
The access token for the identity server.
A collection of address mappings to found MXIDs. Results where no user could be found will not be listed.
Import a list of room keys previously exported by exportRoomKeys
a list of session export objects
Optional
opts: ImportRoomKeysOptsoptions object
a promise which resolves when the keys have been imported
Initialise support for end-to-end encryption in this client, using libolm.
You should call this method after creating the matrixclient, but before
calling startClient
, if you want to support end-to-end encryption.
It will return a Promise which will resolve when the crypto layer has been successfully initialised.
Experimental
Initialise support for end-to-end encryption in this client, using the rust matrix-sdk-crypto.
An alternative to initCrypto.
WARNING: this API is very experimental, should not be used in production, and may change without notice!
Eventually it will be deprecated and initCrypto
will do the same thing.
True to use an indexeddb store, false to use an in-memory store. Defaults to 'true'.
Optional
usea Promise which will resolve when the crypto layer has been successfully initialised.
Invite a user to a room based on a third-party identifier.
The room to invite the user to.
The medium to invite the user e.g. "email".
The address for the specified medium.
Promise which resolves: {}
an empty object.
Checks whether cross signing:
If this function returns false, bootstrapCrossSigning() can be used to fix things such that it returns true. That is to say, after bootstrapCrossSigning() completes successfully, this function should return true.
True if cross-signing is ready to be used on this device
Prefer CryptoApi.isCrossSigningReady
:
Is end-to-end crypto enabled for this client.
True if end-to-end is enabled.
prefer getCrypto
Check if the sender of an event is verified
event to be checked
true if the sender of this event has been verified using MatrixClient#setDeviceVerified.
Check whether the key backup private key is stored in secret storage.
map of key name to key info the secret is encrypted with, or null if it is not present or not encrypted with a trusted key
key backup info dict from getKeyBackupVersion()
Prefer CryptoApi.isKeyBackupTrusted
.
Whether encryption is enabled for a room.
the room id to query.
whether encryption is enabled.
Not correctly supported for Rust Cryptography. Use CryptoApi.isEncryptionEnabledInRoom and/or Room.hasEncryptionStateEvent.
Checks whether secret storage:
If this function returns false, bootstrapSecretStorage() can be used to fix things such that it returns true. That is to say, after bootstrapSecretStorage() completes successfully, this function should return true.
True if secret storage is ready to be used on this device
Prefer CryptoApi.isSecretStorageReady
.
Check if a secret is stored on the server.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
the name of the secret
map of key name to key info the secret is encrypted with, or null if it is not present or not encrypted with a trusted key
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#isStored.
Determines if the current user is an administrator of the Synapse homeserver. Returns false if untrue or the homeserver does not appear to be a Synapse homeserver. This function is implementation specific and may change as a result.
true if the user appears to be a Synapse administrator.
Check whether a username is available prior to registration. An error response indicates an invalid/unavailable username.
The username to check the availability of.
Promise which resolves: to boolean of whether the username is available.
Get the raw key for a key backup from the password Used when migrating key backups into SSSS
The cross-signing API is currently UNSTABLE and may change without notice.
Passphrase
Backup metadata from checkKeyBackup
key backup key
Get the raw key for a key backup from the recovery key Used when migrating key backups into SSSS
The cross-signing API is currently UNSTABLE and may change without notice.
The recovery key
key backup key
Knock a room. If you have already knocked the room, this will no-op.
The room ID or room alias to knock.
Options when knocking the room.
Promise which resolves: {room_id: {string}}
Leaves all rooms in the chain of room upgrades based on the given room. By
default, this will leave all the previous and upgraded rooms, including the
given room. To only leave the given room and any previous rooms, keeping the
upgraded (modern) rooms untouched supply false
to includeFuture
.
The room ID to start leaving at
If true, the whole chain (past and future) of upgraded rooms will be left.
Promise which resolves when completed with an object keyed by room ID and value of the error encountered when leaving or null.
Returns the number of listeners listening to the event named event
.
The name of the event being listened for
Returns a copy of the array of listeners for the event named event
.
Promise which resolves to a LoginResponse object
Promise which resolves to the available login flows
Promise which resolves to a LoginResponse object
Login token previously received from homeserver
Promise which resolves to a LoginResponse object
Logs out the current session. Obviously, further calls that require authorisation should fail after this method is called. The state of the MatrixClient object is not affected: it is up to the caller to either reset or destroy the MatrixClient after this method succeeds.
whether to stop the client before calling /logout to prevent invalid token errors.
Promise which resolves: On success, the empty object {}
Looks up the public Matrix ID mapping for a given 3rd party identifier from the identity server
The medium of the threepid, eg. 'email'
The textual address of the threepid
The access_token
field of the Identity
Server /account/register
response (see registerWithIdentityServer).
Promise which resolves: A threepid mapping object or the empty object if no mapping exists
Optional
includeMembership: stringthe membership type to include in the response
Optional
excludeMembership: stringthe membership type to exclude from the response
Optional
atEventId: stringthe id of the event for which moment in the timeline the members should be returned for
Promise which resolves: dictionary of userid to profile information
Turn an MXC URL into an HTTP one. This method is experimental and may change.
The MXC URL
Optional
width: numberThe desired width of the thumbnail.
Optional
height: numberThe desired height of the thumbnail.
Optional
resizeMethod: stringThe thumbnail resize method to use, either "crop" or "scale".
Optional
allowDirectLinks: booleanIf true, return any non-mxc URLs directly. Fetching such URLs will leak information about the user to anyone they share a room with. If false, will return null for such URLs.
Optional
allowRedirects: booleanIf true, the caller supports the URL being 307 or 308 redirected to another resource upon request. If false, redirects are not expected.
the avatar URL or null.
Alias for TypedEventEmitter#removeListener
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.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
Private
onPrivate
onAdds 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 TypedEventEmitter#prependOnceListener method can be used as an alternative to add the event listener to the beginning of the listeners array.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
Take an EventTimeline, and back/forward-fill results.
timeline object to be updated
Promise which resolves to a boolean: false if there are no events and we reached either end of the timeline; else true.
Set up the data required to create a new backup version. The backup version will not be created and enabled until createKeyBackupVersion is called.
Optional
password: null | string | Uint8ArrayPassphrase string that can be entered by the user when restoring the backup as an alternative to entering the recovery key. Optional.
Object that can be passed to createKeyBackupVersion and additionally has a 'recovery_key' member with the user-facing recovery key string.
Perform any background tasks that can be done before a message is ready to send, in order to speed up sending of the message.
the room the event is in
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.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
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.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
Calls aggregation functions for event types that are aggregated Polls and location beacons
Optional
room: Roomroom the events belong to
Optional
events: MatrixEvent[]timeline events to be processed
Optional
room: RoomOptional
events: MatrixEvent[]Internal
helper for searchRoomEvents and backPaginateRoomEventsSearch. Processes the response from the API call and updates the searchResults
searchResults
Processes a list of threaded events and adds them to their respective timelines
the room the adds the threaded events
an array of the threaded events
the direction in which we want to add the events
Processes a list of thread roots and creates a thread model
the room to create the threads in
an array of thread roots
the direction
Options for this request
Promise which resolves: IPublicRoomsResponse
Sends events directly to specific devices using Matrix's to-device messaging system. The batch will be split up into appropriately sized batches for sending and stored in the store so they can be retried later if they fail to send. Retries will happen automatically.
The to-device messages to send
Returns a copy of the array of listeners for the event named eventName
,
including any wrappers (such as those created by .once()
).
Optional
txnId: stringtransaction id. One will be made up if not supplied.
Optional
opts: IRedactOptsRedact options
Promise which resolves: TODO
Error if called with with_rel_types
(MSC3912) but the server does not support it.
Callers should check whether the server supports MSC3912 via MatrixClient.canSupport
.
Optional
txnId: stringOptional
opts: IRedactOptsRefreshes an access token using a provided refresh token. The refresh token must be valid for the current access token known to the client instance.
Note that this function will not cause a logout if the token is deemed unknown by the server - the caller is responsible for managing logout actions on error.
The refresh token.
Promise which resolves to the new token.
Optional
session?: stringOptional
bindThreepids: null | boolean | { Set key 'email' to true to bind any email threepid uses during registration in the identity server. Set 'msisdn' to true to bind msisdn.
Optional
guestAccessToken: stringOptional
inhibitLogin: booleanPromise which resolves to a RegisterResponse object
Register a guest account.
This method returns the auth info needed to create a new authenticated client,
Remember to call setGuest(true)
on the (guest-)authenticated client, e.g:
const tmpClient = await sdk.createClient(MATRIX_INSTANCE);
const { user_id, device_id, access_token } = tmpClient.registerGuest();
const client = createClient({
baseUrl: MATRIX_INSTANCE,
accessToken: access_token,
userId: user_id,
deviceId: device_id,
})
client.setGuest(true);
JSON HTTP body to provide.
Optional
body?: RegisterRequestPromise which resolves: JSON object that contains:
{ user_id, device_id, access_token, home_server }
parameters for registration request
Optional
kind: stringtype of user to register. may be "guest"
Promise which resolves: to the /register response
Register with an identity server using the OpenID token from the user's Homeserver, which can be retrieved via MatrixClient#getOpenIdToken.
Note that the /account/register
endpoint (as well as IS authentication in
general) was added as part of the v2 API version.
Promise which resolves: with object containing an Identity Server access token.
Try to rehydrate a device if available. The client must have been
initialized with a cryptoCallback.getDehydrationKey
option, and this
function must be called before initCrypto and startClient are called.
Promise which resolves to undefined if a device could not be dehydrated, or to the new device ID if the dehydration was successful.
Returns relations for a given event. Handles encryption transparently, with the caveat that the amount of events returned might be 0, even though you get a nextBatch. When the returned promise resolves, all messages should have finished trying to decrypt.
the room of the event
the id of the event
the rel_type of the relations requested
Optional
eventType: null | stringthe event type of the relations requested
options with optional values for the request.
an object with events
as MatrixEvent[]
and optionally nextBatch
if more relations are available.
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).
Optional
event: EventEmitterEvents | EmittedEventsThe name of the event. If undefined, all listeners everywhere are removed.
a reference to the EventEmitter
, so that calls can be chained.
Removes the specified listener
from the listener array for the event named event
.
a reference to the EventEmitter
, so that calls can be chained.
Reports an event as inappropriate to the server, which may then notify the appropriate people.
The room in which the event being reported is located.
The event to report.
The score to rate this content as where -100 is most offensive and 0 is inoffensive.
The reason the content is being reported. May be blank.
Promise which resolves to an empty object if successful
Requests an email verification token for the purposes of adding a third party identifier to an account. This API requests a token from the homeserver. The doesServerRequireIdServerParam() method can be used to determine if the server requires the id_server parameter to be provided. If an account with the given email address already exists and is associated with an account other than the one the user is authed as, it will either send an email to the address informing them of this or return M_THREEPID_IN_USE (which one is up to the homeserver).
As requestEmailToken
As requestEmailToken
As requestEmailToken
Optional
nextLink: stringAs requestEmailToken
Promise which resolves: As requestEmailToken
Requests a text message verification token for the purposes of adding a third party identifier to an account. This API proxies the identity server /validate/email/requestToken API, adding specific behaviour for the addition of phone numbers to an account, as requestAdd3pidEmailToken.
As requestRegisterMsisdnToken
As requestRegisterMsisdnToken
As requestEmailToken
As requestEmailToken
Optional
nextLink: stringAs requestEmailToken
Promise which resolves: As requestEmailToken
Requests an email verification token directly from an identity server.
This API is used as part of binding an email for discovery on an identity
server. The validation data that results should be passed to the
bindThreePid
method to complete the binding process.
The email address to request a token for
A secret binary string generated by the client. It is recommended this be around 16 ASCII characters.
If an identity server sees a duplicate request with the same sendAttempt, it will not send another email. To request another email to be sent, use a larger value for the sendAttempt param as was used in the previous request.
Optional
nextLink: stringOptional If specified, the client will be redirected to this link after validation.
Optional
identityAccessToken: stringThe access_token
field of the identity
server /account/register
response (see registerWithIdentityServer).
Promise which resolves: TODO
Error if no identity server is set
Make a request for an m.login.token
to be issued as per
https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv1loginget_token
The server may require User-Interactive auth.
Optional
auth: AuthDictOptional. Auth data to supply for User-Interactive auth.
Promise which resolves: On success, the token response or UIA auth data.
Requests a MSISDN verification token directly from an identity server.
This API is used as part of binding a MSISDN for discovery on an identity
server. The validation data that results should be passed to the
bindThreePid
method to complete the binding process.
The ISO 3166-1 alpha-2 code for the country in which phoneNumber should be parsed relative to.
The phone number, in national or international format
A secret binary string generated by the client. It is recommended this be around 16 ASCII characters.
If an identity server sees a duplicate request with the same sendAttempt, it will not send another SMS. To request another SMS to be sent, use a larger value for the sendAttempt param as was used in the previous request.
Optional
nextLink: stringOptional If specified, the client will be redirected to this link after validation.
Optional
identityAccessToken: stringThe access_token
field of the Identity
Server /account/register
response (see registerWithIdentityServer).
Promise which resolves to an object with a sid string
Error if no identity server is set
Requests an email verification token for the purposes of resetting the password on an account. This API proxies the identity server /validate/email/requestToken API, adding specific behaviour for the password resetting. Specifically, if no account with the given email address exists, it may either return M_THREEPID_NOT_FOUND or send an email to the address informing them of this (which one is up to the homeserver).
requestEmailToken calls the equivalent API directly on the identity server, therefore bypassing the password reset specific logic.
As requestEmailToken
As requestEmailToken
As requestEmailToken
Optional
nextLink: stringAs requestEmailToken
Promise which resolves: As requestEmailToken
Requests a text message verification token for the purposes of resetting the password on an account. This API proxies the identity server /validate/email/requestToken API, adding specific behaviour for the password resetting, as requestPasswordEmailToken.
As requestRegisterMsisdnToken
As requestRegisterMsisdnToken
As requestEmailToken
As requestEmailToken
As requestEmailToken
Promise which resolves: As requestEmailToken
Requests an email verification token for the purposes of registration. This API requests a token from the homeserver. The doesServerRequireIdServerParam() method can be used to determine if the server requires the id_server parameter to be provided.
Parameters and return value are as for requestEmailToken
As requestEmailToken
As requestEmailToken
As requestEmailToken
Optional
nextLink: stringAs requestEmailToken
Promise which resolves: As requestEmailToken
Requests a text message verification token for the purposes of registration. This API requests a token from the homeserver. The doesServerRequireIdServerParam() method can be used to determine if the server requires the id_server parameter to be provided.
The ISO 3166-1 alpha-2 code for the country in which phoneNumber should be parsed relative to.
The phone number, in national or international format
As requestEmailToken
As requestEmailToken
Optional
nextLink: stringAs requestEmailToken
Promise which resolves: As requestEmailToken
Request a secret from another device.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
the name of the secret to request
the devices to request the secret from
the secret request object
Request a key verification from another user.
the user to request verification with
Optional
devices: string[]array of device IDs to send requests to. Defaults to all devices owned by the user
resolves to a VerificationRequest when the request has been sent to the other party.
Prefer CryptoApi#requestOwnUserVerification or CryptoApi#requestDeviceVerification.
Request a key verification from another user, using a DM.
the user to request verification with
the room to use for verification
resolves to a VerificationRequest when the request has been sent to the other party.
Prefer CryptoApi.requestVerificationDM.
Resend an event. Will also retry any to-device messages waiting to be sent.
The event to resend.
Optional. The room the event is in. Will update the timeline entry if provided.
Promise which resolves: to an ISendEventResponse object
Optional
opts: IKeyBackupRestoreOptsOptional
opts: IKeyBackupRestoreOptsOptional
opts: IKeyBackupRestoreOptsRestore from an existing key backup via a passphrase.
Passphrase
Room ID to target a specific room. Restores all rooms if omitted.
Session ID to target a specific session. Restores all sessions if omitted.
Backup metadata from getKeyBackupVersion
or checkKeyBackup
.backupInfo
Optional params such as callbacks
Status of restoration with total
and imported
key counts.
Restore from an existing key backup via an encoded recovery key.
Encoded recovery key
Room ID to target a specific room. Restores all rooms if omitted.
Session ID to target a specific session. Restores all sessions if omitted.
Backup metadata from checkKeyBackup
Optional
opts: IKeyBackupRestoreOptsOptional params such as callbacks
Status of restoration with total
and imported
key counts.
Optional
opts: IKeyBackupRestoreOptsOptional
opts: IKeyBackupRestoreOptsRestore from an existing key backup via a private key stored in secret storage.
Backup metadata from checkKeyBackup
Optional
targetRoomId: stringRoom ID to target a specific room. Restores all rooms if omitted.
Optional
targetSessionId: stringSession ID to target a specific session. Restores all sessions if omitted.
Optional
opts: IKeyBackupRestoreOptsOptional params such as callbacks
Status of restoration with total
and imported
key counts.
Retry a backed off syncing request immediately. This should only be used when the user explicitly attempts to retry their lost connection. Will also retry any outbound to-device messages currently in the queue to be sent (retries of regular outgoing events are handled separately, per-event).
True if this resulted in a request being retried.
Promise which resolves: TODO
Promise which resolves: TODO
Marks all group sessions as needing to be backed up and schedules them to upload in the background as soon as possible.
(This is done automatically as part of CryptoApi.resetKeyBackup, so there is probably no need to call this manually.)
Retrieve older messages from the given room and put them in the timeline.
If this is called multiple times whilst a request is ongoing, the same Promise will be returned. If there was a problem requesting scrollback, there will be a small delay before another request can be made (to prevent tight-looping when there is no connection).
The room to get older messages in.
Optional. The maximum number of previous events to pull in. Default: 30.
Promise which resolves: Room. If you are at the beginning
of the timeline, Room.oldState.paginationToken
will be
null
.
Perform a server-side search.
the JSON object to pass to the request body.
Optional
next_the batch token to pass in the query string
Optional
abortSignal: AbortSignaloptional signal used to cancel the http request.
Promise which resolves to the search response object.
Perform a server-side search for room events.
The returned promise resolves to an object containing the fields:
Each entry in the results list is a SearchResult.
Promise which resolves: result object
Query the user directory with a term matching user IDs, display names and domains.
Optional
limit?: numberthe maximum number of results to return. The server will apply a limit if unspecified.
the term with which to search.
Promise which resolves: an array of results.
Optional
txnId: stringOptional.
Promise which resolves: to a ISendEventResponse object
Optional
txnId: stringOptional
txnId: stringOptional
txnId: stringPromise which resolves: to a ISendEventResponse object
Promise which resolves: to a ISendEventResponse object
Promise which resolves: to a ISendEventResponse object
Optional
info: IImageInfoOptional
text: stringPromise which resolves: to a ISendEventResponse object
Optional
info: IImageInfoOptional
text: stringBack up session keys to the homeserver.
ID of the room that the keys are for Optional.
ID of the session that the keys are for Optional.
backup version Optional.
Object keys to send
a promise that will resolve when the keys are uploaded
Optional
txnId: stringOptional.
Promise which resolves: to an ISendEventResponse object
Optional
txnId: stringOptional
txnId: stringOptional.
Promise which resolves: to a ISendEventResponse object
Optional
txnId: stringSend a read receipt.
The event that has been read.
other than ReceiptType.Read are experimental! Optional.
Promise which resolves: to an empty object {}
Send a receipt.
The event being acknowledged
The kind of receipt e.g. "m.read". Other than ReceiptType.Read are experimental!
Optional
body: Record<string, any>Additional content to send alongside the receipt.
An unthreaded receipt will clear room+thread notifications
Promise which resolves: to an empty object {}
Share shared-history decryption keys with the given users.
the room for which keys should be shared.
a list of users to share with. The keys will be sent to all of the user's current devices.
Promise which resolves: TODO
Optional
info: IImageInfoOptional
text: stringPromise which resolves: to a ISendEventResponse object
Optional
info: IImageInfoOptional
text: stringOptional
txnId: stringOptional.
Optional
txnId: stringSend an event to a specific list of devices. This is a low-level API that simply wraps the HTTP API call to send to-device messages. We recommend using queueToDevice() which is a higher level API.
type of event to send content to send. Map from user_id to device_id to content object.
Promise which resolves: to an empty object {}
Set a function which is called when /sync returns a 'limited' response. It is called with a room ID and returns a boolean. It should return 'true' if the SDK can SAFELY remove events from this room. It may not be safe to remove events if there are other references to the timelines for this room, e.g because the client is actively viewing events in this room. Default: returns false.
The callback which will be invoked.
Set the current default key ID for encrypting secrets.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
The new default key ID
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#setDefaultKeyId.
Set the dehydration key. This will also periodically dehydrate devices to the server.
the dehydration key
Information about the key. Primarily for information about how to generate the key from a passphrase.
Optional
deviceDisplayName: stringThe device display name for the dehydrated device.
A promise that resolves when the dehydrated device is stored.
Mark the given device as blocked/unblocked
owner of the device
unique identifier for the device or user's cross-signing public key ID.
whether to mark the device as blocked. defaults to 'true'.
Mark the given device as known/unknown
owner of the device
unique identifier for the device or user's cross-signing public key ID.
whether to mark the device as known. defaults to 'true'.
Mark the given device as verified
owner of the device
unique identifier for the device or user's cross-signing public key ID.
whether to mark the device as verified. defaults to 'true'.
Set the global override for whether the client should ever send encrypted messages to unverified devices. This provides the default for rooms which do not specify a value.
whether to blacklist all unverified devices by default
Prefer direct access to CryptoApi.globalBlacklistUnverifiedDevices:
client.getCrypto().globalBlacklistUnverifiedDevices = value;
Set whether sendMessage in a room with unknown and unverified devices should throw an error and not send them message. This has 'Global' for symmetry with setGlobalBlacklistUnverifiedDevices but there is currently no room-level equivalent for this setting.
This API is currently UNSTABLE and may change or be removed without notice.
It has no effect with the Rust crypto implementation.
whether error on unknown devices
client.getCrypto().globalErrorOnUnknownDevices = value;
Experimental
Set whether this client is a guest account. This method is experimental and may change without warning.
True if this is a guest account. if the token is a macaroon, it should be encoded in it that it is a 'guest' access token, which means that the SDK can determine this entirely without the dev manually flipping this flag.
Set r/w flags for guest access in a room.
The room to configure guest access in.
Options
Promise which resolves
Persists local notification settings
Promise which resolves: an empty object
Set the global notification EventTimelineSet
Make a request to change your password.
The new desired password.
Optional
logoutDevices: booleanShould all sessions be logged out after the password change. Defaults to true.
Promise which resolves: to an empty object {}
Set a power level to one or multiple users.
Will apply changes atop of current power level event from local state if running & synced, falling back
to fetching latest from the /state/
API.
the room to update power levels in
the ID of the user or users to update power levels of
the numeric power level to update given users to
Optional
event: null | MatrixEventdeprecated and no longer used.
Promise which resolves: to an ISendEventResponse object
Options to apply
Promise which resolves
If 'presence' isn't a valid presence enum value.
The kind of info to set (e.g. 'avatar_url')
The JSON object to set.
Set the actions for a push notification rule.
Promise which resolves: to an empty object {}
Enable or disable a push notification rule.
Promise which resolves: to an empty object {}
Update the push rules for the account. This should be called whenever updated push rules are available.
Adds a new pusher or updates an existing pusher
Object representing a pusher
Promise which resolves: Empty json object on success
Set the visbility of a room in the current HS's room directory
"public" to make the room visible in the public directory, or "private" to make it invisible.
Promise which resolves: to an empty object {}
Enable end-to-end encryption for a room. This does not modify room state. Any messages sent before the returned promise resolves will be sent unencrypted.
The room ID to enable encryption in.
The encryption config for the room.
A promise that will resolve when encryption is set up.
Not supported for Rust Cryptography. To enable encryption in a room, send an m.room.encryption
state event.
Set a room-kind muting push rule in a room. The operation also updates MatrixClient.pushRules at the end.
"global" or device-specific.
the id of the room.
the mute state.
Promise which resolves: result object
Promise which resolves: TODO
Set a marker to indicate the point in a room before which the user has read every
event. This can be retrieved from room account data (the event type is m.fully_read
)
and displayed as a horizontal line in the timeline that is visually distinct to the
position of the user's own read receipt.
ID of the room that has been read
ID of the event that has been read
Optional
rrEvent: MatrixEventthe event tracked by the read receipt. This is here for convenience because the RR and the RM are commonly updated at the same time as each other. The local echo of this receipt will be done if set. Optional.
Optional
rpEvent: MatrixEventthe m.read.private read receipt event for when we don't want other users to see the read receipts. This is experimental. Optional.
Promise which resolves: the empty object, {}
.
Set a marker to indicate the point in a room before which the user has read every
event. This can be retrieved from room account data (the event type is m.fully_read
)
and displayed as a horizontal line in the timeline that is visually distinct to the
position of the user's own read receipt.
ID of the room that has been read
ID of the event that has been read
Optional
rrEventId: stringID of the event tracked by the read receipt. This is here for convenience because the RR and the RM are commonly updated at the same time as each other. Optional.
Optional
rpEventId: stringrpEvent the m.read.private read receipt event for when we don't want other users to see the read receipts. This is experimental. Optional.
Promise which resolves: the empty object, {}
.
name of room tag to be set
associated with that tag to be stored
Promise which resolves: to an empty object
Optional
htmlTopic: stringOptional.
Promise which resolves: TODO
Specify the set_presence value to be used for subsequent calls to the Sync API. This has an advantage over calls to the PUT /presence API in that it doesn't clobber status_msg set by other devices.
Optional
presence: SetPresencethe presence to specify to set_presence of sync calls
Private
setPerform a single MSC3575 sliding sync request.
The request to make.
Optional
proxyBaseUrl: stringThe base URL for the sliding sync proxy.
Optional
abortSignal: AbortSignalOptional signal to abort request mid-flight.
The sliding sync response, or a standard error.
on non 2xx status codes with an object with a field "httpStatus":number.
High level helper method to begin syncing and poll for new events. To listen for these events, add a listener for ClientEvent.Event via MatrixClient#on. Alternatively, listen for specific state change events.
Options to apply when syncing.
Store an encrypted secret on the server.
The Secure Secret Storage API is currently UNSTABLE and may change without notice.
The name of the secret
The secret contents.
Optional
keys: string[]The IDs of the keys to use to encrypt the secret or null/undefined to use the default (will throw if no default key is set).
Use MatrixClient#secretStorage and SecretStorage.ServerSideSecretStorage#store.
Submits a MSISDN token to the identity server
This is used when submitting the code sent by SMS to a phone number. The identity server has an equivalent API for email but the js-sdk does not expose this, since email is normally validated by the user clicking a link rather than entering a code.
The sid given in the response to requestToken
A secret binary string generated by the client. This must be the same value submitted in the requestToken call.
The MSISDN token, as enetered by the user.
The access_token
field of the Identity
Server /account/register
response (see registerWithIdentityServer).
Some legacy identity servers had no authentication here.
Promise which resolves: Object, containing success boolean.
Error if No identity server is set
Submits a MSISDN token to an arbitrary URL.
This is used when submitting the code sent by SMS to a phone number in the
newer 3PID flow where the homeserver validates 3PID ownership (as part of
requestAdd3pidMsisdnToken
). The homeserver response may include a
submit_url
to specify where the token should be sent, and this helper can
be used to pass the token to this URL.
The URL to submit the token to
The sid given in the response to requestToken
A secret binary string generated by the client. This must be the same value submitted in the requestToken call.
The MSISDN token, as enetered by the user.
Promise which resolves: Object, containing success boolean.
Find the event_id closest to the given timestamp in the given direction.
Resolves: A promise of an object containing the event_id and origin_server_ts of the closest event to the timestamp in the given direction
Promise which resolves: ITurnServerResponse object
Unbind a 3PID for discovery on an identity server via the homeserver. The homeserver removes its record of the binding to keep an updated record of where all 3PIDs for the account are bound.
The threepid medium (eg. 'email')
The threepid address (eg. 'bob@example.com') this must be as returned by getThreePids.
Promise which resolves: on success
Creates a new file tree space with the given name. The client will pick defaults for how it expects to be able to support the remaining API offered by the returned class.
Note that this is UNSTABLE and may have breaking changes without notice.
The name of the tree space.
Promise which resolves to the created space.
Gets a reference to a tree space, if the room ID given is a tree space. If the room does not appear to be a tree space then null is returned.
Note that this is UNSTABLE and may have breaking changes without notice.
The room ID to get a tree space reference for.
The tree space, or null if not a tree space.
Create an m.beacon_info event
Upsert a live beacon event using a specific m.beacon_info.* event variable type
string
Protected
updateUpgrades a room to a new protocol version
The target version to upgrade to
Promise which resolves: Object with key 'replacement_room'
Upload a file to the media repository on the homeserver.
The object to upload. On a browser, something that can be sent to XMLHttpRequest.send (typically a File). Under node.js, a a Buffer, String or ReadStream.
Optional
opts: UploadOptsoptions object
Promise which resolves to response object, as determined by this.opts.onlyData, opts.rawResponse, and opts.onlyContentUri. Rejects with an error (usually a MatrixError).
Optional
auth: AuthDictOptional
keys: CrossSigningKeysUpload keys
body of upload request
Optional
opts: voidthis method no longer takes any opts, used to take opts.device_id but this was not removed from the spec as a redundant parameter
Promise which resolves: result object. Rejects: with an error response (MatrixError).
Checks if the user has previously published cross-signing keys
This means downloading the devicelist for the user and checking if the list includes the cross-signing pseudo-device.
Prefer CryptoApi.userHasCrossSigningKeys
:
result = client.getCrypto().userHasCrossSigningKeys();
Wait until an initial state for the given room has been processed by the client and the client is aware of any ongoing group calls. Awaiting on the promise returned by this method before calling getGroupCallForRoom() avoids races where getGroupCallForRoom is called before the state for that room has been processed. It does not, however, fix other races, eg. two clients both creating a group call at the same time.
The room ID to wait for
A promise that resolves once existing group calls in the room have been processed.
Private
watchFetches information about the user for the configured access token.
Performs a whois lookup on a user using Synapse's administrator API. This function is implementation specific and may change as a result.
the User ID to look up.
the whois response - see Synapse docs for information.
Generated using TypeDoc
A MatrixClient that routes its requests through the widget API instead of the real CS API. This class is considered unstable!