Skip to content

Commit

Permalink
chore: implement deleteLegacyDeviceSecrets and added overrides to moc…
Browse files Browse the repository at this point in the history
…k legacy credential providers
  • Loading branch information
khatruong2009 committed Dec 19, 2023
1 parent 7b46c5a commit 5617a54
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class LegacyCredentialProviderAndroid implements LegacyCredentialProvider {
Future<void> deleteLegacyDeviceSecrets({
CognitoUserPoolConfig? userPoolConfig,
}) {
// TODO: implement deleteLegacyDeviceSecrets
throw UnimplementedError();
final bridge = _stateMachine.expect<auth_cognito.NativeAuthBridge>();
return bridge.deleteLegacyDeviceSecrets(userPoolConfig as auth_cognito.CognitoUserPoolConfig?);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@ class MockLegacyCredentialProvider implements LegacyCredentialProvider {
}) async {
return data;
}

@override
Future<void> deleteLegacyDeviceSecrets({CognitoUserPoolConfig? userPoolConfig}) async {
return;
}

@override
Future<LegacyDeviceDetails?> fetchLegacyDeviceSecrets({CognitoUserPoolConfig? userPoolConfig}) async {
return null;
}
}

0 comments on commit 5617a54

Please sign in to comment.