From 0d65eed4049c8784951ca51ae09c35c0af065f8f Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Mon, 2 Oct 2023 13:53:02 -0400 Subject: [PATCH] feat: rename sendUserAttributeVerificationCode (#3759) * feat: rename sendUserAttributeVerificationCode * fix: include deprecated category API * chore: add test, docs updates --- packages/amplify_core/doc/lib/auth.dart | 6 +- .../src/category/amplify_auth_category.dart | 38 ++++++---- .../lib/src/http/amplify_category_method.dart | 2 +- .../plugin/amplify_auth_plugin_interface.dart | 14 +++- ...r_attribute_confirmation_code_options.dart | 51 ------------- ...er_attribute_confirmation_code_result.dart | 42 ---------- ...r_attribute_verification_code_options.dart | 62 +++++++++++++++ ...er_attribute_verification_code_result.dart | 47 ++++++++++++ ...attribute_verification_code_result.g.dart} | 12 +-- .../lib/src/types/auth/auth_types.dart | 4 +- .../integration_test/sign_up_test.dart | 4 +- .../user_attributes_test.dart | 76 ++++++++++++++++++- .../lib/screens/confirm_user_attribute.dart | 2 +- .../example/lib/common.dart | 8 +- .../confirm_attribute_component.dart | 8 +- .../lib/amplify_auth_cognito_dart.dart | 4 +- .../lib/src/auth_plugin_impl.dart | 20 ++++- ...r_attribute_confirmation_code_options.dart | 57 -------------- ...bute_confirmation_code_plugin_options.dart | 41 ---------- ...r_attribute_verification_code_options.dart | 62 +++++++++++++++ ...ttribute_verification_code_options.g.dart} | 12 +-- ...bute_verification_code_plugin_options.dart | 46 +++++++++++ ...e_verification_code_plugin_options.g.dart} | 12 +-- .../lib/src/blocs/auth/auth_bloc.dart | 2 +- .../src/services/amplify_auth_service.dart | 10 +-- .../src/stubs/amplify_auth_cognito_stub.dart | 8 +- 26 files changed, 393 insertions(+), 257 deletions(-) delete mode 100644 packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_options.dart delete mode 100644 packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_result.dart create mode 100644 packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_options.dart create mode 100644 packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_result.dart rename packages/amplify_core/lib/src/types/auth/attribute/{resend_user_attribute_confirmation_code_result.g.dart => send_user_attribute_verification_code_result.g.dart} (62%) delete mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.dart delete mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.dart create mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_options.dart rename packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/{cognito_resend_user_attribute_confirmation_code_options.g.dart => cognito_send_user_attribute_verification_code_options.g.dart} (56%) create mode 100644 packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.dart rename packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/{cognito_resend_user_attribute_confirmation_code_plugin_options.g.dart => cognito_send_user_attribute_verification_code_plugin_options.g.dart} (57%) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 2d37c3091e..a69fde0f6c 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -437,10 +437,10 @@ Future verifyAttributeUpdate() async { } // #enddocregion confirm-user-attribute -// #docregion resend-user-attribute-code +// #docregion send-user-attribute-verification-code Future resendVerificationCode() async { try { - final result = await Amplify.Auth.resendUserAttributeConfirmationCode( + final result = await Amplify.Auth.sendUserAttributeVerificationCode( userAttributeKey: AuthUserAttributeKey.email, ); _handleCodeDelivery(result.codeDeliveryDetails); @@ -448,7 +448,7 @@ Future resendVerificationCode() async { safePrint('Error resending code: ${e.message}'); } } -// #enddocregion resend-user-attribute-code +// #enddocregion send-user-attribute-verification-code // #docregion remember-device Future rememberCurrentDevice() async { diff --git a/packages/amplify_core/lib/src/category/amplify_auth_category.dart b/packages/amplify_core/lib/src/category/amplify_auth_category.dart index 1876d90287..7668db291c 100644 --- a/packages/amplify_core/lib/src/category/amplify_auth_category.dart +++ b/packages/amplify_core/lib/src/category/amplify_auth_category.dart @@ -1233,19 +1233,16 @@ class AuthCategory extends AmplifyCategory { ), ); - /// {@template amplify_core.amplify_auth_category.resend_user_attribute_confirmation_code} - /// Resends a confirmation code for the given [userAttributeKey], if required, while - /// updating the attribute. + /// {@template amplify_core.amplify_auth_category.send_attribute_verification_code} + /// Sends a confirmation code for the existing value for the given + /// [userAttributeKey]. /// - /// If a confirmation code sent as the result of a [updateUserAttribute] or [updateUserAttributes] - /// call expires, you can use this API to request a new one. + /// This API can be used to confirm an attribute that was not confirmed during + /// the sign up flow. /// /// Optionally accepts plugin [options] which allow customizing provider-specific /// behavior, e.g. the Cognito User Pool. /// - /// For more information, see the - /// [Amplify docs](https://docs.amplify.aws/lib/auth/user-attributes/q/platform/flutter/#resend-verification-code). - /// /// ## Examples /// /// @@ -1254,11 +1251,11 @@ class AuthCategory extends AmplifyCategory { /// import 'package:amplify_flutter/amplify_flutter.dart'; /// ``` /// - /// + /// /// ```dart /// Future resendVerificationCode() async { /// try { - /// final result = await Amplify.Auth.resendUserAttributeConfirmationCode( + /// final result = await Amplify.Auth.sendUserAttributeVerificationCode( /// userAttributeKey: AuthUserAttributeKey.email, /// ); /// _handleCodeDelivery(result.codeDeliveryDetails); @@ -1269,7 +1266,7 @@ class AuthCategory extends AmplifyCategory { /// ``` /// /// The details of where the code will be delivered are returned in the result's - /// [ResendUserAttributeConfirmationCodeResult.codeDeliveryDetails] property + /// [SendUserAttributeVerificationCodeResult.codeDeliveryDetails] property /// and should be used to prompt the user on where to look for the code. /// /// @@ -1282,14 +1279,29 @@ class AuthCategory extends AmplifyCategory { /// } /// ``` /// {@endtemplate} + Future + sendUserAttributeVerificationCode({ + required AuthUserAttributeKey userAttributeKey, + SendUserAttributeVerificationCodeOptions? options, + }) => + identifyCall( + AuthCategoryMethod.sendUserAttributeVerificationCode, + () => defaultPlugin.sendUserAttributeVerificationCode( + userAttributeKey: userAttributeKey, + options: options, + ), + ); + + /// {@macro amplify_core.amplify_auth_category.send_attribute_verification_code} + @Deprecated('Use sendUserAttributeVerificationCode.') Future resendUserAttributeConfirmationCode({ required AuthUserAttributeKey userAttributeKey, ResendUserAttributeConfirmationCodeOptions? options, }) => identifyCall( - AuthCategoryMethod.resendUserAttributeConfirmationCode, - () => defaultPlugin.resendUserAttributeConfirmationCode( + AuthCategoryMethod.sendUserAttributeVerificationCode, + () => defaultPlugin.sendUserAttributeVerificationCode( userAttributeKey: userAttributeKey, options: options, ), diff --git a/packages/amplify_core/lib/src/http/amplify_category_method.dart b/packages/amplify_core/lib/src/http/amplify_category_method.dart index cd5bb42aec..a0c978594b 100644 --- a/packages/amplify_core/lib/src/http/amplify_category_method.dart +++ b/packages/amplify_core/lib/src/http/amplify_category_method.dart @@ -39,7 +39,7 @@ enum AuthCategoryMethod with AmplifyCategoryMethod { getCurrentUser('10'), rememberDevice('11'), resendSignUpCode('12'), - resendUserAttributeConfirmationCode('13'), + sendUserAttributeVerificationCode('13'), resetPassword('14'), signIn('15'), signInWithWebUI('16'), diff --git a/packages/amplify_core/lib/src/plugin/amplify_auth_plugin_interface.dart b/packages/amplify_core/lib/src/plugin/amplify_auth_plugin_interface.dart index c00d2b7b04..ccf764b554 100644 --- a/packages/amplify_core/lib/src/plugin/amplify_auth_plugin_interface.dart +++ b/packages/amplify_core/lib/src/plugin/amplify_auth_plugin_interface.dart @@ -153,7 +153,8 @@ abstract class AuthPluginInterface extends AmplifyPluginInterface { ); } - /// {@macro amplify_core.amplify_auth_category.resend_user_attribute_confirmation_code} + /// {@macro amplify_core.amplify_auth_category.send_attribute_verification_code} + @Deprecated('Use sendUserAttributeVerificationCode instead.') Future resendUserAttributeConfirmationCode({ required AuthUserAttributeKey userAttributeKey, @@ -164,6 +165,17 @@ abstract class AuthPluginInterface extends AmplifyPluginInterface { ); } + /// {@macro amplify_core.amplify_auth_category.send_attribute_verification_code} + Future + sendUserAttributeVerificationCode({ + required AuthUserAttributeKey userAttributeKey, + SendUserAttributeVerificationCodeOptions? options, + }) { + throw UnimplementedError( + 'sendUserAttributeVerificationCode() has not been implemented.', + ); + } + /// {@macro amplify_core.amplify_auth_category.set_up_totp} Future setUpTotp({ TotpSetupOptions? options, diff --git a/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_options.dart b/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_options.dart deleted file mode 100644 index 8309769ffc..0000000000 --- a/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_options.dart +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import 'package:amplify_core/amplify_core.dart'; - -/// {@category Auth} -/// {@template amplify_core.resend_user_attribute_confirmation_code_options} -/// The shared resend user attribute confirmation code options among all Auth -/// plugins. -/// {@endtemplate} -class ResendUserAttributeConfirmationCodeOptions - with - AWSEquatable, - AWSSerializable>, - AWSDebuggable { - /// {@macro amplify_core.resend_user_attribute_confirmation_code_options} - const ResendUserAttributeConfirmationCodeOptions({ - this.pluginOptions, - }); - - /// {@macro amplify_core.auth.resend_user_attribute_confirmation_code_plugin_options} - final ResendUserAttributeConfirmationCodePluginOptions? pluginOptions; - - @override - List get props => [pluginOptions]; - - @override - String get runtimeTypeName => 'ResendUserAttributeConfirmationCodeOptions'; - - /// @nodoc - @Deprecated('Use toJson instead') - Map serializeAsMap() => toJson(); - - @override - Map toJson() => { - 'pluginOptions': pluginOptions?.toJson(), - }; -} - -/// @nodoc -/// {@template amplify_core.auth.resend_user_attribute_confirmation_code_plugin_options} -/// Plugin-specific options for `Amplify.Auth.resendUserAttributeConfirmationCode`. -/// {@endtemplate} -abstract class ResendUserAttributeConfirmationCodePluginOptions - with - AWSEquatable, - AWSSerializable>, - AWSDebuggable { - /// {@macro amplify_core.auth.resend_user_attribute_confirmation_code_plugin_options} - const ResendUserAttributeConfirmationCodePluginOptions(); -} diff --git a/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_result.dart b/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_result.dart deleted file mode 100644 index a76af62100..0000000000 --- a/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_result.dart +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import 'package:amplify_core/amplify_core.dart'; - -part 'resend_user_attribute_confirmation_code_result.g.dart'; - -/// {@category Auth} -/// {@template amplify_core.resend_user_attribute_confirmation_code_result} -/// Wraps the result of a resend user confirmation code operation. -/// {@endtemplate} -@zAmplifySerializable -class ResendUserAttributeConfirmationCodeResult - with - AWSEquatable, - AWSSerializable>, - AWSDebuggable { - /// {@macro amplify_core.resend_user_attribute_confirmation_code_result} - const ResendUserAttributeConfirmationCodeResult({ - required this.codeDeliveryDetails, - }); - - /// {@macro amplify_core.resend_user_attribute_confirmation_code_result} - factory ResendUserAttributeConfirmationCodeResult.fromJson( - Map json, - ) => - _$ResendUserAttributeConfirmationCodeResultFromJson(json); - - /// Contains the delivery details of the confirmation code that was sent to - /// the user. - final AuthCodeDeliveryDetails codeDeliveryDetails; - - @override - List get props => [codeDeliveryDetails]; - - @override - String get runtimeTypeName => 'ResendUserAttributeConfirmationCodeResult'; - - @override - Map toJson() => - _$ResendUserAttributeConfirmationCodeResultToJson(this); -} diff --git a/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_options.dart b/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_options.dart new file mode 100644 index 0000000000..c6eb3e7405 --- /dev/null +++ b/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_options.dart @@ -0,0 +1,62 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:amplify_core/amplify_core.dart'; + +/// {@category Auth} +/// {@template amplify_core.send_attribute_verification_code_options} +/// The shared send user attribute verification code options among all Auth +/// plugins. +/// {@endtemplate} +class SendUserAttributeVerificationCodeOptions + with + AWSEquatable, + AWSSerializable>, + AWSDebuggable { + /// {@macro amplify_core.send_attribute_verification_code_options} + const SendUserAttributeVerificationCodeOptions({ + this.pluginOptions, + }); + + /// {@macro amplify_core.auth.send_user_attribute_verification_code_plugin_options} + final SendUserAttributeVerificationCodePluginOptions? pluginOptions; + + @override + List get props => [pluginOptions]; + + @override + String get runtimeTypeName => 'SendUserAttributeVerificationCodeOptions'; + + /// @nodoc + @Deprecated('Use toJson instead') + Map serializeAsMap() => toJson(); + + @override + Map toJson() => { + 'pluginOptions': pluginOptions?.toJson(), + }; +} + +/// @nodoc +/// {@template amplify_core.auth.send_user_attribute_verification_code_plugin_options} +/// Plugin-specific options for `Amplify.Auth.sendUserAttributeVerificationCode`. +/// {@endtemplate} +abstract class SendUserAttributeVerificationCodePluginOptions + with + AWSEquatable, + AWSSerializable>, + AWSDebuggable { + /// {@macro amplify_core.auth.send_user_attribute_verification_code_plugin_options} + const SendUserAttributeVerificationCodePluginOptions(); +} + +/// {@macro amplify_core.send_attribute_verification_code_options} +@Deprecated('Use SendUserAttributeVerificationCodeOptions.') +typedef ResendUserAttributeConfirmationCodeOptions + = SendUserAttributeVerificationCodeOptions; + +/// @nodoc +/// {@macro amplify_core.auth.send_user_attribute_verification_code_plugin_options} +@Deprecated('Use SendUserAttributeVerificationCodePluginOptions.') +typedef ResendUserAttributeConfirmationCodePluginOptions + = SendUserAttributeVerificationCodePluginOptions; diff --git a/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_result.dart b/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_result.dart new file mode 100644 index 0000000000..7ea84637a4 --- /dev/null +++ b/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_result.dart @@ -0,0 +1,47 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:amplify_core/amplify_core.dart'; + +part 'send_user_attribute_verification_code_result.g.dart'; + +/// {@category Auth} +/// {@template amplify_core.send_user_attribute_verification_code_result} +/// Wraps the result of a send user verification code operation. +/// {@endtemplate} +@zAmplifySerializable +class SendUserAttributeVerificationCodeResult + with + AWSEquatable, + AWSSerializable>, + AWSDebuggable { + /// {@macro amplify_core.send_user_attribute_verification_code_result} + const SendUserAttributeVerificationCodeResult({ + required this.codeDeliveryDetails, + }); + + /// {@macro amplify_core.send_user_attribute_verification_code_result} + factory SendUserAttributeVerificationCodeResult.fromJson( + Map json, + ) => + _$SendUserAttributeVerificationCodeResultFromJson(json); + + /// Contains the delivery details of the confirmation code that was sent to + /// the user. + final AuthCodeDeliveryDetails codeDeliveryDetails; + + @override + List get props => [codeDeliveryDetails]; + + @override + String get runtimeTypeName => 'SendUserAttributeVerificationCodeResult'; + + @override + Map toJson() => + _$SendUserAttributeVerificationCodeResultToJson(this); +} + +/// {@macro amplify_core.send_user_attribute_verification_code_result} +@Deprecated('Use SendUserAttributeVerificationCodeResult.') +typedef ResendUserAttributeConfirmationCodeResult + = SendUserAttributeVerificationCodeResult; diff --git a/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_result.g.dart b/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_result.g.dart similarity index 62% rename from packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_result.g.dart rename to packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_result.g.dart index 0a95f55362..5e8a9f3d8b 100644 --- a/packages/amplify_core/lib/src/types/auth/attribute/resend_user_attribute_confirmation_code_result.g.dart +++ b/packages/amplify_core/lib/src/types/auth/attribute/send_user_attribute_verification_code_result.g.dart @@ -2,22 +2,22 @@ // ignore_for_file: deprecated_member_use_from_same_package -part of 'resend_user_attribute_confirmation_code_result.dart'; +part of 'send_user_attribute_verification_code_result.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -ResendUserAttributeConfirmationCodeResult - _$ResendUserAttributeConfirmationCodeResultFromJson( +SendUserAttributeVerificationCodeResult + _$SendUserAttributeVerificationCodeResultFromJson( Map json) => - ResendUserAttributeConfirmationCodeResult( + SendUserAttributeVerificationCodeResult( codeDeliveryDetails: AuthCodeDeliveryDetails.fromJson( json['codeDeliveryDetails'] as Map), ); -Map _$ResendUserAttributeConfirmationCodeResultToJson( - ResendUserAttributeConfirmationCodeResult instance) => +Map _$SendUserAttributeVerificationCodeResultToJson( + SendUserAttributeVerificationCodeResult instance) => { 'codeDeliveryDetails': instance.codeDeliveryDetails.toJson(), }; diff --git a/packages/amplify_core/lib/src/types/auth/auth_types.dart b/packages/amplify_core/lib/src/types/auth/auth_types.dart index 7ff4eab620..90ae525acc 100644 --- a/packages/amplify_core/lib/src/types/auth/auth_types.dart +++ b/packages/amplify_core/lib/src/types/auth/auth_types.dart @@ -24,8 +24,8 @@ export 'attribute/cognito_user_attribute_key.dart'; export 'attribute/confirm_user_attribute_options.dart'; export 'attribute/confirm_user_attribute_result.dart'; export 'attribute/fetch_user_attributes_options.dart'; -export 'attribute/resend_user_attribute_confirmation_code_options.dart'; -export 'attribute/resend_user_attribute_confirmation_code_result.dart'; +export 'attribute/send_user_attribute_verification_code_options.dart'; +export 'attribute/send_user_attribute_verification_code_result.dart'; export 'attribute/update_user_attribute_options.dart'; export 'attribute/update_user_attribute_result.dart'; export 'attribute/update_user_attributes_options.dart'; diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/sign_up_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/sign_up_test.dart index 62a9850d6d..967f760ca6 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/sign_up_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/sign_up_test.dart @@ -182,13 +182,13 @@ void main() { reason: 'When both phone and email are passed during sign up, only ' 'phone is verified by Cognito. It is the responsibility of developers ' - 'to all resendUserAttributeConfirmationCode to receive a code for ' + 'to all sendUserAttributeVerificationCode to receive a code for ' 'verifying the other attribute.', ); final emailCode = await getOtpCode(UserAttribute.email(email)); final resendRes = - await Amplify.Auth.resendUserAttributeConfirmationCode( + await Amplify.Auth.sendUserAttributeVerificationCode( userAttributeKey: AuthUserAttributeKey.email, ); expect( diff --git a/packages/auth/amplify_auth_cognito/example/integration_test/user_attributes_test.dart b/packages/auth/amplify_auth_cognito/example/integration_test/user_attributes_test.dart index d83a1405e2..847ad1cc39 100644 --- a/packages/auth/amplify_auth_cognito/example/integration_test/user_attributes_test.dart +++ b/packages/auth/amplify_auth_cognito/example/integration_test/user_attributes_test.dart @@ -279,6 +279,7 @@ void main() { UserAttribute.email(keepOriginal ? email : newEmail), ); final resendResult = + // ignore: deprecated_member_use await Amplify.Auth.resendUserAttributeConfirmationCode( userAttributeKey: AuthUserAttributeKey.email, ); @@ -303,6 +304,79 @@ void main() { completes, ); }); + }); + + group('sendUserAttributeVerificationCode', () { + asyncTest('to email', (_) async { + final newEmail = generateEmail(); + // Cognito sends the confirmation code to the new attribute + // even when `keepOriginal` is true and even though it uses the old + // attribute when resending the code. + final code = await getOtpCode(UserAttribute.email(newEmail)); + logger.debug( + 'Updating email (keepOriginal=$keepOriginal) to: $newEmail', + ); + final updateResult = await Amplify.Auth.updateUserAttribute( + userAttributeKey: AuthUserAttributeKey.email, + value: newEmail, + ); + expect(updateResult.isUpdated, false); + expect( + updateResult.nextStep.updateAttributeStep, + AuthUpdateAttributeStep.confirmAttributeWithCode, + ); + expect( + updateResult.nextStep.codeDeliveryDetails?.attributeKey, + AuthUserAttributeKey.email, + ); + expect( + updateResult.nextStep.codeDeliveryDetails?.deliveryMedium, + DeliveryMedium.email, + ); + expect( + updateResult.nextStep.codeDeliveryDetails?.destination, + isNotNull, + ); + + // Drain original code + await expectLater( + code.code, + completes, + reason: + 'Cognito sends the confirmation code to the new attribute ' + 'even when keepOriginal is true and even though it uses the old ' + 'attribute when resending the code', + ); + logger.debug('Got original code'); + + final resentCode = await getOtpCode( + UserAttribute.email(keepOriginal ? email : newEmail), + ); + final resendResult = + await Amplify.Auth.sendUserAttributeVerificationCode( + userAttributeKey: AuthUserAttributeKey.email, + ); + expect( + resendResult.codeDeliveryDetails.attributeKey, + AuthUserAttributeKey.email, + ); + expect( + resendResult.codeDeliveryDetails.deliveryMedium, + DeliveryMedium.email, + ); + expect( + resendResult.codeDeliveryDetails.destination, + isNotNull, + ); + + await expectLater( + Amplify.Auth.confirmUserAttribute( + userAttributeKey: AuthUserAttributeKey.email, + confirmationCode: await resentCode.code, + ), + completes, + ); + }); asyncTest('to phoneNumber', (_) async { final newPhoneNumber = generatePhoneNumber(); @@ -350,7 +424,7 @@ void main() { UserAttribute.phone(keepOriginal ? phoneNumber : newPhoneNumber), ); final resendResult = - await Amplify.Auth.resendUserAttributeConfirmationCode( + await Amplify.Auth.sendUserAttributeVerificationCode( userAttributeKey: AuthUserAttributeKey.phoneNumber, ); expect( diff --git a/packages/auth/amplify_auth_cognito/example/lib/screens/confirm_user_attribute.dart b/packages/auth/amplify_auth_cognito/example/lib/screens/confirm_user_attribute.dart index c472a7088e..436289641c 100644 --- a/packages/auth/amplify_auth_cognito/example/lib/screens/confirm_user_attribute.dart +++ b/packages/auth/amplify_auth_cognito/example/lib/screens/confirm_user_attribute.dart @@ -53,7 +53,7 @@ class _ConfirmUserAttributeScreenState Future _resendCode() async { try { - final res = await Amplify.Auth.resendUserAttributeConfirmationCode( + final res = await Amplify.Auth.sendUserAttributeVerificationCode( userAttributeKey: widget.userAttributeKey, ); _showInfo( diff --git a/packages/auth/amplify_auth_cognito_dart/example/lib/common.dart b/packages/auth/amplify_auth_cognito_dart/example/lib/common.dart index d6f97c1451..42347c4c90 100644 --- a/packages/auth/amplify_auth_cognito_dart/example/lib/common.dart +++ b/packages/auth/amplify_auth_cognito_dart/example/lib/common.dart @@ -149,12 +149,12 @@ Future confirmUserAttribute({ ); } -Future - resendUserAttributeConfirmationCode({ +Future + sendUserAttributeVerificationCode({ required AuthUserAttributeKey key, - ResendUserAttributeConfirmationCodeOptions? options, + SendUserAttributeVerificationCodeOptions? options, }) async { - return Amplify.Auth.resendUserAttributeConfirmationCode( + return Amplify.Auth.sendUserAttributeVerificationCode( userAttributeKey: key, options: options, ); diff --git a/packages/auth/amplify_auth_cognito_dart/example/web/components/confirm_attribute_component.dart b/packages/auth/amplify_auth_cognito_dart/example/web/components/confirm_attribute_component.dart index b121c8888a..5c42d065a3 100644 --- a/packages/auth/amplify_auth_cognito_dart/example/web/components/confirm_attribute_component.dart +++ b/packages/auth/amplify_auth_cognito_dart/example/web/components/confirm_attribute_component.dart @@ -21,12 +21,12 @@ abstract class ConfirmAttributeComponent extends StatefulComponent { } void _resendCode() { - resendUserAttributeConfirmationCode( + sendUserAttributeVerificationCode( key: key, - options: const ResendUserAttributeConfirmationCodeOptions( - pluginOptions: CognitoResendUserAttributeConfirmationCodePluginOptions( + options: const SendUserAttributeVerificationCodeOptions( + pluginOptions: CognitoSendUserAttributeVerificationCodePluginOptions( clientMetadata: { - 'method': 'resendUserAttributeConfirmationCode', + 'method': 'sendUserAttributeVerificationCode', }, ), ), diff --git a/packages/auth/amplify_auth_cognito_dart/lib/amplify_auth_cognito_dart.dart b/packages/auth/amplify_auth_cognito_dart/lib/amplify_auth_cognito_dart.dart index 6b68fb58a2..51dcf4f857 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/amplify_auth_cognito_dart.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/amplify_auth_cognito_dart.dart @@ -16,8 +16,8 @@ export 'src/jwt/src/cognito.dart'; export 'src/jwt/src/token.dart'; export 'src/model/attribute/cognito_confirm_user_attribute_plugin_options.dart'; export 'src/model/attribute/cognito_fetch_user_attributes_plugin_options.dart'; -export 'src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.dart'; -export 'src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.dart'; +export 'src/model/attribute/cognito_send_user_attribute_verification_code_options.dart'; +export 'src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.dart'; export 'src/model/attribute/cognito_update_user_attribute_options.dart'; export 'src/model/attribute/cognito_update_user_attribute_plugin_options.dart'; export 'src/model/attribute/cognito_update_user_attribute_step.dart'; 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 29804f86f4..f967867cc6 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 @@ -698,15 +698,27 @@ class AmplifyAuthCognitoDart extends AuthPluginInterface } @override - Future + Future resendUserAttributeConfirmationCode({ required AuthUserAttributeKey userAttributeKey, - ResendUserAttributeConfirmationCodeOptions? options, + SendUserAttributeVerificationCodeOptions? options, + }) async { + return sendUserAttributeVerificationCode( + userAttributeKey: userAttributeKey, + options: options, + ); + } + + @override + Future + sendUserAttributeVerificationCode({ + required AuthUserAttributeKey userAttributeKey, + SendUserAttributeVerificationCodeOptions? options, }) async { final pluginOptions = reifyPluginOptions( pluginOptions: options?.pluginOptions, defaultPluginOptions: - const CognitoResendUserAttributeConfirmationCodePluginOptions(), + const CognitoSendUserAttributeVerificationCodePluginOptions(), ); final tokens = await stateMachine.getUserPoolTokens(); final result = await _cognitoIdp @@ -723,7 +735,7 @@ class AmplifyAuthCognitoDart extends AuthPluginInterface if (codeDeliveryDetails == null) { throw const UnknownException('Could not resend confirmation code'); } - return ResendUserAttributeConfirmationCodeResult( + return SendUserAttributeVerificationCodeResult( codeDeliveryDetails: codeDeliveryDetails, ); } diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.dart deleted file mode 100644 index 7027b7b849..0000000000 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.dart +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import 'package:amplify_auth_cognito_dart/amplify_auth_cognito_dart.dart'; -import 'package:amplify_core/amplify_core.dart'; - -part 'cognito_resend_user_attribute_confirmation_code_options.g.dart'; - -const _deprecatedMessage = ''' -Use ResendUserAttributeConfirmationCodeOptions instead. If Cognito-specific options are needed, use `pluginOptions`: - -ResendUserAttributeConfirmationCodeOptions( - pluginOptions: CognitoResendUserAttributeConfirmationCodePluginOptions( - clientMetadata: { - 'my-key': 'my-value', - }, - ), -) -'''; - -/// {@template amplify_auth_cognito.cognito_resend_user_attribute_confirmation_code_options} -/// Cognito options for `Amplify.Auth.resendUserAttributeConfirmationCode`. -/// {@endtemplate} -@zAmplifySerializable -@Deprecated(_deprecatedMessage) -class CognitoResendUserAttributeConfirmationCodeOptions - extends ResendUserAttributeConfirmationCodeOptions { - /// {@macro amplify_auth_cognito.cognito_resend_user_attribute_confirmation_code_options} - @Deprecated(_deprecatedMessage) - const CognitoResendUserAttributeConfirmationCodeOptions({ - Map? clientMetadata, - }) : clientMetadata = clientMetadata ?? const {}; - - /// {@macro amplify_auth_cognito.cognito_resend_user_attribute_confirmation_code_options} - @Deprecated(_deprecatedMessage) - factory CognitoResendUserAttributeConfirmationCodeOptions.fromJson( - Map json, - ) => - _$CognitoResendUserAttributeConfirmationCodeOptionsFromJson(json); - - /// {@macro amplify_auth_cognito.model.cognito_resend_user_attribute_confirmation_code_plugin_options.client_metadata} - final Map clientMetadata; - - @override - CognitoResendUserAttributeConfirmationCodePluginOptions get pluginOptions => - CognitoResendUserAttributeConfirmationCodePluginOptions( - clientMetadata: clientMetadata, - ); - - @override - String get runtimeTypeName => - 'CognitoResendUserAttributeConfirmationCodeOptions'; - - @override - Map toJson() => - _$CognitoResendUserAttributeConfirmationCodeOptionsToJson(this); -} diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.dart deleted file mode 100644 index 3954bb30e2..0000000000 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import 'package:amplify_core/amplify_core.dart'; - -part 'cognito_resend_user_attribute_confirmation_code_plugin_options.g.dart'; - -/// {@template amplify_auth_cognito.model.cognito_resend_user_attribute_confirmation_code_plugin_options} -/// Cognito options for `Amplify.Auth.resendUserAttributeConfirmationCode`. -/// {@endtemplate} -@zAmplifySerializable -class CognitoResendUserAttributeConfirmationCodePluginOptions - extends ResendUserAttributeConfirmationCodePluginOptions { - /// {@macro amplify_auth_cognito.model.cognito_resend_user_attribute_confirmation_code_plugin_options} - const CognitoResendUserAttributeConfirmationCodePluginOptions({ - Map? clientMetadata, - }) : clientMetadata = clientMetadata ?? const {}; - - /// {@macro amplify_auth_cognito.model.cognito_resend_user_attribute_confirmation_code_plugin_options} - factory CognitoResendUserAttributeConfirmationCodePluginOptions.fromJson( - Map json, - ) => - _$CognitoResendUserAttributeConfirmationCodePluginOptionsFromJson(json); - - /// {@template amplify_auth_cognito.model.cognito_resend_user_attribute_confirmation_code_plugin_options.client_metadata} - /// A map of custom key-value pairs that you can provide as input for certain - /// custom workflows that this action triggers. - /// {@endtemplate} - final Map clientMetadata; - - @override - List get props => [clientMetadata]; - - @override - String get runtimeTypeName => - 'CognitoResendUserAttributeConfirmationCodePluginOptions'; - - @override - Map toJson() => - _$CognitoResendUserAttributeConfirmationCodePluginOptionsToJson(this); -} diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_options.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_options.dart new file mode 100644 index 0000000000..1f11fdd8f3 --- /dev/null +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_options.dart @@ -0,0 +1,62 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:amplify_auth_cognito_dart/amplify_auth_cognito_dart.dart'; +import 'package:amplify_core/amplify_core.dart'; + +part 'cognito_send_user_attribute_verification_code_options.g.dart'; + +const _deprecatedMessage = ''' +Use SendUserAttributeVerificationCodeOptions instead. If Cognito-specific options are needed, use `pluginOptions`: + +SendUserAttributeVerificationCodeOptions( + pluginOptions: CognitoSendUserAttributeVerificationCodePluginOptions( + clientMetadata: { + 'my-key': 'my-value', + }, + ), +) +'''; + +/// {@template amplify_auth_cognito.cognito_send_user_attribute_verification_code_options} +/// Cognito options for `Amplify.Auth.sendUserAttributeVerificationCode`. +/// {@endtemplate} +@zAmplifySerializable +@Deprecated(_deprecatedMessage) +class CognitoSendUserAttributeVerificationCodeOptions + extends SendUserAttributeVerificationCodeOptions { + /// {@macro amplify_auth_cognito.cognito_send_user_attribute_verification_code_options} + @Deprecated(_deprecatedMessage) + const CognitoSendUserAttributeVerificationCodeOptions({ + Map? clientMetadata, + }) : clientMetadata = clientMetadata ?? const {}; + + /// {@macro amplify_auth_cognito.cognito_send_user_attribute_verification_code_options} + @Deprecated(_deprecatedMessage) + factory CognitoSendUserAttributeVerificationCodeOptions.fromJson( + Map json, + ) => + _$CognitoSendUserAttributeVerificationCodeOptionsFromJson(json); + + /// {@macro amplify_auth_cognito.model.cognito_send_user_attribute_verification_code_plugin_options.client_metadata} + final Map clientMetadata; + + @override + CognitoSendUserAttributeVerificationCodePluginOptions get pluginOptions => + CognitoSendUserAttributeVerificationCodePluginOptions( + clientMetadata: clientMetadata, + ); + + @override + String get runtimeTypeName => + 'CognitoSendUserAttributeVerificationCodeOptions'; + + @override + Map toJson() => + _$CognitoSendUserAttributeVerificationCodeOptionsToJson(this); +} + +/// {@macro amplify_auth_cognito.cognito_send_user_attribute_verification_code_options} +@Deprecated(_deprecatedMessage) +typedef CognitoResendUserAttributeConfirmationCodeOptions + = CognitoSendUserAttributeVerificationCodeOptions; diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.g.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_options.g.dart similarity index 56% rename from packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.g.dart rename to packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_options.g.dart index 41052d7152..f43b90c0b4 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_options.g.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_options.g.dart @@ -1,23 +1,23 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'cognito_resend_user_attribute_confirmation_code_options.dart'; +part of 'cognito_send_user_attribute_verification_code_options.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -CognitoResendUserAttributeConfirmationCodeOptions - _$CognitoResendUserAttributeConfirmationCodeOptionsFromJson( +CognitoSendUserAttributeVerificationCodeOptions + _$CognitoSendUserAttributeVerificationCodeOptionsFromJson( Map json) => - CognitoResendUserAttributeConfirmationCodeOptions( + CognitoSendUserAttributeVerificationCodeOptions( clientMetadata: (json['clientMetadata'] as Map?)?.map( (k, e) => MapEntry(k, e as String), ), ); -Map _$CognitoResendUserAttributeConfirmationCodeOptionsToJson( - CognitoResendUserAttributeConfirmationCodeOptions instance) => +Map _$CognitoSendUserAttributeVerificationCodeOptionsToJson( + CognitoSendUserAttributeVerificationCodeOptions instance) => { 'clientMetadata': instance.clientMetadata, }; diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.dart new file mode 100644 index 0000000000..e7a0ee342e --- /dev/null +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.dart @@ -0,0 +1,46 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:amplify_core/amplify_core.dart'; + +part 'cognito_send_user_attribute_verification_code_plugin_options.g.dart'; + +/// {@template amplify_auth_cognito.model.cognito_send_user_attribute_verification_code_plugin_options} +/// Cognito options for `Amplify.Auth.sendUserAttributeVerificationCode`. +/// {@endtemplate} +@zAmplifySerializable +class CognitoSendUserAttributeVerificationCodePluginOptions + extends SendUserAttributeVerificationCodePluginOptions { + /// {@macro amplify_auth_cognito.model.cognito_send_user_attribute_verification_code_plugin_options} + const CognitoSendUserAttributeVerificationCodePluginOptions({ + Map? clientMetadata, + }) : clientMetadata = clientMetadata ?? const {}; + + /// {@macro amplify_auth_cognito.model.cognito_send_user_attribute_verification_code_plugin_options} + factory CognitoSendUserAttributeVerificationCodePluginOptions.fromJson( + Map json, + ) => + _$CognitoSendUserAttributeVerificationCodePluginOptionsFromJson(json); + + /// {@template amplify_auth_cognito.model.cognito_send_user_attribute_verification_code_plugin_options.client_metadata} + /// A map of custom key-value pairs that you can provide as input for certain + /// custom workflows that this action triggers. + /// {@endtemplate} + final Map clientMetadata; + + @override + List get props => [clientMetadata]; + + @override + String get runtimeTypeName => + 'CognitoSendUserAttributeVerificationCodePluginOptions'; + + @override + Map toJson() => + _$CognitoSendUserAttributeVerificationCodePluginOptionsToJson(this); +} + +/// {@macro amplify_auth_cognito.model.cognito_send_user_attribute_verification_code_plugin_options} +@Deprecated('Use CognitoSendUserAttributeVerificationCodePluginOptions') +typedef CognitoResendUserAttributeConfirmationCodePluginOptions + = CognitoSendUserAttributeVerificationCodePluginOptions; diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.g.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.g.dart similarity index 57% rename from packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.g.dart rename to packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.g.dart index 15d61037f1..1b681a0876 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_resend_user_attribute_confirmation_code_plugin_options.g.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/model/attribute/cognito_send_user_attribute_verification_code_plugin_options.g.dart @@ -1,15 +1,15 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'cognito_resend_user_attribute_confirmation_code_plugin_options.dart'; +part of 'cognito_send_user_attribute_verification_code_plugin_options.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -CognitoResendUserAttributeConfirmationCodePluginOptions - _$CognitoResendUserAttributeConfirmationCodePluginOptionsFromJson( +CognitoSendUserAttributeVerificationCodePluginOptions + _$CognitoSendUserAttributeVerificationCodePluginOptionsFromJson( Map json) => - CognitoResendUserAttributeConfirmationCodePluginOptions( + CognitoSendUserAttributeVerificationCodePluginOptions( clientMetadata: (json['clientMetadata'] as Map?)?.map( (k, e) => MapEntry(k, e as String), @@ -17,8 +17,8 @@ CognitoResendUserAttributeConfirmationCodePluginOptions ); Map - _$CognitoResendUserAttributeConfirmationCodePluginOptionsToJson( - CognitoResendUserAttributeConfirmationCodePluginOptions instance) => + _$CognitoSendUserAttributeVerificationCodePluginOptionsToJson( + CognitoSendUserAttributeVerificationCodePluginOptions instance) => { 'clientMetadata': instance.clientMetadata, }; 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 054eb8f99b..4c729b9078 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 @@ -494,7 +494,7 @@ class StateMachineBloc Stream _verifyUser(AuthVerifyUserData data) async* { try { - final result = await _authService.resendUserAttributeConfirmationCode( + final result = await _authService.sendUserAttributeVerificationCode( userAttributeKey: data.userAttributeKey, ); _notifyCodeSent(result.codeDeliveryDetails.destination); diff --git a/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart b/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart index 9e8a80d2c5..68831d7eec 100644 --- a/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart +++ b/packages/authenticator/amplify_authenticator/lib/src/services/amplify_auth_service.dart @@ -59,8 +59,8 @@ abstract class AuthService { Future getAttributeVerificationStatus(); - Future - resendUserAttributeConfirmationCode({ + Future + sendUserAttributeVerificationCode({ required CognitoUserAttributeKey userAttributeKey, }); @@ -256,12 +256,12 @@ class AmplifyAuthService } @override - Future - resendUserAttributeConfirmationCode({ + Future + sendUserAttributeVerificationCode({ required CognitoUserAttributeKey userAttributeKey, }) { return _withUserAgent( - () => Amplify.Auth.resendUserAttributeConfirmationCode( + () => Amplify.Auth.sendUserAttributeVerificationCode( userAttributeKey: userAttributeKey, ), ); diff --git a/packages/test/amplify_integration_test/lib/src/stubs/amplify_auth_cognito_stub.dart b/packages/test/amplify_integration_test/lib/src/stubs/amplify_auth_cognito_stub.dart index 3a727ca258..4285160278 100644 --- a/packages/test/amplify_integration_test/lib/src/stubs/amplify_auth_cognito_stub.dart +++ b/packages/test/amplify_integration_test/lib/src/stubs/amplify_auth_cognito_stub.dart @@ -348,15 +348,15 @@ class AmplifyAuthCognitoStub extends AuthPluginInterface } @override - Future - resendUserAttributeConfirmationCode({ + Future + sendUserAttributeVerificationCode({ required AuthUserAttributeKey userAttributeKey, - ResendUserAttributeConfirmationCodeOptions? options, + SendUserAttributeVerificationCodeOptions? options, }) async { if (_currentUser == null) { throw const SignedOutException('There is no user signed in.'); } - return ResendUserAttributeConfirmationCodeResult( + return SendUserAttributeVerificationCodeResult( codeDeliveryDetails: _codeDeliveryDetails(_currentUser!), ); }