IdentityService

interface IdentityService

Provides access to the identity server configuration and services identity server can provide.

Functions

Link copied to clipboard
abstract fun addListener(listener: IdentityServiceListener)
Link copied to clipboard
abstract suspend fun cancelBindThreePid(threePid: ThreePid)

This will cancel a pending binding of threePid.

Link copied to clipboard
abstract suspend fun disconnect()

Disconnect (logout) from the current identity server.

Link copied to clipboard
abstract suspend fun finalizeBindThreePid(threePid: ThreePid)

This will perform the actual association of ThreePid and Matrix account.

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

Return the current identity server URL used by this account. Returns null if no identity server is configured.

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

Return the default identity server of the user, which may have been provided at login time by the homeserver, or by the Well-known setup of the homeserver. It may be different from the current configured identity server.

Link copied to clipboard
abstract suspend fun getShareStatus(threePids: List<ThreePid>): Map<ThreePid, SharedState>

Get the status of the current user's threePid. A lookup will be performed, but also pending binding state will be restored.

Link copied to clipboard
abstract fun getUserConsent(): Boolean

Return the current user consent for the current identity server, which has been stored using setUserConsent. If setUserConsent has not been called, the returned value will be false. Note that if the identity server is changed, the user consent is reset to false.

Link copied to clipboard
abstract suspend fun isValidIdentityServer(url: String)

Check if the identity server is valid. See https://matrix.org/docs/spec/identity_service/latest#status-check. Matrix Android SDK2 only supports identity server API v2.

Link copied to clipboard
abstract suspend fun lookUp(threePids: List<ThreePid>): List<FoundThreePid>

Search MatrixId of users providing email and phone numbers. Note the the user consent has to be set to true, or it will throw a UserConsentNotProvided failure. Application has to explicitly ask for the user consent, and the answer can be stored using setUserConsent. Please see https://support.google.com/googleplay/android-developer/answer/9888076?hl=en for more details.

Link copied to clipboard
abstract fun removeListener(listener: IdentityServiceListener)
Link copied to clipboard
abstract suspend fun sendAgainValidationCode(threePid: ThreePid)

This will ask the identity server to send an new email or a new SMS to let the user confirm he owns the ThreePid.

Link copied to clipboard
abstract suspend fun setNewIdentityServer(url: String): String

Update the identity server url. If successful, any previous identity server will be disconnected. In case of error, any previous identity server will remain configured.

Link copied to clipboard
abstract fun setUserConsent(newValue: Boolean)

Set the user consent to the provided value. Application MUST explicitly ask for the user consent to send their private data (email and phone numbers) to the identity server. Please see https://support.google.com/googleplay/android-developer/answer/9888076?hl=en for more details.

Link copied to clipboard
abstract suspend fun sign3pidInvitation(    identiyServer: String,     token: String,     secret: String): SignInvitationResult

When one performs a 3pid invite and the third party identifier is unknown, the home server will store the invitation in the Identity server and store some information in the room state membership event. The email invite will contains the token and secret that can be used to claim the stored invitation.

Link copied to clipboard
abstract suspend fun startBindThreePid(threePid: ThreePid)

This will ask the identity server to send an email or an SMS to let the user confirm he owns the ThreePid.

Link copied to clipboard
abstract suspend fun submitValidationToken(threePid: ThreePid, code: String)

Submit the code that the identity server has sent to the user (in email or SMS). Once successful, you will have to call finalizeBindThreePid

Link copied to clipboard
abstract suspend fun unbindThreePid(threePid: ThreePid)

Unbind a threePid. The request will actually be done on the homeserver.