feat(auth): make each MFA enrollment step a real navigation destination - #2467
Merged
russellwheatley merged 1 commit intoSep 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the MFA enrollment flow to host steps as real navigation destinations, ensuring state survives step transitions and Activity recreation. This is achieved by introducing MfaEnrollmentFlowState and custom savers for CountryData and SmsEnrollmentSession. Feedback on the changes highlights a potential security risk of cross-user state leakage, suggesting that rememberMfaEnrollmentFlowState be keyed on the user's ID. Additionally, it is recommended to wrap a composition-time popBackStack() call in a LaunchedEffect to avoid side-effects during composition.
demolaf
force-pushed
the
feat/mfa-enrollment-per-step-nav
branch
from
September 2, 2026 01:10
84abce8 to
4d4fe41
Compare
demolaf
force-pushed
the
feat/mfa-enrollment-per-step-nav
branch
from
September 2, 2026 13:17
4d4fe41 to
548c396
Compare
demolaf
force-pushed
the
feat/mfa-enrollment-per-step-nav
branch
from
September 2, 2026 13:30
548c396 to
a38bb4f
Compare
Base automatically changed from
feat/auth-per-step-nav-destinations
to
version-10.0.0-beta05
September 2, 2026 14:23
russellwheatley
force-pushed
the
feat/mfa-enrollment-per-step-nav
branch
from
September 2, 2026 14:23
a38bb4f to
bfc6583
Compare
russellwheatley
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MFA enrollment kept its four steps in local composable state, so
onBackClickhand-rolled a back stack by inspecting the selected factor, and backing out of SMS enrollment discarded the phone number the user had typed. Each step is now its own destination, so system back walks them and entered data survives.Cross-step state moves into a
MfaEnrollmentFlowStateholder above the NavHost, with hand-writtenSavers so the SMS session and selected country survive Activity recreation. A TOTP secret can't survive one — the SDK'sTotpSecretis an interface with no public reconstruction path — so a lost secret is now regenerated with a fresh QR code and an explanatory message, rather than leaving the user on an opaque "No TOTP secret available" error.MfaEnrollmentDestinations.kt: shared graph extension registering the four steps, plusmfaEnrollmentStartStepso a single-allowed-factor config resolves its start step at flow entry instead of auto-advancing pastSelectFactor.MfaEnrollmentScreen: gainedstep/onNavigateToStep/onNavigateBack/flowStateas a required set (a partial subset throws at composition); a nullsteppreserves today's standalone behaviour.Added
MfaEnrollmentRouteNavigationTest,MfaEnrollmentFlowStateRestorationTestandMfaEnrollmentTotpRegenerationTest— data preservation across step switches and recreation, back-stack ordering, and TOTP regeneration.Usage
Maintainer note: Fixes internal CPRN-403