fix: Better detection if x-signing and megolm backup is enabled

This commit is contained in:
Sorunome 2021-02-10 13:35:45 +01:00
parent 9fa36f736b
commit 2d70360a8d
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
3 changed files with 8 additions and 4 deletions

View File

@ -55,9 +55,9 @@ class CrossSigning {
}
bool get enabled =>
client.accountData[EventTypes.CrossSigningSelfSigning] != null &&
client.accountData[EventTypes.CrossSigningUserSigning] != null &&
client.accountData[EventTypes.CrossSigningMasterKey] != null;
encryption.ssss.isSecret(EventTypes.CrossSigningSelfSigning) &&
encryption.ssss.isSecret(EventTypes.CrossSigningUserSigning) &&
encryption.ssss.isSecret(EventTypes.CrossSigningMasterKey);
Future<bool> isCached() async {
if (!enabled) {

View File

@ -75,7 +75,7 @@ class KeyManager {
});
}
bool get enabled => client.accountData[MEGOLM_KEY] != null;
bool get enabled => encryption.ssss.isSecret(MEGOLM_KEY);
/// clear all cached inbound group sessions. useful for testing
void clearInboundGroupSessions() {

View File

@ -264,6 +264,10 @@ class SSSS {
}
}
bool isSecret(String type) =>
client.accountData[type] != null &&
client.accountData[type].content['encrypted'] is Map;
Future<String> getCached(String type) async {
if (client.database == null) {
return null;