Class AccountRegistration
Create an account before the first sign-in: find the server, learn what registering needs there, and register without logging in, so the apps then sign in the usual way.
Inherited Members
Namespace: Uniform.Matrix.Client.Services
Assembly: Uniform.Matrix.Client.dll
Syntax
public static class AccountRegistration
Methods
| Edit this page View SourceFindHomeserverAsync(HttpClient, UserId, string?, CancellationToken)
Return the address of the server of userId: homeserver when given, else the one its .well-known names.
Declaration
public static Task<Uri> FindHomeserverAsync(HttpClient http, UserId userId, string? homeserver, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpClient | http | |
| UserId | userId | |
| string | homeserver | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Uri> |
GetRequirementsAsync(HttpClient, Uri, CancellationToken)
Return what registering on homeserver needs; throw MatrixException when it does not allow registering.
Declaration
public static Task<RegistrationRequirements> GetRequirementsAsync(HttpClient http, Uri homeserver, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpClient | http | |
| Uri | homeserver | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<RegistrationRequirements> |
RegisterAsync(HttpClient, Uri, UserId, string, string?, bool, CancellationToken)
Register userId on homeserver without logging in; throw MatrixException when the name is taken or invalid, and UserInteractiveAuthException when the token is wrong or the terms were not accepted.
Declaration
public static Task RegisterAsync(HttpClient http, Uri homeserver, UserId userId, string password, string? registrationToken, bool acceptTerms, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpClient | http | HTTP client. |
| Uri | homeserver | Server address, from FindHomeserverAsync(HttpClient, UserId, string?, CancellationToken). |
| UserId | userId | Wanted user ID; its localpart becomes the account name. |
| string | password | Password of the new account. |
| string | registrationToken | Token from the server's admin, when NeedsToken. |
| bool | acceptTerms | Whether the user accepted Policies. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |