Constructor
# new MatrixAuth(homeserverUrl)
Creates a new MatrixAuth class for creating a MatrixClient
Parameters:
Name | Type | Description |
---|---|---|
homeserverUrl |
string
|
The homeserver URL to authenticate against. |
Classes
Methods
# createTemplateClient()
Generate a client with no access token so we can reuse the doRequest
logic already written.
# async passwordLogin(username, password, deviceName) → {Promise.<MatrixClient>}
Performs simple password login with the homeserver. The caller is
expected to confirm if the homeserver supports this login flow prior
to invocation.
Parameters:
Name | Type | Description |
---|---|---|
username |
string
|
The username (localpart or user ID) to log in with |
password |
string
|
The password for the account |
deviceName |
string
|
The name of the newly created device. Optional. |
Resolves to a logged-in MatrixClient
Promise.<MatrixClient>
# async passwordRegister(localpart, password, deviceName) → {Promise.<MatrixClient>}
Performs simple registration using a password for the account. This will
assume the server supports the m.login.password flow for registration, and
will attempt to complete only that stage. The caller is expected to determine
if the homeserver supports registration prior to invocation.
Parameters:
Name | Type | Description |
---|---|---|
localpart |
string
|
The localpart (username) to register |
password |
string
|
The password to register with |
deviceName |
string
|
The name of the newly created device. Optional. |
Resolves to a logged-in MatrixClient
Promise.<MatrixClient>