mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Adopt Rust's new sessionPath that replaces the basePath (#2903)
This commit is contained in:
@@ -21,19 +21,21 @@ import MatrixRustSDK
|
||||
class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
||||
private let authenticationService: AuthenticationService
|
||||
private let userSessionStore: UserSessionStoreProtocol
|
||||
private let passphrase: String?
|
||||
private let sessionDirectory: URL
|
||||
private let passphrase: String
|
||||
|
||||
private let homeserverSubject: CurrentValueSubject<LoginHomeserver, Never>
|
||||
var homeserver: CurrentValuePublisher<LoginHomeserver, Never> { homeserverSubject.asCurrentValuePublisher() }
|
||||
|
||||
init(userSessionStore: UserSessionStoreProtocol, encryptionKeyProvider: EncryptionKeyProviderProtocol, appSettings: AppSettings) {
|
||||
sessionDirectory = .sessionsBaseDirectory.appending(component: UUID().uuidString)
|
||||
passphrase = encryptionKeyProvider.generateKey().base64EncodedString()
|
||||
self.userSessionStore = userSessionStore
|
||||
|
||||
homeserverSubject = .init(LoginHomeserver(address: appSettings.defaultHomeserverAddress,
|
||||
loginMode: .unknown))
|
||||
|
||||
authenticationService = AuthenticationService(basePath: userSessionStore.baseDirectory.path,
|
||||
authenticationService = AuthenticationService(sessionPath: sessionDirectory.path(percentEncoded: false),
|
||||
passphrase: passphrase,
|
||||
userAgent: UserAgentBuilder.makeASCIIUserAgent(),
|
||||
additionalRootCertificates: [],
|
||||
@@ -136,7 +138,7 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
||||
// MARK: - Private
|
||||
|
||||
private func userSession(for client: Client) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
|
||||
switch await userSessionStore.userSession(for: client, passphrase: passphrase) {
|
||||
switch await userSessionStore.userSession(for: client, sessionDirectory: sessionDirectory, passphrase: passphrase) {
|
||||
case .success(let clientProxy):
|
||||
return .success(clientProxy)
|
||||
case .failure:
|
||||
|
||||
@@ -25,6 +25,7 @@ struct OIDCConfigurationProxy {
|
||||
let policyURI: URL
|
||||
let contacts: [String]
|
||||
let staticRegistrations: [String: String]
|
||||
let dynamicRegistrationsFile: URL
|
||||
}
|
||||
|
||||
#if canImport(MatrixRustSDK)
|
||||
@@ -39,7 +40,8 @@ extension OIDCConfigurationProxy {
|
||||
tosUri: tosURI.absoluteString,
|
||||
policyUri: policyURI.absoluteString,
|
||||
contacts: contacts,
|
||||
staticRegistrations: staticRegistrations)
|
||||
staticRegistrations: staticRegistrations,
|
||||
dynamicRegistrationsFile: dynamicRegistrationsFile.path(percentEncoded: false))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user