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

chore: API Name Change Amendment #5602

Merged
merged 5 commits into from
Oct 25, 2024
Merged
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
2 changes: 1 addition & 1 deletion packages/amplify_core/doc/lib/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Future<void> _handleSignInResult(SignInResult result) async {
_handleCodeDelivery(codeDeliveryDetails);
// #enddocregion handle-confirm-signin-sms
// #docregion handle-confirm-signin-email
case AuthSignInStep.confirmSignInWithEmailMfaCode:
case AuthSignInStep.confirmSignInWithOtpCode:
final codeDeliveryDetails = result.nextStep.codeDeliveryDetails!;
_handleCodeDelivery(codeDeliveryDetails);
// #enddocregion handle-confirm-signin-email
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum AuthSignInStep {
confirmSignInWithTotpMfaCode,

/// The sign-in is not complete and must be confirmed with an email code.
confirmSignInWithEmailMfaCode,
confirmSignInWithOtpCode,

/// The sign-in is not complete and must be confirmed with the user's new
/// password.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);

final confirmRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand All @@ -63,7 +63,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -353,7 +353,7 @@ void main() {
confirmationValue: 'EMAIL',
);
check(selectRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(selectRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -392,7 +392,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void main() {
signInRes.nextStep.signInStep,
because:
'When an email is registered and the userpool has email MFA enabled, Cognito will automatically enable email MFA as the preferred MFA method.',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);

final setupRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand All @@ -60,7 +60,7 @@ void main() {
password: password,
);
check(resignInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -98,7 +98,7 @@ void main() {
signInRes.nextStep.signInStep,
because:
'MFA is required so Cognito automatically enables EMAIL MFA',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);

final confirmRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand Down Expand Up @@ -224,7 +224,7 @@ void main() {
check(
signInRes.nextStep.signInStep,
because: 'Preference is EMAIL MFA now',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void main() {
signInRes.nextStep.signInStep,
because: 'Once Email MFA is preferred, it is performed '
'on every sign-in attempt.',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -155,7 +155,7 @@ void main() {
password: password,
);
check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -386,7 +386,7 @@ void main() {
);

check(signInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void main() {
signInRes.nextStep.signInStep,
because: 'MFA is required, and EMAIL is chosen when '
'no phone number is registered',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);

final setupRes = await Amplify.Auth.confirmSignIn(
confirmationValue: await otpResult.code,
Expand All @@ -68,7 +68,7 @@ void main() {
password: password,
);
check(resignInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -147,7 +147,7 @@ void main() {
check(
resignInRes.nextStep.signInStep,
because: 'Preference is EMAIL MFA now',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -300,7 +300,7 @@ void main() {
check(
signInRes.nextStep.signInStep,
because: 'Preference is EMAIL MFA now',
).equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
).equals(AuthSignInStep.confirmSignInWithOtpCode);
check(signInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void main() {
password: password,
);
check(resignInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down Expand Up @@ -199,7 +199,7 @@ void main() {
);

check(resignInRes.nextStep.signInStep)
.equals(AuthSignInStep.confirmSignInWithEmailMfaCode);
.equals(AuthSignInStep.confirmSignInWithOtpCode);
check(resignInRes.nextStep.codeDeliveryDetails)
.isNotNull()
.has((d) => d.deliveryMedium, 'deliveryMedium')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class CognitoConstants {
static const challengeParamSmsMfaCode = 'SMS_MFA_CODE';

/// The `EMAIL_OTP_CODE` parameter.
static const challengeParamEmailMfaCode = 'EMAIL_OTP_CODE';
static const challengeParamEmailOtpCode = 'EMAIL_OTP_CODE';

/// The `SOFTWARE_TOKEN_MFA_CODE` parameter.
static const challengeParamSoftwareTokenMfaCode = 'SOFTWARE_TOKEN_MFA_CODE';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ extension ChallengeNameTypeBridge on ChallengeNameType {
AuthSignInStep.continueSignInWithMfaSetupSelection,
ChallengeNameType.softwareTokenMfa =>
AuthSignInStep.confirmSignInWithTotpMfaCode,
ChallengeNameType.emailOtp =>
AuthSignInStep.confirmSignInWithEmailMfaCode,
ChallengeNameType.emailOtp => AuthSignInStep.confirmSignInWithOtpCode,
ChallengeNameType.adminNoSrpAuth ||
ChallengeNameType.passwordVerifier ||
ChallengeNameType.devicePasswordVerifier ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ final class SignInStateMachine
ChallengeNameType.softwareTokenMfa when hasUserResponse =>
createSoftwareTokenMfaRequest(event),
ChallengeNameType.emailOtp when hasUserResponse =>
createEmailMfaRequest(event),
createEmailOtpRequest(event),
ChallengeNameType.selectMfaType when hasUserResponse =>
createSelectMfaRequest(event),
ChallengeNameType.mfaSetup when hasUserResponse =>
Expand Down Expand Up @@ -454,7 +454,7 @@ final class SignInStateMachine

/// Creates the response object for an Email MFA challenge.
@protected
Future<RespondToAuthChallengeRequest> createEmailMfaRequest(
Future<RespondToAuthChallengeRequest> createEmailOtpRequest(
SignInRespondToChallenge event,
) async {
_enableMfaType = MfaType.email;
Expand All @@ -464,7 +464,7 @@ final class SignInStateMachine
..challengeName = _challengeName
..challengeResponses.addAll({
CognitoConstants.challengeParamUsername: cognitoUsername,
CognitoConstants.challengeParamEmailMfaCode: event.answer,
CognitoConstants.challengeParamEmailOtpCode: event.answer,
})
..clientMetadata.addAll(event.clientMetadata);
});
Expand Down Expand Up @@ -702,13 +702,13 @@ final class SignInStateMachine

// User has provided the verification code
return _enableMfaType == MfaType.totp
? createMfaSetupRequest(event)
? createTotpMfaSetupRequest(event)
: createEmailMfaSetupRequest(event);
}

/// Completes set up of a TOTP MFA.
@protected
Future<RespondToAuthChallengeRequest> createMfaSetupRequest(
Future<RespondToAuthChallengeRequest> createTotpMfaSetupRequest(
SignInRespondToChallenge event,
) async {
await verifySoftwareToken(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand All @@ -62,7 +62,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the email MFA code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// And I type a valid EMAIL OTP code
await confirmSignInPage.enterVerificationCode(await otpResult.code);
Expand Down Expand Up @@ -94,7 +94,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the EMAIL OTP code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid EMAIL OTP code
await confirmSignInPage.enterVerificationCode(await otpResult2.code);
Expand Down Expand Up @@ -129,7 +129,7 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
emitsDone,
]),
);
Expand All @@ -147,7 +147,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the EMAIL OTP code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// And I type an invalid confirmation code
await confirmSignInPage.enterVerificationCode('123456');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
isA<ContinueSignInWithMfaSelection>(),
Expand All @@ -61,7 +61,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the confirm email mfa page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid confirmation code
await confirmSignInPage.enterVerificationCode(await otpResult.code);
Expand Down Expand Up @@ -138,11 +138,11 @@ void main() {
tester.bloc.stream,
emitsInOrder([
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
isA<ContinueSignInWithMfaSelection>(),
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand All @@ -163,7 +163,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the confirm email mfa page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid confirmation code
await confirmSignInPage.enterVerificationCode(await otpResult.code);
Expand Down Expand Up @@ -205,7 +205,7 @@ void main() {
await confirmSignInPage.submitConfirmSignInMfaSelection();

// Then I will be redirected to the confirm EMAIL mfa page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid confirmation code
await confirmSignInPage.enterVerificationCode(await otpResult2.code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void main() {
UnauthenticatedState.confirmSignInMfa,
isA<AuthenticatedState>(),
UnauthenticatedState.signIn,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand Down Expand Up @@ -101,7 +101,7 @@ void main() {
await signInPage.submitSignIn();

// Then I will be redirected to the EMAIL MFA code page
await confirmSignInPage.expectConfirmSignInWithEmailMfaCodeIsPresent();
await confirmSignInPage.expectConfirmSignInWithOtpCodeIsPresent();

// When I type a valid EMAIL MFA code
await confirmSignInPage.enterVerificationCode(await code_2.code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void main() {
UnauthenticatedState.signIn,
isA<ContinueSignInWithMfaSetupSelection>(),
UnauthenticatedState.continueSignInWithEmailMfaSetup,
UnauthenticatedState.confirmSignInWithEmailMfaCode,
UnauthenticatedState.confirmSignInWithOtpCode,
isA<AuthenticatedState>(),
emitsDone,
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ class _AuthenticatorState extends State<Authenticator> {
continueSignInWithEmailMfaSetupForm:
ContinueSignInWithEmailMfaSetupForm(),
confirmSignInWithTotpMfaCodeForm: ConfirmSignInMFAForm(),
confirmSignInWithEmailMfaCodeForm: ConfirmSignInMFAForm(),
confirmSignInWithOtpCodeForm: ConfirmSignInMFAForm(),
verifyUserForm: VerifyUserForm(),
confirmVerifyUserForm: ConfirmVerifyUserForm(),
child: widget.child,
Expand Down
Loading
Loading