Separate cases in DeviceListener (#32973)
* Separate cases in DeviceListener According to the comment in `else` there were two ways to end up there. Split these into separate cases and provide a different log message in each case. If we somehow get there another way, throw an error. * Replace a throw with an error log
This commit is contained in:
@@ -228,21 +228,25 @@ export class DeviceListenerCurrentDevice {
|
|||||||
logSpan.info("No default 4S key but backup disabled: no toast needed");
|
logSpan.info("No default 4S key but backup disabled: no toast needed");
|
||||||
await this.setDeviceState("ok", logSpan);
|
await this.setDeviceState("ok", logSpan);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!recoveryIsOk) {
|
||||||
// If we get here, then we are verified, have key backup, and
|
logSpan.warn("4S is missing secrets: setting state to KEY_STORAGE_OUT_OF_SYNC", {
|
||||||
// 4S, but allSystemsReady is false, which means that either
|
|
||||||
// secretStorageStatus.ready is false (which means that 4S
|
|
||||||
// doesn't have all the secrets), or we don't have the backup
|
|
||||||
// key cached locally. If any of the cross-signing keys are
|
|
||||||
// missing locally, that is handled by the
|
|
||||||
// `!allCrossSigningSecretsCached` branch above.
|
|
||||||
logSpan.warn("4S is missing secrets or backup key not cached", {
|
|
||||||
secretStorageStatus,
|
secretStorageStatus,
|
||||||
allCrossSigningSecretsCached,
|
allCrossSigningSecretsCached,
|
||||||
isCurrentDeviceTrusted,
|
isCurrentDeviceTrusted,
|
||||||
keyBackupDownloadIsOk,
|
keyBackupDownloadIsOk,
|
||||||
});
|
});
|
||||||
await this.setDeviceState("key_storage_out_of_sync", logSpan);
|
await this.setDeviceState("key_storage_out_of_sync", logSpan);
|
||||||
|
} else if (!keyBackupDownloadIsOk) {
|
||||||
|
logSpan.warn("Backup key is not cached locally: setting state to KEY_STORAGE_OUT_OF_SYNC", {
|
||||||
|
secretStorageStatus,
|
||||||
|
allCrossSigningSecretsCached,
|
||||||
|
isCurrentDeviceTrusted,
|
||||||
|
keyBackupDownloadIsOk,
|
||||||
|
});
|
||||||
|
await this.setDeviceState("key_storage_out_of_sync", logSpan);
|
||||||
|
} else {
|
||||||
|
// We should not get here
|
||||||
|
logSpan.error("DeviceListenerCurrentDevice: allSystemsReady was false, but no case matched.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user