Skip to content

Commit

Permalink
Respect the methods setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ggajews committed Feb 10, 2023
1 parent 4cc2daa commit c3a55fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
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

0 comments on commit c3a55fe

Please sign in to comment.