Skip to content

Commit 970bf15

Browse files
committed
chore: add authenticator state/step enums
1 parent 69abe75 commit 970bf15

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,29 @@ enum AuthenticatorStep {
6161
/// an MFA method.
6262
continueSignInWithMfaSelection,
6363

64+
/// The user is on the Continue Sign In with MFA Setup Selection step.
65+
/// The sign-in is not complete and the user must select an MFA method to setup.
66+
continueSignInWithMfaSetupSelection,
67+
6468
/// The user is on the Continue Sign In with TOTP setup step.
6569
///
6670
/// The sign-in is not complete and a TOTP authenticator app must be
6771
/// registered before continuing.
6872
continueSignInWithTotpSetup,
6973

74+
/// The sign-in is not complete and an Email MFA must be set up before
75+
/// continuing.
76+
continueSignInWithEmailMfaSetup,
77+
7078
/// The user is on the Confirm Sign In with TOTP MFA step.
7179
///
7280
/// The sign-in is not complete and must be confirmed with a TOTP code
7381
/// from a registered authenticator app.
7482
confirmSignInWithTotpMfaCode,
7583

84+
/// The sign-in is not complete and must be confirmed with an email code.
85+
confirmSignInWithEmailMfaCode,
86+
7687
/// The user is on the Reset Password step.
7788
resetPassword,
7889

packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ class UnauthenticatedState extends AuthState
4646
static const confirmSignInWithTotpMfaCode = UnauthenticatedState(
4747
step: AuthenticatorStep.confirmSignInWithTotpMfaCode,
4848
);
49+
static const continueSignInWithEmailMfaSetup = UnauthenticatedState(
50+
step: AuthenticatorStep.continueSignInWithEmailMfaSetup,
51+
);
52+
static const confirmSignInWithEmailMfaCode = UnauthenticatedState(
53+
step: AuthenticatorStep.confirmSignInWithEmailMfaCode,
54+
);
4955
static const resetPassword =
5056
UnauthenticatedState(step: AuthenticatorStep.resetPassword);
5157
static const confirmResetPassword =
@@ -111,6 +117,21 @@ class ContinueSignInWithMfaSelection extends UnauthenticatedState {
111117
String get runtimeTypeName => 'ContinueSignInWithMfaSelection';
112118
}
113119

120+
class ContinueSignInWithMfaSetupSelection extends UnauthenticatedState {
121+
const ContinueSignInWithMfaSetupSelection({
122+
Set<MfaType>? allowedMfaTypes,
123+
}) : allowedMfaTypes = allowedMfaTypes ?? const {},
124+
super(step: AuthenticatorStep.continueSignInWithMfaSetupSelection);
125+
126+
final Set<MfaType> allowedMfaTypes;
127+
128+
@override
129+
List<Object?> get props => [step, allowedMfaTypes];
130+
131+
@override
132+
String get runtimeTypeName => 'ContinueSignInWithMfaSetupSelection';
133+
}
134+
114135
class ContinueSignInTotpSetup extends UnauthenticatedState {
115136
const ContinueSignInTotpSetup(this.totpSetupDetails, this.totpSetupUri)
116137
: super(step: AuthenticatorStep.continueSignInWithTotpSetup);

0 commit comments

Comments
 (0)