chore: Cache auth metadata response in client

This is helpful for oidc and
a requirement for implementing
soft logout with oidc.
This commit is contained in:
Christian Kußowski 2025-11-09 13:38:00 +01:00
parent 3d1aa6607e
commit 4e3e7d9ccc
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
1 changed files with 7 additions and 1 deletions

View File

@ -132,7 +132,7 @@ class Client extends MatrixApi {
@override
set homeserver(Uri? homeserver) {
if (this.homeserver != null && homeserver?.host != this.homeserver?.host) {
_wellKnown = null;
_wellKnown = _getAuthMetadataResponseCache = null;
}
super.homeserver = homeserver;
}
@ -741,6 +741,12 @@ class Client extends MatrixApi {
return response;
}
GetAuthMetadataResponse? _getAuthMetadataResponseCache;
@override
Future<GetAuthMetadataResponse> getAuthMetadata() async =>
_getAuthMetadataResponseCache ??= await super.getAuthMetadata();
/// Sends a logout command to the homeserver and clears all local data,
/// including all persistent data from the store.
@override