RegistrationWizard

interface RegistrationWizard

Set of methods to be able to create an account on a homeserver.

Common scenario to register an account successfully:

More documentation can be found in the file https://github.com/element-hq/element-android/blob/main/docs/signup.md and https://matrix.org/docs/spec/client_server/latest#account-registration-and-management

Functions

Link copied to clipboard
abstract suspend fun acceptTerms(): RegistrationResult

Perform the "m.login.terms" stage.

Link copied to clipboard
abstract suspend fun addThreePid(threePid: RegisterThreePid): RegistrationResult

Perform the "m.login.email.identity" or "m.login.msisdn" stage.

Link copied to clipboard
abstract suspend fun checkIfEmailHasBeenValidated(delayMillis: Long): RegistrationResult

Useful to poll the homeserver when waiting for the email to be validated by the user. Once the email is validated, this method will return successfully.

Link copied to clipboard
abstract suspend fun createAccount(    userName: String?,     password: String?,     initialDeviceDisplayName: String?): RegistrationResult

This is the first method to call in order to create an account and start the registration process.

Link copied to clipboard
abstract suspend fun dummy(): RegistrationResult

Perform the "m.login.dummy" stage.

Link copied to clipboard
abstract fun getCurrentThreePid(): String?

Returns the current ThreePid, waiting for validation. The SDK will store it in database, so it can be restored even if the app has been killed during the registration

Link copied to clipboard
abstract suspend fun getRegistrationFlow(): RegistrationResult

Call this method to get the possible registration flow of the current homeserver. It can be useful to ensure that your application implementation supports all the stages required to create an account. If it is not the case, you will have to use the web fallback to let the user create an account with your application. See org.matrix.android.sdk.api.auth.AuthenticationService.getFallbackUrl

Link copied to clipboard
abstract suspend fun handleValidateThreePid(code: String): RegistrationResult

Send the code received by SMS to validate a msisdn. If the code is correct, the registration request will be executed to validate the msisdn.

Link copied to clipboard
abstract fun isRegistrationStarted(): Boolean

Return true when login and password have been sent with success to the homeserver, i.e. createAccount has been called successfully.

Link copied to clipboard
abstract suspend fun performReCaptcha(response: String): RegistrationResult

Perform the "m.login.recaptcha" stage.

Link copied to clipboard
abstract suspend fun registrationAvailable(userName: String): RegistrationAvailability

Can be call to check is the desired userName is available for registration on the current homeserver. It may also fails if the desired userName is not correctly formatted or does not follow any restriction on the homeserver. Ex: userName with only digits may be rejected.

Link copied to clipboard
abstract suspend fun registrationCustom(authParams: JsonDict): RegistrationResult

Perform custom registration stage by sending a custom JsonDict. Current registration "session" param will be included into authParams by default. The authParams should contain at least one entry "type" with a String value.

Link copied to clipboard
abstract suspend fun sendAgainThreePid(): RegistrationResult

Ask the homeserver to send again the current threePid (email or msisdn).