Skip to content
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

Respect the secure backup methods setting #8113

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8113.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Respect the secure backup methods setting
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class BootstrapSetupRecoveryKeyFragment :
views.bootstrapSetupSecureSubmit.isVisible = false

// Choose between create a passphrase or use a recovery key
renderBackupMethodActions(firstFormStep.methods)
renderBackupMethodActions(state.secureBackupMethod)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
copy(
step = BootstrapStep.FirstForm(
keyBackUpExist = false,
reset = session.sharedSecretStorageService().isRecoverySetup(),
methods = this.secureBackupMethod
reset = session.sharedSecretStorageService().isRecoverySetup()
)
)
}
Expand All @@ -134,7 +133,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
// we just resume plain bootstrap
doesKeyBackupExist = false
setState {
copy(step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod))
copy(step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist))
}
} else {
// we need to get existing backup passphrase/key and convert to SSSS
Expand All @@ -148,7 +147,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
doesKeyBackupExist = true
isBackupCreatedFromPassphrase = keyVersion.getAuthDataAsMegolmBackupAuthData()?.privateKeySalt != null
setState {
copy(step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod))
copy(step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist))
}
}
}
Expand Down Expand Up @@ -496,7 +495,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
} else {
setState {
copy(
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod),
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist),
// Also reset the passphrase
passphrase = null,
passphraseRepeat = null,
Expand All @@ -509,7 +508,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
is BootstrapStep.SetupPassphrase -> {
setState {
copy(
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod),
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist),
// Also reset the passphrase
passphrase = null,
passphraseRepeat = null
Expand All @@ -530,7 +529,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
// Go back to the first step
setState {
copy(
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod),
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist),
// Also reset the passphrase
passphrase = null,
passphraseRepeat = null
Expand Down Expand Up @@ -563,7 +562,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
is BootstrapStep.GetBackupSecretForMigration -> {
setState {
copy(
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist, methods = this.secureBackupMethod),
step = BootstrapStep.FirstForm(keyBackUpExist = doesKeyBackupExist),
// Also reset the passphrase
passphrase = null,
passphraseRepeat = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ sealed class BootstrapStep {
object CheckingMigration : BootstrapStep()

// Use will be asked to choose between passphrase or recovery key, or to start process if a key backup exists
data class FirstForm(val keyBackUpExist: Boolean, val reset: Boolean = false, val methods: SecureBackupMethod) : BootstrapStep()
data class FirstForm(val keyBackUpExist: Boolean, val reset: Boolean = false) : BootstrapStep()

object SetupPassphrase : BootstrapStep()
object ConfirmPassphrase : BootstrapStep()
Expand Down