Use a Client in AuthenticationService now that the Rust one has been removed. (#2954)

* Replace Rust's Authentication service by building a Client.

* Drop the Proxy from AuthenticationServiceProxy[Protocol].

* Make sure to call abortOIDCLogin.

* Centralise common ClientBuilder code.

* Update the SDK.
This commit is contained in:
Doug
2024-06-24 15:05:00 +01:00
committed by GitHub
parent fc0573a41d
commit 3465ea4cc1
23 changed files with 489 additions and 564 deletions
@@ -118,24 +118,16 @@ class UserSessionStore: UserSessionStoreProtocol {
let homeserverURL = credentials.restorationToken.session.homeserverUrl
var builder = ClientBuilder()
let builder = ClientBuilder
.baseBuilder(httpProxy: URL(string: homeserverURL)?.globalProxy,
sessionDelegate: keychainController)
.sessionPath(path: credentials.restorationToken.sessionDirectory.path(percentEncoded: false))
.username(username: credentials.userID)
.homeserverUrl(url: homeserverURL)
.passphrase(passphrase: credentials.restorationToken.passphrase)
.userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent())
.enableCrossProcessRefreshLock(processId: InfoPlistReader.main.bundleIdentifier,
sessionDelegate: keychainController)
.serverVersions(versions: ["v1.0", "v1.1", "v1.2", "v1.3", "v1.4", "v1.5"]) // FIXME: Quick and dirty fix for stopping version requests on startup https://github.com/matrix-org/matrix-rust-sdk/pull/1376
if let homeserverURL = URL(string: homeserverURL),
let proxy = homeserverURL.globalProxy {
builder = builder.proxy(url: proxy)
}
let completeBuilder = builder
do {
let client = try await completeBuilder.build()
let client = try await builder.build()
try await client.restoreSession(session: credentials.restorationToken.session)