mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
e5bfc3a26d
Expose OpenID tokens and homeserver credentials from the client proxy, and add fork-only services for the HealthChat member directory backend (api.healthchat.ch) plus a service that reads MSC4133 extended profile fields directly from the homeserver. Groundwork for the members tab and the profile screens. Claude-Session: https://claude.ai/code/session_013qdTbAWsZj2quQzEkagXaS
37 lines
1.2 KiB
Swift
37 lines
1.2 KiB
Swift
//
|
|
// Copyright 2026 Element Creations Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import Foundation
|
|
import MatrixRustSDK
|
|
|
|
/// An OpenID token that third-party services can use to verify the user's identity
|
|
/// against the homeserver (MSC1961). Short-lived — cache per call site.
|
|
nonisolated struct OpenIDToken: Equatable {
|
|
let accessToken: String
|
|
let matrixServerName: String
|
|
/// The interval after which the token expires, relative to when it was requested.
|
|
let expiresIn: TimeInterval
|
|
|
|
init(accessToken: String, matrixServerName: String, expiresIn: TimeInterval) {
|
|
self.accessToken = accessToken
|
|
self.matrixServerName = matrixServerName
|
|
self.expiresIn = expiresIn
|
|
}
|
|
|
|
init(rustValue: MatrixRustSDK.OpenIdToken) {
|
|
accessToken = rustValue.accessToken
|
|
matrixServerName = rustValue.matrixServerName
|
|
expiresIn = TimeInterval(rustValue.expiresInSeconds)
|
|
}
|
|
}
|
|
|
|
extension OpenIDToken: CustomStringConvertible {
|
|
var description: String {
|
|
"OpenIDToken(matrixServerName: \(matrixServerName), accessToken: <redacted>)"
|
|
}
|
|
}
|