diff --git a/packages/auth/amplify_auth_cognito/lib/src/credentials/legacy_credential_provider_android.dart b/packages/auth/amplify_auth_cognito/lib/src/credentials/legacy_credential_provider_android.dart index 5ee00cb6d6..b4a8106438 100644 --- a/packages/auth/amplify_auth_cognito/lib/src/credentials/legacy_credential_provider_android.dart +++ b/packages/auth/amplify_auth_cognito/lib/src/credentials/legacy_credential_provider_android.dart @@ -63,8 +63,8 @@ class LegacyCredentialProviderAndroid implements LegacyCredentialProvider { Future deleteLegacyDeviceSecrets({ CognitoUserPoolConfig? userPoolConfig, }) { - // TODO: implement deleteLegacyDeviceSecrets - throw UnimplementedError(); + final bridge = _stateMachine.expect(); + return bridge.deleteLegacyDeviceSecrets(userPoolConfig as auth_cognito.CognitoUserPoolConfig?); } } diff --git a/packages/auth/amplify_auth_cognito/pigeons/native_auth_plugin.dart b/packages/auth/amplify_auth_cognito/pigeons/native_auth_plugin.dart index 7b6a19bcee..99612a2154 100644 --- a/packages/auth/amplify_auth_cognito/pigeons/native_auth_plugin.dart +++ b/packages/auth/amplify_auth_cognito/pigeons/native_auth_plugin.dart @@ -71,12 +71,14 @@ abstract class NativeAuthBridge { @async void clearLegacyCredentials(); - @async + /// Fetch legacy device secrets stored by native SDKs. + @async LegacyDeviceDetailsSecret? fetchLegacyDeviceSecrets( String? userPoolId, String? appClientId, ); + /// Clears the legacy device secrets. @async void deleteLegacyDeviceSecrets(CognitoUserPoolConfig? userPoolConfig); } diff --git a/packages/auth/amplify_auth_cognito_test/lib/common/mock_legacy_credential_provider.dart b/packages/auth/amplify_auth_cognito_test/lib/common/mock_legacy_credential_provider.dart index 65401e9f18..d8bcf59c48 100644 --- a/packages/auth/amplify_auth_cognito_test/lib/common/mock_legacy_credential_provider.dart +++ b/packages/auth/amplify_auth_cognito_test/lib/common/mock_legacy_credential_provider.dart @@ -30,4 +30,14 @@ class MockLegacyCredentialProvider implements LegacyCredentialProvider { }) async { return data; } + + @override + Future deleteLegacyDeviceSecrets({CognitoUserPoolConfig? userPoolConfig}) async { + return; + } + + @override + Future fetchLegacyDeviceSecrets({CognitoUserPoolConfig? userPoolConfig}) async { + return null; + } }