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 b4a8106438..1c66690cac 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 @@ -55,7 +55,6 @@ class LegacyCredentialProviderAndroid implements LegacyCredentialProvider { final bridge = _stateMachine.expect(); final device = await bridge.fetchLegacyDeviceSecrets( userPoolConfig?.poolId, userPoolConfig?.appClientId,); - return device?.toLegacyDeviceDetails(); } diff --git a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart index ec54784271..628b3a3248 100644 --- a/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart +++ b/packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/credential_store_state_machine.dart @@ -327,7 +327,6 @@ final class CredentialStoreStateMachine if (username != null) { await _migrateDeviceSecrets(username); } - await _migrateAsfDeviceID(); await _updateVersion(CredentialStoreVersion.v1); } @@ -380,10 +379,7 @@ final class CredentialStoreStateMachine } // Migrate Asf Device ID - final legacyDeviceId = await credentialProvider.fetchLegacyDeviceSecrets( - userPoolConfig: authConfig.userPoolConfig, - ); - final asfDeviceId = legacyDeviceId?.asfDeviceId; + final asfDeviceId = legacySecrets?.asfDeviceId; if (asfDeviceId != null) { await _secureStorage.write( key: userPoolKeys[CognitoUserPoolKey.asfDeviceId], @@ -404,39 +400,6 @@ final class CredentialStoreStateMachine } } - // TODO: UPDATE BY COMBINING INTO MIGRATE DEVICE SECRETS - - /// Migrates legacy device secrets. - Future _migrateAsfDeviceID() async { - final credentialProvider = get(); - final authConfig = expect(); - final userPoolConfig = authConfig.userPoolConfig; - if (credentialProvider == null || userPoolConfig == null) return; - final userPoolKeys = CognitoUserPoolKeys(userPoolConfig); - try { - final legacyDeviceId = await credentialProvider.fetchLegacyDeviceSecrets( - userPoolConfig: userPoolConfig, - ); - final asfDeviceId = legacyDeviceId?.asfDeviceId; - if (asfDeviceId != null) { - await _secureStorage.write( - key: userPoolKeys[CognitoUserPoolKey.asfDeviceId], - value: asfDeviceId, - ); - } - } on Object catch (e, s) { - logger.error('Error migrating legacy ASF device ID', e, s); - } finally { - try { - await _secureStorage.delete( - key: userPoolKeys[CognitoUserPoolKey.asfDeviceId], - ); - } on Object catch (e, s) { - logger.error('Error clearing legacy ASF device ID', e, s); - } - } - } - /// State machine callback for the [CredentialStoreLoadCredentialStore] event. Future onLoadCredentialStore( CredentialStoreLoadCredentialStore event,