-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix logic in DeviceListener #30230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix logic in DeviceListener #30230
Changes from all commits
90e26ba
5178c45
a0a5cbc
de29d3a
c49fb82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,7 +362,7 @@ export default class DeviceListener { | |
// said we are OK with that. | ||
const keyBackupIsOk = keyBackupUploadActive || backupDisabled; | ||
|
||
const allSystemsReady = crossSigningReady && keyBackupIsOk && recoveryIsOk && allCrossSigningSecretsCached; | ||
const allSystemsReady = isCurrentDeviceTrusted && allCrossSigningSecretsCached && keyBackupIsOk && recoveryIsOk; | ||
|
||
await this.reportCryptoSessionStateToAnalytics(cli); | ||
|
||
|
@@ -375,13 +375,8 @@ export default class DeviceListener { | |
// make sure our keys are finished downloading | ||
await crypto.getUserDeviceInfo([cli.getSafeUserId()]); | ||
|
||
if (!crossSigningReady) { | ||
// This account is legacy and doesn't have cross-signing set up at all. | ||
// Prompt the user to set it up. | ||
logSpan.info("Cross-signing not ready: showing SET_UP_ENCRYPTION toast"); | ||
showSetupEncryptionToast(SetupKind.SET_UP_ENCRYPTION); | ||
} else if (!isCurrentDeviceTrusted) { | ||
// cross signing is ready but the current device is not trusted: prompt the user to verify | ||
if (!isCurrentDeviceTrusted) { | ||
// the current device is not trusted: prompt the user to verify | ||
logSpan.info("Current device not verified: showing VERIFY_THIS_SESSION toast"); | ||
showSetupEncryptionToast(SetupKind.VERIFY_THIS_SESSION); | ||
} else if (!allCrossSigningSecretsCached) { | ||
|
@@ -410,16 +405,11 @@ export default class DeviceListener { | |
hideSetupEncryptionToast(); | ||
} | ||
} else { | ||
// some other condition... yikes! Show the 'set up encryption' toast: this is what we previously did | ||
// in 'other' situations. Possibly we should consider prompting for a full reset in this case? | ||
logSpan.warn("Couldn't match encryption state to a known case: showing 'setup encryption' prompt", { | ||
crossSigningReady, | ||
secretStorageReady, | ||
allCrossSigningSecretsCached, | ||
isCurrentDeviceTrusted, | ||
defaultKeyId, | ||
}); | ||
showSetupEncryptionToast(SetupKind.SET_UP_ENCRYPTION); | ||
// If we get here, then we are verified, have key backup, and | ||
// 4S, but crypto.isCrossSigningReady returned false, which | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Are you sure this is the only way we can get here? For example, what happens if In any case, please can you keep the logic to log all the flags, so that we can debug why we are falling into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ugh. I typo'ed the comment. It should say "but crypto.isSecretStorageReady returned false". (If |
||
// means that 4S doesn't have all the secrets. | ||
logSpan.warn("4S is missing secrets"); | ||
showSetupEncryptionToast(SetupKind.KEY_STORAGE_OUT_OF_SYNC_STORE); | ||
} | ||
} else { | ||
logSpan.info("Not yet ready, but shouldShowSetupEncryptionToast==false"); | ||
|
Uh oh!
There was an error while loading. Please reload this page.