Introduce a user session manager (#6295)

This commit is contained in:
Mauro
2026-10-09 14:07:39 +02:00
committed by GitHub
parent 65bab49f39
commit 60db364436
26 changed files with 594 additions and 66 deletions
@@ -10,7 +10,7 @@ import Foundation
import MatrixRustSDK
enum UserSessionStoreError: Error {
case missingCredentials
case unknownAccount
case failedRestoringLogin
case failedSettingUpSession
case failedSettingUpClientProxy(Error)
@@ -30,8 +30,8 @@ protocol UserSessionStoreProtocol {
/// Returns the delegate that should handle any changes to a `Client`'s `Session`.
var clientSessionDelegate: ClientSessionDelegate { get }
/// Restores an existing user session.
func restoreUserSession() async -> Result<UserSessionProtocol, UserSessionStoreError>
/// Restores the session of the given account. If this fails, the account's credentials and data are deleted.
func restoreUserSession(userID: String) async -> Result<UserSessionProtocol, UserSessionStoreError>
/// Creates a user session for a new client from the SDK along with the passphrase used for the data stores.
func userSession(for client: ClientProtocol, sessionDirectories: SessionDirectories, passphrase: Data) async -> Result<UserSessionProtocol, UserSessionStoreError>