mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Enable OIDC token refresh in the NSE. (#1711)
Update the SDK and handle API changes.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
import Foundation
|
||||
import KeychainAccess
|
||||
import MatrixRustSDK
|
||||
|
||||
enum KeychainControllerService: String {
|
||||
case sessions
|
||||
@@ -86,4 +87,20 @@ class KeychainController: KeychainControllerProtocol {
|
||||
MXLog.error("Failed removing all tokens")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - ClientSessionDelegate
|
||||
|
||||
func retrieveSessionFromKeychain(userId: String) throws -> Session {
|
||||
MXLog.info("Retrieving an updated Session from the keychain.")
|
||||
guard let session = restorationTokenForUsername(userId)?.session else {
|
||||
throw ClientError.Generic(msg: "Failed to find RestorationToken in the Keychain.")
|
||||
}
|
||||
return session
|
||||
}
|
||||
|
||||
func saveSessionInKeychain(session: Session) {
|
||||
MXLog.info("Saving session changes in the keychain.")
|
||||
let restorationToken = RestorationToken(session: session)
|
||||
setRestorationToken(restorationToken, forUsername: session.userId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user