Classes
Members
# brand
If truthy, this is a string that will be supplied as `?brand=$brand` where endpoints can
result in communications to a user.
string
# brand
If truthy, this is a string that will be supplied as `?brand=$brand` where endpoints can
result in communications to a user.
# metrics
The metrics instance for this client. Note that metrics for the underlying MatrixClient will
not be available here.
Methods
# async acceptAllTerms() → {Promise.<void>}
Accepts all the terms of service offered by the identity server. Note that this is only meant to be
used by automated bots where terms acceptance is implicit - the terms of service need to be presented
to the user in most cases.
Resolves when complete.
Promise.<void>
# acceptTerms(termsUrls) → {Promise.<void>}
Accepts a given set of URLs from Policy objects returned by the server. This implies acceptance of
the terms. Note that this will not update the user's account data to consider these terms accepted
in the future - that is an exercise left to the caller.
Parameters:
Name | Type | Description |
---|---|---|
termsUrls |
Array.<string>
|
The URLs to count as accepted. |
Resolves when complete.
Promise.<void>
# doRequest(method, endpoint, qs, body, timeout, raw, contentType, noEncoding) → {Promise.<any>}
Performs a web request to the server, applying appropriate authorization headers for
this client.
Parameters:
Name | Type | Description |
---|---|---|
method |
"GET"
|
"POST"
|
"PUT"
|
"DELETE"
|
The HTTP method to use in the request |
endpoint |
string
|
The endpoint to call. For example: "/_matrix/identity/v2/account" |
qs |
any
|
The query string to send. Optional. |
body |
any
|
The request body to send. Optional. Will be converted to JSON unless the type is a Buffer. |
timeout |
number
|
The number of milliseconds to wait before timing out. |
raw |
boolean
|
If true, the raw response will be returned instead of the response body. |
contentType |
string
|
The content type to send. Only used if the `body` is a Buffer. |
noEncoding |
string
|
Set to true to disable encoding, and return a Buffer. Defaults to false |
Resolves to the response (body), rejected if a non-2xx status code was returned.
Promise.<any>
# getAccount() → {Promise.<IdentityServerAccount>}
Gets account information for the logged in user.
Resolves to the account information
Promise.<IdentityServerAccount>
# getTermsOfService() → {Promise.<Policies>}
Gets the terms of service for which the identity server has.
Resolves to the policies of the server.
Promise.<Policies>
# async lookup(identifiers, allowPlaintext) → {Promise.<Array.<string>>}
Looks up a series of third party identifiers (email addresses or phone numbers) to see if they have
associated mappings. The returned array will be ordered the same as the input, and have falsey values
in place of any failed/missing lookups (eg: no mapping).
Parameters:
Name | Type | Description |
---|---|---|
identifiers |
Array.<Threepid>
|
The identifiers to look up. |
allowPlaintext |
boolean
|
If true, the function will accept the server's offer to use plaintext lookups when no other methods are available. The function will always prefer hashed methods. |
Resolves to the user IDs (or falsey values) in the same order as the input.
Promise.<Array.<string>>
# async makeEmailInvite(emailAddress, roomId) → {Promise.<IdentityServerInvite>}
Creates a third party email invite. This will store the invite in the identity server, but
not publish the invite to the room - the caller is expected to handle the remaining part. Note
that this function is not required to be called when using the Client-Server API for inviting
third party addresses to a room. This will make several calls into the room state to populate
the invite details, therefore the inviter (the client backing this identity client) must be
present in the room.
Parameters:
Name | Type | Description |
---|---|---|
emailAddress |
string
|
The email address to invite. |
roomId |
string
|
The room ID to invite to. |
Resolves to the identity server's stored invite.
Promise.<IdentityServerInvite>
# async static acquire(oidc, serverUrl) → {Promise.<IdentityClient>}
Gets an instance of an identity client.
Parameters:
Name | Type | Description |
---|---|---|
oidc |
OpenIDConnectToken
|
The OpenID Connect token to register to the identity server with. |
serverUrl |
string
|
The full URL where the identity server can be reached at. |
Promise.<IdentityClient>