Merge pull request #3467 from element-hq/feature/bma/accountCreation

Temporary account creation using Element Web.
This commit is contained in:
Benoit Marty 2024-09-16 16:52:26 +02:00 committed by GitHub
commit cf2c90ea0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 1203 additions and 29 deletions

View file

@ -9,6 +9,7 @@ package io.element.android.libraries.matrix.api.auth
import io.element.android.libraries.matrix.api.MatrixClient
import io.element.android.libraries.matrix.api.MatrixClientProvider
import io.element.android.libraries.matrix.api.auth.external.ExternalSession
import io.element.android.libraries.matrix.api.auth.qrlogin.MatrixQrCodeLoginData
import io.element.android.libraries.matrix.api.auth.qrlogin.QrCodeLoginStep
import io.element.android.libraries.matrix.api.core.SessionId
@ -30,6 +31,11 @@ interface MatrixAuthenticationService {
suspend fun setHomeserver(homeserver: String): Result<Unit>
suspend fun login(username: String, password: String): Result<SessionId>
/**
* Import a session that was created using another client, for instance Element Web.
*/
suspend fun importCreatedSession(externalSession: ExternalSession): Result<SessionId>
/*
* OIDC part.
*/

View file

@ -0,0 +1,20 @@
/*
* Copyright 2024 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only
* Please see LICENSE in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.auth.external
/***
* Represents a session data of a session created by another client.
*/
data class ExternalSession(
val userId: String,
val deviceId: String,
val accessToken: String,
val refreshToken: String?,
val homeserverUrl: String,
val slidingSyncProxy: String?
)