Merge branch 'soru/better-detect' into 'main'

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

See merge request famedly/famedlysdk!645
This commit is contained in:
Marcus 2021-02-10 12:43:19 +00:00
commit 28f6ab6ff2
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;