From 1b5d2bd63548a9e67515f8afc22af1bf9fcaddb4 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:32:25 -0700 Subject: [PATCH 01/52] chore: add mfaType enum values, --- .../lib/src/config/amplify_outputs/auth/mfa.dart | 5 ++++- packages/amplify_core/lib/src/config/auth/cognito/mfa.dart | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/auth/mfa.dart b/packages/amplify_core/lib/src/config/amplify_outputs/auth/mfa.dart index e82d3327d7..92fee3d781 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/auth/mfa.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/auth/mfa.dart @@ -11,7 +11,10 @@ enum MfaMethod { sms, @JsonValue('TOTP') - totp; + totp, + + @JsonValue('EMAIL') + email; /// The value to pass to `Amplify.Auth.confirmSignIn` when /// selecting an MFA type. diff --git a/packages/amplify_core/lib/src/config/auth/cognito/mfa.dart b/packages/amplify_core/lib/src/config/auth/cognito/mfa.dart index 6d33bd00b3..292c5e184f 100644 --- a/packages/amplify_core/lib/src/config/auth/cognito/mfa.dart +++ b/packages/amplify_core/lib/src/config/auth/cognito/mfa.dart @@ -9,7 +9,10 @@ enum MfaType { sms, @JsonValue('TOTP') - totp; + totp, + + @JsonValue('EMAIL') + email; /// The value to pass to `Amplify.Auth.confirmSignIn` when /// selecting an MFA type. @@ -21,6 +24,7 @@ extension ToMfaMethod on MfaType { return switch (this) { MfaType.sms => MfaMethod.sms, MfaType.totp => MfaMethod.totp, + MfaType.email => MfaMethod.email, }; } } From a6492d7b46c465d3f559ca2198f25d69b886affb Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:32:49 -0700 Subject: [PATCH 02/52] chore: add sign in step enums --- .../lib/src/types/auth/sign_in/auth_sign_in_step.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart index 7474f4be5e..b0d446dd8e 100644 --- a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart +++ b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart @@ -10,10 +10,17 @@ enum AuthSignInStep { /// an MFA method. continueSignInWithMfaSelection, + /// The sign-in is not complete and the user must set up and select an MFA method. + continueSignInWithMfaSetupSelection, + /// The sign-in is not complete and a TOTP authenticator app must be /// registered before continuing. continueSignInWithTotpSetup, + /// The sign-in is not complete and an Email MFA must be set up before + /// continuing. + continueSignInWithEmailMfaSetup, + /// The sign-in is not complete and must be confirmed with an SMS code. confirmSignInWithSmsMfaCode, @@ -21,6 +28,9 @@ enum AuthSignInStep { /// from a registered authenticator app. confirmSignInWithTotpMfaCode, + /// The sign-in is not complete and must be confirmed with an email code. + confirmSignInWithEmailMfaCode, + /// The sign-in is not complete and must be confirmed with the user's new /// password. confirmSignInWithNewPassword, From 755f30d6f0d339c945f31e0a2d58062edacaffd0 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:33:08 -0700 Subject: [PATCH 03/52] chore: add ChallengeName --- .../model/challenge_name_type.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart index 16183b5270..7b8ba49818 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart @@ -74,6 +74,12 @@ class ChallengeNameType extends _i1.SmithyEnum { 'SOFTWARE_TOKEN_MFA', ); + static const emailMfa = ChallengeNameType._( + 10, + 'EMAIL_MFA', + 'EMAIL_MFA', + ); + /// All values of [ChallengeNameType]. static const values = [ ChallengeNameType.adminNoSrpAuth, @@ -86,6 +92,7 @@ class ChallengeNameType extends _i1.SmithyEnum { ChallengeNameType.selectMfaType, ChallengeNameType.smsMfa, ChallengeNameType.softwareTokenMfa, + ChallengeNameType.emailMfa, ]; static const List<_i1.SmithySerializer> serializers = [ From 95f658b55758caf963c2ed35c41f32bf12453cc8 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:46:40 -0700 Subject: [PATCH 04/52] Revert "chore: add ChallengeName" This reverts commit 04fbd0c4ebd073fe291d95abfb5f33aa8bfe1f50. --- .../model/challenge_name_type.dart | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart index 7b8ba49818..16183b5270 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart @@ -74,12 +74,6 @@ class ChallengeNameType extends _i1.SmithyEnum { 'SOFTWARE_TOKEN_MFA', ); - static const emailMfa = ChallengeNameType._( - 10, - 'EMAIL_MFA', - 'EMAIL_MFA', - ); - /// All values of [ChallengeNameType]. static const values = [ ChallengeNameType.adminNoSrpAuth, @@ -92,7 +86,6 @@ class ChallengeNameType extends _i1.SmithyEnum { ChallengeNameType.selectMfaType, ChallengeNameType.smsMfa, ChallengeNameType.softwareTokenMfa, - ChallengeNameType.emailMfa, ]; static const List<_i1.SmithySerializer> serializers = [ From 1f72acaf8cceb5494cd9c425d6fc263b32cd7532 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:19:18 -0700 Subject: [PATCH 05/52] Update packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart Co-authored-by: Elijah Quartey --- .../lib/src/types/auth/sign_in/auth_sign_in_step.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart index b0d446dd8e..9631ca1d94 100644 --- a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart +++ b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart @@ -10,7 +10,7 @@ enum AuthSignInStep { /// an MFA method. continueSignInWithMfaSelection, - /// The sign-in is not complete and the user must set up and select an MFA method. + /// The sign-in is not complete and the user must select an MFA method to setup. continueSignInWithMfaSetupSelection, /// The sign-in is not complete and a TOTP authenticator app must be From a5abb1eb7d0da20093370326ef71de595f3f87e1 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:46:47 -0700 Subject: [PATCH 06/52] chore add email mfa to sdk_bridge and state machine --- .../lib/src/sdk/sdk_bridge.dart | 33 +++++++++++++++---- .../state/machines/sign_in_state_machine.dart | 22 ++++++++++++- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index 5c81717008..593b38a583 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -32,6 +32,8 @@ extension ChallengeNameTypeBridge on ChallengeNameType { AuthSignInStep.continueSignInWithTotpSetup, ChallengeNameType.softwareTokenMfa => AuthSignInStep.confirmSignInWithTotpMfaCode, + // TODO(khatruong2009): confirm ChallengeNameType.emailMfa is added to SDK + ChallengeNameType.emailMfa => AuthSignInStep.confirmSignInWithEmailMfaCode, ChallengeNameType.adminNoSrpAuth || ChallengeNameType.passwordVerifier || ChallengeNameType.devicePasswordVerifier || @@ -795,6 +797,7 @@ extension MfaSettings on CognitoIdentityProviderClient { required String accessToken, MfaPreference? sms, MfaPreference? totp, + MfaPreference? email, }) async { final UserMfaPreference( enabled: currentEnabled, @@ -811,6 +814,7 @@ extension MfaSettings on CognitoIdentityProviderClient { final explicitlyDisabled = switch (mfaType) { MfaType.sms => sms == MfaPreference.disabled, MfaType.totp => totp == MfaPreference.disabled, + MfaType.email => email == MfaPreference.disabled, }; if (explicitlyDisabled) { return false; @@ -819,22 +823,25 @@ extension MfaSettings on CognitoIdentityProviderClient { final requestingEnabled = switch (mfaType) { MfaType.sms => enabledValues.contains(sms), MfaType.totp => enabledValues.contains(totp), + MfaType.email => enabledValues.contains(email), }; return currentlyEnabled || requestingEnabled; } - final preferred = switch ((currentPreference, sms: sms, totp: totp)) { + final preferred = switch ((currentPreference, sms: sms, totp: totp, email: email)) { // Prevent an invalid choice. - (_, sms: MfaPreference.preferred, totp: MfaPreference.preferred) => + (_, sms: MfaPreference.preferred, totp: MfaPreference.preferred, email: MfaPreference.preferred) => throw const InvalidParameterException( - 'Cannot assign both SMS and TOTP as preferred', + 'Cannot assign multiple MFA methods as preferred', ), // Setting one or the other as preferred overrides previous value. - (_, sms: MfaPreference.preferred, totp: != MfaPreference.preferred) => + (_, sms: MfaPreference.preferred, totp: != MfaPreference.preferred, email: != MfaPreference.preferred) => MfaType.sms, - (_, sms: != MfaPreference.preferred, totp: MfaPreference.preferred) => + (_, sms: != MfaPreference.preferred, totp: MfaPreference.preferred, email: != MfaPreference.preferred) => MfaType.totp, + (_, sms: != MfaPreference.preferred, totp: != MfaPreference.preferred, email: MfaPreference.preferred) => + MfaType.email, // Setting one or the other as disabled or not preferred removes current // preference if it matches. @@ -842,16 +849,24 @@ extension MfaSettings on CognitoIdentityProviderClient { MfaType.sms, sms: MfaPreference.notPreferred || MfaPreference.disabled, totp: _, + email: _, ) || ( MfaType.totp, sms: _, totp: MfaPreference.notPreferred || MfaPreference.disabled, + email: _, + ) || + ( + MfaType.email, + sms: _, + totp: _, + email: MfaPreference.notPreferred || MfaPreference.disabled, ) => null, // Ignore preference changes which do not affect the current preference. - (final currentPreference, sms: _, totp: _) => currentPreference, + (final currentPreference, sms: _, totp: _, email: _) => currentPreference, }; final smsMfaSettings = SmsMfaSettingsType( enabled: isEnabled(MfaType.sms), @@ -861,6 +876,11 @@ extension MfaSettings on CognitoIdentityProviderClient { enabled: isEnabled(MfaType.totp), preferredMfa: preferred == MfaType.totp, ); + // TODO(khatruong2009): confirm EmailMfaSettingsType is added to SDK + final emailMfaSettings = EmailMfaSettingsType( + enabled: isEnabled(MfaType.email), + preferredMfa: preferred == MfaType.email, + ); await setUserMfaPreference( SetUserMfaPreferenceRequest( accessToken: accessToken, @@ -876,6 +896,7 @@ extension on String { MfaType get mfaType => switch (this) { 'SOFTWARE_TOKEN_MFA' => MfaType.totp, 'SMS_MFA' => MfaType.sms, + 'EMAIL_MFA' => MfaType.email, final invalidType => throw StateError('Invalid MFA type: $invalidType'), }; } diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index cafeb1d3e7..46666c79fd 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -211,6 +211,7 @@ final class SignInStateMachine (type) => switch (type) { 'SOFTWARE_TOKEN_MFA' => MfaType.totp, 'SMS_MFA' => MfaType.sms, + 'EMAIL_MFA' => MfaType.email, _ => () { logger.error('Unrecognized MFA type: $type'); return null; @@ -449,6 +450,24 @@ final class SignInStateMachine }); } + /// Creates the response object for an Email MFA challenge. + @protected + Future createEmailMfaRequest( + SignInRespondToChallenge event, + ) async { + _enableMfaType = MfaType.email; + return RespondToAuthChallengeRequest.build((b) { + b + ..clientId = config.appClientId + ..challengeName = _challengeName + ..challengeResponses.addAll({ + CognitoConstants.challengeParamUsername: cognitoUsername, + CognitoConstants.challengeParamEmailMfaCode: event.answer, + }) + ..clientMetadata.addAll(event.clientMetadata); + }); + } + /// Creates the response object for a new password challenge. @protected Future createNewPasswordRequest( @@ -667,7 +686,8 @@ final class SignInStateMachine CognitoConstants.challengeParamAnswer: switch (selection) { 'sms' => 'SMS_MFA', 'totp' => 'SOFTWARE_TOKEN_MFA', - _ => throw ArgumentError('Must be either SMS or TOTP'), + 'email' => 'EMAIL_MFA', + _ => throw ArgumentError('Must be either SMS, Email, or TOTP'), }, }) ..clientId = _authOutputs.userPoolClientId From edaf99947b3c1b3e01849cf52e64c194eacf9156 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:47:52 -0700 Subject: [PATCH 07/52] chore: add email mfa to constants.dart --- .../amplify_auth_cognito_dart/lib/src/flows/constants.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart index 3ab6d376a5..ff49ec7974 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart @@ -57,6 +57,9 @@ abstract class CognitoConstants { /// The `SMS_MFA_CODE` parameter. static const challengeParamSmsMfaCode = 'SMS_MFA_CODE'; + /// The `EMAIL_MFA_CODE` parameter. + static const challengeParamEmailMfaCode = 'EMAIL_MFA_CODE'; + /// The `SOFTWARE_TOKEN_MFA_CODE` parameter. static const challengeParamSoftwareTokenMfaCode = 'SOFTWARE_TOKEN_MFA_CODE'; From 630adad3fc5deac35c9f63b6b12bc8419b191226 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:48:54 -0700 Subject: [PATCH 08/52] chore: add email to updateMfaPreference API --- .../amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart index f458548642..f080f48fc2 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart @@ -892,6 +892,7 @@ class AmplifyAuthCognitoDart extends AuthPluginInterface Future updateMfaPreference({ MfaPreference? sms, MfaPreference? totp, + MfaPreference? email, }) async { final tokens = await _stateMachine.getUserPoolTokens(); final accessToken = tokens.accessToken.raw; @@ -899,6 +900,7 @@ class AmplifyAuthCognitoDart extends AuthPluginInterface accessToken: accessToken, sms: sms, totp: totp, + email: email, ); } From 3f4efce65dcdfc1efb60ec27967b9112eaa14a21 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:49:18 -0700 Subject: [PATCH 09/52] chore: generate code for mfa types/methods and sign in step --- .../lib/src/config/amplify_outputs/auth/auth_outputs.g.dart | 1 + .../amplify_core/lib/src/config/auth/cognito/auth.g.dart | 1 + .../src/types/auth/sign_in/auth_next_sign_in_step.g.dart | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart index f278972143..9c9639f654 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart @@ -128,4 +128,5 @@ const _$MfaEnforcementEnumMap = { const _$MfaMethodEnumMap = { MfaMethod.sms: 'SMS', MfaMethod.totp: 'TOTP', + MfaMethod.email: 'EMAIL', }; diff --git a/packages/amplify_core/lib/src/config/auth/cognito/auth.g.dart b/packages/amplify_core/lib/src/config/auth/cognito/auth.g.dart index 51926ead53..6bbb532080 100644 --- a/packages/amplify_core/lib/src/config/auth/cognito/auth.g.dart +++ b/packages/amplify_core/lib/src/config/auth/cognito/auth.g.dart @@ -119,4 +119,5 @@ const _$MfaConfigurationEnumMap = { const _$MfaTypeEnumMap = { MfaType.sms: 'SMS', MfaType.totp: 'TOTP', + MfaType.email: 'EMAIL', }; diff --git a/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart b/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart index 46d7e2de61..addf8e6b35 100644 --- a/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart +++ b/packages/amplify_core/lib/src/types/auth/sign_in/auth_next_sign_in_step.g.dart @@ -75,9 +75,14 @@ Map _$AuthNextSignInStepToJson(AuthNextSignInStep instance) { const _$AuthSignInStepEnumMap = { AuthSignInStep.continueSignInWithMfaSelection: 'continueSignInWithMfaSelection', + AuthSignInStep.continueSignInWithMfaSetupSelection: + 'continueSignInWithMfaSetupSelection', AuthSignInStep.continueSignInWithTotpSetup: 'continueSignInWithTotpSetup', + AuthSignInStep.continueSignInWithEmailMfaSetup: + 'continueSignInWithEmailMfaSetup', AuthSignInStep.confirmSignInWithSmsMfaCode: 'confirmSignInWithSmsMfaCode', AuthSignInStep.confirmSignInWithTotpMfaCode: 'confirmSignInWithTotpMfaCode', + AuthSignInStep.confirmSignInWithEmailMfaCode: 'confirmSignInWithEmailMfaCode', AuthSignInStep.confirmSignInWithNewPassword: 'confirmSignInWithNewPassword', AuthSignInStep.confirmSignInWithCustomChallenge: 'confirmSignInWithCustomChallenge', @@ -89,4 +94,5 @@ const _$AuthSignInStepEnumMap = { const _$MfaTypeEnumMap = { MfaType.sms: 'SMS', MfaType.totp: 'TOTP', + MfaType.email: 'EMAIL', }; From 438f800810f18b04f7b407217a6b67db2da48607 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:45:05 -0700 Subject: [PATCH 10/52] chore: merge main (#5449) * chore(api): update endpoint config to use ApiOutputs instead of AWSApiConfig type (#5193) * feat: bump json_annotation dependency to v4.9 * chore: update actions workflow to run aft link * chore(secure_storage): Plugin Endorsement (#5208) * chore(infra): bump deps (#5221) * chore(test): use Amplify Gen 2 config in unit tests (#5205) * chore: add testUrlScheme back to test (#5223) * chore: add gen2 auth e2e infra (#5179) * chore(infra): Api migrate to Gen 2 E2E * fix: git update-index --chmod=+x * fix: code review * chore: port auth backend * chore: port lambda triggers for create user and custom email sender * chore: move utils to infra-common * chore: compile infra common to js * chore: update utils for js restructure, add missing deps * chore: fix confirmation code infra * chore: update tests to run for gen2 stacks * chore: remove alias from custom sender lambda * chore: fix deliveryMedium in reset password test * chore: add phone sign in infra * chore: rename email-sign-in * chore: add license header * chore: fix formatting in GH workflow * chore: update package-lock * chore: remove deleted file * chore: fix formatting * chore: update package lock * chore: remove dup function * chore: remove changes from merge conflicts * chore: fix build script * chore: fetch auth amplify_outputs * chore: remove libgit2dart * chore: add custom sms sender * chore: add stack name to infra resources * chore: pull gen2 backend for authenticator * chore: update package-lock * chore: move dependencies to dev_dependencies * chore: update fetch auth session tests * chore: separate reset pw and confirmation delivery medium * chore: fix hanging test * chore: rename test group * chore: update comments, remove unused type * chore: update package lock --------- Co-authored-by: Elijah Quartey * chore(auth): sign-up state machine to use AmplifyOutputs instead of AmplifyConfig types (#5230) * chore(auth): sign-in state machine to use AmplifyOutputs instead of AmplifyConfig types (#5231) * chore(auth): fetch auth session state machine to use AmplifyOutputs instead of AmplifyConfig types (#5234) * chore(auth): sign-out state machine to use AmplifyOutputs instead of AmplifConfig types (#5235) * chore(actions): android emulator to start with clear cache and data (#5245) * chore(actions): e2e android tests to run with API 34 (#5247) * chore(infra): bump deps (#5246) Updated @aws-sdk/client-amplify @aws-sdk/client-cognito-identity-provider @aws-crypto/client-node @aws-sdk/client-s3 * chore(auth): cognito keys to not use AmplifyConfig types (#5243) * chore(auth): hosted ui state machine to not use AmplifyConfig types (#5254) * fix(datastore): Clear subscriptions on Stop (#5253) * Chore/goldens flutter lint (#5271) * temp: generate goldens png * test: fixing context mounted issue * chore: add todo comment about deprecated member use --------- Co-authored-by: Andrew Hahn * chore(infra): analytics integ test gen 2 backend (#5104) * chore(auth): device metadata repository to use AuthOutputs instead of CognitoUserPoolConfig (#5289) * feat(Auth): Add fetchCurrentDevice API (#5251) feat(Auth): Add fetchCurrentDevice API (#5251) * chore(dependencies): bump package_info_plus (#5274) chore: bump package_info_plus * chore: migrate sms only MFA infra to Gen 2 (#5291) * chore: add new auth backend * chore: add auth extension * chore: add license headers * chore: add mfa to env * chore: add trigger to enable MFA * chore: add infra for sms required * chore: refactor tests for gen 2 backends * chore: add backends to deploy script * chore: package-lock for mfa-required-sms * chore: remove bundling of @aws-crypto/client-node * chore: fix formatting * fix(datastore): Restart Sync Engine when network on/off (#5218) * chore: update authenticator tests (#5296) * chore(auth): hosted ui platforms to use AmplifyOutputs types instead of AmplifyConfig (#5273) * chore(auth): asf context data provider to use AuthOutputs instead of CognitoUserPoolConfig (#5290) * chore(auth): fix fetch current device test (#5297) * fix: push notification flush events (#5215) fix: push notification flush events (#5215) * chore(dependencies): bump build_runner (#5300) * chore(dependencies): bump build_runner * chore(bump): checks package (#5305) * chore(bump): checks package * chore(version): Bump version chore(): Fixed Version Bumps chore: fixed change log chore: fixed change log chore: fixed change log chore: fixed change log * chore: manually bump amplify_db_common version * chore(infra): Extend API key expiration (#5336) * chore(dev): use ubuntu image from amazon ECR public gallery instead of docket hub (#5341) * fix(api): web socket error handling (#5359) * chore: update issue template (#5369) * fix(datastore): FlutterSerializedModel.extractJsonValue returns `.some(nil)` instead of `nil` (#5370) * chore: add GH actions for issue open, close, comment, label events (#5310) * fix(secure_storage): add missing macOS plugin (#5372) fix(secure_storage): add missing macos plugin it's fixing #5361 * chore: update plugin registrant for example apps that depend on secure storage (#5379) * chore(version): Bump version - fix(secure_storage): add missing macOS plugin ([#5372](https://github.com/aws-amplify/amplify-flutter/pull/5372)) Updated-Components: Secure Storage * chore(deps): Amplify Android 2.21.1 (#5376) * update amplify android to latest * update amplify android to latest in notifications * feat(aws_common): Generated new AWSService constructors (#5378) * chore(infra): regen lock file (#5374) * chore(auth): credential store state machine to use AuthOutputs instead of AmplifyConfig types (#5298) * chore(api): Remove Gen 1 API backend (#5393) * chore(datastore): Add multi auth integration tests (#5204) * feat: move App Sync subscription headers to protocol (#5301) * chore: move subscription headers to protocol * fix: remove `=` from encoded headers * chore: add comment * chore: `aft version-bump` test suite (#5424) * chore: add `--skip-build-version` option * chore: use `base-ref`/`head-ref` over env vars * chore: add new version bump test suite * chore: remove old version bump tests * chore: only include first change log entry * fix: sort change types before writing to the change log * chore: remove non essential info from diffs * chore: generate repo snapshot * chore: generate diff snapshots * chore: clean up tests and test output * chore: update `aft generate workflows`, regenerate dependabot.yaml (#5441) * chore: skip repo snapshot in dependabot generation * chore: regenerate dependabot.yaml * chore: fix `aft version-bump` (#5436) * fix: properly handle component propagation * chore: add test for multi package update with breaking common package --------- Co-authored-by: NikaHsn Co-authored-by: Jordan Nelson Co-authored-by: Elijah Quartey Co-authored-by: Elijah Quartey Co-authored-by: Tyler-Larkin Co-authored-by: Andrew Hahn Co-authored-by: Andrew Hahn <58017052+hahnandrew@users.noreply.github.com> Co-authored-by: Burak Karahan Co-authored-by: Jamil Saadeh --- infra-gen2/package-lock.json | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/infra-gen2/package-lock.json b/infra-gen2/package-lock.json index 806c800dd6..191c337b64 100644 --- a/infra-gen2/package-lock.json +++ b/infra-gen2/package-lock.json @@ -4462,6 +4462,18 @@ "inBundle": true, "license": "Apache-2.0", "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.624.0", + "@aws-sdk/client-sts": "3.624.0", + "@aws-sdk/core": "3.624.0", + "@aws-sdk/credential-provider-node": "3.624.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-sdk-ec2": "3.622.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", "@aws-sdk/types": "3.609.0", "@smithy/types": "^3.3.0", "bowser": "^2.11.0", @@ -4474,9 +4486,27 @@ "inBundle": true, "license": "Apache-2.0", "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.624.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", "@aws-sdk/types": "3.609.0", "@smithy/node-config-provider": "^3.1.4", "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, "engines": { @@ -4592,6 +4622,8 @@ "license": "Apache-2.0", "dependencies": { "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "fast-xml-parser": "4.4.1", "tslib": "^2.6.2" }, "engines": { @@ -4606,6 +4638,7 @@ "dependencies": { "@smithy/eventstream-serde-universal": "^3.0.5", "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.3", "tslib": "^2.6.2" }, "engines": { From b4a8ceb1c8a1c68044c9f15ceb7d785d1aa113ad Mon Sep 17 00:00:00 2001 From: NikaHsn Date: Fri, 13 Sep 2024 16:17:54 -0700 Subject: [PATCH 11/52] chore(auth): re-generate auth cognito sdk for email mfa (#5455) * chore(api): update endpoint config to use ApiOutputs instead of AWSApiConfig type (#5193) * feat: bump json_annotation dependency to v4.9 * chore: update actions workflow to run aft link * chore(secure_storage): Plugin Endorsement (#5208) * chore(infra): bump deps (#5221) * chore(test): use Amplify Gen 2 config in unit tests (#5205) * chore: add testUrlScheme back to test (#5223) * chore: add gen2 auth e2e infra (#5179) * chore(infra): Api migrate to Gen 2 E2E * fix: git update-index --chmod=+x * fix: code review * chore: port auth backend * chore: port lambda triggers for create user and custom email sender * chore: move utils to infra-common * chore: compile infra common to js * chore: update utils for js restructure, add missing deps * chore: fix confirmation code infra * chore: update tests to run for gen2 stacks * chore: remove alias from custom sender lambda * chore: fix deliveryMedium in reset password test * chore: add phone sign in infra * chore: rename email-sign-in * chore: add license header * chore: fix formatting in GH workflow * chore: update package-lock * chore: remove deleted file * chore: fix formatting * chore: update package lock * chore: remove dup function * chore: remove changes from merge conflicts * chore: fix build script * chore: fetch auth amplify_outputs * chore: remove libgit2dart * chore: add custom sms sender * chore: add stack name to infra resources * chore: pull gen2 backend for authenticator * chore: update package-lock * chore: move dependencies to dev_dependencies * chore: update fetch auth session tests * chore: separate reset pw and confirmation delivery medium * chore: fix hanging test * chore: rename test group * chore: update comments, remove unused type * chore: update package lock --------- Co-authored-by: Elijah Quartey * chore(auth): sign-up state machine to use AmplifyOutputs instead of AmplifyConfig types (#5230) * chore(auth): sign-in state machine to use AmplifyOutputs instead of AmplifyConfig types (#5231) * chore(auth): fetch auth session state machine to use AmplifyOutputs instead of AmplifyConfig types (#5234) * chore(auth): sign-out state machine to use AmplifyOutputs instead of AmplifConfig types (#5235) * chore(actions): android emulator to start with clear cache and data (#5245) * chore(actions): e2e android tests to run with API 34 (#5247) * chore(infra): bump deps (#5246) Updated @aws-sdk/client-amplify @aws-sdk/client-cognito-identity-provider @aws-crypto/client-node @aws-sdk/client-s3 * chore(auth): cognito keys to not use AmplifyConfig types (#5243) * chore(auth): hosted ui state machine to not use AmplifyConfig types (#5254) * fix(datastore): Clear subscriptions on Stop (#5253) * Chore/goldens flutter lint (#5271) * temp: generate goldens png * test: fixing context mounted issue * chore: add todo comment about deprecated member use --------- Co-authored-by: Andrew Hahn * chore(infra): analytics integ test gen 2 backend (#5104) * chore(auth): device metadata repository to use AuthOutputs instead of CognitoUserPoolConfig (#5289) * feat(Auth): Add fetchCurrentDevice API (#5251) feat(Auth): Add fetchCurrentDevice API (#5251) * chore(dependencies): bump package_info_plus (#5274) chore: bump package_info_plus * chore: migrate sms only MFA infra to Gen 2 (#5291) * chore: add new auth backend * chore: add auth extension * chore: add license headers * chore: add mfa to env * chore: add trigger to enable MFA * chore: add infra for sms required * chore: refactor tests for gen 2 backends * chore: add backends to deploy script * chore: package-lock for mfa-required-sms * chore: remove bundling of @aws-crypto/client-node * chore: fix formatting * fix(datastore): Restart Sync Engine when network on/off (#5218) * chore: update authenticator tests (#5296) * chore(auth): hosted ui platforms to use AmplifyOutputs types instead of AmplifyConfig (#5273) * chore(auth): asf context data provider to use AuthOutputs instead of CognitoUserPoolConfig (#5290) * chore(auth): fix fetch current device test (#5297) * fix: push notification flush events (#5215) fix: push notification flush events (#5215) * chore(dependencies): bump build_runner (#5300) * chore(dependencies): bump build_runner * chore(bump): checks package (#5305) * chore(bump): checks package * chore(version): Bump version chore(): Fixed Version Bumps chore: fixed change log chore: fixed change log chore: fixed change log chore: fixed change log * chore: manually bump amplify_db_common version * chore(infra): Extend API key expiration (#5336) * chore(dev): use ubuntu image from amazon ECR public gallery instead of docket hub (#5341) * fix(api): web socket error handling (#5359) * chore: update issue template (#5369) * fix(datastore): FlutterSerializedModel.extractJsonValue returns `.some(nil)` instead of `nil` (#5370) * chore: add GH actions for issue open, close, comment, label events (#5310) * fix(secure_storage): add missing macOS plugin (#5372) fix(secure_storage): add missing macos plugin it's fixing #5361 * chore: update plugin registrant for example apps that depend on secure storage (#5379) * chore(version): Bump version ### Fixes - fix(secure_storage): add missing macOS plugin ([#5372](https://github.com/aws-amplify/amplify-flutter/pull/5372)) Updated-Components: Secure Storage * chore(deps): Amplify Android 2.21.1 (#5376) * update amplify android to latest * update amplify android to latest in notifications * feat(aws_common): Generated new AWSService constructors (#5378) * chore(infra): regen lock file (#5374) * chore(auth): credential store state machine to use AuthOutputs instead of AmplifyConfig types (#5298) * chore(api): Remove Gen 1 API backend (#5393) * chore(datastore): Add multi auth integration tests (#5204) * feat: move App Sync subscription headers to protocol (#5301) * chore: move subscription headers to protocol * fix: remove `=` from encoded headers * chore: add comment * chore: `aft version-bump` test suite (#5424) * chore: add `--skip-build-version` option * chore: use `base-ref`/`head-ref` over env vars * chore: add new version bump test suite * chore: remove old version bump tests * chore: only include first change log entry * fix: sort change types before writing to the change log * chore: remove non essential info from diffs * chore: generate repo snapshot * chore: generate diff snapshots * chore: clean up tests and test output * chore: update `aft generate workflows`, regenerate dependabot.yaml (#5441) * chore: skip repo snapshot in dependabot generation * chore: regenerate dependabot.yaml * chore: fix `aft version-bump` (#5436) * fix: properly handle component propagation * chore: add test for multi package update with breaking common package * chore(auth): re-generate auth cognito sdk for email mfa --------- Co-authored-by: Jordan Nelson Co-authored-by: Elijah Quartey Co-authored-by: Elijah Quartey Co-authored-by: Tyler-Larkin Co-authored-by: Andrew Hahn Co-authored-by: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Co-authored-by: Andrew Hahn <58017052+hahnandrew@users.noreply.github.com> Co-authored-by: Burak Karahan Co-authored-by: Jamil Saadeh Co-authored-by: Nika Hassani --- .../lib/src/sdk/cognito_identity.dart | 2 +- .../src/sdk/cognito_identity_provider.dart | 4 +- .../lib/src/sdk/sdk_exception.dart | 21 +++ .../cognito_identity_client.dart | 2 +- .../common/endpoint_resolver.dart | 2 +- .../cognito_identity/common/serializers.dart | 2 +- .../cognito_identity/model/credentials.dart | 4 +- .../model/external_service_exception.dart | 2 +- .../get_credentials_for_identity_input.dart | 2 +- ...get_credentials_for_identity_response.dart | 2 +- .../cognito_identity/model/get_id_input.dart | 2 +- .../model/get_id_response.dart | 2 +- .../model/internal_error_exception.dart | 2 +- ...identity_pool_configuration_exception.dart | 2 +- .../model/invalid_parameter_exception.dart | 2 +- .../model/limit_exceeded_exception.dart | 2 +- .../model/not_authorized_exception.dart | 2 +- .../model/resource_conflict_exception.dart | 2 +- .../model/resource_not_found_exception.dart | 2 +- .../model/too_many_requests_exception.dart | 2 +- ...et_credentials_for_identity_operation.dart | 4 +- .../operation/get_id_operation.dart | 4 +- .../cognito_identity_provider_client.dart | 18 +-- .../common/endpoint_resolver.dart | 2 +- .../common/serializers.dart | 6 +- .../model/alias_exists_exception.dart | 2 +- .../model/analytics_metadata_type.dart | 2 +- .../associate_software_token_request.dart | 2 +- .../associate_software_token_response.dart | 2 +- .../model/attribute_type.dart | 2 +- .../model/auth_flow_type.dart | 2 +- .../model/authentication_result_type.dart | 2 +- .../model/challenge_name_type.dart | 21 ++- .../model/change_password_request.dart | 2 +- .../model/change_password_response.dart | 2 +- .../model/code_delivery_details_type.dart | 2 +- .../code_delivery_failure_exception.dart | 2 +- .../model/code_mismatch_exception.dart | 2 +- .../concurrent_modification_exception.dart | 2 +- .../model/confirm_device_request.dart | 2 +- .../model/confirm_device_response.dart | 2 +- .../confirm_forgot_password_request.dart | 2 +- .../confirm_forgot_password_response.dart | 2 +- .../model/confirm_sign_up_request.dart | 2 +- .../model/confirm_sign_up_response.dart | 2 +- .../model/delete_user_request.dart | 2 +- .../model/delivery_medium_type.dart | 2 +- .../model/device_remembered_status_type.dart | 2 +- .../device_secret_verifier_config_type.dart | 2 +- .../model/device_type.dart | 2 +- .../model/email_mfa_settings_type.dart | 147 +++++++++++++++++ .../model/email_mfa_settings_type.g.dart | 106 +++++++++++++ .../enable_software_token_mfa_exception.dart | 2 +- .../model/expired_code_exception.dart | 2 +- .../model/forbidden_exception.dart | 2 +- .../model/forget_device_request.dart | 2 +- .../model/forgot_password_request.dart | 2 +- .../model/forgot_password_response.dart | 2 +- .../model/get_device_request.dart | 2 +- .../model/get_device_response.dart | 2 +- ...r_attribute_verification_code_request.dart | 2 +- ..._attribute_verification_code_response.dart | 2 +- .../model/get_user_request.dart | 2 +- .../model/get_user_response.dart | 4 +- .../model/global_sign_out_request.dart | 2 +- .../model/global_sign_out_response.dart | 2 +- .../model/initiate_auth_request.dart | 2 +- .../model/initiate_auth_response.dart | 6 +- .../model/internal_error_exception.dart | 2 +- ...id_email_role_access_policy_exception.dart | 2 +- .../invalid_lambda_response_exception.dart | 2 +- .../model/invalid_parameter_exception.dart | 2 +- .../model/invalid_password_exception.dart | 2 +- ...alid_sms_role_access_policy_exception.dart | 2 +- ...sms_role_trust_relationship_exception.dart | 2 +- ...lid_user_pool_configuration_exception.dart | 2 +- .../model/limit_exceeded_exception.dart | 2 +- .../model/list_devices_request.dart | 2 +- .../model/list_devices_response.dart | 2 +- .../model/mfa_method_not_found_exception.dart | 2 +- .../model/mfa_option_type.dart | 2 +- .../model/new_device_metadata_type.dart | 2 +- .../model/not_authorized_exception.dart | 2 +- ...rd_history_policy_violation_exception.dart | 148 ++++++++++++++++++ ..._history_policy_violation_exception.g.dart | 101 ++++++++++++ .../password_reset_required_exception.dart | 2 +- .../resend_confirmation_code_request.dart | 2 +- .../resend_confirmation_code_response.dart | 2 +- .../model/resource_not_found_exception.dart | 2 +- .../respond_to_auth_challenge_request.dart | 10 +- .../respond_to_auth_challenge_response.dart | 2 +- .../model/revoke_token_request.dart | 2 +- .../model/revoke_token_response.dart | 2 +- .../set_user_mfa_preference_request.dart | 31 +++- .../set_user_mfa_preference_request.g.dart | 15 ++ .../set_user_mfa_preference_response.dart | 2 +- .../model/sign_up_request.dart | 2 +- .../model/sign_up_response.dart | 4 +- .../model/sms_mfa_settings_type.dart | 4 +- ...oftware_token_mfa_not_found_exception.dart | 2 +- .../software_token_mfa_settings_type.dart | 2 +- .../too_many_failed_attempts_exception.dart | 2 +- .../model/too_many_requests_exception.dart | 2 +- .../model/unauthorized_exception.dart | 2 +- .../model/unexpected_lambda_exception.dart | 2 +- .../unsupported_operation_exception.dart | 2 +- .../unsupported_token_type_exception.dart | 2 +- .../model/update_device_status_request.dart | 2 +- .../model/update_device_status_response.dart | 2 +- .../model/update_user_attributes_request.dart | 2 +- .../update_user_attributes_response.dart | 2 +- .../model/user_context_data_type.dart | 2 +- .../user_lambda_validation_exception.dart | 2 +- .../model/user_not_confirmed_exception.dart | 2 +- .../model/user_not_found_exception.dart | 2 +- .../model/username_exists_exception.dart | 2 +- .../model/verify_software_token_request.dart | 2 +- .../model/verify_software_token_response.dart | 2 +- .../verify_software_token_response_type.dart | 2 +- .../model/verify_user_attribute_request.dart | 2 +- .../model/verify_user_attribute_response.dart | 2 +- .../associate_software_token_operation.dart | 8 +- .../operation/change_password_operation.dart | 16 +- .../operation/confirm_device_operation.dart | 4 +- .../confirm_forgot_password_operation.dart | 16 +- .../operation/confirm_sign_up_operation.dart | 4 +- .../operation/delete_user_operation.dart | 4 +- .../operation/forget_device_operation.dart | 4 +- .../operation/forgot_password_operation.dart | 8 +- .../operation/get_device_operation.dart | 4 +- ...attribute_verification_code_operation.dart | 8 +- .../operation/get_user_operation.dart | 4 +- .../operation/global_sign_out_operation.dart | 4 +- .../operation/initiate_auth_operation.dart | 20 ++- .../operation/list_devices_operation.dart | 4 +- .../resend_confirmation_code_operation.dart | 8 +- .../respond_to_auth_challenge_operation.dart | 32 +++- .../operation/revoke_token_operation.dart | 4 +- .../set_user_mfa_preference_operation.dart | 4 +- .../operation/sign_up_operation.dart | 8 +- .../update_device_status_operation.dart | 4 +- .../update_user_attributes_operation.dart | 8 +- .../verify_software_token_operation.dart | 4 +- .../verify_user_attribute_operation.dart | 4 +- 144 files changed, 845 insertions(+), 201 deletions(-) create mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.dart create mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.g.dart create mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.dart create mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.g.dart diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity.dart index bcac91000f..d3b8223bdb 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas /// # Amazon Cognito Identity diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity_provider.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity_provider.dart index 7682084c1c..3bc1811bc4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity_provider.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/cognito_identity_provider.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas /// # Amazon Cognito Identity Provider @@ -68,6 +68,7 @@ export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/ export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/device_remembered_status_type.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/device_secret_verifier_config_type.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/device_type.dart'; +export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/enable_software_token_mfa_exception.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/expired_code_exception.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/forbidden_exception.dart'; @@ -99,6 +100,7 @@ export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/ export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/mfa_option_type.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/new_device_metadata_type.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/not_authorized_exception.dart'; +export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/password_reset_required_exception.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_request.dart'; export 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_response.dart'; diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_exception.dart index fde039d5f1..78f5d3eaa8 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_exception.dart @@ -356,6 +356,22 @@ final class NotAuthorizedServiceException extends CognitoServiceException String get runtimeTypeName => 'NotAuthorizedServiceException'; } +/// {@template amplify_auth_cognito_dart.sdk_exception.password_history_policy_violation_exception} +/// The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy. +/// {@endtemplate} +final class PasswordHistoryPolicyViolationException + extends CognitoServiceException { + /// {@macro amplify_auth_cognito_dart.sdk_exception.password_history_policy_violation_exception} + const PasswordHistoryPolicyViolationException( + super.message, { + super.recoverySuggestion, + super.underlyingException, + }); + + @override + String get runtimeTypeName => 'PasswordHistoryPolicyViolationException'; +} + /// {@template amplify_auth_cognito_dart.sdk_exception.password_reset_required_exception} /// This exception is thrown when a password reset is required. /// {@endtemplate} @@ -685,6 +701,11 @@ Object transformSdkException(Object e) { message, underlyingException: e, ), + 'PasswordHistoryPolicyViolationException' => + PasswordHistoryPolicyViolationException( + message, + underlyingException: e, + ), 'PasswordResetRequiredException' => PasswordResetRequiredException( message, underlyingException: e, diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/cognito_identity_client.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/cognito_identity_client.dart index 4fce991aac..49472116d5 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/cognito_identity_client.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/cognito_identity_client.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.cognito_identity_client; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/endpoint_resolver.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/endpoint_resolver.dart index 7cd37f555f..aabe87df7f 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/endpoint_resolver.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/endpoint_resolver.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.common.endpoint_resolver; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/serializers.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/serializers.dart index 53d9ea9022..13d2996e70 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/serializers.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/common/serializers.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.common.serializers; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/credentials.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/credentials.dart index 4a9768bec5..f907c481b8 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/credentials.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/credentials.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.credentials; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -67,7 +67,7 @@ abstract class Credentials ) ..add( 'secretKey', - secretKey, + '***SENSITIVE***', ) ..add( 'sessionToken', diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/external_service_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/external_service_exception.dart index 40fea8d03e..9e9500945b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/external_service_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/external_service_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.external_service_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_input.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_input.dart index 76881a5f20..1ef8ddd869 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_input.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_input.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.get_credentials_for_identity_input; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_response.dart index 3bda9069de..6f83f4cf28 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_credentials_for_identity_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.get_credentials_for_identity_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_input.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_input.dart index 2469ffe450..15ed362231 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_input.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_input.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.get_id_input; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_response.dart index 17f61687d0..dfe391a845 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/get_id_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.get_id_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/internal_error_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/internal_error_exception.dart index c3aefa1100..4f5a7455e9 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/internal_error_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/internal_error_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.internal_error_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_identity_pool_configuration_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_identity_pool_configuration_exception.dart index 2e2b04cb49..c25b63d9fa 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_identity_pool_configuration_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_identity_pool_configuration_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.invalid_identity_pool_configuration_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_parameter_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_parameter_exception.dart index dd0e1bb993..881a613f75 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_parameter_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/invalid_parameter_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.invalid_parameter_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/limit_exceeded_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/limit_exceeded_exception.dart index d12231e2d3..4909ca0b94 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/limit_exceeded_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/limit_exceeded_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.limit_exceeded_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/not_authorized_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/not_authorized_exception.dart index 43841286cb..50add67fb4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/not_authorized_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/not_authorized_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.not_authorized_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_conflict_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_conflict_exception.dart index 5e5f88ad77..cc4b2f9846 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_conflict_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_conflict_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.resource_conflict_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_not_found_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_not_found_exception.dart index 2061531b78..1ba7efb1b3 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_not_found_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/resource_not_found_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.resource_not_found_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/too_many_requests_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/too_many_requests_exception.dart index 01a910e91a..e005c51ca2 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/too_many_requests_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/model/too_many_requests_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.model.too_many_requests_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_credentials_for_identity_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_credentials_for_identity_operation.dart index 0a3319e2d0..a70ab6465f 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_credentials_for_identity_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_credentials_for_identity_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.operation.get_credentials_for_identity_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -69,7 +69,7 @@ class GetCredentialsForIdentityOperation extends _i1.HttpOperation< credentialsProvider: _credentialsProvider, isOptional: true, ), - const _i1.WithUserAgent('aws-sdk-dart/0.3.1'), + const _i1.WithUserAgent('aws-sdk-dart/0.3.2'), const _i3.WithSdkInvocationId(), const _i3.WithSdkRequest(), ] + diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_id_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_id_operation.dart index c7aa76e5c4..5a9ebaa5b3 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_id_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity/operation/get_id_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity.operation.get_id_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -64,7 +64,7 @@ class GetIdOperation extends _i1 credentialsProvider: _credentialsProvider, isOptional: true, ), - const _i1.WithUserAgent('aws-sdk-dart/0.3.1'), + const _i1.WithUserAgent('aws-sdk-dart/0.3.2'), const _i3.WithSdkInvocationId(), const _i3.WithSdkRequest(), ] + diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/cognito_identity_provider_client.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/cognito_identity_provider_client.dart index 5b504d64fd..77dc73bc98 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/cognito_identity_provider_client.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/cognito_identity_provider_client.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.cognito_identity_provider_client; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -178,7 +178,7 @@ class CognitoIdentityProviderClient { /// Begins setup of time-based one-time password (TOTP) multi-factor authentication (MFA) for a user, with a unique private key that Amazon Cognito generates and returns in the API response. You can authorize an `AssociateSoftwareToken` request with either the user's access token, or a session string from a challenge response that you received from Amazon Cognito. /// - /// Amazon Cognito disassociates an existing software token when you verify the new token in a [VerifySoftwareToken](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerifySoftwareToken.html) API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an `MFA_SETUP` or `SOFTWARE\_TOKEN\_SETUP` challenge each time your user signs. Complete setup with `AssociateSoftwareToken` and `VerifySoftwareToken`. + /// Amazon Cognito disassociates an existing software token when you verify the new token in a [VerifySoftwareToken](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerifySoftwareToken.html) API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an `MFA_SETUP` or `SOFTWARE\_TOKEN\_SETUP` challenge each time your user signs in. Complete setup with `AssociateSoftwareToken` and `VerifySoftwareToken`. /// /// After you set up software token MFA for your user, Amazon Cognito generates a `SOFTWARE\_TOKEN\_MFA` challenge when they authenticate. Respond to this challenge with your user's TOTP. /// @@ -340,7 +340,7 @@ class CognitoIdentityProviderClient { /// /// This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with [Amazon Pinpoint](https://console.aws.amazon.com/pinpoint/home/). Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. /// - /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. + /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Servicesservice, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. _i3.SmithyOperation forgotPassword( ForgotPasswordRequest input, { _i1.AWSHttpClient? client, @@ -410,7 +410,7 @@ class CognitoIdentityProviderClient { /// /// This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with [Amazon Pinpoint](https://console.aws.amazon.com/pinpoint/home/). Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. /// - /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. + /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Servicesservice, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. _i3.SmithyOperation getUserAttributeVerificationCode( GetUserAttributeVerificationCodeRequest input, { @@ -468,7 +468,7 @@ class CognitoIdentityProviderClient { /// /// This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with [Amazon Pinpoint](https://console.aws.amazon.com/pinpoint/home/). Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. /// - /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. + /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Servicesservice, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. _i3.SmithyOperation initiateAuth( InitiateAuthRequest input, { _i1.AWSHttpClient? client, @@ -514,7 +514,7 @@ class CognitoIdentityProviderClient { /// /// This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with [Amazon Pinpoint](https://console.aws.amazon.com/pinpoint/home/). Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. /// - /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. + /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Servicesservice, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. _i3.SmithyOperation resendConfirmationCode( ResendConfirmationCodeRequest input, { _i1.AWSHttpClient? client, @@ -540,7 +540,7 @@ class CognitoIdentityProviderClient { /// /// This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with [Amazon Pinpoint](https://console.aws.amazon.com/pinpoint/home/). Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. /// - /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. + /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Servicesservice, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. _i3.SmithyOperation respondToAuthChallenge( RespondToAuthChallengeRequest input, { _i1.AWSHttpClient? client, @@ -606,7 +606,7 @@ class CognitoIdentityProviderClient { /// /// This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with [Amazon Pinpoint](https://console.aws.amazon.com/pinpoint/home/). Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. /// - /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. + /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Servicesservice, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. _i3.SmithyOperation signUp( SignUpRequest input, { _i1.AWSHttpClient? client, @@ -654,7 +654,7 @@ class CognitoIdentityProviderClient { /// /// This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with [Amazon Pinpoint](https://console.aws.amazon.com/pinpoint/home/). Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in. /// - /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. + /// If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Servicesservice, Amazon Simple Notification Service might place your account in the SMS sandbox. In _[sandbox mode](https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html)_ , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see [SMS message settings for Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html) in the _Amazon Cognito Developer Guide_. _i3.SmithyOperation updateUserAttributes( UpdateUserAttributesRequest input, { _i1.AWSHttpClient? client, diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/endpoint_resolver.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/endpoint_resolver.dart index aa6948f01b..87bbaf7dc7 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/endpoint_resolver.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/endpoint_resolver.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.common.endpoint_resolver; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/serializers.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/serializers.dart index 4bd6e82ab8..45d3210bcb 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/serializers.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/common/serializers.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.common.serializers; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -28,6 +28,7 @@ import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/ import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/device_remembered_status_type.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/device_secret_verifier_config_type.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/device_type.dart'; +import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/enable_software_token_mfa_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/expired_code_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/forbidden_exception.dart'; @@ -59,6 +60,7 @@ import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/ import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/mfa_option_type.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/new_device_metadata_type.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/not_authorized_exception.dart'; +import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/password_reset_required_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_request.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_response.dart'; @@ -112,6 +114,7 @@ const List<_i1.SmithySerializer> serializers = [ ...ChangePasswordResponse.serializers, ...InvalidPasswordException.serializers, ...LimitExceededException.serializers, + ...PasswordHistoryPolicyViolationException.serializers, ...PasswordResetRequiredException.serializers, ...TooManyRequestsException.serializers, ...UserNotConfirmedException.serializers, @@ -175,6 +178,7 @@ const List<_i1.SmithySerializer> serializers = [ ...UnsupportedTokenTypeException.serializers, ...SmsMfaSettingsType.serializers, ...SoftwareTokenMfaSettingsType.serializers, + ...EmailMfaSettingsType.serializers, ...SetUserMfaPreferenceRequest.serializers, ...SetUserMfaPreferenceResponse.serializers, ...SignUpRequest.serializers, diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/alias_exists_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/alias_exists_exception.dart index 6fe989ea5a..92daad3986 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/alias_exists_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/alias_exists_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.alias_exists_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/analytics_metadata_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/analytics_metadata_type.dart index 0c3b5e5cb1..3ce0fd64f0 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/analytics_metadata_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/analytics_metadata_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.analytics_metadata_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_request.dart index e85c27e777..68a490b537 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.associate_software_token_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_response.dart index 5d95699e30..c65a519903 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/associate_software_token_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.associate_software_token_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/attribute_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/attribute_type.dart index c05750b94f..d6e81f84e6 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/attribute_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/attribute_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.attribute_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/auth_flow_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/auth_flow_type.dart index b72dedfb0e..63ef0d3e8b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/auth_flow_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/auth_flow_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.auth_flow_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/authentication_result_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/authentication_result_type.dart index e28c05e8f8..fe4c1436b2 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/authentication_result_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/authentication_result_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.authentication_result_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart index 16183b5270..245f07151e 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/challenge_name_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.challenge_name_type; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -38,38 +38,44 @@ class ChallengeNameType extends _i1.SmithyEnum { 'DEVICE_SRP_AUTH', ); - static const mfaSetup = ChallengeNameType._( + static const emailOtp = ChallengeNameType._( 4, + 'EMAIL_OTP', + 'EMAIL_OTP', + ); + + static const mfaSetup = ChallengeNameType._( + 5, 'MFA_SETUP', 'MFA_SETUP', ); static const newPasswordRequired = ChallengeNameType._( - 5, + 6, 'NEW_PASSWORD_REQUIRED', 'NEW_PASSWORD_REQUIRED', ); static const passwordVerifier = ChallengeNameType._( - 6, + 7, 'PASSWORD_VERIFIER', 'PASSWORD_VERIFIER', ); static const selectMfaType = ChallengeNameType._( - 7, + 8, 'SELECT_MFA_TYPE', 'SELECT_MFA_TYPE', ); static const smsMfa = ChallengeNameType._( - 8, + 9, 'SMS_MFA', 'SMS_MFA', ); static const softwareTokenMfa = ChallengeNameType._( - 9, + 10, 'SOFTWARE_TOKEN_MFA', 'SOFTWARE_TOKEN_MFA', ); @@ -80,6 +86,7 @@ class ChallengeNameType extends _i1.SmithyEnum { ChallengeNameType.customChallenge, ChallengeNameType.devicePasswordVerifier, ChallengeNameType.deviceSrpAuth, + ChallengeNameType.emailOtp, ChallengeNameType.mfaSetup, ChallengeNameType.newPasswordRequired, ChallengeNameType.passwordVerifier, diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_request.dart index 1bee4684cf..aca8f246fd 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.change_password_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_response.dart index 6d32ca2ee8..4dfb38ac75 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/change_password_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.change_password_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_details_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_details_type.dart index 34f7889f1f..2017a74f76 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_details_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_details_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.code_delivery_details_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_failure_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_failure_exception.dart index ce4d865c5c..f3a73bfb96 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_failure_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_delivery_failure_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.code_delivery_failure_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_mismatch_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_mismatch_exception.dart index 470c29a6b7..40d59d121e 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_mismatch_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/code_mismatch_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.code_mismatch_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/concurrent_modification_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/concurrent_modification_exception.dart index af4d648e10..a93d170315 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/concurrent_modification_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/concurrent_modification_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.concurrent_modification_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_request.dart index c9a359ad63..36ec585c57 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.confirm_device_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_response.dart index c4a56e3d20..742d7b7880 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_device_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.confirm_device_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_request.dart index 5ee0b35e9a..7d2eae3eb4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.confirm_forgot_password_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_response.dart index 428faabe8b..a4bd14e09b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_forgot_password_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.confirm_forgot_password_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_request.dart index 674e4bf602..a3d08239b0 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.confirm_sign_up_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_response.dart index eb41e869cb..caba28a5c6 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/confirm_sign_up_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.confirm_sign_up_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delete_user_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delete_user_request.dart index a1945ea8b1..6da56f6fad 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delete_user_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delete_user_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.delete_user_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delivery_medium_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delivery_medium_type.dart index 157cc2712f..f2d8b3b06b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delivery_medium_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/delivery_medium_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.delivery_medium_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_remembered_status_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_remembered_status_type.dart index b7ec625425..6ea59d3c6e 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_remembered_status_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_remembered_status_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.device_remembered_status_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_secret_verifier_config_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_secret_verifier_config_type.dart index 69f90feee7..b001642117 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_secret_verifier_config_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_secret_verifier_config_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.device_secret_verifier_config_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_type.dart index f909f5c4cc..b48c396c5a 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/device_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.device_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.dart new file mode 100644 index 0000000000..f5871bb77d --- /dev/null +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.dart @@ -0,0 +1,147 @@ +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. +// ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas + +library amplify_auth_cognito_dart.cognito_identity_provider.model.email_mfa_settings_type; // ignore_for_file: no_leading_underscores_for_library_prefixes + +import 'package:aws_common/aws_common.dart' as _i1; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:smithy/smithy.dart' as _i2; + +part 'email_mfa_settings_type.g.dart'; + +/// User preferences for multi-factor authentication with email messages. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, [advanced security features](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html) must be active in your user pool. +abstract class EmailMfaSettingsType + with _i1.AWSEquatable + implements Built { + /// User preferences for multi-factor authentication with email messages. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, [advanced security features](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html) must be active in your user pool. + factory EmailMfaSettingsType({ + bool? enabled, + bool? preferredMfa, + }) { + enabled ??= false; + preferredMfa ??= false; + return _$EmailMfaSettingsType._( + enabled: enabled, + preferredMfa: preferredMfa, + ); + } + + /// User preferences for multi-factor authentication with email messages. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, [advanced security features](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html) must be active in your user pool. + factory EmailMfaSettingsType.build( + [void Function(EmailMfaSettingsTypeBuilder) updates]) = + _$EmailMfaSettingsType; + + const EmailMfaSettingsType._(); + + static const List<_i2.SmithySerializer> serializers = [ + EmailMfaSettingsTypeAwsJson11Serializer() + ]; + + @BuiltValueHook(initializeBuilder: true) + static void _init(EmailMfaSettingsTypeBuilder b) { + b + ..enabled = false + ..preferredMfa = false; + } + + /// Specifies whether email message MFA is active for a user. When the value of this parameter is `Enabled`, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted. + bool get enabled; + + /// Specifies whether email message MFA is the user's preferred method. + bool get preferredMfa; + @override + List get props => [ + enabled, + preferredMfa, + ]; + + @override + String toString() { + final helper = newBuiltValueToStringHelper('EmailMfaSettingsType') + ..add( + 'enabled', + enabled, + ) + ..add( + 'preferredMfa', + preferredMfa, + ); + return helper.toString(); + } +} + +class EmailMfaSettingsTypeAwsJson11Serializer + extends _i2.StructuredSmithySerializer { + const EmailMfaSettingsTypeAwsJson11Serializer() + : super('EmailMfaSettingsType'); + + @override + Iterable get types => const [ + EmailMfaSettingsType, + _$EmailMfaSettingsType, + ]; + + @override + Iterable<_i2.ShapeId> get supportedProtocols => const [ + _i2.ShapeId( + namespace: 'aws.protocols', + shape: 'awsJson1_1', + ) + ]; + + @override + EmailMfaSettingsType deserialize( + Serializers serializers, + Iterable serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EmailMfaSettingsTypeBuilder(); + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final value = iterator.current; + if (value == null) { + continue; + } + switch (key) { + case 'Enabled': + result.enabled = (serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool); + case 'PreferredMfa': + result.preferredMfa = (serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool); + } + } + + return result.build(); + } + + @override + Iterable serialize( + Serializers serializers, + EmailMfaSettingsType object, { + FullType specifiedType = FullType.unspecified, + }) { + final result$ = []; + final EmailMfaSettingsType(:enabled, :preferredMfa) = object; + result$.addAll([ + 'Enabled', + serializers.serialize( + enabled, + specifiedType: const FullType(bool), + ), + 'PreferredMfa', + serializers.serialize( + preferredMfa, + specifiedType: const FullType(bool), + ), + ]); + return result$; + } +} diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.g.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.g.dart new file mode 100644 index 0000000000..9be203c737 --- /dev/null +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.g.dart @@ -0,0 +1,106 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'email_mfa_settings_type.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +class _$EmailMfaSettingsType extends EmailMfaSettingsType { + @override + final bool enabled; + @override + final bool preferredMfa; + + factory _$EmailMfaSettingsType( + [void Function(EmailMfaSettingsTypeBuilder)? updates]) => + (new EmailMfaSettingsTypeBuilder()..update(updates))._build(); + + _$EmailMfaSettingsType._({required this.enabled, required this.preferredMfa}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + enabled, r'EmailMfaSettingsType', 'enabled'); + BuiltValueNullFieldError.checkNotNull( + preferredMfa, r'EmailMfaSettingsType', 'preferredMfa'); + } + + @override + EmailMfaSettingsType rebuild( + void Function(EmailMfaSettingsTypeBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + EmailMfaSettingsTypeBuilder toBuilder() => + new EmailMfaSettingsTypeBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is EmailMfaSettingsType && + enabled == other.enabled && + preferredMfa == other.preferredMfa; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, enabled.hashCode); + _$hash = $jc(_$hash, preferredMfa.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } +} + +class EmailMfaSettingsTypeBuilder + implements Builder { + _$EmailMfaSettingsType? _$v; + + bool? _enabled; + bool? get enabled => _$this._enabled; + set enabled(bool? enabled) => _$this._enabled = enabled; + + bool? _preferredMfa; + bool? get preferredMfa => _$this._preferredMfa; + set preferredMfa(bool? preferredMfa) => _$this._preferredMfa = preferredMfa; + + EmailMfaSettingsTypeBuilder() { + EmailMfaSettingsType._init(this); + } + + EmailMfaSettingsTypeBuilder get _$this { + final $v = _$v; + if ($v != null) { + _enabled = $v.enabled; + _preferredMfa = $v.preferredMfa; + _$v = null; + } + return this; + } + + @override + void replace(EmailMfaSettingsType other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$EmailMfaSettingsType; + } + + @override + void update(void Function(EmailMfaSettingsTypeBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + EmailMfaSettingsType build() => _build(); + + _$EmailMfaSettingsType _build() { + final _$result = _$v ?? + new _$EmailMfaSettingsType._( + enabled: BuiltValueNullFieldError.checkNotNull( + enabled, r'EmailMfaSettingsType', 'enabled'), + preferredMfa: BuiltValueNullFieldError.checkNotNull( + preferredMfa, r'EmailMfaSettingsType', 'preferredMfa')); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/enable_software_token_mfa_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/enable_software_token_mfa_exception.dart index ebfbade44b..dfbd457723 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/enable_software_token_mfa_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/enable_software_token_mfa_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.enable_software_token_mfa_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/expired_code_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/expired_code_exception.dart index 29f4dc36e5..f6ab049ad0 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/expired_code_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/expired_code_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.expired_code_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forbidden_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forbidden_exception.dart index 37ccbc6dcd..b97418f44b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forbidden_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forbidden_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.forbidden_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forget_device_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forget_device_request.dart index 57fa4dfe45..f716905bf4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forget_device_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forget_device_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.forget_device_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_request.dart index 206bf31593..de772a3506 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.forgot_password_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_response.dart index 92fe7f3db7..2d77bdb4ac 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/forgot_password_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.forgot_password_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_request.dart index 6f949ad858..d6068a3e65 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.get_device_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_response.dart index 62edc0d585..33bf747c39 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_device_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.get_device_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_request.dart index 183f2e2cb8..bc9f259d32 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.get_user_attribute_verification_code_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_response.dart index ab94635e1a..92e05abeac 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_attribute_verification_code_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.get_user_attribute_verification_code_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_request.dart index eea378cd8a..61c037aa61 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.get_user_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_response.dart index eb690fbcbf..249a5a3fdf 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/get_user_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.get_user_response; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -66,7 +66,7 @@ abstract class GetUserResponse /// The user's preferred MFA setting. String? get preferredMfaSetting; - /// The MFA options that are activated for the user. The possible values in this list are `SMS_MFA` and `SOFTWARE\_TOKEN\_MFA`. + /// The MFA options that are activated for the user. The possible values in this list are `SMS_MFA`, `EMAIL_OTP`, and `SOFTWARE\_TOKEN\_MFA`. _i2.BuiltList? get userMfaSettingList; @override List get props => [ diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_request.dart index 924d17c3d0..a19ee40a56 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.global_sign_out_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_response.dart index 2941bae7c3..0cd0cad3ba 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/global_sign_out_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.global_sign_out_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_request.dart index 299a26378f..d950158c01 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.initiate_auth_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_response.dart index b0d075afe3..b4d2d39b01 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/initiate_auth_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.initiate_auth_response; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -58,7 +58,9 @@ abstract class InitiateAuthResponse /// /// All of the following challenges require `USERNAME` and `SECRET_HASH` (if applicable) in the parameters. /// - /// * `SMS_MFA`: Next challenge is to supply an `SMS\_MFA\_CODE`, delivered via SMS. + /// * `SMS_MFA`: Next challenge is to supply an `SMS\_MFA\_CODE`that your user pool delivered in an SMS message. + /// + /// * `EMAIL_OTP`: Next challenge is to supply an `EMAIL\_OTP\_CODE` that your user pool delivered in an email message. /// /// * `PASSWORD_VERIFIER`: Next challenge is to supply `PASSWORD\_CLAIM\_SIGNATURE`, `PASSWORD\_CLAIM\_SECRET_BLOCK`, and `TIMESTAMP` after the client-side SRP calculations. /// diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/internal_error_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/internal_error_exception.dart index deacb16eb0..ba19414e69 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/internal_error_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/internal_error_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.internal_error_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_email_role_access_policy_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_email_role_access_policy_exception.dart index f5c51b1a95..9593759c9c 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_email_role_access_policy_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_email_role_access_policy_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.invalid_email_role_access_policy_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_lambda_response_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_lambda_response_exception.dart index 265347fda5..dcfeb43424 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_lambda_response_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_lambda_response_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.invalid_lambda_response_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_parameter_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_parameter_exception.dart index ba0823619b..daed39aae1 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_parameter_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_parameter_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.invalid_parameter_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_password_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_password_exception.dart index 52c7699f17..e4f651a82b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_password_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_password_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.invalid_password_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_access_policy_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_access_policy_exception.dart index 15e2e29d4d..857cce6009 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_access_policy_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_access_policy_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.invalid_sms_role_access_policy_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_trust_relationship_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_trust_relationship_exception.dart index 515fc9d07d..cf52736fff 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_trust_relationship_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_sms_role_trust_relationship_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.invalid_sms_role_trust_relationship_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_user_pool_configuration_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_user_pool_configuration_exception.dart index dbf2b347dc..62d8b0cec2 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_user_pool_configuration_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/invalid_user_pool_configuration_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.invalid_user_pool_configuration_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/limit_exceeded_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/limit_exceeded_exception.dart index c4ded607b3..fc3900ee8d 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/limit_exceeded_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/limit_exceeded_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.limit_exceeded_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_request.dart index 07201dab3d..3b2a6f0834 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.list_devices_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_response.dart index 50771c2b25..8de544538a 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/list_devices_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.list_devices_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_method_not_found_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_method_not_found_exception.dart index d159df70a6..f223bc69b0 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_method_not_found_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_method_not_found_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.mfa_method_not_found_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_option_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_option_type.dart index c880f267c7..e6d103c6da 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_option_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/mfa_option_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.mfa_option_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/new_device_metadata_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/new_device_metadata_type.dart index 69a24a5ad4..56c8dc4549 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/new_device_metadata_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/new_device_metadata_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.new_device_metadata_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/not_authorized_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/not_authorized_exception.dart index 8b8c71a14f..667a4e4e7e 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/not_authorized_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/not_authorized_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.not_authorized_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.dart new file mode 100644 index 0000000000..8558e99e29 --- /dev/null +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.dart @@ -0,0 +1,148 @@ +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. +// ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas + +library amplify_auth_cognito_dart.cognito_identity_provider.model.password_history_policy_violation_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes + +import 'package:aws_common/aws_common.dart' as _i1; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:smithy/smithy.dart' as _i2; + +part 'password_history_policy_violation_exception.g.dart'; + +/// The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy. +abstract class PasswordHistoryPolicyViolationException + with + _i1.AWSEquatable + implements + Built, + _i2.SmithyHttpException { + /// The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy. + factory PasswordHistoryPolicyViolationException({String? message}) { + return _$PasswordHistoryPolicyViolationException._(message: message); + } + + /// The message returned when a user's new password matches a previous password and doesn't comply with the password-history policy. + factory PasswordHistoryPolicyViolationException.build( + [void Function(PasswordHistoryPolicyViolationExceptionBuilder) + updates]) = _$PasswordHistoryPolicyViolationException; + + const PasswordHistoryPolicyViolationException._(); + + /// Constructs a [PasswordHistoryPolicyViolationException] from a [payload] and [response]. + factory PasswordHistoryPolicyViolationException.fromResponse( + PasswordHistoryPolicyViolationException payload, + _i1.AWSBaseHttpResponse response, + ) => + payload.rebuild((b) { + b.headers = response.headers; + }); + + static const List< + _i2.SmithySerializer> + serializers = [ + PasswordHistoryPolicyViolationExceptionAwsJson11Serializer() + ]; + + @override + String? get message; + @override + _i2.ShapeId get shapeId => const _i2.ShapeId( + namespace: 'com.amazonaws.cognitoidentityprovider', + shape: 'PasswordHistoryPolicyViolationException', + ); + + @override + _i2.RetryConfig? get retryConfig => null; + + @override + @BuiltValueField(compare: false) + int get statusCode => 400; + + @override + @BuiltValueField(compare: false) + Map? get headers; + @override + Exception? get underlyingException => null; + + @override + List get props => [message]; + + @override + String toString() { + final helper = + newBuiltValueToStringHelper('PasswordHistoryPolicyViolationException') + ..add( + 'message', + message, + ); + return helper.toString(); + } +} + +class PasswordHistoryPolicyViolationExceptionAwsJson11Serializer extends _i2 + .StructuredSmithySerializer { + const PasswordHistoryPolicyViolationExceptionAwsJson11Serializer() + : super('PasswordHistoryPolicyViolationException'); + + @override + Iterable get types => const [ + PasswordHistoryPolicyViolationException, + _$PasswordHistoryPolicyViolationException, + ]; + + @override + Iterable<_i2.ShapeId> get supportedProtocols => const [ + _i2.ShapeId( + namespace: 'aws.protocols', + shape: 'awsJson1_1', + ) + ]; + + @override + PasswordHistoryPolicyViolationException deserialize( + Serializers serializers, + Iterable serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PasswordHistoryPolicyViolationExceptionBuilder(); + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final value = iterator.current; + if (value == null) { + continue; + } + switch (key) { + case 'message': + result.message = (serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String); + } + } + + return result.build(); + } + + @override + Iterable serialize( + Serializers serializers, + PasswordHistoryPolicyViolationException object, { + FullType specifiedType = FullType.unspecified, + }) { + final result$ = []; + final PasswordHistoryPolicyViolationException(:message) = object; + if (message != null) { + result$ + ..add('message') + ..add(serializers.serialize( + message, + specifiedType: const FullType(String), + )); + } + return result$; + } +} diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.g.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.g.dart new file mode 100644 index 0000000000..14462c7c57 --- /dev/null +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.g.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'password_history_policy_violation_exception.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +class _$PasswordHistoryPolicyViolationException + extends PasswordHistoryPolicyViolationException { + @override + final String? message; + @override + final Map? headers; + + factory _$PasswordHistoryPolicyViolationException( + [void Function(PasswordHistoryPolicyViolationExceptionBuilder)? + updates]) => + (new PasswordHistoryPolicyViolationExceptionBuilder()..update(updates)) + ._build(); + + _$PasswordHistoryPolicyViolationException._({this.message, this.headers}) + : super._(); + + @override + PasswordHistoryPolicyViolationException rebuild( + void Function(PasswordHistoryPolicyViolationExceptionBuilder) + updates) => + (toBuilder()..update(updates)).build(); + + @override + PasswordHistoryPolicyViolationExceptionBuilder toBuilder() => + new PasswordHistoryPolicyViolationExceptionBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is PasswordHistoryPolicyViolationException && + message == other.message; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, message.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } +} + +class PasswordHistoryPolicyViolationExceptionBuilder + implements + Builder { + _$PasswordHistoryPolicyViolationException? _$v; + + String? _message; + String? get message => _$this._message; + set message(String? message) => _$this._message = message; + + Map? _headers; + Map? get headers => _$this._headers; + set headers(Map? headers) => _$this._headers = headers; + + PasswordHistoryPolicyViolationExceptionBuilder(); + + PasswordHistoryPolicyViolationExceptionBuilder get _$this { + final $v = _$v; + if ($v != null) { + _message = $v.message; + _headers = $v.headers; + _$v = null; + } + return this; + } + + @override + void replace(PasswordHistoryPolicyViolationException other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$PasswordHistoryPolicyViolationException; + } + + @override + void update( + void Function(PasswordHistoryPolicyViolationExceptionBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + PasswordHistoryPolicyViolationException build() => _build(); + + _$PasswordHistoryPolicyViolationException _build() { + final _$result = _$v ?? + new _$PasswordHistoryPolicyViolationException._( + message: message, headers: headers); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_reset_required_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_reset_required_exception.dart index 3d93fd22a1..0e4500dc25 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_reset_required_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/password_reset_required_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.password_reset_required_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_request.dart index 4cf8678d2d..94ad518a90 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.resend_confirmation_code_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_response.dart index 808df308e4..6a214d00dc 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resend_confirmation_code_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.resend_confirmation_code_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resource_not_found_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resource_not_found_exception.dart index d54f471e9e..925645afe5 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resource_not_found_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/resource_not_found_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.resource_not_found_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_request.dart index 6d45689bc9..06ac52c376 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.respond_to_auth_challenge_request; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -79,10 +79,16 @@ abstract class RespondToAuthChallengeRequest /// /// SMS_MFA /// - /// `"ChallengeName": "SMS\_MFA", "ChallengeResponses": {"SMS\_MFA\_CODE": "\[SMS\_code\]", "USERNAME": "\[username\]"}` + /// `"ChallengeName": "SMS\_MFA", "ChallengeResponses": {"SMS\_MFA_CODE": "\[code\]", "USERNAME": "\[username\]"}` + /// + /// EMAIL_OTP + /// + /// `"ChallengeName": "EMAIL\_OTP", "ChallengeResponses": {"EMAIL\_OTP_CODE": "\[code\]", "USERNAME": "\[username\]"}` /// /// PASSWORD_VERIFIER /// + /// This challenge response is part of the SRP flow. Amazon Cognito requires that your application respond to this challenge within a few seconds. When the response time exceeds this period, your user pool returns a `NotAuthorizedException` error. + /// /// `"ChallengeName": "PASSWORD\_VERIFIER", "ChallengeResponses": {"PASSWORD\_CLAIM\_SIGNATURE": "\[claim\_signature\]", "PASSWORD\_CLAIM\_SECRET\_BLOCK": "\[secret\_block\]", "TIMESTAMP": \[timestamp\], "USERNAME": "\[username\]"}` /// /// Add `"DEVICE_KEY"` when you sign in with a remembered device. diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_response.dart index d2cef93d19..8ea2f06cec 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/respond_to_auth_challenge_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.respond_to_auth_challenge_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_request.dart index 7a46034d7d..423af9fabe 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.revoke_token_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_response.dart index 566e257c2a..d9e99039d3 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/revoke_token_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.revoke_token_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.dart index 6a541e339c..04bb1ad29b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.dart @@ -1,8 +1,9 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.set_user_mfa_preference_request; // ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/email_mfa_settings_type.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/sms_mfa_settings_type.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/software_token_mfa_settings_type.dart'; import 'package:aws_common/aws_common.dart' as _i2; @@ -21,11 +22,13 @@ abstract class SetUserMfaPreferenceRequest factory SetUserMfaPreferenceRequest({ SmsMfaSettingsType? smsMfaSettings, SoftwareTokenMfaSettingsType? softwareTokenMfaSettings, + EmailMfaSettingsType? emailMfaSettings, required String accessToken, }) { return _$SetUserMfaPreferenceRequest._( smsMfaSettings: smsMfaSettings, softwareTokenMfaSettings: softwareTokenMfaSettings, + emailMfaSettings: emailMfaSettings, accessToken: accessToken, ); } @@ -46,12 +49,15 @@ abstract class SetUserMfaPreferenceRequest static const List<_i1.SmithySerializer> serializers = [SetUserMfaPreferenceRequestAwsJson11Serializer()]; - /// The SMS text message multi-factor authentication (MFA) settings. + /// User preferences for SMS message MFA. Activates or deactivates SMS MFA and sets it as the preferred MFA method when multiple methods are available. SmsMfaSettingsType? get smsMfaSettings; - /// The time-based one-time password (TOTP) software token MFA settings. + /// User preferences for time-based one-time password (TOTP) MFA. Activates or deactivates TOTP MFA and sets it as the preferred MFA method when multiple methods are available. SoftwareTokenMfaSettingsType? get softwareTokenMfaSettings; + /// User preferences for email message MFA. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, [advanced security features](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html) must be active in your user pool. + EmailMfaSettingsType? get emailMfaSettings; + /// A valid access token that Amazon Cognito issued to the user whose MFA preference you want to set. String get accessToken; @override @@ -61,6 +67,7 @@ abstract class SetUserMfaPreferenceRequest List get props => [ smsMfaSettings, softwareTokenMfaSettings, + emailMfaSettings, accessToken, ]; @@ -75,6 +82,10 @@ abstract class SetUserMfaPreferenceRequest 'softwareTokenMfaSettings', softwareTokenMfaSettings, ) + ..add( + 'emailMfaSettings', + emailMfaSettings, + ) ..add( 'accessToken', '***SENSITIVE***', @@ -128,6 +139,11 @@ class SetUserMfaPreferenceRequestAwsJson11Serializer value, specifiedType: const FullType(SoftwareTokenMfaSettingsType), ) as SoftwareTokenMfaSettingsType)); + case 'EmailMfaSettings': + result.emailMfaSettings.replace((serializers.deserialize( + value, + specifiedType: const FullType(EmailMfaSettingsType), + ) as EmailMfaSettingsType)); case 'AccessToken': result.accessToken = (serializers.deserialize( value, @@ -149,6 +165,7 @@ class SetUserMfaPreferenceRequestAwsJson11Serializer final SetUserMfaPreferenceRequest( :smsMfaSettings, :softwareTokenMfaSettings, + :emailMfaSettings, :accessToken ) = object; result$.addAll([ @@ -174,6 +191,14 @@ class SetUserMfaPreferenceRequestAwsJson11Serializer specifiedType: const FullType(SoftwareTokenMfaSettingsType), )); } + if (emailMfaSettings != null) { + result$ + ..add('EmailMfaSettings') + ..add(serializers.serialize( + emailMfaSettings, + specifiedType: const FullType(EmailMfaSettingsType), + )); + } return result$; } } diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.g.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.g.dart index ca68a57587..fec5ce2c1e 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.g.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_request.g.dart @@ -12,6 +12,8 @@ class _$SetUserMfaPreferenceRequest extends SetUserMfaPreferenceRequest { @override final SoftwareTokenMfaSettingsType? softwareTokenMfaSettings; @override + final EmailMfaSettingsType? emailMfaSettings; + @override final String accessToken; factory _$SetUserMfaPreferenceRequest( @@ -21,6 +23,7 @@ class _$SetUserMfaPreferenceRequest extends SetUserMfaPreferenceRequest { _$SetUserMfaPreferenceRequest._( {this.smsMfaSettings, this.softwareTokenMfaSettings, + this.emailMfaSettings, required this.accessToken}) : super._() { BuiltValueNullFieldError.checkNotNull( @@ -42,6 +45,7 @@ class _$SetUserMfaPreferenceRequest extends SetUserMfaPreferenceRequest { return other is SetUserMfaPreferenceRequest && smsMfaSettings == other.smsMfaSettings && softwareTokenMfaSettings == other.softwareTokenMfaSettings && + emailMfaSettings == other.emailMfaSettings && accessToken == other.accessToken; } @@ -50,6 +54,7 @@ class _$SetUserMfaPreferenceRequest extends SetUserMfaPreferenceRequest { var _$hash = 0; _$hash = $jc(_$hash, smsMfaSettings.hashCode); _$hash = $jc(_$hash, softwareTokenMfaSettings.hashCode); + _$hash = $jc(_$hash, emailMfaSettings.hashCode); _$hash = $jc(_$hash, accessToken.hashCode); _$hash = $jf(_$hash); return _$hash; @@ -76,6 +81,12 @@ class SetUserMfaPreferenceRequestBuilder SoftwareTokenMfaSettingsTypeBuilder? softwareTokenMfaSettings) => _$this._softwareTokenMfaSettings = softwareTokenMfaSettings; + EmailMfaSettingsTypeBuilder? _emailMfaSettings; + EmailMfaSettingsTypeBuilder get emailMfaSettings => + _$this._emailMfaSettings ??= new EmailMfaSettingsTypeBuilder(); + set emailMfaSettings(EmailMfaSettingsTypeBuilder? emailMfaSettings) => + _$this._emailMfaSettings = emailMfaSettings; + String? _accessToken; String? get accessToken => _$this._accessToken; set accessToken(String? accessToken) => _$this._accessToken = accessToken; @@ -87,6 +98,7 @@ class SetUserMfaPreferenceRequestBuilder if ($v != null) { _smsMfaSettings = $v.smsMfaSettings?.toBuilder(); _softwareTokenMfaSettings = $v.softwareTokenMfaSettings?.toBuilder(); + _emailMfaSettings = $v.emailMfaSettings?.toBuilder(); _accessToken = $v.accessToken; _$v = null; } @@ -114,6 +126,7 @@ class SetUserMfaPreferenceRequestBuilder new _$SetUserMfaPreferenceRequest._( smsMfaSettings: _smsMfaSettings?.build(), softwareTokenMfaSettings: _softwareTokenMfaSettings?.build(), + emailMfaSettings: _emailMfaSettings?.build(), accessToken: BuiltValueNullFieldError.checkNotNull( accessToken, r'SetUserMfaPreferenceRequest', 'accessToken')); } catch (_) { @@ -123,6 +136,8 @@ class SetUserMfaPreferenceRequestBuilder _smsMfaSettings?.build(); _$failedField = 'softwareTokenMfaSettings'; _softwareTokenMfaSettings?.build(); + _$failedField = 'emailMfaSettings'; + _emailMfaSettings?.build(); } catch (e) { throw new BuiltValueNestedFieldError( r'SetUserMfaPreferenceRequest', _$failedField, e.toString()); diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_response.dart index 371c315986..bfb06d87f1 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/set_user_mfa_preference_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.set_user_mfa_preference_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_request.dart index c3363048cb..8709755f15 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.sign_up_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_response.dart index c20050a0b7..5c5dc0cf4c 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sign_up_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.sign_up_response; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -57,7 +57,7 @@ abstract class SignUpResponse /// The code delivery details returned by the server response to the user registration request. CodeDeliveryDetailsType? get codeDeliveryDetails; - /// The UUID of the authenticated user. This isn't the same as `username`. + /// The 128-bit ID of the authenticated user. This isn't the same as `username`. String get userSub; @override List get props => [ diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sms_mfa_settings_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sms_mfa_settings_type.dart index 5fbcc78d0a..c69f645d76 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sms_mfa_settings_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/sms_mfa_settings_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.sms_mfa_settings_type; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -45,7 +45,7 @@ abstract class SmsMfaSettingsType ..preferredMfa = false; } - /// Specifies whether SMS text message MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted. + /// Specifies whether SMS message MFA is activated. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been trusted. bool get enabled; /// Specifies whether SMS is the preferred MFA method. diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_not_found_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_not_found_exception.dart index b886706039..b3e013dc50 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_not_found_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_not_found_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.software_token_mfa_not_found_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_settings_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_settings_type.dart index 25cfafd5a3..1aee62a4d4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_settings_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/software_token_mfa_settings_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.software_token_mfa_settings_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_failed_attempts_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_failed_attempts_exception.dart index c487f39ff6..df9e4d77e4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_failed_attempts_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_failed_attempts_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.too_many_failed_attempts_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_requests_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_requests_exception.dart index b1cb3aaa5f..dcf1d32175 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_requests_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/too_many_requests_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.too_many_requests_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unauthorized_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unauthorized_exception.dart index 50ecabe32d..e5c09b5106 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unauthorized_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unauthorized_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.unauthorized_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unexpected_lambda_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unexpected_lambda_exception.dart index 34a02e236b..474492765a 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unexpected_lambda_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unexpected_lambda_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.unexpected_lambda_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_operation_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_operation_exception.dart index c31068e2ae..0e4b511b26 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_operation_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_operation_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.unsupported_operation_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_token_type_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_token_type_exception.dart index 2979954ab5..acff97bd7d 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_token_type_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/unsupported_token_type_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.unsupported_token_type_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_request.dart index 1935e80768..3c50ce8453 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.update_device_status_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_response.dart index 970c2e9b97..81f5daaa34 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_device_status_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.update_device_status_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_request.dart index 49238c60f8..50c621fa40 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.update_user_attributes_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_response.dart index a8dbfabd2c..65a464efff 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/update_user_attributes_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.update_user_attributes_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_context_data_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_context_data_type.dart index 5f214b4004..f98d85cfd4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_context_data_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_context_data_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.user_context_data_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_lambda_validation_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_lambda_validation_exception.dart index 225e45dbca..19a37c5299 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_lambda_validation_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_lambda_validation_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.user_lambda_validation_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_confirmed_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_confirmed_exception.dart index a75f0605f2..1ba1c2d2e8 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_confirmed_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_confirmed_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.user_not_confirmed_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_found_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_found_exception.dart index 9d0d33889c..060958dac4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_found_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/user_not_found_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.user_not_found_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/username_exists_exception.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/username_exists_exception.dart index 0d1ad7b19b..6a5e063454 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/username_exists_exception.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/username_exists_exception.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.username_exists_exception; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_request.dart index 78199373a4..b880b6ff91 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.verify_software_token_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response.dart index 706fc241fe..5084e7f717 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.verify_software_token_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response_type.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response_type.dart index 4fa5346f09..5de62aad58 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response_type.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_software_token_response_type.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.verify_software_token_response_type; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_request.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_request.dart index 7603269bcb..0ab9eb603b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_request.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_request.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.verify_user_attribute_request; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_response.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_response.dart index 79883fe9ed..2bd2b4cd53 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_response.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/model/verify_user_attribute_response.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.model.verify_user_attribute_response; // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/associate_software_token_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/associate_software_token_operation.dart index 8a63714d88..a59df7d709 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/associate_software_token_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/associate_software_token_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.operation.associate_software_token_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -23,7 +23,7 @@ import 'package:smithy_aws/smithy_aws.dart' as _i3; /// Begins setup of time-based one-time password (TOTP) multi-factor authentication (MFA) for a user, with a unique private key that Amazon Cognito generates and returns in the API response. You can authorize an `AssociateSoftwareToken` request with either the user's access token, or a session string from a challenge response that you received from Amazon Cognito. /// -/// Amazon Cognito disassociates an existing software token when you verify the new token in a [VerifySoftwareToken](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerifySoftwareToken.html) API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an `MFA_SETUP` or `SOFTWARE\_TOKEN\_SETUP` challenge each time your user signs. Complete setup with `AssociateSoftwareToken` and `VerifySoftwareToken`. +/// Amazon Cognito disassociates an existing software token when you verify the new token in a [VerifySoftwareToken](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerifySoftwareToken.html) API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an `MFA_SETUP` or `SOFTWARE\_TOKEN\_SETUP` challenge each time your user signs in. Complete setup with `AssociateSoftwareToken` and `VerifySoftwareToken`. /// /// After you set up software token MFA for your user, Amazon Cognito generates a `SOFTWARE\_TOKEN\_MFA` challenge when they authenticate. Respond to this challenge with your user's TOTP. /// @@ -35,7 +35,7 @@ class AssociateSoftwareTokenOperation extends _i1.HttpOperation< AssociateSoftwareTokenResponse> { /// Begins setup of time-based one-time password (TOTP) multi-factor authentication (MFA) for a user, with a unique private key that Amazon Cognito generates and returns in the API response. You can authorize an `AssociateSoftwareToken` request with either the user's access token, or a session string from a challenge response that you received from Amazon Cognito. /// - /// Amazon Cognito disassociates an existing software token when you verify the new token in a [VerifySoftwareToken](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerifySoftwareToken.html) API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an `MFA_SETUP` or `SOFTWARE\_TOKEN\_SETUP` challenge each time your user signs. Complete setup with `AssociateSoftwareToken` and `VerifySoftwareToken`. + /// Amazon Cognito disassociates an existing software token when you verify the new token in a [VerifySoftwareToken](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerifySoftwareToken.html) API request. If you don't verify the software token and your user pool doesn't require MFA, the user can then authenticate with user name and password credentials alone. If your user pool requires TOTP MFA, Amazon Cognito generates an `MFA_SETUP` or `SOFTWARE\_TOKEN\_SETUP` challenge each time your user signs in. Complete setup with `AssociateSoftwareToken` and `VerifySoftwareToken`. /// /// After you set up software token MFA for your user, Amazon Cognito generates a `SOFTWARE\_TOKEN\_MFA` challenge when they authenticate. Respond to this challenge with your user's TOTP. /// @@ -76,7 +76,7 @@ class AssociateSoftwareTokenOperation extends _i1.HttpOperation< credentialsProvider: _credentialsProvider, isOptional: true, ), - const _i1.WithUserAgent('aws-sdk-dart/0.3.1'), + const _i1.WithUserAgent('aws-sdk-dart/0.3.2'), const _i3.WithSdkInvocationId(), const _i3.WithSdkRequest(), ] + diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/change_password_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/change_password_operation.dart index 81918f776a..7b6f0b0a20 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/change_password_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/change_password_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.operation.change_password_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -15,6 +15,7 @@ import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/ import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/invalid_password_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/limit_exceeded_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/not_authorized_exception.dart'; +import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/password_history_policy_violation_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/password_reset_required_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/resource_not_found_exception.dart'; import 'package:amplify_auth_cognito_dart/src/sdk/src/cognito_identity_provider/model/too_many_requests_exception.dart'; @@ -70,7 +71,7 @@ class ChangePasswordOperation extends _i1.HttpOperation( + _i1.ShapeId( + namespace: 'com.amazonaws.cognitoidentityprovider', + shape: 'PasswordHistoryPolicyViolationException', + ), + _i1.ErrorKind.client, + PasswordHistoryPolicyViolationException, + statusCode: 400, + builder: PasswordHistoryPolicyViolationException.fromResponse, + ), _i1.SmithyError( _i1.ShapeId( diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_device_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_device_operation.dart index 27c5bc8073..5e6c9a0969 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_device_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_device_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.operation.confirm_device_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -72,7 +72,7 @@ class ConfirmDeviceOperation extends _i1.HttpOperation( + _i1.ShapeId( + namespace: 'com.amazonaws.cognitoidentityprovider', + shape: 'PasswordHistoryPolicyViolationException', + ), + _i1.ErrorKind.client, + PasswordHistoryPolicyViolationException, + statusCode: 400, + builder: PasswordHistoryPolicyViolationException.fromResponse, + ), _i1.SmithyError( _i1.ShapeId( namespace: 'com.amazonaws.cognitoidentityprovider', diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_sign_up_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_sign_up_operation.dart index 9d62149fbf..dd03525a4f 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_sign_up_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/confirm_sign_up_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.operation.confirm_sign_up_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -74,7 +74,7 @@ class ConfirmSignUpOperation extends _i1.HttpOperation { /// Calling this API causes a message to be sent to the end user with a confirmation code that is required to change the user's password. For the `Username` parameter, you can use the username or user alias. The method used to send the confirmation code is sent according to the specified AccountRecoverySetting. For more information, see [Recovering User Accounts](https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-recover-a-user-account.html) in the _Amazon Cognito Developer Guide_. To use the confirmation code for resetting the password, call [ConfirmForgotPassword](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ConfirmForgotPassword.html). @@ -52,7 +52,7 @@ class ForgotPasswordOperation extends _i1.HttpOperation { /// Initiates sign-in for a user in the Amazon Cognito user directory. You can't sign in a user with a federated IdP with `InitiateAuth`. For more information, see [Adding user pool sign-in through a third party](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-identity-federation.html). @@ -44,7 +45,7 @@ class InitiateAuthOperation extends _i1.HttpOperation( + _i1.ShapeId( + namespace: 'com.amazonaws.cognitoidentityprovider', + shape: 'InvalidEmailRoleAccessPolicyException', + ), + _i1.ErrorKind.client, + InvalidEmailRoleAccessPolicyException, + statusCode: 400, + builder: InvalidEmailRoleAccessPolicyException.fromResponse, + ), _i1.SmithyError( _i1.ShapeId( diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/list_devices_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/list_devices_operation.dart index 3c17fd4b17..e9087a8151 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/list_devices_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/list_devices_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.operation.list_devices_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -69,7 +69,7 @@ class ListDevicesOperation extends _i1.HttpOperation( + _i1.ShapeId( + namespace: 'com.amazonaws.cognitoidentityprovider', + shape: 'InvalidEmailRoleAccessPolicyException', + ), + _i1.ErrorKind.client, + InvalidEmailRoleAccessPolicyException, + statusCode: 400, + builder: InvalidEmailRoleAccessPolicyException.fromResponse, + ), _i1.SmithyError( _i1.ShapeId( @@ -274,6 +287,17 @@ class RespondToAuthChallengeOperation extends _i1.HttpOperation< statusCode: 403, builder: NotAuthorizedException.fromResponse, ), + _i1.SmithyError( + _i1.ShapeId( + namespace: 'com.amazonaws.cognitoidentityprovider', + shape: 'PasswordHistoryPolicyViolationException', + ), + _i1.ErrorKind.client, + PasswordHistoryPolicyViolationException, + statusCode: 400, + builder: PasswordHistoryPolicyViolationException.fromResponse, + ), _i1.SmithyError( _i1.ShapeId( diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/revoke_token_operation.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/revoke_token_operation.dart index 7ae9abe992..e7878fd5f7 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/revoke_token_operation.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/src/cognito_identity_provider/operation/revoke_token_operation.dart @@ -1,4 +1,4 @@ -// Generated with smithy-dart 0.3.1. DO NOT MODIFY. +// Generated with smithy-dart 0.3.2. DO NOT MODIFY. // ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas library amplify_auth_cognito_dart.cognito_identity_provider.operation.revoke_token_operation; // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -62,7 +62,7 @@ class RevokeTokenOperation extends _i1.HttpOperation { /// Registers the user in the specified user pool and creates a user name, password, and user attributes. @@ -45,7 +45,7 @@ class SignUpOperation extends _i1.HttpOperation Date: Fri, 13 Sep 2024 16:38:52 -0700 Subject: [PATCH 12/52] chore: fix merge changes and sdk challenge name --- .../auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart | 2 +- .../lib/src/state/machines/sign_in_state_machine.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index 593b38a583..ec6a73d46c 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -33,7 +33,7 @@ extension ChallengeNameTypeBridge on ChallengeNameType { ChallengeNameType.softwareTokenMfa => AuthSignInStep.confirmSignInWithTotpMfaCode, // TODO(khatruong2009): confirm ChallengeNameType.emailMfa is added to SDK - ChallengeNameType.emailMfa => AuthSignInStep.confirmSignInWithEmailMfaCode, + ChallengeNameType.emailOtp => AuthSignInStep.confirmSignInWithEmailMfaCode, ChallengeNameType.adminNoSrpAuth || ChallengeNameType.passwordVerifier || ChallengeNameType.devicePasswordVerifier || diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 46666c79fd..024e39c875 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -458,7 +458,7 @@ final class SignInStateMachine _enableMfaType = MfaType.email; return RespondToAuthChallengeRequest.build((b) { b - ..clientId = config.appClientId + ..clientId = _authOutputs.userPoolClientId ..challengeName = _challengeName ..challengeResponses.addAll({ CognitoConstants.challengeParamUsername: cognitoUsername, From c98ce74a40684320b0fca2722d23a89c898ea773 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:40:46 -0700 Subject: [PATCH 13/52] chore: fix name of challenge to match with SDK changes and updated state machine --- .../lib/src/flows/constants.dart | 2 +- .../lib/src/state/machines/sign_in_state_machine.dart | 7 +++++-- .../lib/src/l10n/generated/input_localizations.dart | 6 ++++++ .../lib/src/l10n/generated/input_localizations_en.dart | 3 +++ .../lib/src/l10n/input_resolver.dart | 8 ++++++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart index ff49ec7974..536c33c529 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart @@ -58,7 +58,7 @@ abstract class CognitoConstants { static const challengeParamSmsMfaCode = 'SMS_MFA_CODE'; /// The `EMAIL_MFA_CODE` parameter. - static const challengeParamEmailMfaCode = 'EMAIL_MFA_CODE'; + static const challengeParamEmailMfaCode = 'EMAIL_OTP_CODE'; /// The `SOFTWARE_TOKEN_MFA_CODE` parameter. static const challengeParamSoftwareTokenMfaCode = 'SOFTWARE_TOKEN_MFA_CODE'; diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 024e39c875..4dbc775736 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -211,7 +211,7 @@ final class SignInStateMachine (type) => switch (type) { 'SOFTWARE_TOKEN_MFA' => MfaType.totp, 'SMS_MFA' => MfaType.sms, - 'EMAIL_MFA' => MfaType.email, + 'EMAIL_OTP' => MfaType.email, _ => () { logger.error('Unrecognized MFA type: $type'); return null; @@ -326,6 +326,8 @@ final class SignInStateMachine createSmsMfaRequest(event), ChallengeNameType.softwareTokenMfa when hasUserResponse => createSoftwareTokenMfaRequest(event), + ChallengeNameType.emailOtp when hasUserResponse => + createEmailMfaRequest(event), ChallengeNameType.selectMfaType when hasUserResponse => createSelectMfaRequest(event), ChallengeNameType.mfaSetup when hasUserResponse => @@ -686,7 +688,7 @@ final class SignInStateMachine CognitoConstants.challengeParamAnswer: switch (selection) { 'sms' => 'SMS_MFA', 'totp' => 'SOFTWARE_TOKEN_MFA', - 'email' => 'EMAIL_MFA', + 'email' => 'EMAIL_OTP', _ => throw ArgumentError('Must be either SMS, Email, or TOTP'), }, }) @@ -954,6 +956,7 @@ final class SignInStateMachine accessToken: accessToken, sms: enableMfaType == MfaType.sms ? MfaPreference.enabled : null, totp: enableMfaType == MfaType.totp ? MfaPreference.enabled : null, + email: enableMfaType == MfaType.email ? MfaPreference.enabled : null, ); } on Exception catch (e, st) { logger.error( diff --git a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart index 178e5b3eeb..c86a8a9ed4 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart @@ -297,6 +297,12 @@ abstract class AuthenticatorInputLocalizations { /// **'Authenticator App (TOTP)'** String get selectTotp; + /// Label for the radio button to select email as the user's chosen MFA method. + /// + /// In en, this message translates to: + /// **'Email'** + String get selectEmail; + /// The instructional text for submitting a TOTP pass code /// /// In en, this message translates to: diff --git a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations_en.dart b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations_en.dart index dcd9c0139c..6b6d42a494 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations_en.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations_en.dart @@ -153,6 +153,9 @@ class AuthenticatorInputLocalizationsEn @override String get selectTotp => 'Authenticator App (TOTP)'; + @override + String get selectEmail => 'Email'; + @override String get totpCodePrompt => 'Please enter the code from your registered Authenticator app'; diff --git a/packages/authenticator/amplify_authenticator/lib/src/l10n/input_resolver.dart b/packages/authenticator/amplify_authenticator/lib/src/l10n/input_resolver.dart index ad9eed1b0c..4b04f86962 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/l10n/input_resolver.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/l10n/input_resolver.dart @@ -33,6 +33,7 @@ enum InputField { rememberDevice, selectSms, selectTotp, + selectEmail, totpCodePrompt, usernameType, } @@ -171,6 +172,11 @@ class InputResolverKey { field: InputField.selectSms, ); + static const selectEmail = InputResolverKey._( + InputResolverKeyType.title, + field: InputField.email, + ); + static const totpCodePrompt = InputResolverKey._( InputResolverKeyType.title, field: InputField.totpCodePrompt, @@ -456,6 +462,8 @@ class InputResolver extends Resolver { return AuthenticatorLocalizations.inputsOf(context).selectSms; case InputField.selectTotp: return AuthenticatorLocalizations.inputsOf(context).selectTotp; + case InputField.selectEmail: + return AuthenticatorLocalizations.inputsOf(context).selectEmail; case InputField.totpCodePrompt: return AuthenticatorLocalizations.inputsOf(context).totpCodePrompt; case InputField.usernameType: From c1d33e3ed83c407331594ce69c9322f1c1ee1301 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:47:32 -0700 Subject: [PATCH 14/52] chore: edit doc comment in auth_plugin_impl --- .../amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart index f080f48fc2..02b5a8e2df 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/auth_plugin_impl.dart @@ -885,8 +885,8 @@ class AmplifyAuthCognitoDart extends AuthPluginInterface /// {@template amplify_core.amplify_auth_category.update_mfa_preference} /// Updates the MFA preference for the current user. /// - /// If [sms] or [totp] is `null`, the preference for that MFA type is left - /// unchanged. Setting either [sms] or [totp] to [MfaPreference.preferred] + /// If [sms], [totp], or [email] is `null`, the preference for that MFA type is left + /// unchanged. Setting either [sms], [totp], or [email] to [MfaPreference.preferred] /// will mark the other as not preferred. /// {@endtemplate} Future updateMfaPreference({ From 18a531669533d484f3c09efdac6aad6f9560b683 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:52:31 -0700 Subject: [PATCH 15/52] chore: add emailMfaSettings to setMfaSettings --- .../auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index ec6a73d46c..b65f5d3dfc 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -886,6 +886,7 @@ extension MfaSettings on CognitoIdentityProviderClient { accessToken: accessToken, smsMfaSettings: smsMfaSettings, softwareTokenMfaSettings: softwareTokenSettings, + emailMfaSettings: emailMfaSettings, ), ).result; } From d484c55a713bceaff89e682585667dcd042d1282 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:40:31 -0700 Subject: [PATCH 16/52] chore: formatting --- .../lib/src/sdk/sdk_bridge.dart | 34 +++++++++++++++---- .../state/machines/sign_in_state_machine.dart | 3 +- .../l10n/generated/input_localizations.dart | 2 +- .../email_or_phone_config.dart | 2 +- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index b65f5d3dfc..f183fd1914 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -33,7 +33,8 @@ extension ChallengeNameTypeBridge on ChallengeNameType { ChallengeNameType.softwareTokenMfa => AuthSignInStep.confirmSignInWithTotpMfaCode, // TODO(khatruong2009): confirm ChallengeNameType.emailMfa is added to SDK - ChallengeNameType.emailOtp => AuthSignInStep.confirmSignInWithEmailMfaCode, + ChallengeNameType.emailOtp => + AuthSignInStep.confirmSignInWithEmailMfaCode, ChallengeNameType.adminNoSrpAuth || ChallengeNameType.passwordVerifier || ChallengeNameType.devicePasswordVerifier || @@ -828,19 +829,40 @@ extension MfaSettings on CognitoIdentityProviderClient { return currentlyEnabled || requestingEnabled; } - final preferred = switch ((currentPreference, sms: sms, totp: totp, email: email)) { + final preferred = + switch ((currentPreference, sms: sms, totp: totp, email: email)) { // Prevent an invalid choice. - (_, sms: MfaPreference.preferred, totp: MfaPreference.preferred, email: MfaPreference.preferred) => + ( + _, + sms: MfaPreference.preferred, + totp: MfaPreference.preferred, + email: MfaPreference.preferred + ) => throw const InvalidParameterException( 'Cannot assign multiple MFA methods as preferred', ), // Setting one or the other as preferred overrides previous value. - (_, sms: MfaPreference.preferred, totp: != MfaPreference.preferred, email: != MfaPreference.preferred) => + ( + _, + sms: MfaPreference.preferred, + totp: != MfaPreference.preferred, + email: != MfaPreference.preferred + ) => MfaType.sms, - (_, sms: != MfaPreference.preferred, totp: MfaPreference.preferred, email: != MfaPreference.preferred) => + ( + _, + sms: != MfaPreference.preferred, + totp: MfaPreference.preferred, + email: != MfaPreference.preferred + ) => MfaType.totp, - (_, sms: != MfaPreference.preferred, totp: != MfaPreference.preferred, email: MfaPreference.preferred) => + ( + _, + sms: != MfaPreference.preferred, + totp: != MfaPreference.preferred, + email: MfaPreference.preferred + ) => MfaType.email, // Setting one or the other as disabled or not preferred removes current diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 4dbc775736..7794b48c15 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -956,7 +956,8 @@ final class SignInStateMachine accessToken: accessToken, sms: enableMfaType == MfaType.sms ? MfaPreference.enabled : null, totp: enableMfaType == MfaType.totp ? MfaPreference.enabled : null, - email: enableMfaType == MfaType.email ? MfaPreference.enabled : null, + email: + enableMfaType == MfaType.email ? MfaPreference.enabled : null, ); } on Exception catch (e, st) { logger.error( diff --git a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart index c86a8a9ed4..b34f12cf8e 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/l10n/generated/input_localizations.dart @@ -298,7 +298,7 @@ abstract class AuthenticatorInputLocalizations { String get selectTotp; /// Label for the radio button to select email as the user's chosen MFA method. - /// + /// /// In en, this message translates to: /// **'Email'** String get selectEmail; diff --git a/packages/authenticator/amplify_authenticator_test/lib/src/amplify_outputs/email_or_phone_config.dart b/packages/authenticator/amplify_authenticator_test/lib/src/amplify_outputs/email_or_phone_config.dart index ad5ef29355..a7cc4c93ac 100644 --- a/packages/authenticator/amplify_authenticator_test/lib/src/amplify_outputs/email_or_phone_config.dart +++ b/packages/authenticator/amplify_authenticator_test/lib/src/amplify_outputs/email_or_phone_config.dart @@ -29,4 +29,4 @@ const emailOrPhoneConfig = '''{ "SMS" ] } -}'''; \ No newline at end of file +}'''; From f604447dffd7c747c5bbebca38c8e6ed57b59a96 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:41:16 -0700 Subject: [PATCH 17/52] chore: update docs comment in constants --- .../auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart index 536c33c529..7a40ff446c 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart @@ -57,7 +57,7 @@ abstract class CognitoConstants { /// The `SMS_MFA_CODE` parameter. static const challengeParamSmsMfaCode = 'SMS_MFA_CODE'; - /// The `EMAIL_MFA_CODE` parameter. + /// The `EMAIL_OTP_CODE` parameter. static const challengeParamEmailMfaCode = 'EMAIL_OTP_CODE'; /// The `SOFTWARE_TOKEN_MFA_CODE` parameter. From b0c03b79a0fb9af10d25c31ee732a276d41a1fb1 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:42:46 -0700 Subject: [PATCH 18/52] chore: add docs and formatting --- packages/amplify_core/doc/lib/auth.dart | 7 ++++++- .../lib/src/types/auth/sign_in/auth_sign_in_step.dart | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 6e48014a9b..d7a0fd803b 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -104,7 +104,7 @@ Future resendSignUpCode(String username) async { } // #enddocregion resend-signup-code -// #docregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code +// #docregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-email Future _handleSignInResult(SignInResult result) async { switch (result.nextStep.signInStep) { // #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code @@ -129,6 +129,11 @@ Future _handleSignInResult(SignInResult result) async { final codeDeliveryDetails = result.nextStep.codeDeliveryDetails!; _handleCodeDelivery(codeDeliveryDetails); // #enddocregion handle-confirm-signin-sms + // #docregion handle-confirm-signin-email + case AuthSignInStep.confirmSignInWithEmailMfaCode: + final codeDeliveryDetails = result.nextStep.codeDeliveryDetails!; + _handleCodeDelivery(codeDeliveryDetails); + // #enddocregion handle-confirm-signin-email // #docregion handle-confirm-signin-new-password case AuthSignInStep.confirmSignInWithNewPassword: safePrint('Enter a new password to continue signing in'); diff --git a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart index 9631ca1d94..eef001a650 100644 --- a/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart +++ b/packages/amplify_core/lib/src/types/auth/sign_in/auth_sign_in_step.dart @@ -10,7 +10,7 @@ enum AuthSignInStep { /// an MFA method. continueSignInWithMfaSelection, - /// The sign-in is not complete and the user must select an MFA method to setup. + /// The sign-in is not complete and the user must select an MFA method to setup. continueSignInWithMfaSetupSelection, /// The sign-in is not complete and a TOTP authenticator app must be From 515368315eb444e77a5a1bb37a1b244e0ed8446a Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:05:01 -0700 Subject: [PATCH 19/52] chore: revert package-lock.json changes --- infra-gen2/package-lock.json | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/infra-gen2/package-lock.json b/infra-gen2/package-lock.json index 191c337b64..806c800dd6 100644 --- a/infra-gen2/package-lock.json +++ b/infra-gen2/package-lock.json @@ -4462,18 +4462,6 @@ "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sso-oidc": "3.624.0", - "@aws-sdk/client-sts": "3.624.0", - "@aws-sdk/core": "3.624.0", - "@aws-sdk/credential-provider-node": "3.624.0", - "@aws-sdk/middleware-host-header": "3.620.0", - "@aws-sdk/middleware-logger": "3.609.0", - "@aws-sdk/middleware-recursion-detection": "3.620.0", - "@aws-sdk/middleware-sdk-ec2": "3.622.0", - "@aws-sdk/middleware-user-agent": "3.620.0", - "@aws-sdk/region-config-resolver": "3.614.0", "@aws-sdk/types": "3.609.0", "@smithy/types": "^3.3.0", "bowser": "^2.11.0", @@ -4486,27 +4474,9 @@ "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.624.0", - "@aws-sdk/middleware-host-header": "3.620.0", - "@aws-sdk/middleware-logger": "3.609.0", - "@aws-sdk/middleware-recursion-detection": "3.620.0", - "@aws-sdk/middleware-user-agent": "3.620.0", - "@aws-sdk/region-config-resolver": "3.614.0", "@aws-sdk/types": "3.609.0", "@smithy/node-config-provider": "^3.1.4", "@smithy/types": "^3.3.0", - "@smithy/url-parser": "^3.0.3", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.14", - "@smithy/util-defaults-mode-node": "^3.0.14", - "@smithy/util-endpoints": "^2.0.5", - "@smithy/util-middleware": "^3.0.3", - "@smithy/util-retry": "^3.0.3", - "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, "engines": { @@ -4622,8 +4592,6 @@ "license": "Apache-2.0", "dependencies": { "@smithy/types": "^3.3.0", - "@smithy/util-middleware": "^3.0.3", - "fast-xml-parser": "4.4.1", "tslib": "^2.6.2" }, "engines": { @@ -4638,7 +4606,6 @@ "dependencies": { "@smithy/eventstream-serde-universal": "^3.0.5", "@smithy/types": "^3.3.0", - "@smithy/util-stream": "^3.1.3", "tslib": "^2.6.2" }, "engines": { From 1d37caec6868c93b0064a886975e18334d7f0fd2 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:14:17 -0700 Subject: [PATCH 20/52] chore: update mfaSetup to MfaSetupSelection --- .../auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index f183fd1914..171c2feac3 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -29,10 +29,9 @@ extension ChallengeNameTypeBridge on ChallengeNameType { ChallengeNameType.selectMfaType => AuthSignInStep.continueSignInWithMfaSelection, ChallengeNameType.mfaSetup => - AuthSignInStep.continueSignInWithTotpSetup, + AuthSignInStep.continueSignInWithMfaSetupSelection, ChallengeNameType.softwareTokenMfa => AuthSignInStep.confirmSignInWithTotpMfaCode, - // TODO(khatruong2009): confirm ChallengeNameType.emailMfa is added to SDK ChallengeNameType.emailOtp => AuthSignInStep.confirmSignInWithEmailMfaCode, ChallengeNameType.adminNoSrpAuth || From e69d96bb657c48989dacd952d233232726693804 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:16:29 -0700 Subject: [PATCH 21/52] chore: refactor setMfaSettings method to handle multiple mfa preferred scenarios --- .../lib/src/sdk/sdk_bridge.dart | 193 ++++++++---------- 1 file changed, 81 insertions(+), 112 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index 171c2feac3..a95acbe95b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -794,123 +794,92 @@ extension MfaSettings on CognitoIdentityProviderClient { /// Sets the MFA settings for the user. Future setMfaSettings({ - required String accessToken, - MfaPreference? sms, - MfaPreference? totp, - MfaPreference? email, - }) async { - final UserMfaPreference( - enabled: currentEnabled, - preferred: currentPreference - ) = await _getRawUserSettings( - accessToken: accessToken, - ); - const enabledValues = [ - MfaPreference.enabled, - MfaPreference.notPreferred, - MfaPreference.preferred, - ]; - bool isEnabled(MfaType mfaType) { - final explicitlyDisabled = switch (mfaType) { - MfaType.sms => sms == MfaPreference.disabled, - MfaType.totp => totp == MfaPreference.disabled, - MfaType.email => email == MfaPreference.disabled, - }; - if (explicitlyDisabled) { - return false; - } - final currentlyEnabled = currentEnabled.contains(mfaType); - final requestingEnabled = switch (mfaType) { - MfaType.sms => enabledValues.contains(sms), - MfaType.totp => enabledValues.contains(totp), - MfaType.email => enabledValues.contains(email), - }; - return currentlyEnabled || requestingEnabled; + required String accessToken, + MfaPreference? sms, + MfaPreference? totp, + MfaPreference? email, +}) async { + final UserMfaPreference( + enabled: currentEnabled, + preferred: currentPreference + ) = await _getRawUserSettings( + accessToken: accessToken, + ); + + const enabledValues = [ + MfaPreference.enabled, + MfaPreference.notPreferred, + MfaPreference.preferred, + ]; + + bool isEnabled(MfaType mfaType) { + final explicitlyDisabled = switch (mfaType) { + MfaType.sms => sms == MfaPreference.disabled, + MfaType.totp => totp == MfaPreference.disabled, + MfaType.email => email == MfaPreference.disabled, + }; + if (explicitlyDisabled) { + return false; } + final currentlyEnabled = currentEnabled.contains(mfaType); + final requestingEnabled = switch (mfaType) { + MfaType.sms => enabledValues.contains(sms), + MfaType.totp => enabledValues.contains(totp), + MfaType.email => enabledValues.contains(email), + }; + return currentlyEnabled || requestingEnabled; + } - final preferred = - switch ((currentPreference, sms: sms, totp: totp, email: email)) { - // Prevent an invalid choice. - ( - _, - sms: MfaPreference.preferred, - totp: MfaPreference.preferred, - email: MfaPreference.preferred - ) => - throw const InvalidParameterException( - 'Cannot assign multiple MFA methods as preferred', - ), + // Count the number of MFA methods set to preferred + final preferredMethods = [ + if (sms == MfaPreference.preferred) MfaType.sms, + if (totp == MfaPreference.preferred) MfaType.totp, + if (email == MfaPreference.preferred) MfaType.email, + ]; - // Setting one or the other as preferred overrides previous value. - ( - _, - sms: MfaPreference.preferred, - totp: != MfaPreference.preferred, - email: != MfaPreference.preferred - ) => - MfaType.sms, - ( - _, - sms: != MfaPreference.preferred, - totp: MfaPreference.preferred, - email: != MfaPreference.preferred - ) => - MfaType.totp, - ( - _, - sms: != MfaPreference.preferred, - totp: != MfaPreference.preferred, - email: MfaPreference.preferred - ) => - MfaType.email, - - // Setting one or the other as disabled or not preferred removes current - // preference if it matches. - ( - MfaType.sms, - sms: MfaPreference.notPreferred || MfaPreference.disabled, - totp: _, - email: _, - ) || - ( - MfaType.totp, - sms: _, - totp: MfaPreference.notPreferred || MfaPreference.disabled, - email: _, - ) || - ( - MfaType.email, - sms: _, - totp: _, - email: MfaPreference.notPreferred || MfaPreference.disabled, - ) => - null, - - // Ignore preference changes which do not affect the current preference. - (final currentPreference, sms: _, totp: _, email: _) => currentPreference, + if (preferredMethods.length > 1) { + throw const InvalidParameterException( + 'Cannot assign multiple MFA methods as preferred', + ); + } + + MfaType? preferred; + if (preferredMethods.isNotEmpty) { + preferred = preferredMethods.first; + } else { + // Check if the current preference needs to be removed + final isCurrentPreferenceDisabled = switch (currentPreference) { + MfaType.sms => sms == MfaPreference.disabled || sms == MfaPreference.notPreferred, + MfaType.totp => totp == MfaPreference.disabled || totp == MfaPreference.notPreferred, + MfaType.email => email == MfaPreference.disabled || email == MfaPreference.notPreferred, + _ => false, }; - final smsMfaSettings = SmsMfaSettingsType( - enabled: isEnabled(MfaType.sms), - preferredMfa: preferred == MfaType.sms, - ); - final softwareTokenSettings = SoftwareTokenMfaSettingsType( - enabled: isEnabled(MfaType.totp), - preferredMfa: preferred == MfaType.totp, - ); - // TODO(khatruong2009): confirm EmailMfaSettingsType is added to SDK - final emailMfaSettings = EmailMfaSettingsType( - enabled: isEnabled(MfaType.email), - preferredMfa: preferred == MfaType.email, - ); - await setUserMfaPreference( - SetUserMfaPreferenceRequest( - accessToken: accessToken, - smsMfaSettings: smsMfaSettings, - softwareTokenMfaSettings: softwareTokenSettings, - emailMfaSettings: emailMfaSettings, - ), - ).result; + preferred = isCurrentPreferenceDisabled ? null : currentPreference; } + + final smsMfaSettings = SmsMfaSettingsType( + enabled: isEnabled(MfaType.sms), + preferredMfa: preferred == MfaType.sms, + ); + final softwareTokenSettings = SoftwareTokenMfaSettingsType( + enabled: isEnabled(MfaType.totp), + preferredMfa: preferred == MfaType.totp, + ); + final emailMfaSettings = EmailMfaSettingsType( + enabled: isEnabled(MfaType.email), + preferredMfa: preferred == MfaType.email, + ); + + await setUserMfaPreference( + SetUserMfaPreferenceRequest( + accessToken: accessToken, + smsMfaSettings: smsMfaSettings, + softwareTokenMfaSettings: softwareTokenSettings, + emailMfaSettings: emailMfaSettings, + ), + ).result; +} + } extension on String { From 764f16d4ec6a0f4b2e396159f1bdf2692fa11440 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:49:08 -0700 Subject: [PATCH 22/52] chore: fix mfaType switch statement to reflect new name --- .../auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index a95acbe95b..db8e3c856f 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -887,7 +887,7 @@ extension on String { MfaType get mfaType => switch (this) { 'SOFTWARE_TOKEN_MFA' => MfaType.totp, 'SMS_MFA' => MfaType.sms, - 'EMAIL_MFA' => MfaType.email, + 'EMAIL_OTP' => MfaType.email, final invalidType => throw StateError('Invalid MFA type: $invalidType'), }; } From 26bececf5457135fc2120e7b07e86ea7611cb1b5 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:39:48 -0700 Subject: [PATCH 23/52] chore: refactor setMfaSettings method --- .../lib/src/sdk/sdk_bridge.dart | 141 ++++++++---------- 1 file changed, 63 insertions(+), 78 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index db8e3c856f..8ea47761ed 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -794,92 +794,77 @@ extension MfaSettings on CognitoIdentityProviderClient { /// Sets the MFA settings for the user. Future setMfaSettings({ - required String accessToken, - MfaPreference? sms, - MfaPreference? totp, - MfaPreference? email, -}) async { - final UserMfaPreference( - enabled: currentEnabled, - preferred: currentPreference - ) = await _getRawUserSettings( - accessToken: accessToken, - ); - - const enabledValues = [ - MfaPreference.enabled, - MfaPreference.notPreferred, - MfaPreference.preferred, - ]; - - bool isEnabled(MfaType mfaType) { - final explicitlyDisabled = switch (mfaType) { - MfaType.sms => sms == MfaPreference.disabled, - MfaType.totp => totp == MfaPreference.disabled, - MfaType.email => email == MfaPreference.disabled, - }; - if (explicitlyDisabled) { - return false; + required String accessToken, + MfaPreference? sms, + MfaPreference? totp, + MfaPreference? email, + }) async { + final UserMfaPreference( + enabled: currentEnabled, + preferred: currentPreference, + ) = await _getRawUserSettings(accessToken: accessToken); + + final newPreferredMethods = [ + if (sms == MfaPreference.preferred) MfaType.sms, + if (totp == MfaPreference.preferred) MfaType.totp, + if (email == MfaPreference.preferred) MfaType.email, + ]; + + if (newPreferredMethods.length > 1) { + throw const InvalidParameterException( + 'Cannot assign multiple MFA methods as preferred', + ); } - final currentlyEnabled = currentEnabled.contains(mfaType); - final requestingEnabled = switch (mfaType) { - MfaType.sms => enabledValues.contains(sms), - MfaType.totp => enabledValues.contains(totp), - MfaType.email => enabledValues.contains(email), - }; - return currentlyEnabled || requestingEnabled; - } - // Count the number of MFA methods set to preferred - final preferredMethods = [ - if (sms == MfaPreference.preferred) MfaType.sms, - if (totp == MfaPreference.preferred) MfaType.totp, - if (email == MfaPreference.preferred) MfaType.email, - ]; + var preferred = newPreferredMethods.isNotEmpty + ? newPreferredMethods.first + : currentPreference; - if (preferredMethods.length > 1) { - throw const InvalidParameterException( - 'Cannot assign multiple MFA methods as preferred', - ); - } - - MfaType? preferred; - if (preferredMethods.isNotEmpty) { - preferred = preferredMethods.first; - } else { - // Check if the current preference needs to be removed final isCurrentPreferenceDisabled = switch (currentPreference) { - MfaType.sms => sms == MfaPreference.disabled || sms == MfaPreference.notPreferred, - MfaType.totp => totp == MfaPreference.disabled || totp == MfaPreference.notPreferred, - MfaType.email => email == MfaPreference.disabled || email == MfaPreference.notPreferred, + MfaType.sms => + sms == MfaPreference.disabled || sms == MfaPreference.notPreferred, + MfaType.totp => + totp == MfaPreference.disabled || totp == MfaPreference.notPreferred, + MfaType.email => + email == MfaPreference.disabled || email == MfaPreference.notPreferred, _ => false, }; - preferred = isCurrentPreferenceDisabled ? null : currentPreference; - } + preferred = isCurrentPreferenceDisabled ? null : preferred; + + const enabledValues = [ + MfaPreference.enabled, + MfaPreference.notPreferred, + MfaPreference.preferred, + ]; + + bool isMfaEnabled(MfaType mfaType, MfaPreference? preference) { + if (preference == MfaPreference.disabled) return false; + return currentEnabled.contains(mfaType) || + enabledValues.contains(preference); + } - final smsMfaSettings = SmsMfaSettingsType( - enabled: isEnabled(MfaType.sms), - preferredMfa: preferred == MfaType.sms, - ); - final softwareTokenSettings = SoftwareTokenMfaSettingsType( - enabled: isEnabled(MfaType.totp), - preferredMfa: preferred == MfaType.totp, - ); - final emailMfaSettings = EmailMfaSettingsType( - enabled: isEnabled(MfaType.email), - preferredMfa: preferred == MfaType.email, - ); - - await setUserMfaPreference( - SetUserMfaPreferenceRequest( - accessToken: accessToken, - smsMfaSettings: smsMfaSettings, - softwareTokenMfaSettings: softwareTokenSettings, - emailMfaSettings: emailMfaSettings, - ), - ).result; -} + final smsMfaSettings = SmsMfaSettingsType( + enabled: isMfaEnabled(MfaType.sms, sms), + preferredMfa: preferred == MfaType.sms, + ); + final softwareTokenSettings = SoftwareTokenMfaSettingsType( + enabled: isMfaEnabled(MfaType.totp, totp), + preferredMfa: preferred == MfaType.totp, + ); + final emailMfaSettings = EmailMfaSettingsType( + enabled: isMfaEnabled(MfaType.email, email), + preferredMfa: preferred == MfaType.email, + ); + await setUserMfaPreference( + SetUserMfaPreferenceRequest( + accessToken: accessToken, + smsMfaSettings: smsMfaSettings, + softwareTokenMfaSettings: softwareTokenSettings, + emailMfaSettings: emailMfaSettings, + ), + ).result; + } } extension on String { From 86a322877de0a91627fe49ecfcedd649e61a227d Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:50:52 -0700 Subject: [PATCH 24/52] chore: mark sdk_exception file as generated --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 3fcc994970..ab23572ce9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -74,6 +74,7 @@ ## Generated SDK files packages/**/lib/src/sdk/src/** linguist-generated +packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_exception.dart linguist-generated ## Generated Swift Plugins packages/amplify_datastore/ios/internal/** linguist-generated From 13e60c4f4f5d718ff9502a3a96ef30c316a867fe Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:47:39 -0700 Subject: [PATCH 25/52] chore: update core docs --- packages/amplify_core/doc/lib/auth.dart | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index d7a0fd803b..384845b9c2 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -104,22 +104,32 @@ Future resendSignUpCode(String username) async { } // #enddocregion resend-signup-code -// #docregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-email +// #docregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-email-code, handle-confirm-signin-mfa-setup-selection, handle-confirm-signin-email-setup Future _handleSignInResult(SignInResult result) async { switch (result.nextStep.signInStep) { - // #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code + // #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-email-code, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-mfa-setup-selection, handle-confirm-signin-email-setup // #docregion handle-confirm-signin-mfa-selection case AuthSignInStep.continueSignInWithMfaSelection: final allowedMfaTypes = result.nextStep.allowedMfaTypes!; final selection = await _promptUserPreference(allowedMfaTypes); return _handleMfaSelection(selection); // #enddocregion handle-confirm-signin-mfa-selection + // #docregion handle-confirm-signin-mfa-setup-selection + case AuthSignInStep.continueSignInWithMfaSetupSelection: + final allowedMfaTypes = result.nextStep.allowedMfaTypes!; + final selection = await _promptUserPreference(allowedMfaTypes); + return _handleMfaSetupSelection(selection); + // #enddocregion handle-confirm-signin-mfa-setup-selection // #docregion handle-confirm-signin-totp-setup case AuthSignInStep.continueSignInWithTotpSetup: final totpSetupDetails = result.nextStep.totpSetupDetails!; final setupUri = totpSetupDetails.getSetupUri(appName: 'MyApp'); safePrint('Open URI to complete setup: $setupUri'); // #enddocregion handle-confirm-signin-totp-setup + // #docregion handle-confirm-signin-email-setup + case AuthSignInStep.continueSignInWithEmailMfaSetup: + safePrint('A confirmation code has been sent to your email'); + // #enddocregion handle-confirm-signin-email-setup // #docregion handle-confirm-signin-totp-code case AuthSignInStep.confirmSignInWithTotpMfaCode: safePrint('Enter a one-time code from your registered Authenticator app'); @@ -163,10 +173,10 @@ Future _handleSignInResult(SignInResult result) async { case AuthSignInStep.done: safePrint('Sign in is complete'); // #enddocregion handle-confirm-signin-done - // #docregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code + // #docregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-email-code, handle-confirm-signin-mfa-setup-selection, handle-confirm-signin-email-setup } } -// #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code +// #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-email-code, handle-confirm-signin-mfa-setup-selection, handle-confirm-signin-email-setup // #docregion signin Future signInUser(String username, String password) async { @@ -241,6 +251,19 @@ Future _handleMfaSelection(MfaType selection) async { } // #enddocregion handle-mfa-selection +// #docregion handle-mfa-setup-selection +Future _handleMfaSetupSelection(MfaType selection) async { + try { + final result = await Amplify.Auth.confirmSignIn( + confirmationValue: selection.confirmationValue, + ); + return _handleSignInResult(result); + } on AuthException catch (e) { + safePrint('Error resending code: ${e.message}'); + } +} +// #enddocregion handle-mfa-setup-selection + // #docregion signout Future signOutCurrentUser() async { final result = await Amplify.Auth.signOut(); From 0d725dc204d945e6150e75d38f3657776ecde27e Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:38:35 -0700 Subject: [PATCH 26/52] chore: update integ tests Update integ tests to change expected state from continueSignInWithTotpSetup to continueSignInWithMfaSetupSelection --- .../example/integration_test/mfa_sms_totp_required_test.dart | 2 +- .../example/integration_test/mfa_totp_required_test.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_totp_required_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_totp_required_test.dart index 32862bf0bb..2f5c1422e3 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_totp_required_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_sms_totp_required_test.dart @@ -35,7 +35,7 @@ void main() { signInRes.nextStep.signInStep, because: 'MFA is required, and TOTP is chosen when ' 'no phone number is registered', - ).equals(AuthSignInStep.continueSignInWithTotpSetup); + ).equals(AuthSignInStep.continueSignInWithMfaSetupSelection); final sharedSecret = signInRes.nextStep.totpSetupDetails!.sharedSecret; final setupRes = await Amplify.Auth.confirmSignIn( diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_totp_required_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_totp_required_test.dart index 84370b665c..323700b9f6 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/mfa_totp_required_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/mfa_totp_required_test.dart @@ -34,7 +34,7 @@ void main() { signInRes.nextStep.signInStep, because: "TOTP MFA is automatically enabled when it's the only option", - ).equals(AuthSignInStep.continueSignInWithTotpSetup); + ).equals(AuthSignInStep.continueSignInWithMfaSetupSelection); final sharedSecret = signInRes.nextStep.totpSetupDetails!.sharedSecret; final setupRes = await Amplify.Auth.confirmSignIn( From 69abe75023998122a5286c2e868e9a20b128b80f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:52:32 -0700 Subject: [PATCH 27/52] chore: update core docs example --- packages/amplify_core/doc/lib/auth.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 384845b9c2..6364ceb84a 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -117,6 +117,9 @@ Future _handleSignInResult(SignInResult result) async { // #docregion handle-confirm-signin-mfa-setup-selection case AuthSignInStep.continueSignInWithMfaSetupSelection: final allowedMfaTypes = result.nextStep.allowedMfaTypes!; + if (allowedMfaTypes.length == 1) { + return _handleMfaSetupSelection(allowedMfaTypes.first); + } final selection = await _promptUserPreference(allowedMfaTypes); return _handleMfaSetupSelection(selection); // #enddocregion handle-confirm-signin-mfa-setup-selection From 970bf15dd1df3b1ce8b40ccfb1a9e7bae8b75394 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 4 Oct 2024 13:00:06 -0700 Subject: [PATCH 28/52] chore: add authenticator state/step enums --- .../lib/src/enums/authenticator_step.dart | 11 ++++++++++ .../lib/src/state/auth_state.dart | 21 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart b/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart index a90f0f8b0a..5ef325081a 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/enums/authenticator_step.dart @@ -61,18 +61,29 @@ enum AuthenticatorStep { /// an MFA method. continueSignInWithMfaSelection, + /// The user is on the Continue Sign In with MFA Setup Selection step. + /// The sign-in is not complete and the user must select an MFA method to setup. + continueSignInWithMfaSetupSelection, + /// The user is on the Continue Sign In with TOTP setup step. /// /// The sign-in is not complete and a TOTP authenticator app must be /// registered before continuing. continueSignInWithTotpSetup, + /// The sign-in is not complete and an Email MFA must be set up before + /// continuing. + continueSignInWithEmailMfaSetup, + /// The user is on the Confirm Sign In with TOTP MFA step. /// /// The sign-in is not complete and must be confirmed with a TOTP code /// from a registered authenticator app. confirmSignInWithTotpMfaCode, + /// The sign-in is not complete and must be confirmed with an email code. + confirmSignInWithEmailMfaCode, + /// The user is on the Reset Password step. resetPassword, diff --git a/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart b/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart index 5a948e05bf..834afbe683 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/state/auth_state.dart @@ -46,6 +46,12 @@ class UnauthenticatedState extends AuthState static const confirmSignInWithTotpMfaCode = UnauthenticatedState( step: AuthenticatorStep.confirmSignInWithTotpMfaCode, ); + static const continueSignInWithEmailMfaSetup = UnauthenticatedState( + step: AuthenticatorStep.continueSignInWithEmailMfaSetup, + ); + static const confirmSignInWithEmailMfaCode = UnauthenticatedState( + step: AuthenticatorStep.confirmSignInWithEmailMfaCode, + ); static const resetPassword = UnauthenticatedState(step: AuthenticatorStep.resetPassword); static const confirmResetPassword = @@ -111,6 +117,21 @@ class ContinueSignInWithMfaSelection extends UnauthenticatedState { String get runtimeTypeName => 'ContinueSignInWithMfaSelection'; } +class ContinueSignInWithMfaSetupSelection extends UnauthenticatedState { + const ContinueSignInWithMfaSetupSelection({ + Set? allowedMfaTypes, + }) : allowedMfaTypes = allowedMfaTypes ?? const {}, + super(step: AuthenticatorStep.continueSignInWithMfaSetupSelection); + + final Set allowedMfaTypes; + + @override + List get props => [step, allowedMfaTypes]; + + @override + String get runtimeTypeName => 'ContinueSignInWithMfaSetupSelection'; +} + class ContinueSignInTotpSetup extends UnauthenticatedState { const ContinueSignInTotpSetup(this.totpSetupDetails, this.totpSetupUri) : super(step: AuthenticatorStep.continueSignInWithTotpSetup); From 5586c16043a67a1d2de1e7bf43d72ce1c4fb035a Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 4 Oct 2024 13:01:09 -0700 Subject: [PATCH 29/52] chore: change state machine and auth bloc to automatically move states if only one mfa method is allowed --- .../state/machines/sign_in_state_machine.dart | 70 ++++++++++++++++++- .../lib/src/blocs/auth/auth_bloc.dart | 48 +++++++++++++ 2 files changed, 116 insertions(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 7794b48c15..03fc0c3edb 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -330,8 +330,56 @@ final class SignInStateMachine createEmailMfaRequest(event), ChallengeNameType.selectMfaType when hasUserResponse => createSelectMfaRequest(event), - ChallengeNameType.mfaSetup when hasUserResponse => - createMfaSetupRequest(event), + ChallengeNameType.mfaSetup => + (() async { + final allowedMfaTypes = _allowedMfaTypes; + if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { + throw const InvalidUserPoolConfigurationException( + 'No MFA types are allowed for setup.', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + // Exclude MfaType.sms from consideration + final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms}); + if (mfaTypesForSetup.isEmpty) { + throw const InvalidUserPoolConfigurationException( + 'No eligible MFA types are available for setup.', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + if (mfaTypesForSetup.length == 1) { + final mfaType = mfaTypesForSetup.first; + if (mfaType == MfaType.totp) { + _enableMfaType = MfaType.totp; + _totpSetupResult ??= await associateSoftwareToken(); + if (hasUserResponse) { + return createMfaSetupRequest(event); + } else { + // Need to prompt user for the TOTP code + return null; + } + } else if (mfaType == MfaType.email) { + _enableMfaType = MfaType.email; + if (hasUserResponse) { + return createEmailMfaSetupRequest(event); + } else { + // Need to prompt user for the email verification code + return null; + } + } else { + throw InvalidUserPoolConfigurationException( + 'Unsupported MFA type: ${mfaType.name}', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + } else if (hasUserResponse) { + // Handle user's selection + return createMfaSetupRequest(event); + } else { + // Need to prompt user to select an MFA type + return null; + } + })(), ChallengeNameType.newPasswordRequired when hasUserResponse => createNewPasswordRequest(event), _ => null, @@ -674,6 +722,24 @@ final class SignInStateMachine }); } + /// Compeletes set up of an email MFA. + @protected + Future createEmailMfaSetupRequest( + SignInRespondToChallenge event, + ) async { + _enableMfaType = MfaType.email; + return RespondToAuthChallengeRequest.build((b) { + b + ..challengeName = ChallengeNameType.emailOtp + ..challengeResponses.addAll({ + CognitoConstants.challengeParamUsername: cognitoUsername, + CognitoConstants.challengeParamEmailMfaCode: event.answer, + }) + ..clientId = _authOutputs.userPoolClientId + ..clientMetadata.addAll(event.clientMetadata); + }); + } + /// Selects an MFA type to use for sign-in. @protected Future createSelectMfaRequest( diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index 4c729b9078..41dcfe410e 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -227,10 +227,16 @@ class StateMachineBloc yield UnauthenticatedState.confirmSignInNewPassword; case AuthSignInStep.confirmSignInWithTotpMfaCode: yield UnauthenticatedState.confirmSignInWithTotpMfaCode; + case AuthSignInStep.confirmSignInWithEmailMfaCode: + yield UnauthenticatedState.confirmSignInWithEmailMfaCode; case AuthSignInStep.continueSignInWithMfaSelection: yield ContinueSignInWithMfaSelection( allowedMfaTypes: result.nextStep.allowedMfaTypes, ); + case AuthSignInStep.continueSignInWithMfaSetupSelection: + yield ContinueSignInWithMfaSetupSelection( + allowedMfaTypes: result.nextStep.allowedMfaTypes, + ); case AuthSignInStep.continueSignInWithTotpSetup: assert( result.nextStep.totpSetupDetails != null, @@ -333,6 +339,43 @@ class StateMachineBloc allowedMfaTypes: result.nextStep.allowedMfaTypes, ), ); + case AuthSignInStep.continueSignInWithMfaSetupSelection: + final allowedMfaTypes = result.nextStep.allowedMfaTypes; + if (allowedMfaTypes != null) { + final mfaTypesForSetup = allowedMfaTypes.toSet()..remove(MfaType.sms); + if (mfaTypesForSetup.length == 1) { + final mfaType = mfaTypesForSetup.first; + if (mfaType == MfaType.totp) { + assert( + result.nextStep.totpSetupDetails != null, + 'Sign In Result should have totpSetupDetails', + ); + _emit(await ContinueSignInTotpSetup.setupURI( + result.nextStep.totpSetupDetails!, + totpOptions, + ),); + } else if (mfaType == MfaType.email) { + _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); + } else { + throw InvalidUserPoolConfigurationException( + 'Unsupported MFA type: ${mfaType.name}', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + } else { + _emit( + ContinueSignInWithMfaSetupSelection( + allowedMfaTypes: result.nextStep.allowedMfaTypes, + ), + ); + } + } else { + _emit( + ContinueSignInWithMfaSetupSelection( + allowedMfaTypes: result.nextStep.allowedMfaTypes, + ), + ); + } case AuthSignInStep.continueSignInWithTotpSetup: assert( result.nextStep.totpSetupDetails != null, @@ -344,8 +387,13 @@ class StateMachineBloc totpOptions, ), ); + case AuthSignInStep.continueSignInWithEmailMfaSetup: + _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); case AuthSignInStep.confirmSignInWithTotpMfaCode: _emit(UnauthenticatedState.confirmSignInWithTotpMfaCode); + case AuthSignInStep.confirmSignInWithEmailMfaCode: + _notifyCodeSent(result.nextStep.codeDeliveryDetails?.destination); + _emit(UnauthenticatedState.confirmSignInWithEmailMfaCode); case AuthSignInStep.resetPassword: _emit(UnauthenticatedState.confirmResetPassword); case AuthSignInStep.confirmSignUp: From 472507467d8e031c5d87606355d0bddac5e944fe Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 4 Oct 2024 13:01:26 -0700 Subject: [PATCH 30/52] chore: add email mfa to test_runner --- .../amplify_auth_integration_test/lib/src/test_runner.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/test/amplify_auth_integration_test/lib/src/test_runner.dart b/packages/test/amplify_auth_integration_test/lib/src/test_runner.dart index 1401bc4fd6..9654971cdd 100644 --- a/packages/test/amplify_auth_integration_test/lib/src/test_runner.dart +++ b/packages/test/amplify_auth_integration_test/lib/src/test_runner.dart @@ -145,6 +145,7 @@ class MfaInfo { this.required = false, this.smsEnabled = false, this.totpEnabled = false, + this.emailEnabled = false, }); /// Whether MFA is required (`true`) or optional (`false`). @@ -155,6 +156,9 @@ class MfaInfo { /// Whether TOTP MFA is available. final bool totpEnabled; + + /// Whether email MFA is available. + final bool emailEnabled; } /// A test environment descriptor. From f0b69a392fa98c6c261a408a96fe0a2e14351199 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 4 Oct 2024 13:58:09 -0700 Subject: [PATCH 31/52] chore: dart format --- .../state/machines/sign_in_state_machine.dart | 91 +++++++++---------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 03fc0c3edb..39c6314a07 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -330,56 +330,55 @@ final class SignInStateMachine createEmailMfaRequest(event), ChallengeNameType.selectMfaType when hasUserResponse => createSelectMfaRequest(event), - ChallengeNameType.mfaSetup => - (() async { - final allowedMfaTypes = _allowedMfaTypes; - if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { - throw const InvalidUserPoolConfigurationException( - 'No MFA types are allowed for setup.', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - // Exclude MfaType.sms from consideration - final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms}); - if (mfaTypesForSetup.isEmpty) { - throw const InvalidUserPoolConfigurationException( - 'No eligible MFA types are available for setup.', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - if (mfaTypesForSetup.length == 1) { - final mfaType = mfaTypesForSetup.first; - if (mfaType == MfaType.totp) { - _enableMfaType = MfaType.totp; - _totpSetupResult ??= await associateSoftwareToken(); - if (hasUserResponse) { - return createMfaSetupRequest(event); - } else { - // Need to prompt user for the TOTP code - return null; - } - } else if (mfaType == MfaType.email) { - _enableMfaType = MfaType.email; - if (hasUserResponse) { - return createEmailMfaSetupRequest(event); + ChallengeNameType.mfaSetup => (() async { + final allowedMfaTypes = _allowedMfaTypes; + if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { + throw const InvalidUserPoolConfigurationException( + 'No MFA types are allowed for setup.', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + // Exclude MfaType.sms from consideration + final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms}); + if (mfaTypesForSetup.isEmpty) { + throw const InvalidUserPoolConfigurationException( + 'No eligible MFA types are available for setup.', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + if (mfaTypesForSetup.length == 1) { + final mfaType = mfaTypesForSetup.first; + if (mfaType == MfaType.totp) { + _enableMfaType = MfaType.totp; + _totpSetupResult ??= await associateSoftwareToken(); + if (hasUserResponse) { + return createMfaSetupRequest(event); + } else { + // Need to prompt user for the TOTP code + return null; + } + } else if (mfaType == MfaType.email) { + _enableMfaType = MfaType.email; + if (hasUserResponse) { + return createEmailMfaSetupRequest(event); + } else { + // Need to prompt user for the email verification code + return null; + } } else { - // Need to prompt user for the email verification code - return null; + throw InvalidUserPoolConfigurationException( + 'Unsupported MFA type: ${mfaType.name}', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); } + } else if (hasUserResponse) { + // Handle user's selection + return createMfaSetupRequest(event); } else { - throw InvalidUserPoolConfigurationException( - 'Unsupported MFA type: ${mfaType.name}', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); + // Need to prompt user to select an MFA type + return null; } - } else if (hasUserResponse) { - // Handle user's selection - return createMfaSetupRequest(event); - } else { - // Need to prompt user to select an MFA type - return null; - } - })(), + })(), ChallengeNameType.newPasswordRequired when hasUserResponse => createNewPasswordRequest(event), _ => null, From 7b901af8e6f44923a9b658d127a98e3a3ec4afe4 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:07:51 -0700 Subject: [PATCH 32/52] chore: fix auth.dart docs --- packages/amplify_core/doc/lib/auth.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 6364ceb84a..5573052fba 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -107,7 +107,7 @@ Future resendSignUpCode(String username) async { // #docregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-email-code, handle-confirm-signin-mfa-setup-selection, handle-confirm-signin-email-setup Future _handleSignInResult(SignInResult result) async { switch (result.nextStep.signInStep) { - // #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-email-code, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-mfa-setup-selection, handle-confirm-signin-email-setup + // #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code, handle-confirm-signin-email-code, handle-confirm-signin-mfa-setup-selection, handle-confirm-signin-email-setup // #docregion handle-confirm-signin-mfa-selection case AuthSignInStep.continueSignInWithMfaSelection: final allowedMfaTypes = result.nextStep.allowedMfaTypes!; @@ -121,6 +121,7 @@ Future _handleSignInResult(SignInResult result) async { return _handleMfaSetupSelection(allowedMfaTypes.first); } final selection = await _promptUserPreference(allowedMfaTypes); + safePrint('Selected MFA type: $selection'); return _handleMfaSetupSelection(selection); // #enddocregion handle-confirm-signin-mfa-setup-selection // #docregion handle-confirm-signin-totp-setup @@ -262,7 +263,7 @@ Future _handleMfaSetupSelection(MfaType selection) async { ); return _handleSignInResult(result); } on AuthException catch (e) { - safePrint('Error resending code: ${e.message}'); + safePrint('Error selecting MFA method: ${e.message}'); } } // #enddocregion handle-mfa-setup-selection From 66097f2af8fdad60c6be8ac5d2428431138c675b Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:15:51 -0700 Subject: [PATCH 33/52] chore: moved ChallengeNameType.mfaSetup switch statement logic to a helper method --- .../state/machines/sign_in_state_machine.dart | 108 ++++++++++-------- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 39c6314a07..6e6a121ceb 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -330,55 +330,8 @@ final class SignInStateMachine createEmailMfaRequest(event), ChallengeNameType.selectMfaType when hasUserResponse => createSelectMfaRequest(event), - ChallengeNameType.mfaSetup => (() async { - final allowedMfaTypes = _allowedMfaTypes; - if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { - throw const InvalidUserPoolConfigurationException( - 'No MFA types are allowed for setup.', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - // Exclude MfaType.sms from consideration - final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms}); - if (mfaTypesForSetup.isEmpty) { - throw const InvalidUserPoolConfigurationException( - 'No eligible MFA types are available for setup.', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - if (mfaTypesForSetup.length == 1) { - final mfaType = mfaTypesForSetup.first; - if (mfaType == MfaType.totp) { - _enableMfaType = MfaType.totp; - _totpSetupResult ??= await associateSoftwareToken(); - if (hasUserResponse) { - return createMfaSetupRequest(event); - } else { - // Need to prompt user for the TOTP code - return null; - } - } else if (mfaType == MfaType.email) { - _enableMfaType = MfaType.email; - if (hasUserResponse) { - return createEmailMfaSetupRequest(event); - } else { - // Need to prompt user for the email verification code - return null; - } - } else { - throw InvalidUserPoolConfigurationException( - 'Unsupported MFA type: ${mfaType.name}', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - } else if (hasUserResponse) { - // Handle user's selection - return createMfaSetupRequest(event); - } else { - // Need to prompt user to select an MFA type - return null; - } - })(), + ChallengeNameType.mfaSetup => + handleMfaSetup(event: event, hasUserResponse: hasUserResponse), ChallengeNameType.newPasswordRequired when hasUserResponse => createNewPasswordRequest(event), _ => null, @@ -698,6 +651,63 @@ final class SignInStateMachine } } + /// Handles the MFA setup challenge. + @protected + Future handleMfaSetup({ + SignInEvent? event, + required bool hasUserResponse, + }) async { + final allowedMfaTypes = _allowedMfaTypes; + if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { + throw const InvalidUserPoolConfigurationException( + 'No MFA types are allowed for setup.', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + + // Exclude MfaType.sms from consideration + final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms}); + if (mfaTypesForSetup.isEmpty) { + throw const InvalidUserPoolConfigurationException( + 'No eligible MFA types are available for setup.', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + + if (mfaTypesForSetup.length == 1) { + final mfaType = mfaTypesForSetup.first; + if (mfaType == MfaType.totp) { + _enableMfaType = MfaType.totp; + _totpSetupResult ??= await associateSoftwareToken(); + if (hasUserResponse) { + return createMfaSetupRequest(event as SignInRespondToChallenge); + } else { + // Need to prompt user for the TOTP code + return null; + } + } else if (mfaType == MfaType.email) { + _enableMfaType = MfaType.email; + if (hasUserResponse) { + return createEmailMfaSetupRequest(event as SignInRespondToChallenge); + } else { + // Need to prompt user for the email verification code + return null; + } + } else { + throw InvalidUserPoolConfigurationException( + 'Unsupported MFA type: ${mfaType.name}', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + } else if (hasUserResponse) { + // Handle user's selection + return createMfaSetupRequest(event as SignInRespondToChallenge); + } else { + // Need to prompt user to select an MFA type + return null; + } + } + /// Completes set up of a TOTP MFA. @protected Future createMfaSetupRequest( From 0fdcc15bbfe8784656e4b3df4c3b072a5240ea11 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:27:53 -0700 Subject: [PATCH 34/52] chore: flatten an if statement in the helper method by adding mfaTypesForSetup in the first if statement --- .../src/state/machines/sign_in_state_machine.dart | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 6e6a121ceb..948a68cb2c 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -658,18 +658,11 @@ final class SignInStateMachine required bool hasUserResponse, }) async { final allowedMfaTypes = _allowedMfaTypes; - if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { - throw const InvalidUserPoolConfigurationException( - 'No MFA types are allowed for setup.', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - // Exclude MfaType.sms from consideration - final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms}); - if (mfaTypesForSetup.isEmpty) { + final mfaTypesForSetup = allowedMfaTypes?.difference({MfaType.sms}); + if (allowedMfaTypes == null || allowedMfaTypes.isEmpty || mfaTypesForSetup == null || mfaTypesForSetup.isEmpty) { throw const InvalidUserPoolConfigurationException( - 'No eligible MFA types are available for setup.', + 'No eligible MFA types are allowed for setup.', recoverySuggestion: 'Check your user pool MFA configuration.', ); } From e630a30c59947125ac3dd053e42f756f1c36283d Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:39:24 -0700 Subject: [PATCH 35/52] chore: dart format --- .../lib/src/state/machines/sign_in_state_machine.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 948a68cb2c..c0311d1f78 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -660,7 +660,10 @@ final class SignInStateMachine final allowedMfaTypes = _allowedMfaTypes; // Exclude MfaType.sms from consideration final mfaTypesForSetup = allowedMfaTypes?.difference({MfaType.sms}); - if (allowedMfaTypes == null || allowedMfaTypes.isEmpty || mfaTypesForSetup == null || mfaTypesForSetup.isEmpty) { + if (allowedMfaTypes == null || + allowedMfaTypes.isEmpty || + mfaTypesForSetup == null || + mfaTypesForSetup.isEmpty) { throw const InvalidUserPoolConfigurationException( 'No eligible MFA types are allowed for setup.', recoverySuggestion: 'Check your user pool MFA configuration.', From 334e8b3dead6cec863fb96d478cc77d5016c904a Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:04:16 -0700 Subject: [PATCH 36/52] chore: remove extra if checks and add null check --- .../lib/src/state/machines/sign_in_state_machine.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index c0311d1f78..5d65b00f8e 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -661,16 +661,14 @@ final class SignInStateMachine // Exclude MfaType.sms from consideration final mfaTypesForSetup = allowedMfaTypes?.difference({MfaType.sms}); if (allowedMfaTypes == null || - allowedMfaTypes.isEmpty || - mfaTypesForSetup == null || - mfaTypesForSetup.isEmpty) { + allowedMfaTypes.isEmpty) { throw const InvalidUserPoolConfigurationException( 'No eligible MFA types are allowed for setup.', recoverySuggestion: 'Check your user pool MFA configuration.', ); } - if (mfaTypesForSetup.length == 1) { + if (mfaTypesForSetup!.length == 1) { final mfaType = mfaTypesForSetup.first; if (mfaType == MfaType.totp) { _enableMfaType = MfaType.totp; From 87bb72ba66bceb674f4d40aba82d73dbf198379c Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:16:16 -0700 Subject: [PATCH 37/52] chore: dart format --- .../lib/src/state/machines/sign_in_state_machine.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 5d65b00f8e..b5ee708705 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -660,8 +660,7 @@ final class SignInStateMachine final allowedMfaTypes = _allowedMfaTypes; // Exclude MfaType.sms from consideration final mfaTypesForSetup = allowedMfaTypes?.difference({MfaType.sms}); - if (allowedMfaTypes == null || - allowedMfaTypes.isEmpty) { + if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { throw const InvalidUserPoolConfigurationException( 'No eligible MFA types are allowed for setup.', recoverySuggestion: 'Check your user pool MFA configuration.', From c4ee27de24f33b497a917e590885304df9f78d18 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:21:05 -0700 Subject: [PATCH 38/52] chore: add back in mfaTypesForSetup instead of allowedMfaTypes --- .../lib/src/state/machines/sign_in_state_machine.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index b5ee708705..725f66b9d1 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -660,14 +660,14 @@ final class SignInStateMachine final allowedMfaTypes = _allowedMfaTypes; // Exclude MfaType.sms from consideration final mfaTypesForSetup = allowedMfaTypes?.difference({MfaType.sms}); - if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) { + if (mfaTypesForSetup == null || mfaTypesForSetup.isEmpty) { throw const InvalidUserPoolConfigurationException( 'No eligible MFA types are allowed for setup.', recoverySuggestion: 'Check your user pool MFA configuration.', ); } - if (mfaTypesForSetup!.length == 1) { + if (mfaTypesForSetup.length == 1) { final mfaType = mfaTypesForSetup.first; if (mfaType == MfaType.totp) { _enableMfaType = MfaType.totp; From dd769423b1d5f611f008416577771f3a02b39616 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:08:21 -0700 Subject: [PATCH 39/52] chore: doc fixes --- packages/amplify_core/doc/lib/auth.dart | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 5573052fba..d2bd9da534 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -118,11 +118,11 @@ Future _handleSignInResult(SignInResult result) async { case AuthSignInStep.continueSignInWithMfaSetupSelection: final allowedMfaTypes = result.nextStep.allowedMfaTypes!; if (allowedMfaTypes.length == 1) { - return _handleMfaSetupSelection(allowedMfaTypes.first); + return _handleMfaSelection(allowedMfaTypes.first); } final selection = await _promptUserPreference(allowedMfaTypes); safePrint('Selected MFA type: $selection'); - return _handleMfaSetupSelection(selection); + return _handleMfaSelection(selection); // #enddocregion handle-confirm-signin-mfa-setup-selection // #docregion handle-confirm-signin-totp-setup case AuthSignInStep.continueSignInWithTotpSetup: @@ -132,7 +132,7 @@ Future _handleSignInResult(SignInResult result) async { // #enddocregion handle-confirm-signin-totp-setup // #docregion handle-confirm-signin-email-setup case AuthSignInStep.continueSignInWithEmailMfaSetup: - safePrint('A confirmation code has been sent to your email'); + safePrint('Enter the email address you want to use for two-factor authentication'); // #enddocregion handle-confirm-signin-email-setup // #docregion handle-confirm-signin-totp-code case AuthSignInStep.confirmSignInWithTotpMfaCode: @@ -255,19 +255,6 @@ Future _handleMfaSelection(MfaType selection) async { } // #enddocregion handle-mfa-selection -// #docregion handle-mfa-setup-selection -Future _handleMfaSetupSelection(MfaType selection) async { - try { - final result = await Amplify.Auth.confirmSignIn( - confirmationValue: selection.confirmationValue, - ); - return _handleSignInResult(result); - } on AuthException catch (e) { - safePrint('Error selecting MFA method: ${e.message}'); - } -} -// #enddocregion handle-mfa-setup-selection - // #docregion signout Future signOutCurrentUser() async { final result = await Amplify.Auth.signOut(); From d602beffa9942964dbbec4bf9f4864d27f709fc4 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:02:05 -0700 Subject: [PATCH 40/52] chore: fixed else statement circular loop --- .../lib/src/blocs/auth/auth_bloc.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index 41dcfe410e..2e879f38af 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -370,10 +370,9 @@ class StateMachineBloc ); } } else { - _emit( - ContinueSignInWithMfaSetupSelection( - allowedMfaTypes: result.nextStep.allowedMfaTypes, - ), + throw const InvalidUserPoolConfigurationException( + 'Allowed MFA types are null', + recoverySuggestion: 'Check your user pool MFA configuration.', ); } case AuthSignInStep.continueSignInWithTotpSetup: From e98a31c95cff8d2d3a04a4b9cb1624923e18d80b Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:08:34 -0700 Subject: [PATCH 41/52] chore: dart format --- packages/amplify_core/doc/lib/auth.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index d2bd9da534..5480d2aa1e 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -132,7 +132,8 @@ Future _handleSignInResult(SignInResult result) async { // #enddocregion handle-confirm-signin-totp-setup // #docregion handle-confirm-signin-email-setup case AuthSignInStep.continueSignInWithEmailMfaSetup: - safePrint('Enter the email address you want to use for two-factor authentication'); + safePrint( + 'Enter the email address you want to use for two-factor authentication'); // #enddocregion handle-confirm-signin-email-setup // #docregion handle-confirm-signin-totp-code case AuthSignInStep.confirmSignInWithTotpMfaCode: From d7ebd261b33748b3518c9eb5aabd43e30be1e51f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:08:57 -0700 Subject: [PATCH 42/52] chore: dart format authenticator --- .../lib/src/blocs/auth/auth_bloc.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index 2e879f38af..d0cbff9fe8 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -350,10 +350,12 @@ class StateMachineBloc result.nextStep.totpSetupDetails != null, 'Sign In Result should have totpSetupDetails', ); - _emit(await ContinueSignInTotpSetup.setupURI( - result.nextStep.totpSetupDetails!, - totpOptions, - ),); + _emit( + await ContinueSignInTotpSetup.setupURI( + result.nextStep.totpSetupDetails!, + totpOptions, + ), + ); } else if (mfaType == MfaType.email) { _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); } else { From aad98830d60b5e744c95cbcf3f136dd7c53a8d0f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:14:35 -0700 Subject: [PATCH 43/52] chore: add trailing comma --- packages/amplify_core/doc/lib/auth.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 5480d2aa1e..cdd3b872c5 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -133,7 +133,7 @@ Future _handleSignInResult(SignInResult result) async { // #docregion handle-confirm-signin-email-setup case AuthSignInStep.continueSignInWithEmailMfaSetup: safePrint( - 'Enter the email address you want to use for two-factor authentication'); + 'Enter the email address you want to use for two-factor authentication',); // #enddocregion handle-confirm-signin-email-setup // #docregion handle-confirm-signin-totp-code case AuthSignInStep.confirmSignInWithTotpMfaCode: From 9d9abe864efea05e1b7f0a3fcc991160ecca27cf Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:35:36 -0700 Subject: [PATCH 44/52] chore: dart format --- packages/amplify_core/doc/lib/auth.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index cdd3b872c5..79cc4e0858 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -133,7 +133,8 @@ Future _handleSignInResult(SignInResult result) async { // #docregion handle-confirm-signin-email-setup case AuthSignInStep.continueSignInWithEmailMfaSetup: safePrint( - 'Enter the email address you want to use for two-factor authentication',); + 'Enter the email address you want to use for two-factor authentication', + ); // #enddocregion handle-confirm-signin-email-setup // #docregion handle-confirm-signin-totp-code case AuthSignInStep.confirmSignInWithTotpMfaCode: From e7e08880d67aeb06455cdcb0f30a5bdb4f9e9ad9 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:57:44 -0700 Subject: [PATCH 45/52] chore: refactor setMfaSettings to make it easier to read with helper methods --- .../lib/src/sdk/sdk_bridge.dart | 104 +++++++++++------- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index 8ea47761ed..d137d37225 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -804,55 +804,27 @@ extension MfaSettings on CognitoIdentityProviderClient { preferred: currentPreference, ) = await _getRawUserSettings(accessToken: accessToken); - final newPreferredMethods = [ - if (sms == MfaPreference.preferred) MfaType.sms, - if (totp == MfaPreference.preferred) MfaType.totp, - if (email == MfaPreference.preferred) MfaType.email, - ]; - - if (newPreferredMethods.length > 1) { - throw const InvalidParameterException( - 'Cannot assign multiple MFA methods as preferred', - ); - } - - var preferred = newPreferredMethods.isNotEmpty - ? newPreferredMethods.first - : currentPreference; - - final isCurrentPreferenceDisabled = switch (currentPreference) { - MfaType.sms => - sms == MfaPreference.disabled || sms == MfaPreference.notPreferred, - MfaType.totp => - totp == MfaPreference.disabled || totp == MfaPreference.notPreferred, - MfaType.email => - email == MfaPreference.disabled || email == MfaPreference.notPreferred, - _ => false, - }; - preferred = isCurrentPreferenceDisabled ? null : preferred; - - const enabledValues = [ - MfaPreference.enabled, - MfaPreference.notPreferred, - MfaPreference.preferred, - ]; + var preferred = + _getNewPreferredMethod(sms: sms, totp: totp, email: email) ?? + currentPreference; - bool isMfaEnabled(MfaType mfaType, MfaPreference? preference) { - if (preference == MfaPreference.disabled) return false; - return currentEnabled.contains(mfaType) || - enabledValues.contains(preference); + if (_isCurrentPreferenceDisabled(currentPreference, + sms: sms, totp: totp, email: email,)) { + preferred = null; } final smsMfaSettings = SmsMfaSettingsType( - enabled: isMfaEnabled(MfaType.sms, sms), + enabled: _isMfaEnabled(MfaType.sms, sms, currentEnabled), preferredMfa: preferred == MfaType.sms, ); + final softwareTokenSettings = SoftwareTokenMfaSettingsType( - enabled: isMfaEnabled(MfaType.totp, totp), + enabled: _isMfaEnabled(MfaType.totp, totp, currentEnabled), preferredMfa: preferred == MfaType.totp, ); + final emailMfaSettings = EmailMfaSettingsType( - enabled: isMfaEnabled(MfaType.email, email), + enabled: _isMfaEnabled(MfaType.email, email, currentEnabled), preferredMfa: preferred == MfaType.email, ); @@ -865,6 +837,60 @@ extension MfaSettings on CognitoIdentityProviderClient { ), ).result; } + + /// Making sure a maximum of one MFA method is set to preferred. + MfaType? _getNewPreferredMethod({ + MfaPreference? sms, + MfaPreference? totp, + MfaPreference? email, + }) { + final preferredMethods = [ + if (sms == MfaPreference.preferred) MfaType.sms, + if (totp == MfaPreference.preferred) MfaType.totp, + if (email == MfaPreference.preferred) MfaType.email, + ]; + + if (preferredMethods.length > 1) { + throw const InvalidParameterException( + 'Cannot assign multiple MFA methods as preferred', + ); + } + + return preferredMethods.isNotEmpty ? preferredMethods.first : null; + } + + /// Checks if the current preferred MFA method is being disabled or set to not preferred. + bool _isCurrentPreferenceDisabled( + MfaType? currentPreference, { + MfaPreference? sms, + MfaPreference? totp, + MfaPreference? email, + }) { + switch (currentPreference) { + case MfaType.sms: + return sms == MfaPreference.disabled || + sms == MfaPreference.notPreferred; + case MfaType.totp: + return totp == MfaPreference.disabled || + totp == MfaPreference.notPreferred; + case MfaType.email: + return email == MfaPreference.disabled || + email == MfaPreference.notPreferred; + default: + return false; + } + } + + /// Determines if an MFA type should be enabled based on preferences and current settings. + bool _isMfaEnabled( + MfaType mfaType, + MfaPreference? preference, + Set currentEnabled, + ) { + if (preference == MfaPreference.disabled) return false; + if (preference != null) return true; + return currentEnabled.contains(mfaType); + } } extension on String { From 4135f06efeeca7635285f2a9f0b46bc5bf433a40 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 14 Oct 2024 23:21:00 -0700 Subject: [PATCH 46/52] chore: refactor auth_bloc with helper function used in two switch statements --- .../lib/src/blocs/auth/auth_bloc.dart | 96 +++++++++---------- 1 file changed, 45 insertions(+), 51 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index d0cbff9fe8..6bf58c0493 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -234,9 +234,7 @@ class StateMachineBloc allowedMfaTypes: result.nextStep.allowedMfaTypes, ); case AuthSignInStep.continueSignInWithMfaSetupSelection: - yield ContinueSignInWithMfaSetupSelection( - allowedMfaTypes: result.nextStep.allowedMfaTypes, - ); + await _handleMfaSetupSelection(result); case AuthSignInStep.continueSignInWithTotpSetup: assert( result.nextStep.totpSetupDetails != null, @@ -246,6 +244,8 @@ class StateMachineBloc result.nextStep.totpSetupDetails!, totpOptions, ); + case AuthSignInStep.continueSignInWithEmailMfaSetup: + yield UnauthenticatedState.continueSignInWithEmailMfaSetup; case AuthSignInStep.resetPassword: yield UnauthenticatedState.resetPassword; case AuthSignInStep.confirmSignUp: @@ -340,54 +340,7 @@ class StateMachineBloc ), ); case AuthSignInStep.continueSignInWithMfaSetupSelection: - final allowedMfaTypes = result.nextStep.allowedMfaTypes; - if (allowedMfaTypes != null) { - final mfaTypesForSetup = allowedMfaTypes.toSet()..remove(MfaType.sms); - if (mfaTypesForSetup.length == 1) { - final mfaType = mfaTypesForSetup.first; - if (mfaType == MfaType.totp) { - assert( - result.nextStep.totpSetupDetails != null, - 'Sign In Result should have totpSetupDetails', - ); - _emit( - await ContinueSignInTotpSetup.setupURI( - result.nextStep.totpSetupDetails!, - totpOptions, - ), - ); - } else if (mfaType == MfaType.email) { - _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); - } else { - throw InvalidUserPoolConfigurationException( - 'Unsupported MFA type: ${mfaType.name}', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - } else { - _emit( - ContinueSignInWithMfaSetupSelection( - allowedMfaTypes: result.nextStep.allowedMfaTypes, - ), - ); - } - } else { - throw const InvalidUserPoolConfigurationException( - 'Allowed MFA types are null', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - case AuthSignInStep.continueSignInWithTotpSetup: - assert( - result.nextStep.totpSetupDetails != null, - 'Sign In Result should have totpSetupDetails', - ); - _emit( - await ContinueSignInTotpSetup.setupURI( - result.nextStep.totpSetupDetails!, - totpOptions, - ), - ); + await _handleMfaSetupSelection(result); case AuthSignInStep.continueSignInWithEmailMfaSetup: _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); case AuthSignInStep.confirmSignInWithTotpMfaCode: @@ -590,6 +543,47 @@ class StateMachineBloc yield* const Stream.empty(); } + Future _handleMfaSetupSelection(SignInResult result) async { + final allowedMfaTypes = result.nextStep.allowedMfaTypes; + if (allowedMfaTypes != null) { + final mfaTypesForSetup = allowedMfaTypes.toSet()..remove(MfaType.sms); + if (mfaTypesForSetup.length == 1) { + final mfaType = mfaTypesForSetup.first; + if (mfaType == MfaType.totp) { + assert( + result.nextStep.totpSetupDetails != null, + 'Sign In Result should have totpSetupDetails', + ); + _emit( + await ContinueSignInTotpSetup.setupURI( + result.nextStep.totpSetupDetails!, + totpOptions, + ), + ); + } else if (mfaType == MfaType.email) { + _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); + } else { + throw InvalidUserPoolConfigurationException( + 'Unsupported MFA type: ${mfaType.name}', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + } else { + _emit( + ContinueSignInWithMfaSetupSelection( + allowedMfaTypes: result.nextStep.allowedMfaTypes, + ), + ); + } + } else { + _emit( + ContinueSignInWithMfaSetupSelection( + allowedMfaTypes: result.nextStep.allowedMfaTypes, + ), + ); + } + } + @override Future close() async { await Future.wait([ From eb93be4403c2148d3605f7f376df3c57dd1cb8d3 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Mon, 14 Oct 2024 23:49:17 -0700 Subject: [PATCH 47/52] chore: refactor auth bloc helper method to remove nested if/else statements --- .../lib/src/blocs/auth/auth_bloc.dart | 70 ++++++++++--------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index 6bf58c0493..f53beb7acd 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -545,42 +545,48 @@ class StateMachineBloc Future _handleMfaSetupSelection(SignInResult result) async { final allowedMfaTypes = result.nextStep.allowedMfaTypes; - if (allowedMfaTypes != null) { - final mfaTypesForSetup = allowedMfaTypes.toSet()..remove(MfaType.sms); - if (mfaTypesForSetup.length == 1) { - final mfaType = mfaTypesForSetup.first; - if (mfaType == MfaType.totp) { - assert( - result.nextStep.totpSetupDetails != null, - 'Sign In Result should have totpSetupDetails', - ); - _emit( - await ContinueSignInTotpSetup.setupURI( - result.nextStep.totpSetupDetails!, - totpOptions, - ), - ); - } else if (mfaType == MfaType.email) { - _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); - } else { - throw InvalidUserPoolConfigurationException( - 'Unsupported MFA type: ${mfaType.name}', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - } else { - _emit( - ContinueSignInWithMfaSetupSelection( - allowedMfaTypes: result.nextStep.allowedMfaTypes, - ), - ); - } - } else { + + if (allowedMfaTypes == null) { + throw const InvalidUserPoolConfigurationException( + 'No MFA types are supported', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); + } + + final mfaTypesForSetup = allowedMfaTypes.toSet()..remove(MfaType.sms); + + if (mfaTypesForSetup.length != 1) { _emit( ContinueSignInWithMfaSetupSelection( - allowedMfaTypes: result.nextStep.allowedMfaTypes, + allowedMfaTypes: allowedMfaTypes, ), ); + return; + } + + final mfaType = mfaTypesForSetup.first; + + switch (mfaType) { + case MfaType.totp: + assert( + result.nextStep.totpSetupDetails != null, + 'Sign In Result should have totpSetupDetails', + ); + _emit( + await ContinueSignInTotpSetup.setupURI( + result.nextStep.totpSetupDetails!, + totpOptions, + ), + ); + + case MfaType.email: + _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); + + default: + throw InvalidUserPoolConfigurationException( + 'Unsupported MFA type: ${mfaType.name}', + recoverySuggestion: 'Check your user pool MFA configuration.', + ); } } From daacad78fc72cd5c9b38d1aaa4a77804c411499a Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 15 Oct 2024 00:22:36 -0700 Subject: [PATCH 48/52] chore: refactor sign in state machine and add in constants for email challenge --- .../lib/src/flows/constants.dart | 3 + .../state/machines/sign_in_state_machine.dart | 89 +++++++++++-------- 2 files changed, 53 insertions(+), 39 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart index 7a40ff446c..7f916b290b 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart @@ -11,6 +11,9 @@ abstract class CognitoConstants { /// The `USERNAME` parameter. static const challengeParamUsername = 'USERNAME'; + /// The 'EMAIL' parameter. + static const challengeParamEmail = 'EMAIL'; + /// The `SRP_A` parameter. static const challengeParamSrpA = 'SRP_A'; diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index 725f66b9d1..a62e593d4d 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -330,8 +330,8 @@ final class SignInStateMachine createEmailMfaRequest(event), ChallengeNameType.selectMfaType when hasUserResponse => createSelectMfaRequest(event), - ChallengeNameType.mfaSetup => - handleMfaSetup(event: event, hasUserResponse: hasUserResponse), + ChallengeNameType.mfaSetup when hasUserResponse => + handleMfaSetup(event: event), ChallengeNameType.newPasswordRequired when hasUserResponse => createNewPasswordRequest(event), _ => null, @@ -655,7 +655,6 @@ final class SignInStateMachine @protected Future handleMfaSetup({ SignInEvent? event, - required bool hasUserResponse, }) async { final allowedMfaTypes = _allowedMfaTypes; // Exclude MfaType.sms from consideration @@ -667,38 +666,44 @@ final class SignInStateMachine ); } - if (mfaTypesForSetup.length == 1) { - final mfaType = mfaTypesForSetup.first; - if (mfaType == MfaType.totp) { - _enableMfaType = MfaType.totp; - _totpSetupResult ??= await associateSoftwareToken(); - if (hasUserResponse) { - return createMfaSetupRequest(event as SignInRespondToChallenge); - } else { - // Need to prompt user for the TOTP code - return null; - } - } else if (mfaType == MfaType.email) { - _enableMfaType = MfaType.email; - if (hasUserResponse) { - return createEmailMfaSetupRequest(event as SignInRespondToChallenge); - } else { - // Need to prompt user for the email verification code - return null; - } - } else { - throw InvalidUserPoolConfigurationException( - 'Unsupported MFA type: ${mfaType.name}', - recoverySuggestion: 'Check your user pool MFA configuration.', - ); - } - } else if (hasUserResponse) { - // Handle user's selection - return createMfaSetupRequest(event as SignInRespondToChallenge); - } else { - // Need to prompt user to select an MFA type + if (event == null) { + throw StateError('Event cannot be null when there is user response.'); + } + if (event is! SignInRespondToChallenge) { + throw StateError('Expected SignInRespondToChallenge event.'); + } + + if (_enableMfaType == null && _totpSetupResult == null) { + // User has just selected the MFA type + final selection = event.answer.toLowerCase(); + _enableMfaType = switch (selection) { + 'totp' => MfaType.totp, + 'email' => MfaType.email, + _ => throw const InvalidParameterException('Invalid MFA type selected'), + }; + + final challengeResponses = { + CognitoConstants.challengeParamMfasCanSetup: + _enableMfaType == MfaType.totp + ? '["SOFTWARE_TOKEN_MFA"]' + : '["EMAIL_OTP"]', + }; + _challengeParameters = BuiltMap(challengeResponses); + await _processChallenge(); return null; } + + // totp mfa method was already selected + if (mfaTypesForSetup.length == 1 && + mfaTypesForSetup.contains(MfaType.totp) && + _totpSetupResult != null) { + await createSoftwareTokenMfaRequest(event); + } + + // User has provided the verification code + return _enableMfaType == MfaType.totp + ? createMfaSetupRequest(event) + : createEmailMfaSetupRequest(event); } /// Completes set up of a TOTP MFA. @@ -732,10 +737,10 @@ final class SignInStateMachine _enableMfaType = MfaType.email; return RespondToAuthChallengeRequest.build((b) { b - ..challengeName = ChallengeNameType.emailOtp + ..challengeName = ChallengeNameType.mfaSetup ..challengeResponses.addAll({ CognitoConstants.challengeParamUsername: cognitoUsername, - CognitoConstants.challengeParamEmailMfaCode: event.answer, + CognitoConstants.challengeParamEmail: event.answer, }) ..clientId = _authOutputs.userPoolClientId ..clientMetadata.addAll(event.clientMetadata); @@ -1048,14 +1053,20 @@ final class SignInStateMachine if (_allowedMfaTypes case final allowedMfaTypes? when _challengeParameters .containsKey(CognitoConstants.challengeParamMfasCanSetup)) { - if (!allowedMfaTypes.contains(MfaType.totp)) { + if (!allowedMfaTypes.contains(MfaType.totp) && + allowedMfaTypes.contains(MfaType.email)) { throw const InvalidUserPoolConfigurationException( - 'Cannot enable SMS MFA and TOTP MFA is not allowed', + 'Cannot enable SMS MFA and TOTP or EMAIL MFA is not allowed', recoverySuggestion: - 'Contact an administrator to enable SMS MFA or allow TOTP MFA', + 'Contact an administrator to enable SMS MFA or allow TOTP or EMAIL MFA', ); } - _totpSetupResult ??= await associateSoftwareToken(); + final allowedMfaSetupTypes = [...?_allowedMfaTypes]..remove(MfaType.sms); + if (allowedMfaSetupTypes.length == 1 && + allowedMfaSetupTypes.first == MfaType.totp && + _totpSetupResult == null) { + _totpSetupResult = await associateSoftwareToken(accessToken: _session); + } } // Query the state machine for a response given potential user input in From a3c57e90b26e4d8ba041f516127a488d791736f3 Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 15 Oct 2024 00:24:20 -0700 Subject: [PATCH 49/52] chore: fix missing ! --- .../lib/src/state/machines/sign_in_state_machine.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart index a62e593d4d..2fdb6c66af 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart @@ -1054,7 +1054,7 @@ final class SignInStateMachine when _challengeParameters .containsKey(CognitoConstants.challengeParamMfasCanSetup)) { if (!allowedMfaTypes.contains(MfaType.totp) && - allowedMfaTypes.contains(MfaType.email)) { + !allowedMfaTypes.contains(MfaType.email)) { throw const InvalidUserPoolConfigurationException( 'Cannot enable SMS MFA and TOTP or EMAIL MFA is not allowed', recoverySuggestion: From 7129360f8eda5fddf007c9381aaa273927463eac Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 15 Oct 2024 00:47:31 -0700 Subject: [PATCH 50/52] chore: run dart format --- .../amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart index d137d37225..a48c8d4a01 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/sdk/sdk_bridge.dart @@ -808,8 +808,12 @@ extension MfaSettings on CognitoIdentityProviderClient { _getNewPreferredMethod(sms: sms, totp: totp, email: email) ?? currentPreference; - if (_isCurrentPreferenceDisabled(currentPreference, - sms: sms, totp: totp, email: email,)) { + if (_isCurrentPreferenceDisabled( + currentPreference, + sms: sms, + totp: totp, + email: email, + )) { preferred = null; } From 865d204c26d56c51a34505a58790d2d44efe803f Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:32:46 -0700 Subject: [PATCH 51/52] chore: fix docs --- .../auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart index 7f916b290b..361ac6ccb8 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/flows/constants.dart @@ -11,7 +11,7 @@ abstract class CognitoConstants { /// The `USERNAME` parameter. static const challengeParamUsername = 'USERNAME'; - /// The 'EMAIL' parameter. + /// The `EMAIL` parameter. static const challengeParamEmail = 'EMAIL'; /// The `SRP_A` parameter. From 2fddb4ae0701a40ca6613564dab23f9dc9e2241c Mon Sep 17 00:00:00 2001 From: Kha Truong <64438356+khatruong2009@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:49:39 -0700 Subject: [PATCH 52/52] chore: refactor _handleMfaSetupSelection to return the new state so it can be yielded to the stream --- .../lib/src/blocs/auth/auth_bloc.dart | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart index f53beb7acd..1ae97d13b2 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/blocs/auth/auth_bloc.dart @@ -234,7 +234,7 @@ class StateMachineBloc allowedMfaTypes: result.nextStep.allowedMfaTypes, ); case AuthSignInStep.continueSignInWithMfaSetupSelection: - await _handleMfaSetupSelection(result); + yield await _handleMfaSetupSelection(result); case AuthSignInStep.continueSignInWithTotpSetup: assert( result.nextStep.totpSetupDetails != null, @@ -543,7 +543,7 @@ class StateMachineBloc yield* const Stream.empty(); } - Future _handleMfaSetupSelection(SignInResult result) async { + Future _handleMfaSetupSelection(SignInResult result) async { final allowedMfaTypes = result.nextStep.allowedMfaTypes; if (allowedMfaTypes == null) { @@ -556,12 +556,7 @@ class StateMachineBloc final mfaTypesForSetup = allowedMfaTypes.toSet()..remove(MfaType.sms); if (mfaTypesForSetup.length != 1) { - _emit( - ContinueSignInWithMfaSetupSelection( - allowedMfaTypes: allowedMfaTypes, - ), - ); - return; + return ContinueSignInWithMfaSetupSelection(allowedMfaTypes: allowedMfaTypes); } final mfaType = mfaTypesForSetup.first; @@ -572,15 +567,13 @@ class StateMachineBloc result.nextStep.totpSetupDetails != null, 'Sign In Result should have totpSetupDetails', ); - _emit( - await ContinueSignInTotpSetup.setupURI( - result.nextStep.totpSetupDetails!, - totpOptions, - ), + return ContinueSignInTotpSetup.setupURI( + result.nextStep.totpSetupDetails!, + totpOptions, ); case MfaType.email: - _emit(UnauthenticatedState.continueSignInWithEmailMfaSetup); + return UnauthenticatedState.continueSignInWithEmailMfaSetup; default: throw InvalidUserPoolConfigurationException(